@SuppressWarnings("javadoc") @Test public void testSofaInitializer() throws Exception { AnalysisEngineDescription description = AnalysisEngineFactory.createEngineDescription( SofaAwareAnnotator.class, typeSystemDescription); AnalysisEngine engine = AnalysisEngineFactory.createEngine(description, "myView"); AnalysisEngine viewCreator = AnalysisEngineFactory.createEngine(ViewCreatorAnnotator.class, typeSystemDescription, ViewCreatorAnnotator.PARAM_VIEW_NAME, "myView"); viewCreator.process(jCas); engine.process(jCas); assertEquals("some", JCasUtil.selectByIndex(jCas.getView("myView"), Token.class, 0) .getCoveredText()); jCas.reset(); viewCreator.process(jCas); viewCreator.process(jCas); engine.process(jCas); assertEquals("some", JCasUtil.selectByIndex(jCas.getView("myView"), Token.class, 0) .getCoveredText()); description = AnalysisEngineFactory.createEngineDescription(SofaUnawareAnnotator.class, typeSystemDescription); engine = AnalysisEngineFactory.createEngine(description, "myView"); jCas.reset(); viewCreator.process(jCas); engine.process(jCas); assertEquals("some", JCasUtil.selectByIndex(jCas.getView("myView"), Token.class, 0) .getCoveredText()); jCas.reset(); viewCreator.process(jCas); viewCreator.process(jCas); engine.process(jCas); assertEquals("some", JCasUtil.selectByIndex(jCas.getView("myView"), Token.class, 0) .getCoveredText()); }
@Override public void process(final JCas aJCas) throws AnalysisEngineProcessException { createViewSafely(aJCas, viewName); }
ViewCreatorAnnotator extends JCasAnnotator_ImplBase { @Override public void process(final JCas aJCas) throws AnalysisEngineProcessException { createViewSafely(aJCas, viewName); } }
ViewCreatorAnnotator extends JCasAnnotator_ImplBase { @Override public void process(final JCas aJCas) throws AnalysisEngineProcessException { createViewSafely(aJCas, viewName); }  }
ViewCreatorAnnotator extends JCasAnnotator_ImplBase { @Override public void process(final JCas aJCas) throws AnalysisEngineProcessException { createViewSafely(aJCas, viewName); }  @Override void process(final JCas aJCas); static JCas createViewSafely(final JCas aJCas, final String aViewName); }
ViewCreatorAnnotator extends JCasAnnotator_ImplBase { @Override public void process(final JCas aJCas) throws AnalysisEngineProcessException { createViewSafely(aJCas, viewName); }  @Override void process(final JCas aJCas); static JCas createViewSafely(final JCas aJCas, final String aViewName); static final String PARAM_VIEW_NAME; }