use of org.apache.uima.analysis_engine.AnalysisEngine in project stanbol by apache.
the class UIMALocal method activate.
@Override
protected void activate(ComponentContext ctx) throws ConfigurationException {
super.activate(ctx);
Dictionary<String, Object> props = ctx.getProperties();
this.uimaUri = (String) props.get(UIMA_CONTENTPART_URIREF);
this.uimaSourceName = (String) props.get(UIMA_SOURCENAME);
this.uimaDescriptorPath = (String) props.get(UIMA_DESCRIPTOR_PATH);
SUPPORTED_MIMETYPES = Collections.unmodifiableSet(new HashSet<String>(Arrays.asList((String[]) props.get(UIMA_SUPPORTED_MIMETYPES))));
aeProvider = AEProviderFactory.getInstance().getAEProvider(uimaSourceName, uimaDescriptorPath, new HashMap<String, Object>());
try {
AnalysisEngine ae = aeProvider.getAE();
TypeDescription[] aeTypes = ae.getAnalysisEngineMetaData().getTypeSystem().getTypes();
uimaTypeNames = new ArrayList<String>();
for (TypeDescription aeType : aeTypes) {
String aeTypeName = aeType.getName();
logger.info("Configuring Analysis Engine Type:" + aeTypeName);
uimaTypeNames.add(aeTypeName);
}
} catch (ResourceInitializationException ex) {
logger.error("Cannot retrieve AE from AEProvider. ", ex);
throw new ConfigurationException(uimaDescriptorPath, "Cannot retreive AE from AEProvider", ex);
}
}
Aggregations