Package org.apache.uima.flow

Examples of org.apache.uima.flow.Flow


      // now get the right interface(e.g. CAS or JCAS)
      Class<? extends AbstractCas> requiredInterface = mFlowController.getRequiredCasInterface();
      AbstractCas casToPass = getCasManager().getCasInterface(view, requiredInterface);   
      ((CASImpl)view).switchClassLoaderLockCasCL(this.getResourceManager().getExtensionClassLoader());
      Flow flow = mFlowController.computeFlow(casToPass);
      if (flow instanceof CasFlow_ImplBase) {
        ((CasFlow_ImplBase)flow).setCas(view);
      }
      if (flow instanceof JCasFlow_ImplBase) {
        ((JCasFlow_ImplBase)flow).setJCas(view.getJCas());
View Full Code Here


      // must be done before call to switchClassLoader
      Class<? extends AbstractCas> requiredInterface = mFlowControllerContainer.getRequiredCasInterface();
      AbstractCas casToPass = getCasManager().getCasInterface(view, requiredInterface);

      ((CASImpl)view).switchClassLoaderLockCasCL(getFlowClassLoader());
      Flow flow = mFlow.newCasProduced(casToPass, producedBy);
      if (flow instanceof CasFlow_ImplBase) {
        ((CasFlow_ImplBase)flow).setCas(view);
      }
      if (flow instanceof JCasFlow_ImplBase) {
        ((JCasFlow_ImplBase)flow).setJCas(view.getJCas());
View Full Code Here

  }

  public void testComputeFlow() throws Exception {
    CAS cas1 = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null);
    CAS cas2 = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null);
    Flow flow1 = fixedFlowController.computeFlow(cas1);
    Flow flow2 = fixedFlowController.computeFlow(cas2);
    //two steps in flow 1
    Step step = flow1.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow1.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key2", ((SimpleStep)step).getAnalysisEngineKey());
   
    //one step in flow 2
    step = flow2.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());

    //third step in flow 1
    step = flow1.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());

    //one step in flow 2
    step = flow2.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key2", ((SimpleStep)step).getAnalysisEngineKey());

    //finish flow 1
    step = flow1.next();
    assertTrue(step instanceof FinalStep);
   
    //finish flow 2
    step = flow2.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow2.next();
    assertTrue(step instanceof FinalStep);
  }
View Full Code Here

    assertTrue(step instanceof FinalStep);
  }
 
  public void testAddAnalysisEngines() throws Exception {
    CAS cas = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null);
    Flow flow = fixedFlowController.computeFlow(cas);
    //two steps in flow
    Step step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key2", ((SimpleStep)step).getAnalysisEngineKey());
   
    //now add two new AEs
    //first update AE metadata map
    AnalysisEngineMetaData delegateMd = new AnalysisEngineMetaData_impl();
    delegateMd.setOperationalProperties(new OperationalProperties_impl());
    analysisEngineMetaDataMap.put("key4", delegateMd);   
    analysisEngineMetaDataMap.put("key5", delegateMd);   
    //then notify FC
    List<String> newAeKeys = new ArrayList<String>();
    newAeKeys.add("key4");
    newAeKeys.add("key5");
    fixedFlowController.addAnalysisEngines(newAeKeys);
   
    //finish flow
    step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key4", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key5", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow.next();
    assertTrue(step instanceof FinalStep);
   
    //test new flow
    flow = fixedFlowController.computeFlow(cas);
    step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key2", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key4", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key5", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow.next();
    assertTrue(step instanceof FinalStep);
  }
View Full Code Here

    assertTrue(step instanceof FinalStep);
  }
 
  public void testRemoveAnalysisEngines() throws Exception {
    CAS cas = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null);
    Flow flow = fixedFlowController.computeFlow(cas);
    //one step in flow
    Step step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
   
    //remove "key2"
    analysisEngineMetaDataMap.remove("key2");
    List<String> removedKeys = new ArrayList<String>();
    removedKeys.add("key2");
    fixedFlowController.removeAnalysisEngines(removedKeys);
   
    //finish flow
    step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());   
    step = flow.next();
    assertTrue(step instanceof FinalStep);
   
    //test new flow
    flow = fixedFlowController.computeFlow(cas);
    step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow.next();
    assertTrue(step instanceof FinalStep);
  }
View Full Code Here

      // now get the right interface(e.g. CAS or JCAS)
      Class<? extends AbstractCas> requiredInterface = mFlowControllerContainer.getRequiredCasInterface();
      AbstractCas casToPass = getCasManager().getCasInterface(view, requiredInterface);

      ((CASImpl)newCAS).switchClassLoaderLockCasCL(getFlowClassLoader());
      Flow flow = mFlow.newCasProduced(casToPass, producedBy);
      if (flow instanceof CasFlow_ImplBase) {
        ((CasFlow_ImplBase)flow).setCas(view);
      }
      if (flow instanceof JCasFlow_ImplBase) {
        ((JCasFlow_ImplBase)flow).setJCas(view.getJCas());
View Full Code Here

      }
      // now get the right interface(e.g. CAS or JCAS)
      Class<? extends AbstractCas> requiredInterface = mFlowController.getRequiredCasInterface();
      AbstractCas casToPass = getCasManager().getCasInterface(view, requiredInterface);   
      ((CASImpl)aCAS).switchClassLoaderLockCasCL(this.getResourceManager().getExtensionClassLoader());
      Flow flow = mFlowController.computeFlow(casToPass);
      if (flow instanceof CasFlow_ImplBase) {
        ((CasFlow_ImplBase)flow).setCas(view);
      }
      if (flow instanceof JCasFlow_ImplBase) {
        ((JCasFlow_ImplBase)flow).setJCas(view.getJCas());
View Full Code Here

      // now get the right interface(e.g. CAS or JCAS)
      Class<? extends AbstractCas> requiredInterface = mFlowController.getRequiredCasInterface();
      AbstractCas casToPass = getCasManager().getCasInterface(view, requiredInterface);   
      ((CASImpl)view).switchClassLoaderLockCasCL(this.getResourceManager().getExtensionClassLoader());
      Flow flow = mFlowController.computeFlow(casToPass);
      if (flow instanceof CasFlow_ImplBase) {
        ((CasFlow_ImplBase)flow).setCas(view);
      }
      if (flow instanceof JCasFlow_ImplBase) {
        ((JCasFlow_ImplBase)flow).setJCas(view.getJCas());
View Full Code Here

  }

  public void testComputeFlow() throws Exception {
    CAS cas1 = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null);
    CAS cas2 = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null);
    Flow flow1 = fixedFlowController.computeFlow(cas1);
    Flow flow2 = fixedFlowController.computeFlow(cas2);
    //two steps in flow 1
    Step step = flow1.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow1.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key2", ((SimpleStep)step).getAnalysisEngineKey());
   
    //one step in flow 2
    step = flow2.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());

    //third step in flow 1
    step = flow1.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());

    //one step in flow 2
    step = flow2.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key2", ((SimpleStep)step).getAnalysisEngineKey());

    //finish flow 1
    step = flow1.next();
    assertTrue(step instanceof FinalStep);
   
    //finish flow 2
    step = flow2.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow2.next();
    assertTrue(step instanceof FinalStep);
  }
View Full Code Here

    assertTrue(step instanceof FinalStep);
  }
 
  public void testAddAnalysisEngines() throws Exception {
    CAS cas = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null);
    Flow flow = fixedFlowController.computeFlow(cas);
    //two steps in flow
    Step step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key2", ((SimpleStep)step).getAnalysisEngineKey());
   
    //now add two new AEs
    //first update AE metadata map
    AnalysisEngineMetaData delegateMd = new AnalysisEngineMetaData_impl();
    delegateMd.setOperationalProperties(new OperationalProperties_impl());
    analysisEngineMetaDataMap.put("key4", delegateMd);   
    analysisEngineMetaDataMap.put("key5", delegateMd);   
    //then notify FC
    List<String> newAeKeys = new ArrayList<String>();
    newAeKeys.add("key4");
    newAeKeys.add("key5");
    fixedFlowController.addAnalysisEngines(newAeKeys);
   
    //finish flow
    step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key4", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key5", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow.next();
    assertTrue(step instanceof FinalStep);
   
    //test new flow
    flow = fixedFlowController.computeFlow(cas);
    step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key2", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key4", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key5", ((SimpleStep)step).getAnalysisEngineKey());
    step = flow.next();
    assertTrue(step instanceof FinalStep);
  }
View Full Code Here

TOP

Related Classes of org.apache.uima.flow.Flow

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.