String xmlDescUri = (xmlDescFile != null) ? xmlDescFile.getAbsolutePath() : xmlDescUrl.toString();
try {
// clean error message
__errTableByUri.remove(xmlDescUri);
// get XMLParser
XMLParser xmlParser = UIMAFramework.getXMLParser();
// create XML source
xmlSource = (xmlDescFile != null) ? new XMLInputSource(xmlDescFile) : new XMLInputSource(
xmlDescUrl);
// parse XML source and create resource specifier
ResourceSpecifier resourceSpec = null;
try {
resourceSpec = xmlParser.parseResourceSpecifier(xmlSource);
} catch (UIMAException err) {
__errTableByUri.put( xmlDescUri, err );
} catch (UIMARuntimeException exc) {
__errTableByUri.put( xmlDescUri, exc );
}
if (resourceSpec != null) { // AE | CR | CI | CC ?
// identify UIMA resource category
if (resourceSpec instanceof AnalysisEngineDescription) {
uimaCompCtg = ANALYSIS_ENGINE_CTG;
} else if (resourceSpec instanceof CollectionReaderDescription) {
uimaCompCtg = COLLECTION_READER_CTG;
} else if (resourceSpec instanceof CasInitializerDescription) {
uimaCompCtg = CAS_INITIALIZER_CTG;
} else if (resourceSpec instanceof CasConsumerDescription) {
uimaCompCtg = CAS_CONSUMER_CTG;
}
}
if (uimaCompCtg == null) { // CPE ?
// refresh XML source object
try {
xmlSource.getInputStream().close();
} catch (Exception e) {
}
xmlSource = (xmlDescFile != null) ? new XMLInputSource(xmlDescFile) : new XMLInputSource(xmlDescUrl);
try {
// try parsing CPE configuration
xmlParser.parseCpeDescription(xmlSource);
uimaCompCtg = CPE_CONFIGURATION_CTG;
__errTableByUri.remove( xmlDescUri );
} catch (UIMAException err) {
__errTableByUri.put( xmlDescUri, err );
} catch (UIMARuntimeException exc) {
__errTableByUri.put( xmlDescUri, exc );
}
}
if (uimaCompCtg == null) { // TS ?
// refresh XML source object
try {
xmlSource.getInputStream().close();
} catch (Exception e) {
}
xmlSource = (xmlDescFile != null) ? new XMLInputSource(xmlDescFile) : new XMLInputSource(xmlDescUrl);
try {
// try parsing TS description
xmlParser.parseTypeSystemDescription(xmlSource);
uimaCompCtg = TYPE_SYSTEM_CTG;
__errTableByUri.remove( xmlDescUri );
} catch (UIMAException err) {
__errTableByUri.put( xmlDescUri, err );
} catch (UIMARuntimeException exc) {
__errTableByUri.put( xmlDescUri, exc );
}
}
if (uimaCompCtg == null) { // RR ?
// refresh XML source object
try {
xmlSource.getInputStream().close();
} catch (Exception e) {
}
xmlSource = (xmlDescFile != null) ? new XMLInputSource(xmlDescFile) : new XMLInputSource(xmlDescUrl);
try {
// try parsing RES manager configuration
xmlParser.parseResourceManagerConfiguration(xmlSource);
uimaCompCtg = REUSABLE_RESOURCE_CTG;
__errTableByUri.remove( xmlDescUri );
} catch (UIMAException err) {
__errTableByUri.put( xmlDescUri, err );
} catch (UIMARuntimeException exc) {