[jbpm-commits] JBoss JBPM SVN: r2689 - in projects/spec/trunk/modules: ri/src/main/java/org/jbpm/ri/model and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Oct 30 16:37:18 EDT 2008


Author: thomas.diesler at jboss.com
Date: 2008-10-30 16:37:18 -0400 (Thu, 30 Oct 2008)
New Revision: 2689

Modified:
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/Token.java
   projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/InclusiveGatewayImpl.java
   projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ParallelGatewayImpl.java
   projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/TaskImpl.java
   projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/DelegatingToken.java
   projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/MutableToken.java
   projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenImpl.java
Log:
cleanup token api

Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/Token.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/Token.java	2008-10-30 19:10:02 UTC (rev 2688)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/Token.java	2008-10-30 20:37:18 UTC (rev 2689)
@@ -23,18 +23,16 @@
 
 // $Id$
 
-import org.jbpm.api.model.InputSet;
-import org.jbpm.api.model.OutputSet;
 import org.jbpm.api.model.SequenceFlow;
 
 /**
  * A Token is a descriptive construct used to describe how the flow of a Process will proceed at runtime.
  * 
- * By tracking how the Token traverses the Flow Objects, gets diverted through alternative paths, and gets split into parallel paths, the normal Sequence Flow should be
- * completely definable.
+ * By tracking how the Token traverses the Flow Objects, gets diverted through alternative paths, and gets split into
+ * parallel paths, the normal Sequence Flow should be completely definable.
  * 
- * A Token will have a unique identity that can be used to separate multiple Tokens that may exist because of concurrent process instances or the splitting of the Token
- * for parallel processing within a single process instance.
+ * A Token will have a unique identity that can be used to separate multiple Tokens that may exist because of concurrent
+ * process instances or the splitting of the Token for parallel processing within a single process instance.
  * 
  * @author Thomas.Diesler at jboss.com
  * @since 20-Apr-2007
@@ -47,46 +45,22 @@
   }
 
   /**
-   * Get the token status
-   */
-  TokenStatus getTokenStatus();
-  
-  /**
    * Get the unique token identity
    */
   String getTokenID();
 
   /**
-   * Get the associated {@link ExecutionContext}
+   * Get the token status
    */
-  ExecutionContext getExecutionContext();
+  TokenStatus getTokenStatus();
 
   /**
-   * Get the current {@link SequenceFlow} 
+   * Get the associated {@link ExecutionContext}
    */
-  SequenceFlow getFlow();
-  
-  /**
-   * Get the active {@link InputSet}  
-   * @return null if the Activity does not define one
-   */
-  InputSet getInputSet();
-  
-  /**
-   * Get the active {@link OutputSet}  
-   * @return null if the Activity does not define one
-   */
-  OutputSet getOutputSet();
-  
-  /**
-   * Create a schallow copy of this Token.
-   * <p/>
-   * The content in the ExecutionContext will be copied by reference. 
-   */
-  Token copyToken();
+  ExecutionContext getExecutionContext();
 
   /**
-   * Merge this Token with another token.
+   * Get the current {@link SequenceFlow}
    */
-  void mergeToken(Token token);
+  SequenceFlow getFlow();
 }
\ No newline at end of file

Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/InclusiveGatewayImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/InclusiveGatewayImpl.java	2008-10-30 19:10:02 UTC (rev 2688)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/InclusiveGatewayImpl.java	2008-10-30 20:37:18 UTC (rev 2689)
@@ -42,6 +42,7 @@
 import org.jbpm.api.runtime.Token;
 import org.jbpm.api.runtime.TokenExecutor;
 import org.jbpm.api.runtime.Attachments.Key;
+import org.jbpm.ri.runtime.MutableToken;
 import org.mvel.MVEL;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -58,7 +59,7 @@
 public class InclusiveGatewayImpl extends GatewayImpl implements InclusiveGateway
 {
   private static final long serialVersionUID = 1L;
-  
+
   // provide logging
   final static Logger log = LoggerFactory.getLogger(InclusiveGatewayImpl.class);
 
@@ -66,12 +67,12 @@
   {
     super(procStruct, name, GatewayType.Inclusive);
   }
-  
+
   // Persistence ctor
   protected InclusiveGatewayImpl()
   {
   }
-  
+
   @Override
   protected FlowHandler getDefaultFlowHandler()
   {
@@ -82,6 +83,7 @@
 
       public void execute(TokenExecutor tokenExecutor, Token token)
       {
+        MutableToken mutableToken = (MutableToken)token;
         Node sourceRef = token.getFlow().getSourceRef();
         log.debug("Propagate token comming from: " + sourceRef);
 
@@ -100,7 +102,7 @@
           for (SequenceFlow auxGate : applicableGates)
           {
             SequenceFlow outFlow = auxGate;
-            Token outToken = token.copyToken();
+            Token outToken = mutableToken.copyToken();
             tokenExecutor.create(outToken, outFlow);
             outTokens.add(outToken);
           }

Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ParallelGatewayImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ParallelGatewayImpl.java	2008-10-30 19:10:02 UTC (rev 2688)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ParallelGatewayImpl.java	2008-10-30 20:37:18 UTC (rev 2689)
@@ -39,6 +39,7 @@
 import org.jbpm.api.runtime.FlowHandler;
 import org.jbpm.api.runtime.Token;
 import org.jbpm.api.runtime.TokenExecutor;
+import org.jbpm.ri.runtime.MutableToken;
 import org.jbpm.ri.runtime.TokenImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -128,7 +129,7 @@
         tokenExecutor.suspend(token);
         
         // If the gateway has a single incomming flow the outgoing token is the incomming token 
-        Token outToken = (getInFlows().size() == 1 ? token : null);
+        MutableToken outToken = (getInFlows().size() == 1 ? (MutableToken)token : null);
         
         // The outgoing token is the merge of all incomming tokens
         if (outToken == null)
@@ -155,7 +156,7 @@
           for(SequenceFlow auxGate : getGates())
           {
             SequenceFlow outFlow = auxGate;
-            outToken = outToken.copyToken();
+            outToken = (MutableToken)outToken.copyToken();
             tokenExecutor.create(outToken, outFlow);
             outTokens.add(outToken);
           }
@@ -196,7 +197,7 @@
     mergeTokens = null;
   }
   
-  private Token getMergedTokens()
+  private TokenImpl getMergedTokens()
   {
     TokenImpl mergedToken = new TokenImpl(null);
     for (Token auxToken : mergeTokens)

Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/TaskImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/TaskImpl.java	2008-10-30 19:10:02 UTC (rev 2688)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/TaskImpl.java	2008-10-30 20:37:18 UTC (rev 2689)
@@ -58,7 +58,6 @@
 import org.jbpm.api.service.SignalService;
 import org.jbpm.ri.model.builder.SingleInFlowSupport;
 import org.jbpm.ri.model.builder.SingleOutFlowSupport;
-import org.jbpm.ri.runtime.MutableToken;
 
 /**
  * A Task is an Atomic Activity that is included within a Process.
@@ -191,12 +190,8 @@
 
       public void execute(Token token)
       {
-        MutableToken mutableToken = (MutableToken)token;
-        mutableToken.setOutputSet(getActiveOutputSet());
-        mutableToken.setInputSet(getActiveInputSet(token));
         superExecHandler.execute(token);
         processOutputSet(token);
-        postProcessInputSet(token);
       }
       
       @Override
@@ -291,8 +286,8 @@
     ExecutionContext exContext = token.getExecutionContext();
 
     // Add the outputSet properties to the Token
-    OutputSet outputSet = token.getOutputSet();
-    for (String propName : getActiveOutputSet().getPropertyNames())
+    OutputSet outputSet = getActiveOutputSet();
+    for (String propName : outputSet.getPropertyNames())
     {
       Property outProp = outputSet.getProperty(propName);
       if (outProp == null)
@@ -304,20 +299,6 @@
     }
   }
 
-  /**
-   * Remove the inputSet properties
-   */
-  protected void postProcessInputSet(Token token)
-  {
-    // InputSet inputSet = token.getInputSet();
-    // ExecutionContext exContext = token.getExecutionContext();
-    // for (Property prop : inputSet.getProperties())
-    // {
-    // // TODO: define proper scope for token data
-    // exContext.removeAttachment(prop.getName());
-    // }
-  }
-
   @Override
   protected SignalHandler getDefaultSignalHandler()
   {

Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/DelegatingToken.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/DelegatingToken.java	2008-10-30 19:10:02 UTC (rev 2688)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/DelegatingToken.java	2008-10-30 20:37:18 UTC (rev 2689)
@@ -23,9 +23,7 @@
 
 //$Id$
 
-import org.jbpm.api.model.InputSet;
 import org.jbpm.api.model.Node;
-import org.jbpm.api.model.OutputSet;
 import org.jbpm.api.model.SequenceFlow;
 import org.jbpm.api.runtime.ExecutionContext;
 import org.jbpm.api.runtime.Token;
@@ -50,66 +48,54 @@
     this.delegateContext = new DelegatingExecutionContext(targetRef, exContext);
   }
 
+  @Override
   public ExecutionContext getExecutionContext()
   {
     return delegateContext;
   }
 
+  @Override
   public Token copyToken()
   {
     return delegateToken.copyToken();
   }
 
+  @Override
   public SequenceFlow getFlow()
   {
     return delegateToken.getFlow();
   }
 
+  @Override
   public String getTokenID()
   {
     return delegateToken.getTokenID();
   }
 
-  public InputSet getInputSet()
-  {
-    return delegateToken.getInputSet();
-  }
-
-  public OutputSet getOutputSet()
-  {
-    return delegateToken.getOutputSet();
-  }
-
+  @Override
   public TokenStatus getTokenStatus()
   {
     return delegateToken.getTokenStatus();
   }
 
+  @Override
   public void mergeToken(Token token)
   {
     delegateToken.mergeToken(token);
   }
 
+  @Override
   public void setFlow(SequenceFlow flow)
   {
     delegateToken.setFlow(flow);
   }
 
+  @Override
   public void setTokenStatus(TokenStatus status)
   {
     delegateToken.setTokenStatus(status);
   }
 
-  public void setInputSet(InputSet inputSet)
-  {
-    delegateToken.setInputSet(inputSet);
-  }
-
-  public void setOutputSet(OutputSet outputSet)
-  {
-    delegateToken.setOutputSet(outputSet);
-  }
-
   public String toString()
   {
     Node node = getFlow().getTargetRef();

Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/MutableToken.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/MutableToken.java	2008-10-30 19:10:02 UTC (rev 2688)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/MutableToken.java	2008-10-30 20:37:18 UTC (rev 2689)
@@ -23,8 +23,6 @@
 
 //$Id$
 
-import org.jbpm.api.model.InputSet;
-import org.jbpm.api.model.OutputSet;
 import org.jbpm.api.model.SequenceFlow;
 import org.jbpm.api.runtime.Token;
 
@@ -40,7 +38,14 @@
 
   void setFlow(SequenceFlow flow);
 
-  void setOutputSet(OutputSet activeOutputSet);
+  /**
+   * Create a schallow copy of this Token. 
+   * The content in the ExecutionContext will be copied by reference.
+   */
+  Token copyToken();
 
-  void setInputSet(InputSet activeInputSet);
+  /**
+   * Merge this Token with another token.
+   */
+  void mergeToken(Token token);
 }
\ No newline at end of file

Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenImpl.java	2008-10-30 19:10:02 UTC (rev 2688)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenImpl.java	2008-10-30 20:37:18 UTC (rev 2689)
@@ -24,8 +24,6 @@
 //$Id$
 
 import org.jboss.util.id.UID;
-import org.jbpm.api.model.InputSet;
-import org.jbpm.api.model.OutputSet;
 import org.jbpm.api.model.SequenceFlow;
 import org.jbpm.api.runtime.Attachments;
 import org.jbpm.api.runtime.BasicExecutionContext;
@@ -50,8 +48,6 @@
   private String id;
   private SequenceFlow flow;
   private ExecutionContext context;
-  private InputSet inputSet;
-  private OutputSet outputSet;
   private TokenStatus status;
 
   /**
@@ -69,28 +65,6 @@
     return id;
   }
 
-  @Override
-  public InputSet getInputSet()
-  {
-    return inputSet;
-  }
-
-  public void setInputSet(InputSet inputSet)
-  {
-    this.inputSet = inputSet;
-  }
-
-  @Override
-  public OutputSet getOutputSet()
-  {
-    return outputSet;
-  }
-
-  public void setOutputSet(OutputSet outputSet)
-  {
-    this.outputSet = outputSet;
-  }
-
   public TokenStatus getTokenStatus()
   {
     return status;




More information about the jbpm-commits mailing list