if (!aeDesc.isPrimitive()) {
Map delegateMap;
try {
delegateMap = aeDesc.getAllComponentSpecifiers(aResourceManager);
} catch (InvalidXMLException e) {
throw new ResourceInitializationException(e);
}
Iterator delIter = delegateMap.entrySet().iterator();
while(delIter.hasNext()) {
Map.Entry delEntry = (Map.Entry)delIter.next();
List tempList = new ArrayList();
tempList.add(delEntry.getValue());
mdList.addAll(getMetaDataList(tempList, aResourceManager, aOutputFailedRemotes, aContextName + "/" + delEntry.getKey()));
}
}
} else if (current instanceof CollectionReaderDescription) {
mdList.add(((CollectionReaderDescription) current).getMetaData().clone());
} else if (current instanceof CasInitializerDescription) {
mdList.add(((CasInitializerDescription) current).getMetaData().clone());
} else if (current instanceof CasConsumerDescription) {
mdList.add(((CasConsumerDescription) current).getMetaData().clone());
} else if (current instanceof FlowControllerDescription) {
mdList.add(((FlowControllerDescription) current).getMetaData().clone());
} else if (current instanceof TypeSystemDescription) {
ProcessingResourceMetaData md = new ProcessingResourceMetaData_impl();
md.setTypeSystem((TypeSystemDescription) current);
mdList.add(md);
} else if (current instanceof FsIndexCollection) {
ProcessingResourceMetaData md = new ProcessingResourceMetaData_impl();
md.setFsIndexCollection((FsIndexCollection) current);
mdList.add(md);
} else if (current instanceof TypePriorities) {
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() });
}
}