}
boolean testIt = false; // FOR TESTING
if (testIt && collRdrs != null && collRdrs.length>0) {
for (int i=0; i<collRdrs.length; ++i) {
// Create a NEW UimaCollectionReader for its Xml descriptor
CpeComponentDescriptor cpeComponentDescriptor = collRdrs[i].getDescriptor();
String xml = null;
if (cpeComponentDescriptor.getInclude() != null) {
xml = cpeComponentDescriptor.getInclude().get();
} else if (cpeComponentDescriptor.getImport() != null) {
xml = cpeComponentDescriptor.getImport().getLocation();
if (xml == null) {
xml = cpeComponentDescriptor.getImport().getName();
}
}
if (xml == null || xml.trim().length() == 0) {
// EMPTY Collection Reader
// Trace.err("EMPTY Collection Reader");
continue;
}
String newFileLocation = xml;
String resolvedFileName = UimaApplication_Impl.resolveUimaXmlDescriptor(xml);
if (resolvedFileName == null) {
// Cannot resolve
// Trace.err("cannot resolve file: " + resolvedFileName);
} else {
File f = new File(resolvedFileName);
if ( !f.isAbsolute() ) {
// Relative path
if ( ! f.exists() ) {
// Can NOT find file.
// Try to find it within CURRENT DIRECTORY
f = new File (currentDir, resolvedFileName);
if ( ! f.exists() ) {
Trace.trace("*** ERROR: Cannot find file: " + resolvedFileName);
error = STATUS_DEPLOYMENT_NODE_ERROR;
details = STATUS_DETAILS_FILE_NOT_FOUND;
}
resolvedFileName = f.getAbsolutePath();
newFileLocation = resolvedFileName;
}
// Trace.trace("+++ New xml:" + resolvedFileName);
}
}
UimaCollectionReader u = UimaCollectionReader.createUimaCasProcessor (collRdrs[i],
newFileLocation/*resolvedFileName*/, this);
// Need to check duplication
// UimaCasProcessor u = getUimaCasProcessor(collRdrs[i].getName());
// if (u != null) {
// UimaCasProcessor_impl.createUimaCasProcessorFrom(u, casProcs[i], specifier, this);
// } else {
// u = UimaCasProcessor_impl.createUimaCasProcessor(casProcs[i], specifier, this);
// uimaCasProcessors.add(u);
// }
if (error > 0) {
u.setStatus(error);
u.setStatusDetails(details);
}
uimaCollectionReaders.add(u);
} // for
// ONLY 1 Cas Initializer is allowed (Also true for Collection Reader)
CpeCollectionReaderCasInitializer casInit = null;
try {
casInit = collRdrs[0].getCasInitializer();
} catch (CpeDescriptorException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (casInit != null) {
// Create a NEW UimaCasInitializer for its Xml descriptor
String xml = casInit.getDescriptor().getInclude().get();
if (xml == null || xml.trim().length() == 0) {
// EMPTY Cas Initializer
// Trace.err("EMPTY Cas Initializer");
} else {
String newFileLocation = xml;
String resolvedFileName = resolveUimaXmlDescriptor(xml);
File f = new File(resolvedFileName);
error = 0;
details = 0;
if ( !f.isAbsolute() ) {
// Relative path
if ( ! f.exists() ) {
// Can NOT find file.
// Try to find it within CURRENT DIRECTORY
f = new File (currentDir, resolvedFileName);
if ( ! f.exists() ) {
// Trace.trace("*** ERROR: Cannot find file: " + resolvedFileName);
error = STATUS_DEPLOYMENT_NODE_ERROR;
details = STATUS_DETAILS_FILE_NOT_FOUND;
}
resolvedFileName = f.getAbsolutePath();
newFileLocation = resolvedFileName;
}
// Trace.trace("+++ New xml:" + resolvedFileName);
}
UimaCasInitializer u = UimaCasInitializer.createUimaCasProcessor (casInit,
newFileLocation/*resolvedFileName*/, this);
if (error > 0) {
u.setStatus(error);
u.setStatusDetails(details);
}
uimaCasInitializers.add(u);
}
}
}
/*****************************************************************/
if (cpeCasProcessorsSettings == null) {
cpeCasProcessorsSettings = new CpeCasProcessorsSettings();
}
try {
cpeCasProcessorsSettings.setCasPoolSize(((CpeCasProcessorsImpl) cpeDescription.getCpeCasProcessors()).getPoolSize());
// Cannot get processingUnitThreadCount
cpeCasProcessorsSettings.setDropCasOnException(((CpeCasProcessorsImpl) cpeDescription.getCpeCasProcessors()).getDropCasOnException());
} catch (CpeDescriptorException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// CPE Cas Processors
CpeCasProcessor[] casProcs = null;
try {
casProcs = cpeDescription.getCpeCasProcessors().getAllCpeCasProcessors();
} catch (CpeDescriptorException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (casProcs == null) {
// Empty Cpe Descriptor
return ;
}
// Get list of CpeCasProcessor which can be an AE or a Cas Consumer
// For each CpeCasProcessor, get its type system (insert in cpeModel.typeSystemList)
// cpeModel.cpeCasProcessorModelList = new ArrayList();
// List specifierList = new ArrayList();
// List aeList = new ArrayList();
// List consumerList = new ArrayList();
// cpeModel.typeSystemList = new ArrayList();
for (int i=0; i < casProcs.length; i++) {
CpeComponentDescriptor cpeComponentDescriptor = casProcs[i].getCpeComponentDescriptor();
String newFileLocation = null;
if (cpeComponentDescriptor.getInclude() != null) {
newFileLocation = cpeComponentDescriptor.getInclude().get();
} else if (cpeComponentDescriptor.getImport() != null) {
newFileLocation = cpeComponentDescriptor.getImport().getLocation();
if (newFileLocation == null) {
newFileLocation = cpeComponentDescriptor.getImport().getName();
}
}
String specifierFile = resolveUimaXmlDescriptor(newFileLocation);
ResourceSpecifier specifier = null;