[jbpm-commits] JBoss JBPM SVN: r1657 - in api/trunk/modules: ri and 10 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Jul 17 02:22:13 EDT 2008


Author: thomas.diesler at jboss.com
Date: 2008-07-17 02:22:12 -0400 (Thu, 17 Jul 2008)
New Revision: 1657

Added:
   api/trunk/modules/ri/
   api/trunk/modules/ri/pom.xml
   api/trunk/modules/ri/scripts/
   api/trunk/modules/ri/src/
   api/trunk/modules/ri/src/main/
   api/trunk/modules/ri/src/main/java/
   api/trunk/modules/ri/src/main/java/org/
   api/trunk/modules/ri/src/main/java/org/jboss/
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/client/
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ExecutionManagerImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ProcessEngineImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/SignalManagerImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ActivityImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ComplexGatewayImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/EndEventImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/EventImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ExclusiveGatewayImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ExecutionHandlerImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowHandlerImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowObjectImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowSchedulerImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GatewayImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/HandlerImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/HandlerSetterSupport.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/InclusiveGatewayImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/IntermediateEventImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MessageFlowImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MultipleInFlowSetterSupport.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MultipleOutFlowSetterSupport.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ParallelGatewayImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderFactoryImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/RuntimeProcessImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SequenceFlowImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SignalHandlerImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SingleInFlowSetterSupport.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SingleOutFlowSetterSupport.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/StartEventImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SubProcessImpl.java
   api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/TaskImpl.java
   api/trunk/modules/ri/src/main/resources/
Log:
Add modules impl

Added: api/trunk/modules/ri/pom.xml
===================================================================
--- api/trunk/modules/ri/pom.xml	                        (rev 0)
+++ api/trunk/modules/ri/pom.xml	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ====================================================================== -->
+<!--                                                                        -->
+<!--  JBoss, the OpenSource J2EE webOS                                      -->
+<!--                                                                        -->
+<!--  Distributable under LGPL license.                                     -->
+<!--  See terms of license at http://www.gnu.org.                           -->
+<!--                                                                        -->
+<!-- ====================================================================== -->
+
+<!-- $Id$ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <name>JBoss jBPM - API Impl</name>
+  <groupId>org.jboss.jbpm</groupId>
+  <artifactId>jbpm-api-impl</artifactId>
+  <packaging>jar</packaging>
+
+  <!-- Parent -->
+  <parent>
+    <groupId>org.jboss.jbpm</groupId>
+    <artifactId>jbpm-api-root</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <relativePath>../../pom.xml</relativePath>
+  </parent>
+
+  <!-- Dependencies -->
+  <dependencies>
+    <dependency>
+      <groupId>org.jboss.jbpm</groupId>
+      <artifactId>jbpm-api</artifactId>
+      <version>${version}</version>
+      <scope>compile</scope>
+    </dependency>
+  </dependencies>
+  
+</project>
\ No newline at end of file


Property changes on: api/trunk/modules/ri/pom.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ExecutionManagerImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ExecutionManagerImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ExecutionManagerImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,187 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.client.internal;
+
+// $Id$
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.bpm.NotImplementedException;
+import org.jboss.bpm.client.ExecutionManager;
+import org.jboss.bpm.client.ProcessEngine;
+import org.jboss.bpm.model.EndEvent;
+import org.jboss.bpm.model.Flow;
+import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.Result;
+import org.jboss.bpm.model.Signal;
+import org.jboss.bpm.model.StartEvent;
+import org.jboss.bpm.model.internal.SequenceFlowImpl;
+import org.jboss.bpm.runtime.Attachments;
+import org.jboss.bpm.runtime.ExecutionHandler;
+import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.MutableFlowScheduler;
+import org.jboss.bpm.runtime.RuntimeProcess;
+import org.jboss.bpm.runtime.SignalHandler;
+import org.jboss.bpm.runtime.Token;
+import org.jboss.bpm.runtime.FlowScheduler.Tuple;
+
+/**
+ * The process manager is the entry point to create, find and otherwise manage processes.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public class ExecutionManagerImpl extends ExecutionManager
+{
+  // provide logging
+  private static final Log log = LogFactory.getLog(ExecutionManager.class);
+
+  public void setProcessEngine(ProcessEngine engine)
+  {
+    this.engine = engine;
+  }
+
+  @Override
+  public Future<Result> startProcess(RuntimeProcess rtProc, Attachments att)
+  {
+    Process proc = rtProc.getProcess();
+    throwSignal(new Signal(proc, Signal.Type.ENTER_PROCESS));
+    MutableFlowScheduler flowScheduler = rtProc.getFlowScheduler();
+    try
+    {
+      Token initalToken = new Token(proc, att);
+      StartEvent start = proc.getStartEvent();
+      Tuple tuple = new Tuple(new InitialFlow(start), initalToken);
+      flowScheduler.scheduleTuple(tuple);
+
+      while (flowScheduler.peekHeadTuple() != null)
+      {
+        // Peek the head flow
+        tuple = flowScheduler.peekHeadTuple();
+        Flow flow = tuple.getFlow();
+        Token token = tuple.getToken();
+
+        // Get the target and its handlers
+        FlowObject target = flow.getTarget();
+        ExecutionHandler exHandler = getExecutionHandler(target);
+        SignalHandler sigHandler = getSignalHandler(target);
+        FlowHandler flowHandler = getFlowHandler(target);
+
+        // Execute the FlowObject's ExecutionHandler
+        try
+        {
+          throwSignal(sigHandler.getEnterSignal());
+          exHandler.execute(token);
+        }
+        finally
+        {
+          throwSignal(sigHandler.getExitSignal());
+        }
+
+        // Remove the head tuple
+        flowScheduler.removeHeadTuple();
+        
+        // Transfer the token to the FlowHandler
+        flowHandler.execute(flowScheduler, token);
+      }
+    }
+    finally
+    {
+      throwSignal(new Signal(proc, Signal.Type.EXIT_PROCESS));
+    }
+    return new ResultFuture(proc);
+  }
+
+  /** 
+   * The initial flow 'to' the StartEvent
+   */
+  class InitialFlow extends SequenceFlowImpl
+  {
+    InitialFlow(StartEvent start)
+    {
+      super("start");
+      setTarget(start);
+    }
+  }
+  
+  /**
+   * A basic implementation of a Future 
+   */
+  class ResultFuture implements Future<Result>
+  {
+    private Result result;
+    private Process proc;
+
+    public ResultFuture(Process proc)
+    {
+      this.proc = proc;
+    }
+
+    public boolean cancel(boolean mayInterruptIfRunning)
+    {
+      throw new NotImplementedException();
+    }
+
+    public Result get() throws InterruptedException, ExecutionException
+    {
+      return getResult();
+    }
+
+    public Result get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
+    {
+      throw new NotImplementedException();
+    }
+
+    public boolean isCancelled()
+    {
+      return false;
+    }
+
+    public boolean isDone()
+    {
+      boolean isDone = getResult() != null;
+      return isDone;
+    }
+
+    private Result getResult()
+    {
+      if (result == null)
+      {
+        for (EndEvent aux : proc.getEndEvents())
+        {
+          result = aux.getResult();
+          if (result != null)
+          {
+            break;
+          }
+        }
+      }
+      return result;
+    }
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ExecutionManagerImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ProcessEngineImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ProcessEngineImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ProcessEngineImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.client.internal;
+
+//$Id$
+
+import org.jboss.bpm.client.ExecutionManager;
+import org.jboss.bpm.client.ProcessEngine;
+import org.jboss.bpm.client.ProcessManager;
+import org.jboss.bpm.client.SignalManager;
+
+/**
+ * A process engine with public access
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public class ProcessEngineImpl extends ProcessEngine
+{
+  public void setProcessManager(ProcessManager processManager)
+  {
+    this.processManager = processManager;
+  }
+
+  public void setExecutionManager(ExecutionManager executionManager)
+  {
+    this.executionManager = executionManager;
+  }
+
+  public void setSignalManager(SignalManager signalManager)
+  {
+    this.signalManager = signalManager;
+  }
+}


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ProcessEngineImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/SignalManagerImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/SignalManagerImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/SignalManagerImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.client.internal;
+
+// $Id$
+
+import org.jboss.bpm.client.ProcessEngine;
+import org.jboss.bpm.client.SignalManager;
+import org.jboss.bpm.model.Signal;
+
+/**
+ * An implementation of a signal manager
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public class SignalManagerImpl extends SignalManager
+{
+  public void setProcessEngine(ProcessEngine engine)
+  {
+    this.engine = engine;
+  }
+
+  @Override
+  public void throwSignal(Signal signal)
+  {
+    super.throwSignal(signal);
+  }
+}


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/SignalManagerImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ActivityImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ActivityImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ActivityImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import org.jboss.bpm.model.Activity;
+
+/**
+ * An activity is a generic term for work that a company or organization performs via business processes. 
+ * An activity can be atomic or non-atomic (compound). 
+ * The types of activities that are a part of a Process Model are: Process, Sub-Process, and Task. 
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public abstract class ActivityImpl extends FlowObjectImpl implements Activity
+{
+  private String name;
+  
+  public ActivityImpl(String name)
+  {
+    this.name = name;
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+  
+  public void setName(String name)
+  {
+    this.name = name;
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ActivityImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ComplexGatewayImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ComplexGatewayImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ComplexGatewayImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import org.jboss.bpm.model.ComplexGateway;
+
+/**
+ * A Complex Gateway handles situations that are not easily handled through the other types of Gateways. Complex Gateways can also be used to combine a set of linked
+ * simple Gateways into a single, more compact situation. Modelers can provide complex expressions that determine the merging and/or splitting behavior of the Gateway.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class ComplexGatewayImpl extends GatewayImpl implements ComplexGateway
+{
+  public ComplexGatewayImpl(String name)
+  {
+    super(name);
+  }
+
+  public String toString()
+  {
+    return "ComplexGateway[" + getName() + "]";
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ComplexGatewayImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/EndEventImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/EndEventImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/EndEventImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,151 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.bpm.model.EndEvent;
+import org.jboss.bpm.model.Flow;
+import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.Result;
+import org.jboss.bpm.model.Signal;
+import org.jboss.bpm.runtime.Attachments;
+import org.jboss.bpm.runtime.ExecutionHandler;
+import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.FlowScheduler;
+import org.jboss.bpm.runtime.SignalHandler;
+import org.jboss.bpm.runtime.Token;
+
+/**
+ * As the name implies, the End Event indicates where a Process will end.
+ * 
+ * In terms of Sequence Flow, the End Event ends the flow of the Process, and thus, will not have any outgoing Sequence Flow. An End Event can have a specific Result
+ * that will appear as a marker within the center of the End Event shape. End Event Results are Message, Error, Compensation, Link, and Multiple.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class EndEventImpl extends EventImpl implements EndEvent, SingleInFlowSetterSupport
+{
+  // provide logging
+  private static final Log log = LogFactory.getLog(EndEventImpl.class);
+
+  private String name;
+  private Result result;
+  private Flow inFlow;
+
+  public EndEventImpl(String name)
+  {
+    this.name = name;
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public Flow getInFlow()
+  {
+    return inFlow;
+  }
+
+  /**
+   * Set the in flow
+   */
+  public void setInFlow(Flow inFlow)
+  {
+    this.inFlow = inFlow;
+  }
+
+  public Result getResult()
+  {
+    return result;
+  }
+
+  public ExecutionHandler getExecutionHandler()
+  {
+    ExecutionHandler handler = super.getExecutionHandler();
+    if (handler == null)
+    {
+      handler = new ExecutionHandler()
+      {
+        public void execute(final Token token)
+        {
+          // Provide the result
+          result = new Result()
+          {
+            public Attachments getAttachments()
+            {
+              return token.getExecutionContext();
+            }
+          };
+        }
+      };
+    }
+    return handler;
+  }
+
+  public FlowHandler getFlowHandler()
+  {
+    FlowHandler handler = super.getFlowHandler();
+    if (handler == null)
+    {
+      handler = new FlowHandler()
+      {
+        public void execute(FlowScheduler scheduler, Token token)
+        {
+          log.debug("End reached in: " + getName());
+        }
+      };
+    }
+    return handler;
+  }
+
+  public SignalHandler getSignalHandler()
+  {
+    SignalHandler handler = super.getSignalHandler();
+    if (handler == null)
+    {
+      final FlowObject end = this;
+      handler = new SignalHandler()
+      {
+        public Signal getEnterSignal()
+        {
+          return new Signal(end, Signal.Type.ENTER_END_EVENT);
+        }
+
+        public Signal getExitSignal()
+        {
+          return new Signal(end, Signal.Type.EXIT_END_EVENT);
+        }
+      };
+    }
+    return handler;
+  }
+
+  public String toString()
+  {
+    return "EndEvent[" + getName() + "]";
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/EndEventImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/EventImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/EventImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/EventImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+import org.jboss.bpm.model.Event;
+import org.jboss.bpm.runtime.ExecutionHandler;
+import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.SignalHandler;
+
+//$Id$
+
+/**
+ * An Event is something that “happens” during the course of a business process. 
+ * <p/>
+ * These Events affect the flow of the Process and usually have a cause or an impact.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public abstract class EventImpl extends FlowObjectImpl implements Event, HandlerSetterSupport
+{
+  private ExecutionHandler executionHandler;
+  private FlowHandler flowHandler;
+  private SignalHandler signalHandler;
+  
+  public ExecutionHandler getExecutionHandler()
+  {
+    return executionHandler;
+  }
+
+  public void setExecutionHandler(ExecutionHandler executionHandler)
+  {
+    this.executionHandler = executionHandler;
+  }
+
+  public FlowHandler getFlowHandler()
+  {
+    return flowHandler;
+  }
+
+  public void setFlowHandler(FlowHandler flowHandler)
+  {
+    this.flowHandler = flowHandler;
+  }
+
+  public SignalHandler getSignalHandler()
+  {
+    return signalHandler;
+  }
+
+  public void setSignalHandler(SignalHandler signalHandler)
+  {
+    this.signalHandler = signalHandler;
+  }
+
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/EventImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ExclusiveGatewayImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ExclusiveGatewayImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ExclusiveGatewayImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import org.jboss.bpm.model.ExclusiveGateway;
+
+/**
+ * A point in the workflow process where, based on a decision or workflow control data, one of several branches is chosen. 
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class ExclusiveGatewayImpl extends GatewayImpl implements ExclusiveGateway
+{
+  public ExclusiveGatewayImpl(String name)
+  {
+    super(name);
+  }
+
+  public String toString()
+  {
+    return "ExclusiveGateway[" + getName() + "]";
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ExclusiveGatewayImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ExecutionHandlerImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ExecutionHandlerImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ExecutionHandlerImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import org.jboss.bpm.runtime.ExecutionHandler;
+import org.jboss.bpm.runtime.Token;
+
+/**
+ * Implement to make the FlowObject executable
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class ExecutionHandlerImpl extends HandlerImpl implements ExecutionHandler
+{
+  private ExecutionHandler handler;
+
+  /**
+   * Execute this flow object
+   */
+  public void execute(Token token)
+  {
+    if (handler == null)
+    {
+      handler = newInstance(ExecutionHandler.class);
+    }
+    handler.execute(token);
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ExecutionHandlerImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowHandlerImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowHandlerImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowHandlerImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.FlowScheduler;
+import org.jboss.bpm.runtime.Token;
+
+/**
+ * Implement to handle the outgoing Flows for an FlowObject
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class FlowHandlerImpl extends HandlerImpl implements FlowHandler
+{
+  private FlowHandler handler;
+
+  public void execute(FlowScheduler scheduler, Token token)
+  {
+    if (handler == null)
+    {
+      handler = newInstance(FlowHandler.class);
+    }
+    handler.execute(scheduler, token);
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowHandlerImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import org.jboss.bpm.model.Flow;
+import org.jboss.bpm.model.FlowObject;
+
+/**
+ * A Flow is a graphical line connecting two objects in a BPD. There are two types of Flow: Sequence Flow and Message Flow, each with their own line style. Flow is also
+ * used in a generic sense (and lowercase) to describe how Tokens will traverse Sequence Flow from the Start Event to an End Event.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public abstract class FlowImpl implements Flow
+{
+  private String name;
+  private String targetName;
+  private FlowObject source;
+  private FlowObject target;
+
+  public FlowImpl(String targetName)
+  {
+    this.targetName = targetName;
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public void setName(String name)
+  {
+    this.name = name;
+  }
+
+  public String getTargetName()
+  {
+    return targetName;
+  }
+
+  public FlowObject getSource()
+  {
+    return source;
+  }
+
+  public void setSource(FlowObject source)
+  {
+    this.source = source;
+  }
+
+  public FlowObject getTarget()
+  {
+    return target;
+  }
+
+  public void setTarget(FlowObject target)
+  {
+    this.target = target;
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowObjectImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowObjectImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowObjectImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,149 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+import org.jboss.bpm.InvalidProcessException;
+import org.jboss.bpm.NameNotUniqueException;
+import org.jboss.bpm.model.Flow;
+import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.MultipleInFlowSupport;
+import org.jboss.bpm.model.MultipleOutFlowSupport;
+import org.jboss.bpm.model.NamedFlowObject;
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.SingleInFlowSupport;
+import org.jboss.bpm.model.SingleOutFlowSupport;
+
+//$Id$
+
+/**
+ * A Flow Object is one of the set of following graphical objects: Event, Activity, and Gateway.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public abstract class FlowObjectImpl implements FlowObject
+{
+  private Process process;
+
+  
+  public Process getProcess()
+  {
+    return process;
+  }
+
+  public void setProcess(Process process)
+  {
+    this.process = process;
+  }
+
+  /**
+   * Initialize the flow object
+   */
+  protected void initialize(ProcessImpl proc)
+  {
+    setProcess(proc);
+
+    if (this instanceof NamedFlowObject)
+    {
+      // Check required name
+      String name = ((NamedFlowObject)this).getName();
+      if (name == null)
+        throw new InvalidProcessException("Name is required for: " + this);
+
+      // Check name uniqueness
+      for (FlowObject aux : proc.getFlowObjects())
+      {
+        if (aux != this && aux instanceof NamedFlowObject)
+        {
+          String auxName = ((NamedFlowObject)aux).getName();
+          if (name.equals(auxName))
+            throw new NameNotUniqueException("NamedFlowObject: " + this);
+        }
+      }
+    }
+
+    // Initialize in/out flows
+    Flow outFlow = null;
+    if (this instanceof SingleOutFlowSupport)
+    {
+      SingleOutFlowSupport sof = (SingleOutFlowSupport)this;
+      outFlow = sof.getOutFlow();
+      initFlow(proc, (FlowImpl)outFlow);
+    }
+    else if (this instanceof MultipleOutFlowSupport)
+    {
+      MultipleOutFlowSupport mof = (MultipleOutFlowSupport)this;
+      for (Flow flow : mof.getOutFlows())
+      {
+        outFlow = flow;
+        initFlow(proc, (FlowImpl)flow);
+      }
+    }
+
+    Flow inFlow = null;
+    if (this instanceof SingleInFlowSupport)
+    {
+      SingleInFlowSupport sif = (SingleInFlowSupport)this;
+      inFlow = sif.getInFlow();
+    }
+    else if (this instanceof MultipleInFlowSupport)
+    {
+      MultipleInFlowSupport mif = (MultipleInFlowSupport)this;
+      for (Flow flow : mif.getInFlows())
+      {
+        inFlow = flow;
+      }
+    }
+
+    if (inFlow == null && outFlow == null)
+      throw new InvalidProcessException("Unconnected flow object: " + this);
+  }
+
+  private void initFlow(Process proc, FlowImpl flow)
+  {
+    if (flow != null)
+    {
+      String name = flow.getTargetName();
+      FlowObject target = proc.findFlowObject(name);
+      if (target == null)
+        throw new InvalidProcessException("Cannot find target for out flow: " + name);
+
+      if (target instanceof SingleInFlowSetterSupport)
+      {
+        SingleInFlowSetterSupport sif = (SingleInFlowSetterSupport)target;
+        sif.setInFlow(flow);
+      }
+      else if (target instanceof MultipleInFlowSetterSupport)
+      {
+        MultipleInFlowSetterSupport mif = (MultipleInFlowSetterSupport)target;
+        mif.addInFlow(flow);
+      }
+      else
+      {
+        throw new InvalidProcessException("Target does not support in flow: " + target);
+      }
+
+      flow.setSource(this);
+      flow.setTarget(target);
+    }
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowObjectImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowSchedulerImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowSchedulerImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowSchedulerImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+import org.jboss.bpm.model.Flow;
+import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.MutableFlowScheduler;
+import org.jboss.bpm.runtime.Token;
+
+/**
+ * The {@link FlowHandler} invokes the FlowScheduler to schedule 
+ * {@link Flow} objects together with their associated {@link Token}.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class FlowSchedulerImpl implements MutableFlowScheduler
+{
+  private Queue<Tuple> flowQueue = new ConcurrentLinkedQueue<Tuple>();
+
+  public void scheduleTuple(Tuple tuple)
+  {
+    flowQueue.add(tuple); 
+  }
+  
+  public Tuple peekHeadTuple()
+  {
+   return flowQueue.peek();
+  }
+  
+  public Tuple removeHeadTuple()
+  {
+   return flowQueue.remove();
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowSchedulerImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GatewayImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GatewayImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GatewayImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,161 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.bpm.model.Flow;
+import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.Gateway;
+import org.jboss.bpm.model.Signal;
+import org.jboss.bpm.runtime.ExecutionHandler;
+import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.FlowScheduler;
+import org.jboss.bpm.runtime.SignalHandler;
+import org.jboss.bpm.runtime.Token;
+import org.jboss.bpm.runtime.FlowScheduler.Tuple;
+
+/**
+ * Gateways are modelling elements that are used to control how Sequence Flow interact as they converge and diverge within a Process. If the flow does not need to be
+ * controlled, then a Gateway is not needed.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class GatewayImpl extends FlowObjectImpl implements Gateway, HandlerSetterSupport, MultipleInFlowSetterSupport, MultipleOutFlowSetterSupport
+{
+  // provide logging
+  private static final Log log = LogFactory.getLog(GatewayImpl.class);
+
+  private String name;
+  protected List<Flow> inFlows = new ArrayList<Flow>();
+  protected List<Flow> outFlows = new ArrayList<Flow>();
+  private ExecutionHandler executionHandler;
+  private FlowHandler flowHandler;
+  private SignalHandler signalHandler;
+
+  public GatewayImpl(String name)
+  {
+    this.name = name;
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public List<Flow> getOutFlows()
+  {
+    return Collections.unmodifiableList(outFlows);
+  }
+
+  public void addOutFlow(Flow flow)
+  {
+    outFlows.add(flow);
+  }
+
+  public List<Flow> getInFlows()
+  {
+    return Collections.unmodifiableList(inFlows);
+  }
+
+  public void addInFlow(Flow inFlow)
+  {
+    this.inFlows.add(inFlow);
+  }
+
+  public ExecutionHandler getExecutionHandler()
+  {
+    ExecutionHandler handler = executionHandler;
+    if (handler == null)
+    {
+      handler = new ExecutionHandler()
+      {
+        public void execute(Token token)
+        {
+          log.debug("Nothing to do in gateway: " + getName());
+        }
+      };
+    }
+    return handler;
+  }
+
+  public void setExecutionHandler(ExecutionHandler executionHandler)
+  {
+    this.executionHandler = executionHandler;
+  }
+
+  public FlowHandler getFlowHandler()
+  {
+    FlowHandler handler = flowHandler;
+    if (handler == null && outFlows.size() == 1)
+    {
+      handler = new FlowHandler()
+      {
+        public void execute(FlowScheduler scheduler, Token token)
+        {
+          Tuple tuple = new Tuple(outFlows.get(0), token);
+          scheduler.scheduleTuple(tuple);
+        }
+      };
+    }
+    return handler;
+  }
+
+  public void setFlowHandler(FlowHandler flowHandler)
+  {
+    this.flowHandler = flowHandler;
+  }
+
+  public SignalHandler getSignalHandler()
+  {
+    SignalHandler handler = signalHandler;
+    if (handler == null)
+    {
+      final FlowObject gateway = this;
+      handler = new SignalHandler()
+      {
+        public Signal getEnterSignal()
+        {
+          return new Signal(gateway, Signal.Type.ENTER_GATEWAY);
+        }
+
+        public Signal getExitSignal()
+        {
+          return new Signal(gateway, Signal.Type.EXIT_GATEWAY);
+        }
+      };
+    }
+    return handler;
+  }
+
+  public void setSignalHandler(SignalHandler signalHandler)
+  {
+    this.signalHandler = signalHandler;
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GatewayImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/HandlerImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/HandlerImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/HandlerImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import org.jboss.bpm.NotImplementedException;
+import org.jboss.bpm.runtime.Handler;
+
+/**
+ * Implement to handle the outgoing Flows for an FlowObject
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public abstract class HandlerImpl implements Handler
+{
+  private String className;
+  private String beanRef;
+  
+  public String getClassName()
+  {
+    return className;
+  }
+
+  public void setClassName(String className)
+  {
+    this.className = className;
+  }
+
+  public String getBeanRef()
+  {
+    return beanRef;
+  }
+
+  public void setBeanRef(String beanRef)
+  {
+    this.beanRef = beanRef;
+  }
+
+  @SuppressWarnings("unchecked")
+  protected <T> T newInstance(Class<T> clazz)
+  {
+    try
+    {
+      if (className != null)
+      {
+        ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+        return (T)ctxLoader.loadClass(className).newInstance();
+      }
+      else if (beanRef != null)
+      {
+        throw new NotImplementedException();
+      }
+      else
+      {
+        throw new IllegalStateException("There is no 'class' nor 'bean' attribute set for this handler");
+      }
+    }
+    catch (Exception ex)
+    {
+      throw new IllegalStateException("Cannot instanciate the handler", ex);
+    }
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/HandlerImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/HandlerSetterSupport.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/HandlerSetterSupport.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/HandlerSetterSupport.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+import org.jboss.bpm.runtime.ExecutionHandler;
+import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.HandlerSupport;
+import org.jboss.bpm.runtime.SignalHandler;
+
+
+//$Id$
+
+/**
+ * A combined interface for execution aspects
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface HandlerSetterSupport extends HandlerSupport
+{
+  /** Set the associated ExecutionHandler */ 
+  void setExecutionHandler(ExecutionHandler handler);
+  
+  /** Set the associated SignalHandler */ 
+  void setSignalHandler(SignalHandler handler);
+  
+  /** Set the associated FlowHandler */ 
+  void setFlowHandler(FlowHandler handler);
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/HandlerSetterSupport.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/InclusiveGatewayImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/InclusiveGatewayImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/InclusiveGatewayImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import org.jboss.bpm.model.InclusiveGateway;
+
+
+
+/**
+ * This Decision represents a branching point where Alternatives are based on conditional expressions contained within outgoing Sequence Flow. 
+ * However, in this case, the True evaluation of one condition expression does not exclude the evaluation of other condition expressions. 
+ * All Sequence Flow with a True evaluation will be traversed by a Token. 
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class InclusiveGatewayImpl extends GatewayImpl implements InclusiveGateway
+{
+  public InclusiveGatewayImpl(String name)
+  {
+    super(name);
+  }
+
+  public String toString()
+  {
+    return "InclusiveGateway[" + getName() + "]";
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/InclusiveGatewayImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/IntermediateEventImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/IntermediateEventImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/IntermediateEventImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,145 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.bpm.model.Event;
+import org.jboss.bpm.model.Flow;
+import org.jboss.bpm.model.IntermediateEvent;
+import org.jboss.bpm.model.Signal;
+import org.jboss.bpm.runtime.ExecutionHandler;
+import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.FlowScheduler;
+import org.jboss.bpm.runtime.SignalHandler;
+import org.jboss.bpm.runtime.Token;
+import org.jboss.bpm.runtime.FlowScheduler.Tuple;
+
+/**
+ * An Intermediate Event is an Event that occurs after a Process has been started. It will affect the Flow of the Process, but will not start or (directly) terminate
+ * the Process. An Intermediate Event will show where messages or delays are expected within the Process, disrupt the Normal Flow through exception handling, or show
+ * the extra flow required for compensating a transaction.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class IntermediateEventImpl extends EventImpl implements IntermediateEvent, SingleInFlowSetterSupport, SingleOutFlowSetterSupport
+{
+  // provide logging
+  private static final Log log = LogFactory.getLog(IntermediateEventImpl.class);
+
+  private String name;
+  private Flow inFlow;
+  private Flow outFlow;
+
+  public IntermediateEventImpl(String name)
+  {
+    this.name = name;
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public Flow getInFlow()
+  {
+    return inFlow;
+  }
+
+  public void setInFlow(Flow inFlow)
+  {
+    this.inFlow = inFlow;
+  }
+
+  public Flow getOutFlow()
+  {
+    return outFlow;
+  }
+
+  public void setOutFlow(Flow flow)
+  {
+    this.outFlow = flow;
+  }
+
+  public ExecutionHandler getExecutionHandler()
+  {
+    ExecutionHandler handler = super.getExecutionHandler();
+    if (handler == null)
+    {
+      handler = new ExecutionHandler()
+      {
+        public void execute(Token token)
+        {
+          log.debug("Nothing to do in event");
+        }
+      };
+    }
+    return handler;
+  }
+
+  public FlowHandler getFlowHandler()
+  {
+    FlowHandler handler = super.getFlowHandler();
+    if (handler == null)
+    {
+      handler = new FlowHandler()
+      {
+        public void execute(FlowScheduler scheduler, Token token)
+        {
+          Tuple tuple = new Tuple(getOutFlow(), token);
+          scheduler.scheduleTuple(tuple);
+        }
+      };
+    }
+    return handler;
+  }
+
+  public SignalHandler getSignalHandler()
+  {
+    SignalHandler handler = super.getSignalHandler();
+    if (handler == null)
+    {
+      final Event event = this;
+      handler = new SignalHandler()
+      {
+        public Signal getEnterSignal()
+        {
+          return new Signal(event, Signal.Type.ENTER_EVENT);
+        }
+
+        public Signal getExitSignal()
+        {
+          return new Signal(event, Signal.Type.EXIT_EVENT);
+        }
+      };
+    }
+    return handler;
+  }
+
+  public String toString()
+  {
+    return "ItermediateEvent[" + getName() + "]";
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/IntermediateEventImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MessageFlowImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MessageFlowImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MessageFlowImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import org.jboss.bpm.model.MessageFlow;
+
+/**
+ * A Message Flow is a dashed line that is used to show the flow of messages between two entities that are prepared to send and receive them. 
+ * In BPMN, two separate Pools in the Diagram will represent the two entities. 
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class MessageFlowImpl extends FlowImpl implements MessageFlow
+{
+
+  public MessageFlowImpl(String targetName)
+  {
+    super(targetName);
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MessageFlowImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MultipleInFlowSetterSupport.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MultipleInFlowSetterSupport.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MultipleInFlowSetterSupport.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+import org.jboss.bpm.model.Flow;
+import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.MultipleInFlowSupport;
+
+
+//$Id$
+
+/**
+ * Implementing {@link FlowObject} support multiple incomming {@link Flow}.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface MultipleInFlowSetterSupport extends MultipleInFlowSupport
+{
+  /**
+   * Add an incomming Flow
+   */
+  void addInFlow(Flow flow);
+}


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MultipleInFlowSetterSupport.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MultipleOutFlowSetterSupport.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MultipleOutFlowSetterSupport.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MultipleOutFlowSetterSupport.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+import org.jboss.bpm.model.Flow;
+import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.MultipleOutFlowSupport;
+
+//$Id$
+
+/**
+ * Implementing {@link FlowObject} support multiple outgoing {@link Flow}.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface MultipleOutFlowSetterSupport extends MultipleOutFlowSupport
+{
+  /**
+   * Add an outgoing Flow
+   */
+  void addOutFlow(Flow flow);
+
+}


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MultipleOutFlowSetterSupport.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ParallelGatewayImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ParallelGatewayImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ParallelGatewayImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import org.jboss.bpm.model.Flow;
+import org.jboss.bpm.model.ParallelGateway;
+import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.FlowScheduler;
+import org.jboss.bpm.runtime.Token;
+import org.jboss.bpm.runtime.FlowScheduler.Tuple;
+
+
+/**
+ * Parallel Gateway is required when two or more Activities need to be executed in parallel.  
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class ParallelGatewayImpl extends GatewayImpl implements ParallelGateway
+{
+  public ParallelGatewayImpl(String name)
+  {
+    super(name);
+  }
+
+  /**
+   * The default FlowHandler adds all out flows to the queue
+   */
+  public FlowHandler getFlowHandler()
+  {
+    FlowHandler handler = super.getFlowHandler();
+    if (handler == null)
+    {
+      handler = new FlowHandler()
+      {
+        public void execute(FlowScheduler scheduler, Token token)
+        {
+          for(Flow outFlow : getOutFlows())
+          {
+            Tuple tuple = new Tuple(outFlow, token.createCopy());
+            scheduler.scheduleTuple(tuple);
+          }
+        }
+      };
+    }
+    return handler;
+  }
+
+  public String toString()
+  {
+    return "ParallelGateway[" + getName() + "]";
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ParallelGatewayImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderFactoryImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderFactoryImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderFactoryImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import org.jboss.bpm.model.ComplexGateway;
+import org.jboss.bpm.model.EndEvent;
+import org.jboss.bpm.model.ExclusiveGateway;
+import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.InclusiveGateway;
+import org.jboss.bpm.model.IntermediateEvent;
+import org.jboss.bpm.model.ParallelGateway;
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.ProcessBuilder;
+import org.jboss.bpm.model.ProcessBuilderFactory;
+import org.jboss.bpm.model.StartEvent;
+import org.jboss.bpm.model.SubProcess;
+import org.jboss.bpm.model.Task;
+import org.jboss.bpm.runtime.ExecutionHandler;
+import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.SignalHandler;
+
+/**
+ * The ProcessBuilder can be used to dynamically build {@link Process}es.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class ProcessBuilderFactoryImpl extends ProcessBuilderFactory
+{
+  @Override
+  public ProcessBuilder newProcessBuilder(String procName)
+  {
+    return new ProcessBuilderImpl(procName);
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderFactoryImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,272 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import org.jboss.bpm.model.ComplexGateway;
+import org.jboss.bpm.model.EndEvent;
+import org.jboss.bpm.model.ExclusiveGateway;
+import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.InclusiveGateway;
+import org.jboss.bpm.model.IntermediateEvent;
+import org.jboss.bpm.model.ParallelGateway;
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.ProcessBuilder;
+import org.jboss.bpm.model.StartEvent;
+import org.jboss.bpm.model.SubProcess;
+import org.jboss.bpm.model.Task;
+import org.jboss.bpm.runtime.ExecutionHandler;
+import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.SignalHandler;
+
+/**
+ * The ProcessBuilder can be used to dynamically build a {@link Process}.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class ProcessBuilderImpl implements ProcessBuilder
+{
+  private ProcessImpl proc;
+  private FlowObjectImpl flowObject;
+
+  public ProcessBuilderImpl(String procName)
+  {
+    proc = new ProcessImpl(procName);
+  }
+
+  public Process getProcess()
+  {
+    proc.initialize();
+    return proc;
+  }
+
+  public ProcessBuilder addSubProcess(String name)
+  {
+    flowObject = new SubProcessImpl(name);
+    proc.addFlowObject(flowObject);
+    return this;
+  }
+
+  public ProcessBuilder addSequenceFlow(String name)
+  {
+    if (flowObject instanceof SingleOutFlowSetterSupport)
+    {
+      SingleOutFlowSetterSupport outFlow = (SingleOutFlowSetterSupport)flowObject;
+      outFlow.setOutFlow(new SequenceFlowImpl(name));
+    }
+    else if (flowObject instanceof MultipleOutFlowSetterSupport)
+    {
+      MultipleOutFlowSetterSupport outFlow = (MultipleOutFlowSetterSupport)flowObject;
+      outFlow.addOutFlow(new SequenceFlowImpl(name));
+    }
+    else
+    {
+      throw new IllegalStateException("Cannot add a sequence flow to: " + flowObject);
+    }
+    return this;
+  }
+
+  public ProcessBuilder addMessageFlow(String name)
+  {
+    if (flowObject instanceof SingleOutFlowSetterSupport)
+    {
+      SingleOutFlowSetterSupport outFlow = (SingleOutFlowSetterSupport)flowObject;
+      outFlow.setOutFlow(new MessageFlowImpl(name));
+    }
+    else if (flowObject instanceof MultipleOutFlowSetterSupport)
+    {
+      MultipleOutFlowSetterSupport outFlow = (MultipleOutFlowSetterSupport)flowObject;
+      outFlow.addOutFlow(new MessageFlowImpl(name));
+    }
+    else
+    {
+      throw new IllegalStateException("Cannot add a message flow to: " + flowObject);
+    }
+    return this;
+  }
+
+  public ProcessBuilder addStartEvent()
+  {
+    flowObject = new StartEventImpl();
+    proc.addFlowObject(flowObject);
+    return this;
+  }
+
+  public ProcessBuilder addItermediateEvent(String name)
+  {
+    flowObject = new IntermediateEventImpl(name);
+    proc.addFlowObject(flowObject);
+    return this;
+  }
+
+  public ProcessBuilder addEndEvent(String name)
+  {
+    flowObject = new EndEventImpl(name);
+    proc.addFlowObject(flowObject);
+    return this;
+  }
+
+  public ProcessBuilder addTask(String name)
+  {
+    flowObject = new TaskImpl(name);
+    proc.addFlowObject(flowObject);
+    return this;
+  }
+
+  public ProcessBuilder addExclusiveGateway(String name)
+  {
+    flowObject = new ExclusiveGatewayImpl(name);
+    proc.addFlowObject(flowObject);
+    return this;
+  }
+
+  public ProcessBuilder addInclusiveGateway(String name)
+  {
+    flowObject = new InclusiveGatewayImpl(name);
+    proc.addFlowObject(flowObject);
+    return this;
+  }
+
+  public ProcessBuilder addComplexGateway(String name)
+  {
+    flowObject = new ComplexGatewayImpl(name);
+    proc.addFlowObject(flowObject);
+    return this;
+  }
+
+  public ProcessBuilder addParallelGateway(String name)
+  {
+    flowObject = new ParallelGatewayImpl(name);
+    proc.addFlowObject(flowObject);
+    return this;
+  }
+
+  public ProcessBuilder addExecutionHandler(Class<?> clazz)
+  {
+    return addHandler(clazz);
+  }
+
+  public ProcessBuilder addFlowHandler(Class<?> clazz)
+  {
+    return addHandler(clazz);
+  }
+
+  public ProcessBuilder addSignalHandler(Class<?> clazz)
+  {
+    return addHandler(clazz);
+  }
+
+  private ProcessBuilder addHandler(Class<?> clazz)
+  {
+    if (flowObject instanceof HandlerSetterSupport == false)
+      throw new IllegalStateException("Current flow object does not support handlers: " + flowObject);
+
+    HandlerSetterSupport hs = (HandlerSetterSupport)flowObject;
+    try
+    {
+      Object handler = clazz.newInstance();
+      if (handler instanceof ExecutionHandler)
+        hs.setExecutionHandler((ExecutionHandler)handler);
+      else if (handler instanceof FlowHandler)
+        hs.setFlowHandler((FlowHandler)handler);
+      else if (handler instanceof SignalHandler)
+        hs.setSignalHandler((SignalHandler)handler);
+      else
+        throw new IllegalArgumentException("Given class is not a supported handler");
+    }
+    catch (Exception ex)
+    {
+      throw new IllegalArgumentException("Cannot instanciate handler", ex);
+    }
+    return this;
+  }
+
+  // ============================
+
+  public Process createProcess(String name)
+  {
+    proc = new ProcessImpl(name);
+    return proc;
+  }
+
+  public SubProcess createSubProcess(String name)
+  {
+    flowObject = new SubProcessImpl(name);
+    return (SubProcess)flowObject;
+  }
+
+  public StartEvent createStartEvent()
+  {
+    flowObject =  new StartEventImpl();
+    return (StartEvent)flowObject;
+  }
+
+  public IntermediateEvent createIntermediateEvent(String name)
+  {
+    flowObject =  new IntermediateEventImpl(name);
+    return (IntermediateEvent)flowObject;
+  }
+
+  public EndEvent createEndEvent(String name)
+  {
+    flowObject =  new EndEventImpl(name);
+    return (EndEvent)flowObject;
+  }
+
+  public ExclusiveGateway createExclusiveGateway(String name)
+  {
+    flowObject =  new ExclusiveGatewayImpl(name);
+    return (ExclusiveGateway)flowObject;
+  }
+
+  public InclusiveGateway createInclusiveGateway(String name)
+  {
+    flowObject =  new InclusiveGatewayImpl(name);
+    return (InclusiveGateway)flowObject;
+  }
+
+  public ComplexGateway createComplexGateway(String name)
+  {
+    flowObject =  new ComplexGatewayImpl(name);
+    return (ComplexGateway)flowObject;
+  }
+
+  public ParallelGateway createParallelGateway(String name)
+  {
+    flowObject =  new ParallelGatewayImpl(name);
+    return (ParallelGateway)flowObject;
+  }
+
+  public Task createTask(String name)
+  {
+    flowObject =  new TaskImpl(name);
+    return (Task)flowObject;
+  }
+
+  public FlowObject addFlowObject(FlowObject fo)
+  {
+    proc.addFlowObject(fo);
+    return fo;
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,175 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.Future;
+
+import org.jboss.bpm.InvalidProcessException;
+import org.jboss.bpm.client.ExecutionManager;
+import org.jboss.bpm.client.ProcessManager;
+import org.jboss.bpm.model.EndEvent;
+import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.NamedFlowObject;
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.Result;
+import org.jboss.bpm.model.StartEvent;
+import org.jboss.bpm.runtime.Attachments;
+
+/**
+ * A Process is any Activity performed within a company or organization.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class ProcessImpl extends ActivityImpl implements Process
+{
+  private List<FlowObject> flowObjects = new ArrayList<FlowObject>();
+  private ProcessState processState = ProcessState.CREATED;
+
+  public ProcessImpl(String name)
+  {
+    super(name);
+    setProcess(this);
+  }
+
+  public void addFlowObject(FlowObject flowObject)
+  {
+    flowObjects.add(flowObject);
+  }
+
+  public StartEventImpl getStartEvent()
+  {
+    StartEventImpl start = null;
+    for (FlowObject aux : flowObjects)
+    {
+      if (aux instanceof StartEvent)
+      {
+        start = (StartEventImpl)aux;
+        break;
+      }
+    }
+    return start;
+  }
+
+  public List<EndEvent> getEndEvents()
+  {
+    List<EndEvent> ends = new ArrayList<EndEvent>();
+    for (FlowObject aux : flowObjects)
+    {
+      if (aux instanceof EndEvent)
+      {
+        ends.add((EndEvent)aux);
+      }
+    }
+    return Collections.unmodifiableList(ends);
+  }
+
+  public List<FlowObject> getFlowObjects()
+  {
+
+    if (processState == ProcessState.CREATED)
+      return flowObjects;
+
+    return Collections.unmodifiableList(flowObjects);
+  }
+
+  public Future<Result> startProcess()
+  {
+    return startProcess(null);
+  }
+
+  public Future<Result> startProcess(Attachments att)
+  {
+    if (processState != ProcessState.INITIALIZED)
+      throw new IllegalStateException("Cannot start process in state: " + processState);
+
+    processState = ProcessState.STARTED;
+    ExecutionManager exm = ExecutionManager.locateExecutionManager();
+    return exm.startProcess(new RuntimeProcessImpl(this), att);
+  }
+
+  public FlowObject findFlowObject(String name)
+  {
+    if (name == null)
+      throw new IllegalArgumentException("Cannot find flow object with name: null");
+
+    FlowObject nfo = null;
+    for (FlowObject aux : flowObjects)
+    {
+      if (aux instanceof NamedFlowObject)
+      {
+        NamedFlowObject auxnfo = (NamedFlowObject)aux;
+        if (name.equals(auxnfo.getName()))
+        {
+          nfo = aux;
+          break;
+        }
+      }
+    }
+    return nfo;
+  }
+
+  public ProcessState getProcessState()
+  {
+    return processState;
+  }
+
+  /**
+   * Set the process state
+   */
+  public void initialize()
+  {
+    if (processState != ProcessState.CREATED)
+      throw new IllegalStateException("Cannot initialize process in state: " + processState);
+
+    // Set the anonymous default name
+    if (getName() == null)
+    {
+      ProcessManager pm = ProcessManager.locateProcessManager();
+      setName("AnonymousProcess#" + pm.getProcesses().size());
+    }
+
+    if (getStartEvent() == null)
+      throw new InvalidProcessException("Process does not have a start event");
+
+    if (getEndEvents().size() == 0)
+      throw new InvalidProcessException("Process does not have end events");
+
+    // Set the associated process
+    for (FlowObject aux : flowObjects)
+    {
+      ((FlowObjectImpl)aux).initialize(this);
+    }
+
+    processState = ProcessState.INITIALIZED;
+  }
+
+  public String toString()
+  {
+    return "Process[" + getName() + "]";
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/RuntimeProcessImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/RuntimeProcessImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/RuntimeProcessImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.runtime.MutableFlowScheduler;
+import org.jboss.bpm.runtime.RuntimeProcess;
+
+/**
+ * A RuntimeProcess add runtime behaviour to the {@link Process}
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class RuntimeProcessImpl implements RuntimeProcess
+{
+  private Process process;
+  private MutableFlowScheduler scheduler = new FlowSchedulerImpl();
+
+  public RuntimeProcessImpl(Process process)
+  {
+    super();
+    this.process = process;
+  }
+
+  public Process getProcess()
+  {
+    return process;
+  }
+
+  public MutableFlowScheduler getFlowScheduler()
+  {
+    return scheduler;
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/RuntimeProcessImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SequenceFlowImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SequenceFlowImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SequenceFlowImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import org.jboss.bpm.model.SequenceFlow;
+
+/**
+ * A Sequence Flow is a solid graphical line that is used to show the order that Activities will be performed in a Process. Each Flow has only one source and only one
+ * target.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class SequenceFlowImpl extends FlowImpl implements SequenceFlow
+{
+  public SequenceFlowImpl(String targetName)
+  {
+    super(targetName);
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SequenceFlowImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SignalHandlerImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SignalHandlerImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SignalHandlerImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import org.jboss.bpm.model.Signal;
+import org.jboss.bpm.runtime.SignalHandler;
+
+/**
+ * Implement to get signals on enter and exit.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class SignalHandlerImpl extends HandlerImpl implements SignalHandler
+{
+  private SignalHandler handler;
+  
+  public Signal getEnterSignal()
+  {
+    if (handler == null)
+    {
+      handler = newInstance(SignalHandler.class);
+    }
+    return handler.getEnterSignal();
+  }
+
+  public Signal getExitSignal()
+  {
+    if (handler == null)
+    {
+      handler = newInstance(SignalHandler.class);
+    }
+    return handler.getExitSignal();
+  }
+}


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SignalHandlerImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SingleInFlowSetterSupport.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SingleInFlowSetterSupport.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SingleInFlowSetterSupport.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+import org.jboss.bpm.model.Flow;
+import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.SingleInFlowSupport;
+
+
+//$Id$
+
+/**
+ * Implementing {@link FlowObject} support a single incomming {@link Flow}.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface SingleInFlowSetterSupport extends SingleInFlowSupport
+{
+  /**
+   * Set the incomming Flow
+   */
+  void setInFlow(Flow flow);
+}


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SingleInFlowSetterSupport.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SingleOutFlowSetterSupport.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SingleOutFlowSetterSupport.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SingleOutFlowSetterSupport.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+import org.jboss.bpm.model.Flow;
+import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.SingleOutFlowSupport;
+
+
+//$Id$
+
+/**
+ * Implementing {@link FlowObject}s support a single outgoing {@link Flow}s.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface SingleOutFlowSetterSupport extends SingleOutFlowSupport
+{
+  /**
+   * Set the outgoing Flow
+   */
+  void setOutFlow(Flow flow);
+}


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SingleOutFlowSetterSupport.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/StartEventImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/StartEventImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/StartEventImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.bpm.model.Flow;
+import org.jboss.bpm.model.Signal;
+import org.jboss.bpm.model.StartEvent;
+import org.jboss.bpm.runtime.ExecutionHandler;
+import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.FlowScheduler;
+import org.jboss.bpm.runtime.SignalHandler;
+import org.jboss.bpm.runtime.Token;
+import org.jboss.bpm.runtime.FlowScheduler.Tuple;
+
+/**
+ * A Start Event indicates where a particular Process will start. In terms of Sequence Flow, the Start Event starts the Flow of the Process, and thus, will not have any
+ * incoming Sequence Flow. A Start Event can have a Trigger that indicates how the Process starts: Message, Timer, Rule, Link, or Multiple.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class StartEventImpl extends EventImpl implements StartEvent, SingleOutFlowSetterSupport
+{
+  // provide logging
+  private static final Log log = LogFactory.getLog(StartEventImpl.class);
+
+  private Flow outFlow;
+
+  public Flow getOutFlow()
+  {
+    return outFlow;
+  }
+
+  public void setOutFlow(Flow flow)
+  {
+    this.outFlow = flow;
+  }
+
+  public ExecutionHandler getExecutionHandler()
+  {
+    ExecutionHandler handler = super.getExecutionHandler();
+    if (handler == null)
+    {
+      handler = new ExecutionHandler()
+      {
+        public void execute(Token token)
+        {
+          log.debug("Nothing to do in start-event");
+        }
+      };
+    }
+    return handler;
+  }
+
+  public FlowHandler getFlowHandler()
+  {
+    FlowHandler handler = super.getFlowHandler();
+    if (handler == null)
+    {
+      handler = new FlowHandler()
+      {
+        public void execute(FlowScheduler scheduler, Token token)
+        {
+          Tuple tuple = new Tuple(outFlow, token);
+          scheduler.scheduleTuple(tuple);
+        }
+      };
+    }
+    return handler;
+  }
+
+  public SignalHandler getSignalHandler()
+  {
+    SignalHandler handler = super.getSignalHandler();
+    if (handler == null)
+    {
+      final StartEvent start = this;
+      handler = new SignalHandler()
+      {
+        public Signal getEnterSignal()
+        {
+          return new Signal(start, Signal.Type.ENTER_START_EVENT);
+        }
+
+        public Signal getExitSignal()
+        {
+          return new Signal(start, Signal.Type.EXIT_START_EVENT);
+        }
+      };
+    }
+    return handler;
+  }
+  
+  public String toString()
+  {
+    return "StartEvent[]";
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/StartEventImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SubProcessImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SubProcessImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SubProcessImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,150 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+//$Id$
+
+import org.jboss.bpm.model.Flow;
+import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.Signal;
+import org.jboss.bpm.model.SubProcess;
+import org.jboss.bpm.runtime.ExecutionHandler;
+import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.FlowScheduler;
+import org.jboss.bpm.runtime.SignalHandler;
+import org.jboss.bpm.runtime.Token;
+import org.jboss.bpm.runtime.FlowScheduler.Tuple;
+
+/**
+ * A Sub-Process is Process that is included within another Process.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class SubProcessImpl extends ProcessImpl implements SubProcess, HandlerSetterSupport, SingleInFlowSetterSupport, SingleOutFlowSetterSupport
+{
+  private Flow inFlow;
+  private Flow outFlow;
+  private ExecutionHandler executionHandler;
+  private FlowHandler flowHandler;
+  private SignalHandler signalHandler;
+
+  public SubProcessImpl(String name)
+  {
+    super(name);
+  }
+
+  public Flow getInFlow()
+  {
+    return inFlow;
+  }
+
+  public void setInFlow(Flow inFlow)
+  {
+    this.inFlow = inFlow;
+  }
+
+  public Flow getOutFlow()
+  {
+    return outFlow;
+  }
+
+  public void setOutFlow(Flow flow)
+  {
+    this.outFlow = flow;
+  }
+
+  public ExecutionHandler getExecutionHandler()
+  {
+    ExecutionHandler handler = executionHandler;
+    if (handler == null)
+    {
+      handler = new ExecutionHandler()
+      {
+        public void execute(Token token)
+        {
+          startProcess(token.getExecutionContext());
+        }
+      };
+    }
+    return handler;
+  }
+
+  public void setExecutionHandler(ExecutionHandler executionHandler)
+  {
+    this.executionHandler = executionHandler;
+  }
+
+  public FlowHandler getFlowHandler()
+  {
+    FlowHandler handler = flowHandler;
+    if (handler == null)
+    {
+      handler = new FlowHandler()
+      {
+        public void execute(FlowScheduler scheduler, Token token)
+        {
+          Tuple tuple = new Tuple(outFlow, token);
+          scheduler.scheduleTuple(tuple);
+        }
+      };
+    }
+    return handler;
+  }
+
+  public void setFlowHandler(FlowHandler flowHandler)
+  {
+    this.flowHandler = flowHandler;
+  }
+
+  public SignalHandler getSignalHandler()
+  {
+    SignalHandler handler = signalHandler;
+    if (handler == null)
+    {
+      final FlowObject subproc = this;
+      handler = new SignalHandler()
+      {
+        public Signal getEnterSignal()
+        {
+          return new Signal(subproc, Signal.Type.ENTER_SUB_PROCESS);
+        }
+
+        public Signal getExitSignal()
+        {
+          return new Signal(subproc, Signal.Type.EXIT_SUB_PROCESS);
+        }
+      };
+    }
+    return handler;
+  }
+
+  public void setSignalHandler(SignalHandler signalHandler)
+  {
+    this.signalHandler = signalHandler;
+  }
+
+  public String toString()
+  {
+    return "SubProcess[" + getName() + "]";
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SubProcessImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/TaskImpl.java
===================================================================
--- api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/TaskImpl.java	                        (rev 0)
+++ api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/TaskImpl.java	2008-07-17 06:22:12 UTC (rev 1657)
@@ -0,0 +1,163 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.bpm.model.Flow;
+import org.jboss.bpm.model.Signal;
+import org.jboss.bpm.model.Task;
+import org.jboss.bpm.runtime.ExecutionHandler;
+import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.FlowScheduler;
+import org.jboss.bpm.runtime.SignalHandler;
+import org.jboss.bpm.runtime.Token;
+import org.jboss.bpm.runtime.FlowScheduler.Tuple;
+
+//$Id$
+
+/**
+ * A Task is an Atomic Activity that is included within a Process.
+ * 
+ * A Task is used when the work in the Process is not broken down to a finer level of Process Model detail. Generally, an end-user and/or an application are used to
+ * perform the Task when it is executed.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class TaskImpl extends ActivityImpl implements Task, HandlerSetterSupport, SingleInFlowSetterSupport, SingleOutFlowSetterSupport
+{
+  // provide logging
+  private static final Log log = LogFactory.getLog(TaskImpl.class);
+ 
+  private Flow inFlow;
+  private Flow outFlow;
+  private ExecutionHandler executionHandler;
+  private FlowHandler flowHandler;
+  private SignalHandler signalHandler;
+
+  public TaskImpl(String name)
+  {
+    super(name);
+  }
+
+  /**
+   * Get the out flow
+   */
+  public Flow getInFlow()
+  {
+    return inFlow;
+  }
+  
+  /**
+   * Set the in flow
+   */
+  public void setInFlow(Flow inFlow)
+  {
+    this.inFlow = inFlow;
+  }
+  
+  public Flow getOutFlow()
+  {
+    return outFlow;
+  }
+
+  public void setOutFlow(Flow flow)
+  {
+    this.outFlow = flow;
+  }
+  
+  public ExecutionHandler getExecutionHandler()
+  {
+    ExecutionHandler handler = executionHandler;
+    if (handler == null)
+    {
+      handler = new ExecutionHandler()
+      {
+        public void execute(Token token)
+        {
+          log.debug("Nothing to do in task: " + getName());
+        }
+      };
+    }
+    return handler;
+  }
+
+  public void setExecutionHandler(ExecutionHandler executionHandler)
+  {
+    this.executionHandler = executionHandler;
+  }
+
+  public FlowHandler getFlowHandler()
+  {
+    FlowHandler handler = flowHandler;
+    if (handler == null)
+    {
+      handler = new FlowHandler()
+      {
+        public void execute(FlowScheduler scheduler, Token token)
+        {
+          Tuple tuple = new Tuple(outFlow, token);
+          scheduler.scheduleTuple(tuple);
+        }
+      };
+    }
+    return handler;
+  }
+
+  public void setFlowHandler(FlowHandler flowHandler)
+  {
+    this.flowHandler = flowHandler;
+  }
+
+  public SignalHandler getSignalHandler()
+  {
+    SignalHandler handler = signalHandler;
+    if (handler == null)
+    {
+      final Task task = this;
+      handler = new SignalHandler()
+      {
+        public Signal getEnterSignal()
+        {
+          return new Signal(task, Signal.Type.ENTER_TASK);
+        }
+
+        public Signal getExitSignal()
+        {
+          return new Signal(task, Signal.Type.EXIT_TASK);
+        }
+      };
+    }
+    return handler;
+  }
+
+  public void setSignalHandler(SignalHandler signalHandler)
+  {
+    this.signalHandler = signalHandler;
+  }
+
+  public String toString()
+  {
+    return "Task[" + getName() + "]";
+  }
+}
\ No newline at end of file


Property changes on: api/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/TaskImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF




More information about the jbpm-commits mailing list