You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by al...@apache.org on 2007/02/28 23:08:53 UTC

svn commit: r513004 - in /incubator/uima/uimaj/trunk/uimaj-core/src: main/java/org/apache/uima/analysis_engine/asb/impl/ main/java/org/apache/uima/flow/ test/java/org/apache/uima/analysis_engine/impl/ test/resources/TextAnalysisEngineImplTest/

Author: alally
Date: Wed Feb 28 14:08:51 2007
New Revision: 513004

URL: http://svn.apache.org/viewvc?view=rev&rev=513004
Log:
Added ParallelStep class that can be returned by Flow.next().  The runtime currently
executes a ParallelStep serially in an arbitrary order.
UIMA-327: https://issues.apache.org/jira/browse/UIMA-327

Added:
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/flow/ParallelStep.java
    incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/ParallelFlowController.java
    incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/TestAnnotator2.java
    incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/AggregateForParallelStepCasMultiplierTest.xml
    incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/AggregateForParallelStepTest.xml
    incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/ParallelFlowController.xml
Modified:
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/analysis_engine/asb/impl/ASB_impl.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/flow/SimpleStep.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/flow/Step.java
    incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/AnalysisEngine_implTest.java
    incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/TestPrimitiveTae2.xml

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/analysis_engine/asb/impl/ASB_impl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/analysis_engine/asb/impl/ASB_impl.java?view=diff&rev=513004&r1=513003&r2=513004
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/analysis_engine/asb/impl/ASB_impl.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/analysis_engine/asb/impl/ASB_impl.java Wed Feb 28 14:08:51 2007
@@ -19,10 +19,13 @@
 
 package org.apache.uima.analysis_engine.asb.impl;
 
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.Stack;
@@ -47,6 +50,7 @@
 import org.apache.uima.cas.CAS;
 import org.apache.uima.flow.FinalStep;
 import org.apache.uima.flow.FlowControllerContext;
+import org.apache.uima.flow.ParallelStep;
 import org.apache.uima.flow.SimpleStep;
 import org.apache.uima.flow.Step;
 import org.apache.uima.flow.impl.FlowControllerContext_impl;
@@ -480,6 +484,7 @@
       try {
         while (true) {
           CAS cas = null;
+          Step nextStep = null;
           flow = null;
           // get an initial CAS from the CasIteratorStack
           while (cas == null) {
@@ -497,6 +502,7 @@
               // that stack frame and continue with its flow
               cas = frame.originalCas;
               flow = frame.originalCasFlow;
+              nextStep = frame.incompleteParallelStep; //in case we need to resume a parallel step
               cas.setCurrentComponentInfo(null); // this CAS is done being processed by the
               // previous AnalysisComponent
               casIteratorStack.pop(); // remove this state from the stack now
@@ -506,11 +512,15 @@
           // record active CASes in case we encounter an exception and need to release them
           activeCASes.add(cas);
 
-          // get next CAS Processor to route to
-          Step nextStep = flow.next();
+          // if we're not in the middle of parallel step already, ask the FlowController 
+          // for the next step
+          if (nextStep == null) {
+            nextStep = flow.next();
+          }
 
           // repeat until we reach a FinalStep
           while (!(nextStep instanceof FinalStep)) {
+            //Simple Step
             if (nextStep instanceof SimpleStep) {
               String nextAeKey = ((SimpleStep) nextStep).getAnalysisEngineKey();
               AnalysisEngine nextAe = (AnalysisEngine) mComponentAnalysisEngineMap.get(nextAeKey);
@@ -540,6 +550,49 @@
                         AnalysisEngineProcessException.UNKNOWN_ID_IN_SEQUENCE,
                         new Object[] { nextAeKey });
               }
+            } 
+            //ParallelStep
+            else if (nextStep instanceof ParallelStep) {
+              //create modifiable list of destinations 
+              List destinations = new LinkedList(((ParallelStep)nextStep).getAnalysisEngineKeys());
+              //iterate over all destinations, removing them from the list as we go
+              while (!destinations.isEmpty()) {
+                String nextAeKey = (String)destinations.get(0);
+                destinations.remove(0); 
+                //execute this step as we would a single step
+                AnalysisEngine nextAe = (AnalysisEngine) mComponentAnalysisEngineMap.get(nextAeKey);
+                if (nextAe != null) {
+                  // invoke next AE in flow
+                  CasIterator casIter;
+                  casIter = nextAe.processAndOutputNewCASes(cas);
+                  if (casIter.hasNext()) // new CASes are output
+                  {
+                    CAS outputCas = casIter.next();
+                    // when pushing the stack frame so we know where to pick up later,
+                    // be sure to include the incomplete ParallelStep
+                    if (!destinations.isEmpty()) {
+                      casIteratorStack.push(new StackFrame(casIter, cas, flow, nextAeKey,
+                              new ParallelStep(destinations)));
+                    } else {
+                      casIteratorStack.push(new StackFrame(casIter, cas, flow, nextAeKey));                      
+                    }
+                      
+                    // compute Flow for the output CAS and begin routing it through the flow
+                    flow = flow.newCasProduced(outputCas, nextAeKey);
+                    cas = outputCas;
+                    activeCASes.add(cas);
+                    break; //break out of processing of ParallelStep
+                  } else {
+                    // no new CASes are output; this cas is done being processed
+                    // by that AnalysisEngine so clear the componentInfo
+                    cas.setCurrentComponentInfo(null);
+                  }
+                } else {
+                  throw new AnalysisEngineProcessException(
+                          AnalysisEngineProcessException.UNKNOWN_ID_IN_SEQUENCE,
+                          new Object[] { nextAeKey });
+                }
+              }            
             } else {
               throw new AnalysisEngineProcessException(
                       AnalysisEngineProcessException.UNSUPPORTED_STEP_TYPE, new Object[] { nextStep
@@ -593,12 +646,17 @@
   static class StackFrame {
     StackFrame(CasIterator casIterator, CAS originalCas, FlowContainer originalCasFlow,
             String lastAeKey) {
+      this(casIterator, originalCas, originalCasFlow, lastAeKey, null);
+    }
+
+    StackFrame(CasIterator casIterator, CAS originalCas, FlowContainer originalCasFlow,
+            String lastAeKey, ParallelStep incompleteParallelStep) {
       this.casIterator = casIterator;
       this.originalCas = originalCas;
       this.originalCasFlow = originalCasFlow;
       this.casMultiplierAeKey = lastAeKey;
+      this.incompleteParallelStep = incompleteParallelStep;
     }
-
     /** CasIterator that returns output CASes produced by the CasMultiplier. */
     CasIterator casIterator;
 
@@ -613,6 +671,12 @@
 
     /** The key that identifies the CasMultiplier whose output we are processing */
     String casMultiplierAeKey;
+    
+    /** If the CAS Multiplier was called while processing a ParallelStep, this specifies
+     * the remaining parts of the parallel step, so we can pick up processing from there
+     * once we've processed all the output CASes.
+     */
+    ParallelStep incompleteParallelStep;
   }
 
   /**

Added: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/flow/ParallelStep.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/flow/ParallelStep.java?view=auto&rev=513004
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/flow/ParallelStep.java (added)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/flow/ParallelStep.java Wed Feb 28 14:08:51 2007
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.flow;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * Indicates that a CAS should be routed to a multiple AnalysisEngines and that the relative order
+ * in which these execute does not matter. Logically, they can run in parallel. The runtime is not
+ * actually obligated to execute them in parallel, however.
+ * <p>
+ * After all the specified Analysis Engines have completed their processing, the {@link Flow#next()}
+ * method will be called again to determine the next destination for the CAS.
+ */
+public class ParallelStep extends Step {
+  /**
+   * Cretes a new SimpleStep
+   * 
+   * @param aAnalysisEngineKeys
+   *          A Collection of Strings, where each String is the key of an Analysis Engine to which the CAS
+   *          should be routed. Each String must bee one of the keys in the FlowController's
+   *          {@link FlowControllerContext#getAnalysisEngineMetaDataMap()}.
+   */
+  public ParallelStep(Collection aAnalysisEngineKeys) {
+    setAnalysisEngineKeys(aAnalysisEngineKeys);
+  }
+
+  /**
+   * Gets the keys of the Analysis Engines to which the CAS should be routed.
+   * 
+   * @return an unmodifiable Collection of Strings, where each String is the key of an Analysis Engine to 
+   *         which the CAS should be routed.
+   */
+  public Collection getAnalysisEngineKeys() {
+    return mKeys;
+  }
+
+  /**
+   * Sets the keys of the Analysis Engines to which the CAS should be routed. By using this method,
+   * a user's Flow implementation can (but is not required to) reuse the same ParallelStep object
+   * multiple times.
+   * 
+   * @return A Collection of Strings, where each String is the key of an Analysis Engine to which the CAS
+   *         should be routed. Each String must bee one of the keys in the FlowController's
+   *         {@link FlowControllerContext#getAnalysisEngineMetaDataMap()}.
+   */
+  public void setAnalysisEngineKeys(Collection aKeys) {
+    mKeys = Collections.unmodifiableCollection(aKeys);
+  }
+
+  private Collection mKeys;
+}

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/flow/SimpleStep.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/flow/SimpleStep.java?view=diff&rev=513004&r1=513003&r2=513004
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/flow/SimpleStep.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/flow/SimpleStep.java Wed Feb 28 14:08:51 2007
@@ -28,8 +28,8 @@
   /**
    * Cretes a new SimpleStep
    * 
-   * @param aCasProcessorKey
-   *          The key of the CAS Processor to which the CAS should be routed. This must be one of
+   * @param aAnalysisEngineKey
+   *          The key of the Analysis Engine to which the CAS should be routed. This must be one of
    *          the keys in the FlowController's
    *          {@link FlowControllerContext#getAnalysisEngineMetaDataMap()}.
    */

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/flow/Step.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/flow/Step.java?view=diff&rev=513004&r1=513003&r2=513004
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/flow/Step.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/flow/Step.java Wed Feb 28 14:08:51 2007
@@ -26,6 +26,8 @@
  * <ul>
  * <li>{@link SimpleStep} - specifies a single AnalysisEngine to which the CAS should next be
  * routed</li>
+ * <li>{@link ParallelStep} - specifies multiple AnalysisEngine to which the CAS should next be
+ * routed, where the relative order in which these Analysis Engines execute does not matter.</li>
  * <li>{@link FinalStep} - indicates that there are no more destinations for this CAS.</li>
  * </ul>
  */

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/AnalysisEngine_implTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/AnalysisEngine_implTest.java?view=diff&rev=513004&r1=513003&r2=513004
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/AnalysisEngine_implTest.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/AnalysisEngine_implTest.java Wed Feb 28 14:08:51 2007
@@ -24,7 +24,9 @@
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.Iterator;
+import java.util.Set;
 
 import junit.framework.Assert;
 import junit.framework.TestCase;
@@ -356,6 +358,18 @@
       assertTrue(outFile.exists());
       assertTrue(outFile.length() > 0);
       outFile.delete();
+      
+      //test aggregate that uses ParallelStep
+      AnalysisEngineDescription desc = UIMAFramework.getXMLParser().parseAnalysisEngineDescription(
+        new XMLInputSource(JUnitExtension.getFile("TextAnalysisEngineImplTest/AggregateForParallelStepTest.xml")));
+      AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(desc);
+      CAS cas = ae.newCAS();
+      cas.setDocumentText("new test");
+      ae.process(cas);
+      assertEquals("new test", TestAnnotator.lastDocument);
+      assertEquals("new test", TestAnnotator2.lastDocument);
+      cas.reset();
+      
     } catch (Exception e) {
       JUnitExtension.handleException(e);
     }
@@ -951,6 +965,27 @@
       assertFalse(iter.hasNext());
       // Annotator should NOT get the original CAS according to the default flow
       assertEquals("Line three", TestAnnotator.lastDocument);
+      
+      //with ParallelStep
+      AnalysisEngineDescription desc = UIMAFramework.getXMLParser().parseAnalysisEngineDescription(
+        new XMLInputSource(JUnitExtension.getFile("TextAnalysisEngineImplTest/AggregateForParallelStepCasMultiplierTest.xml")));
+      AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(desc);
+      cas.reset();
+      cas.setDocumentText("One\tTwo\nThree\tFour");
+      iter = ae.processAndOutputNewCASes(cas);
+      Set expectedOutputs = new HashSet();
+      expectedOutputs.add("One");
+      expectedOutputs.add("Two\nThree");
+      expectedOutputs.add("Four");
+      expectedOutputs.add("One\tTwo");
+      expectedOutputs.add("Three\tFour");
+      while (iter.hasNext()) {
+        outCas = iter.next();
+        assertTrue(expectedOutputs.remove(outCas.getDocumentText()));        
+        outCas.release();
+      }
+      assertTrue(expectedOutputs.isEmpty());
+      
     } catch (Exception e) {
       JUnitExtension.handleException(e);
     }

Added: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/ParallelFlowController.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/ParallelFlowController.java?view=auto&rev=513004
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/ParallelFlowController.java (added)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/ParallelFlowController.java Wed Feb 28 14:08:51 2007
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.analysis_engine.impl;
+
+import java.util.Set;
+
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.cas.CAS;
+import org.apache.uima.flow.CasFlowController_ImplBase;
+import org.apache.uima.flow.CasFlow_ImplBase;
+import org.apache.uima.flow.FinalStep;
+import org.apache.uima.flow.Flow;
+import org.apache.uima.flow.FlowControllerContext;
+import org.apache.uima.flow.ParallelStep;
+import org.apache.uima.flow.Step;
+import org.apache.uima.resource.ResourceInitializationException;
+
+/**
+ * FlowController for testing ParallelStep.
+ */
+public class ParallelFlowController extends CasFlowController_ImplBase {
+  
+  public void initialize(FlowControllerContext aContext) throws ResourceInitializationException {
+    super.initialize(aContext);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.flow.CasFlowController_ImplBase#computeFlow(org.apache.uima.cas.CAS)
+   */
+  public Flow computeFlow(CAS aCAS) throws AnalysisEngineProcessException {
+    ParallelFlowObject ffo = new ParallelFlowObject();
+    ffo.setCas(aCAS);
+    return ffo;
+  }
+
+  class ParallelFlowObject extends CasFlow_ImplBase {
+    private boolean done = false;
+    
+    /**
+     * Create a new fixed flow starting at step <code>startStep</code> of the fixed sequence.
+     * 
+     * @param startStep
+     *          index of mSequence to start at
+     */
+    public ParallelFlowObject() {
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.uima.flow.Flow#next()
+     */
+    public Step next() throws AnalysisEngineProcessException {
+      if (!done) {
+        done = true;
+        Set keys = getContext().getAnalysisEngineMetaDataMap().keySet();
+        return new ParallelStep(keys);
+      }
+      else {
+        return new FinalStep();
+      }
+        
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.uima.flow.CasFlow_ImplBase#newCasProduced(org.apache.uima.cas.CAS, java.lang.String)
+     */
+    protected Flow newCasProduced(CAS newCas, String producedBy) throws AnalysisEngineProcessException {
+      //for this test, new segments don't continue in the flow
+      return new EmptyFlow();
+    }     
+  }
+  
+  class EmptyFlow extends CasFlow_ImplBase {
+    public Step next() {
+      return new FinalStep();
+    }
+  }
+}

Added: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/TestAnnotator2.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/TestAnnotator2.java?view=auto&rev=513004
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/TestAnnotator2.java (added)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/TestAnnotator2.java Wed Feb 28 14:08:51 2007
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.analysis_engine.impl;
+
+import org.apache.uima.analysis_engine.ResultSpecification;
+import org.apache.uima.analysis_engine.annotator.AnnotatorConfigurationException;
+import org.apache.uima.analysis_engine.annotator.AnnotatorContext;
+import org.apache.uima.analysis_engine.annotator.AnnotatorContextException;
+import org.apache.uima.analysis_engine.annotator.AnnotatorInitializationException;
+import org.apache.uima.analysis_engine.annotator.AnnotatorProcessException;
+import org.apache.uima.analysis_engine.annotator.Annotator_ImplBase;
+import org.apache.uima.analysis_engine.annotator.TextAnnotator;
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.TypeSystem;
+
+/**
+ * Annotator class used for testing.
+ * 
+ */
+public class TestAnnotator2 extends Annotator_ImplBase implements TextAnnotator {
+  // Process method saves information to these static fields,
+  // which are queried by the unit test.
+  public static String lastDocument;
+
+  public static String stringParamValue;
+
+  public static ResultSpecification lastResultSpec;
+
+  public static boolean typeSystemInitCalled;
+
+  public static synchronized String getLastDocument() {
+    return lastDocument;  
+  }
+  
+  public static synchronized ResultSpecification getLastResultSpec() {
+    return lastResultSpec;
+  }
+  
+  /**
+   * @see org.apache.uima.analysis_engine.annotator.Annotator#initialize(CAS, AnnotatorContext)
+   */
+  public void initialize(AnnotatorContext aContext) throws AnnotatorConfigurationException,
+          AnnotatorInitializationException {
+    super.initialize(aContext);
+    typeSystemInitCalled = false;
+    lastResultSpec = null;
+    lastDocument = null;
+    try {
+      stringParamValue = (String) getContext().getConfigParameterValue("StringParam");
+    } catch (AnnotatorContextException e) {
+      throw new AnnotatorInitializationException(e);
+    }
+  }
+
+  public void typeSystemInit(TypeSystem aTypeSystem) {
+    typeSystemInitCalled = true;
+  }
+
+  /**
+   * @see org.apache.uima.analysis_engine.annotator.TextAnnotator#process(CAS,ResultSpecification)
+   */
+  public void process(CAS aCAS, ResultSpecification aResultSpec) throws AnnotatorProcessException {
+    // set static fields to contain document text, result spec,
+    // and value of StringParam configuration parameter.
+    lastDocument = aCAS.getDocumentText();
+    lastResultSpec = aResultSpec;
+  }
+}

Added: incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/AggregateForParallelStepCasMultiplierTest.xml
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/AggregateForParallelStepCasMultiplierTest.xml?view=auto&rev=513004
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/AggregateForParallelStepCasMultiplierTest.xml (added)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/AggregateForParallelStepCasMultiplierTest.xml Wed Feb 28 14:08:51 2007
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+
+<!-- Aggregate descriptor for testing merging of type system, type priorities, and indexes. -->
+
+<taeDescription xmlns="http://uima.apache.org/resourceSpecifier">
+<frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+<primitive>false</primitive>
+
+<delegateAnalysisEngineSpecifiers>
+<delegateAnalysisEngine key="CasMult1">
+<import location="NewlineSegmenter.xml"/>
+</delegateAnalysisEngine>
+
+<delegateAnalysisEngine key="CasMult2">
+<import location="TabSegmenter.xml"/>
+</delegateAnalysisEngine>
+</delegateAnalysisEngineSpecifiers> 
+<flowController>
+	<import location="ParallelFlowController.xml"/>
+</flowController>
+<analysisEngineMetaData>
+<name>Aggregate TAE for ParallelStep CAS Multiplier Test</name>
+<description>For testing ParallelStep with CAS Multipliers.</description>
+<version>1.0</version>
+<vendor>The Apache Software Foundation</vendor>
+
+<!-- Capabilities: Inputs and Outputs -->
+<capabilities>
+<capability>
+<inputs/>
+<outputs/>
+<languagesSupported/>
+</capability>
+</capabilities>
+	<operationalProperties>
+		<modifiesCas>true</modifiesCas>
+		<multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+		<outputsNewCASes>true</outputsNewCASes>
+	</operationalProperties>
+</analysisEngineMetaData>
+</taeDescription>

Added: incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/AggregateForParallelStepTest.xml
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/AggregateForParallelStepTest.xml?view=auto&rev=513004
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/AggregateForParallelStepTest.xml (added)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/AggregateForParallelStepTest.xml Wed Feb 28 14:08:51 2007
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+
+<!-- Aggregate descriptor for testing merging of type system, type priorities, and indexes. -->
+
+<taeDescription xmlns="http://uima.apache.org/resourceSpecifier">
+<frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+<primitive>false</primitive>
+
+<delegateAnalysisEngineSpecifiers>
+<delegateAnalysisEngine key="Annotator1">
+<import location="TestPrimitiveTae1.xml"/>
+</delegateAnalysisEngine>
+
+<delegateAnalysisEngine key="Annotator2">
+<import location="TestPrimitiveTae2.xml"/>
+</delegateAnalysisEngine>
+</delegateAnalysisEngineSpecifiers> 
+<flowController>
+	<import location="ParallelFlowController.xml"/>
+</flowController>
+<analysisEngineMetaData>
+<name>Aggregate TAE for ParallelStep Test</name>
+<description>For testing ParallelStep.</description>
+<version>1.0</version>
+<vendor>The Apache Software Foundation</vendor>
+
+<!-- Capabilities: Inputs and Outputs -->
+<capabilities>
+<capability>
+<inputs/>
+<outputs/>
+<languagesSupported/>
+</capability>
+</capabilities>
+
+</analysisEngineMetaData>
+</taeDescription>

Added: incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/ParallelFlowController.xml
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/ParallelFlowController.xml?view=auto&rev=513004
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/ParallelFlowController.xml (added)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/ParallelFlowController.xml Wed Feb 28 14:08:51 2007
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+
+<!-- For testing only. -->
+
+<flowControllerDescription xmlns="http://uima.apache.org/resourceSpecifier">
+<frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+<implementationName>org.apache.uima.analysis_engine.impl.ParallelFlowController</implementationName>
+ 
+<processingResourceMetaData>
+<name>Parallel Flow Controller</name>
+<description>For testing only.</description>
+<version>1.0</version>
+<vendor>The Apache Software Foundation</vendor>
+</processingResourceMetaData>
+</flowControllerDescription>

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/TestPrimitiveTae2.xml
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/TestPrimitiveTae2.xml?view=diff&rev=513004&r1=513003&r2=513004
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/TestPrimitiveTae2.xml (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/TestPrimitiveTae2.xml Wed Feb 28 14:08:51 2007
@@ -23,7 +23,7 @@
 <taeDescription xmlns="http://uima.apache.org/resourceSpecifier">
 <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
 <primitive>true</primitive>
-<annotatorImplementationName>org.apache.uima.analysis_engine.impl.TestAnnotator</annotatorImplementationName>
+<annotatorImplementationName>org.apache.uima.analysis_engine.impl.TestAnnotator2</annotatorImplementationName>
  
 <analysisEngineMetaData>
 <name>Test Primitive TAE 2</name>