ProcessingResourceMetaData md = new ProcessingResourceMetaData_impl();
md.setTypePriorities((TypePriorities) current);
mdList.add(md);
} else if (current instanceof ResourceSpecifier) {
// try to instantiate the resource
Resource resource = null;
Map resourceMgrInMap = new HashMap();
resourceMgrInMap.put(Resource.PARAM_RESOURCE_MANAGER, aResourceManager);
try {
resource = UIMAFramework.produceResource((ResourceSpecifier) current,
(null == aResourceManager) ? Collections.EMPTY_MAP : resourceMgrInMap);
} catch (Exception e) {
// failed. If aOutputFailedRemotes is non-null, add an entry to it to it, else throw the
// exception.
if (aOutputFailedRemotes != null) {
aOutputFailedRemotes.put(aContextName, e);
} else {
if (e instanceof ResourceInitializationException)
throw (ResourceInitializationException) e;
else if (e instanceof RuntimeException)
throw (RuntimeException) e;
else
throw new RuntimeException(e);
}
}
if (resource != null) {
ResourceMetaData metadata = resource.getMetaData();
if (metadata instanceof ProcessingResourceMetaData) {
mdList.add(metadata);
}
resource.destroy();
}
} else {
throw new ResourceInitializationException(
ResourceInitializationException.UNSUPPORTED_OBJECT_TYPE_IN_CREATE_CAS,
new Object[] { current.getClass().getName() });