/******************************************************************************************************************* * ******************************************************************************************************************/ private List<ResourceFile> getFiles (final @Nonnull String prefix, final @Nonnull String propertyFileName, final @Nonnull ResourceFile folder, final @Nonnull List<String> suffixes) { final List<ResourceFile> files = new ArrayList<>(); for (final String localeSuffix : suffixes) { final String fileName = prefix + propertyFileName + localeSuffix + ".xml"; log.trace(">>>> probing {} ...", folder.getPath().asString() + "/" + fileName); try { files.add(folder.findChildren().withName(fileName).result()); } catch (NotFoundException e) { // ok. do nothing } } return files; }
return folder.findChildren().withName(localizedFileName).result();
return folder.findChildren().withName(localizedFileName).result();
/******************************************************************************************************************* * * ******************************************************************************************************************/ @Nonnull private ResourceProperties loadProperties() throws IOException { final ResourceFile file = getFile(); log.debug("loadProperties() for {}", file.getPath().asString()); ResourceProperties properties = modelFactory.createProperties().withPropertyResolver(propertyResolver).build(); try { final ResourceFile propertyFile = file.findChildren().withName("Properties.xml").result(); // FIXME reuse the inheritance helper // log.trace(">>>> reading properties from {} ({})...", propertyFile.getPath().asString(), locale); @Cleanup final InputStream is = propertyFile.getInputStream(); final ResourceProperties tempProperties = // modelFactory.createProperties().build().as(Unmarshallable).unmarshal(is); modelFactory.createProperties().withPropertyResolver(propertyResolver).build().as(Unmarshallable).unmarshal(is); // log.trace(">>>>>>>> read properties: {} ({})", tempProperties, locale); properties = properties.merged(tempProperties); } catch (NotFoundException e) { // ok, no properties } return properties; } }