private List<ConfigGroup> getConfiguration(final Path dir, final ConfigType type) { final List<ConfigGroup> configGroups = new ArrayList<>(); if (!ioService.exists(dir)) { return configGroups; } final DirectoryStream<Path> foundConfigs = getDirectoryStreamForFilesWithParticularExtension(dir, type.getExt()); //Only load and cache if a file was found! final Iterator<Path> it = foundConfigs.iterator(); if (it.hasNext()) { while (it.hasNext()) { final String content = ioService.readAllString(it.next()); final ConfigGroup configGroup = marshaller.unmarshall(content); configGroups.add(configGroup); } return configGroups; } return null; }
while (it.hasNext()) { final String content = ioService.readAllString(it.next()); final ConfigGroup configGroup = marshaller.unmarshall(content); configGroups.add(configGroup);
@Override public List<ConfigGroup> getConfiguration(ConfigType configType) { if (ConfigType.SPACE.equals(configType)) { configType = ConfigType.ORGANIZATIONAL_UNIT; } final ConfigType type = configType; final List<ConfigGroup> configGroups = new ArrayList<>(); final DirectoryStream<Path> foundConfigs = ioService.newDirectoryStream(ioService.get(systemRepository.getUri()), entry -> { if (!Files.isDirectory(entry) && !entry.getFileName().toString().startsWith(".") && entry.getFileName().toString().endsWith(type.getExt())) { return true; } return false; } ); //Only load and cache if a file was found! final Iterator<Path> it = foundConfigs.iterator(); if (it.hasNext()) { while (it.hasNext()) { final String content = ioService.readAllString(it.next()); final ConfigGroup configGroup = marshaller.unmarshall(content); configGroups.add(configGroup); } configGroupsByTypeWithoutNamespace.put(type, configGroups); } return configGroups; }