}
}
private DefaultMetaInf loadMetaInf(Entry dir, boolean strict)
throws IOException, ConfigurationException {
DefaultMetaInf inf = new DefaultMetaInf();
// filter
for (Entry entry: dir.getChildren()) {
String name = entry.getName();
VaultInputSource src = getInputSource(entry);
if (name.equals(Constants.FILTER_XML)) {
// load filter
inf.loadFilter(src.getByteStream(), src.getSystemId());
} else if (name.equals(Constants.CONFIG_XML)) {
// load config
inf.loadConfig(src.getByteStream(), src.getSystemId());
} else if (name.equals(Constants.SETTINGS_XML)) {
// load settings
inf.loadSettings(src.getByteStream(), src.getSystemId());
} else if (name.equals(Constants.PROPERTIES_XML)) {
// load properties
inf.loadProperties(src.getByteStream(), src.getSystemId());
} else if (name.equals(Constants.PRIVILEGES_XML)) {
// load privileges
inf.loadPrivileges(src.getByteStream(), src.getSystemId());
} else if (name.equals(Constants.PACKAGE_DEFINITION_XML)) {
inf.setHasDefinition(true);
log.info("Contains package definition {}.", src.getSystemId());
} else if (name.endsWith(".cnd")) {
try {
Reader r = new InputStreamReader(src.getByteStream(), "utf8");
CNDReader reader = ServiceProviderFactory.getProvider().getCNDReader();
reader.read(r, entry.getName(), null);
inf.getNodeTypes().add(reader);
log.info("Loaded nodetypes from {}.", src.getSystemId());
} catch (IOException e1) {
log.error("Error while reading CND: {}", e1.toString());
if (strict) {
throw e1;
}
}
}
}
if (inf.getFilter() == null) {
log.info("Archive {} does not contain filter definition.", this);
}
if (inf.getConfig() == null) {
log.info("Archive {} does not contain vault config.", this);
}
if (inf.getSettings() == null) {
log.info("Archive {} does not contain vault settings. using default.", this);
VaultSettings settings = new VaultSettings();
settings.getIgnoredNames().add(".svn");
inf.setSettings(settings);
}
if (inf.getProperties() == null) {
log.info("Archive {} does not contain properties.", this);
}
if (inf.getNodeTypes().isEmpty()) {
log.info("Archive {} does not contain nodetypes.", this);
}
return inf;
}