public final void process(AbstractCas aCAS) throws AnalysisEngineProcessException { if (aCAS instanceof CAS) { checkTypeSystemChange((CAS) aCAS); process((CAS) aCAS); } else { throw new AnalysisEngineProcessException( AnalysisEngineProcessException.INCORRECT_CAS_INTERFACE, new Object[] { CAS.class, aCAS.getClass() }); } }
@Override public void initialize(UimaContext aContext) throws ResourceInitializationException { super.initialize(aContext); String migrationClassName = (String) aContext.getConfigParameterValue("migration"); try { migration = Class.forName(migrationClassName).asSubclass(TypeSystemMigration.class) .newInstance(); Preconditions.checkNotNull(migration); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { throw new ResourceInitializationException(e); } }
/** * Gets an empty CAS that this CAS Multiplier can then populate. * * @return an empty CAS */ protected final CAS getEmptyCAS() { return getContext().getEmptyCas(CAS.class); }
/** * Checks it the type system of the given CAS is different from the last type system this * component was operating on. If it is different, calls the typeSystemInit method on the * component. */ private void checkTypeSystemChange(CAS aCAS) throws AnalysisEngineProcessException { TypeSystem typeSystem = aCAS.getTypeSystem(); if (typeSystem != mLastTypeSystem) { typeSystemInit(typeSystem); mLastTypeSystem = typeSystem; } }
@Override public void initialize(final UimaContext context) throws ResourceInitializationException { super.initialize(context); ConfigurationParameterInitializer.initialize(this, context); ExternalResourceInitializer.initialize(this, context); } }