* @param abdera the abdera instance.
*
* @throws Exception if an exception occurs.
*/
public RegistryProvider(Abdera abdera) throws Exception {
RegistryContext context = RegistryContext.getBaseInstance();
if (context == null) {
String msg = "Registry is not properly initialized. Registry context is not found.";
log.error(msg);
throw new RegistryException(msg);
//InputStream is = null;
//try {
// is = new FileInputStream("registry.xml");
//} catch (FileNotFoundException e) {
// // no problem
//}
//context = new RegistryContext(is);
//RegistryContext.setSingleton(context);
}
TargetType[] types = {RegistryResolver.TAGS_TYPE, RegistryResolver.LOGS_TYPE,
RegistryResolver.RATINGS_TYPE, RegistryResolver.COMMENTS_TYPE,
RegistryResolver.RENAME_TYPE, RegistryResolver.COPY_TYPE,
RegistryResolver.MOVE_TYPE, RegistryResolver.TAG_URL_TYPE,
RegistryResolver.ASSOCIATIONS_TYPE, RegistryResolver.RESTORE_TYPE,
RegistryResolver.VERSIONS_TYPE, RegistryResolver.CHECKPOINT_TYPE,
RegistryResolver.QUERY_TYPE, RegistryResolver.IMPORT_TYPE,
RegistryResolver.DUMP_TYPE, RegistryResolver.COLLECTION_CUSTOM_TYPE,
RegistryResolver.DELETE_TYPE, RegistryResolver.ASPECT_TYPE,
ResponseTarget.RESPONSE_TYPE};
RequestProcessor processor = new RegistryRequestProcessor();
for (TargetType type : types) {
this.requestProcessors.put(type, processor);
}
EmbeddedRegistryService embeddedRegistryService;
try {
embeddedRegistryService = Utils.getEmbeddedRegistryService();
} catch (RegistryException e) {
embeddedRegistryService = context.getEmbeddedRegistryService();
}
RegistryResolver resolver = new RegistryResolver(embeddedRegistryService, BASE_CONTEXT);
adapter = new RegistryAdapter();