use of org.eclipse.winery.common.ids.admin.NamespacesId in project winery by eclipse.
the class CsarExporter method addNamespacePrefixes.
/**
* Writes the configured mapping namespaceprefix -> namespace to the archive
* <p>
* This is kind of a quick hack. TODO: during the import, the prefixes should be extracted using JAXB and stored in
* the NamespacesResource
*/
private void addNamespacePrefixes(ArchiveOutputStream zos, IRepository repository) throws IOException {
Configuration configuration = repository.getConfiguration(new NamespacesId());
if (configuration instanceof PropertiesConfiguration) {
// Quick hack: direct serialization only works for PropertiesConfiguration
PropertiesConfiguration pconf = (PropertiesConfiguration) configuration;
ArchiveEntry archiveEntry = new ZipArchiveEntry(CsarExporter.PATH_TO_NAMESPACES_PROPERTIES);
zos.putArchiveEntry(archiveEntry);
try {
pconf.save(zos);
} catch (ConfigurationException e) {
CsarExporter.LOGGER.debug(e.getMessage(), e);
zos.write("#Could not export properties".getBytes());
zos.write(("#" + e.getMessage()).getBytes());
}
zos.closeArchiveEntry();
}
}
Aggregations