@Test public void testResourceSharing() throws Exception { Reader.resource = null; Annotator.resource = null; ExternalResourceDescription res = createResourceDescription(DummySharedResource.class); SimplePipeline.runPipeline(createReaderDescription(Reader.class, "resource", res), createEngineDescription(Annotator.class, "resource", res)); assertNotNull(Reader.resource); assertNotNull(Annotator.resource); assertTrue(Reader.resource == Annotator.resource); Reader.resource = null; Annotator.resource = null; }
public static void runPipeline(final CollectionReader reader, final AnalysisEngineDescription... descs) throws IOException, ResourceInitializationException, AnalysisEngineProcessException, CollectionException { AnalysisEngine aae = null; try { final AnalysisEngineDescription aaeDesc = createEngineDescription(descs); aae = createEngine(aaeDesc); final CAS cas = CasCreationUtils.createCas(asList(reader.getMetaData(), aae.getMetaData()), null, reader.getResourceManager()); reader.typeSystemInit(cas.getTypeSystem()); while (reader.hasNext()) { reader.getNext(cas); aae.process(cas); cas.reset(); } aae.collectionProcessComplete(); } finally { LifeCycleUtil.destroy(aae); } }
SimplePipeline { public static void runPipeline(final CollectionReader reader, final AnalysisEngineDescription... descs) throws IOException, ResourceInitializationException, AnalysisEngineProcessException, CollectionException { AnalysisEngine aae = null; try { final AnalysisEngineDescription aaeDesc = createEngineDescription(descs); aae = createEngine(aaeDesc); final CAS cas = CasCreationUtils.createCas(asList(reader.getMetaData(), aae.getMetaData()), null, reader.getResourceManager()); reader.typeSystemInit(cas.getTypeSystem()); while (reader.hasNext()) { reader.getNext(cas); aae.process(cas); cas.reset(); } aae.collectionProcessComplete(); } finally { LifeCycleUtil.destroy(aae); } } }
SimplePipeline { public static void runPipeline(final CollectionReader reader, final AnalysisEngineDescription... descs) throws IOException, ResourceInitializationException, AnalysisEngineProcessException, CollectionException { AnalysisEngine aae = null; try { final AnalysisEngineDescription aaeDesc = createEngineDescription(descs); aae = createEngine(aaeDesc); final CAS cas = CasCreationUtils.createCas(asList(reader.getMetaData(), aae.getMetaData()), null, reader.getResourceManager()); reader.typeSystemInit(cas.getTypeSystem()); while (reader.hasNext()) { reader.getNext(cas); aae.process(cas); cas.reset(); } aae.collectionProcessComplete(); } finally { LifeCycleUtil.destroy(aae); } } private  SimplePipeline(); }
SimplePipeline { public static void runPipeline(final CollectionReader reader, final AnalysisEngineDescription... descs) throws IOException, ResourceInitializationException, AnalysisEngineProcessException, CollectionException { AnalysisEngine aae = null; try { final AnalysisEngineDescription aaeDesc = createEngineDescription(descs); aae = createEngine(aaeDesc); final CAS cas = CasCreationUtils.createCas(asList(reader.getMetaData(), aae.getMetaData()), null, reader.getResourceManager()); reader.typeSystemInit(cas.getTypeSystem()); while (reader.hasNext()) { reader.getNext(cas); aae.process(cas); cas.reset(); } aae.collectionProcessComplete(); } finally { LifeCycleUtil.destroy(aae); } } private  SimplePipeline(); static void runPipeline(final CollectionReader reader,
          final AnalysisEngineDescription... descs); static void runPipeline(final CollectionReaderDescription readerDesc,
          final AnalysisEngineDescription... descs); static void runPipeline(final CollectionReader reader, final AnalysisEngine... engines); static void runPipeline(final ResourceManager aResMgr, final CollectionReader reader,
          final AnalysisEngine... engines); static void runPipeline(final CAS aCas, final AnalysisEngineDescription... aDescs); static void runPipeline(final JCas jCas, final AnalysisEngineDescription... descs); static void runPipeline(final JCas jCas, final AnalysisEngine... engines); static void runPipeline(final CAS cas, final AnalysisEngine... engines); static JCasIterable iteratePipeline(final CollectionReaderDescription aReader,
          AnalysisEngineDescription... aEngines); }
SimplePipeline { public static void runPipeline(final CollectionReader reader, final AnalysisEngineDescription... descs) throws IOException, ResourceInitializationException, AnalysisEngineProcessException, CollectionException { AnalysisEngine aae = null; try { final AnalysisEngineDescription aaeDesc = createEngineDescription(descs); aae = createEngine(aaeDesc); final CAS cas = CasCreationUtils.createCas(asList(reader.getMetaData(), aae.getMetaData()), null, reader.getResourceManager()); reader.typeSystemInit(cas.getTypeSystem()); while (reader.hasNext()) { reader.getNext(cas); aae.process(cas); cas.reset(); } aae.collectionProcessComplete(); } finally { LifeCycleUtil.destroy(aae); } } private  SimplePipeline(); static void runPipeline(final CollectionReader reader,
          final AnalysisEngineDescription... descs); static void runPipeline(final CollectionReaderDescription readerDesc,
          final AnalysisEngineDescription... descs); static void runPipeline(final CollectionReader reader, final AnalysisEngine... engines); static void runPipeline(final ResourceManager aResMgr, final CollectionReader reader,
          final AnalysisEngine... engines); static void runPipeline(final CAS aCas, final AnalysisEngineDescription... aDescs); static void runPipeline(final JCas jCas, final AnalysisEngineDescription... descs); static void runPipeline(final JCas jCas, final AnalysisEngine... engines); static void runPipeline(final CAS cas, final AnalysisEngine... engines); static JCasIterable iteratePipeline(final CollectionReaderDescription aReader,
          AnalysisEngineDescription... aEngines);  }