use of org.apache.aries.subsystem.core.archive.SubsystemLocalizationHeader in project aries by apache.
the class RawSubsystemResource method computeTranslations.
private Collection<TranslationFile> computeTranslations(IDirectory directory) throws IOException {
SubsystemManifest manifest = getSubsystemManifest();
SubsystemLocalizationHeader header = manifest.getSubsystemLocalizationHeader();
String directoryName = header.getDirectoryName();
// TODO Assumes the ZIP file includes directory entries. Issues?
IFile file = directoryName == null ? directory : directory.getFile(directoryName);
if (file == null || !file.isDirectory())
return Collections.emptyList();
List<IFile> files = file.convert().listFiles();
if (files == null || files.isEmpty())
return Collections.emptyList();
ArrayList<TranslationFile> result = new ArrayList<TranslationFile>(files.size());
for (IFile f : files) {
Properties properties = new Properties();
InputStream is = f.open();
try {
properties.load(is);
result.add(new TranslationFile(f.getName(), properties));
} finally {
is.close();
}
}
result.trimToSize();
return result;
}
Aggregations