String configFile = "data/services/PreservationActionRegistries.xml";
InputStream config = Thread.currentThread().getContextClassLoader().getResourceAsStream(configFile);
if (config == null) {
throw new PlanningServiceException("Config file not found: " + configFile);
}
Digester digester = new Digester();
digester.setValidating(false);
digester.setErrorHandler(new StrictErrorHandler());
digester.push(allRegistries);
digester.addObjectCreate("*/registry", PreservationActionRegistryDefinition.class);
digester.addBeanPropertySetter("*/registry/shortname", "shortname");
digester.addBeanPropertySetter("*/registry/logo", "logo");
digester.addBeanPropertySetter("*/registry/url", "url");
digester.addBeanPropertySetter("*/registry/type", "type");
digester.addBeanPropertySetter("*/registry/active", "active");
digester.addSetNext("*/registry", "add");
try {
digester.setUseContextClassLoader(true);
digester.parse(config);
} catch (Exception e) {
throw new PlanningServiceException(e);
}
return allRegistries;
}