*
* @see org.apache.uima.annotator.Annotator#process(org.apache.uima.core.AbstractCas)
*/
public void process(AbstractCas aCAS) throws AnalysisEngineProcessException {
if (!mCasInterface.isAssignableFrom(aCAS.getClass())) {
throw new AnalysisEngineProcessException(
AnalysisEngineProcessException.INCORRECT_CAS_INTERFACE, new Object[] { mCasInterface,
aCAS.getClass() });
}
// check if type system changed; if so, notify Annotator
checkTypeSystemChange(aCAS);
// do proper typecasts and call process method
try {
if (mAnnotator instanceof TextAnnotator) {
CAS cas = (CAS) aCAS;
ResultSpecification rs = getResultSpecForLanguage(cas.getDocumentLanguage());
rs.setTypeSystem(cas.getTypeSystem());
((TextAnnotator) mAnnotator).process(cas, rs);
} else if (mAnnotator instanceof JTextAnnotator) {
JCas jcas = (JCas) aCAS;
ResultSpecification rs = getResultSpecForLanguage(jcas.getDocumentLanguage());
rs.setTypeSystem(jcas.getTypeSystem());
((JTextAnnotator) mAnnotator).process(jcas, rs);
} else if (mAnnotator instanceof GenericAnnotator) {
mDefaultResultSpecification.setTypeSystem(((CAS) aCAS).getTypeSystem());
((GenericAnnotator) mAnnotator).process((CAS) aCAS, mDefaultResultSpecification);
}
} catch (AnnotatorProcessException e) {
throw new AnalysisEngineProcessException(e);
}
}