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

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Sep 29 11:55:54 EDT 2008


Author: thomas.diesler at jboss.com
Date: 2008-09-29 11:55:54 -0400 (Mon, 29 Sep 2008)
New Revision: 2439

Added:
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client/Deployment.java
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client/SignalListener.java
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/ExecutionHandler.java
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/FlowHandler.java
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/SignalHandler.java
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/DialectHandlerService.java
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ExecutionService.java
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/SignalService.java
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/PersistenceServiceTest.java
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/processbuilder/
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/processbuilder/ProcessBuilderTest.java
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/processbuilder/TestProcessBuilder.java
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/signal/
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/signal/SignalServiceTest.java
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/pattern/
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/pattern/control/
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/pattern/control/sequence/
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/pattern/control/sequence/SequenceTest.java
   projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/model/PropertyImpl.java
   projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/
   projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/DelegatingExecutionContext.java
   projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/DelegatingToken.java
   projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/MutableToken.java
   projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/RuntimeProcess.java
   projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/RuntimeProcessImpl.java
   projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/TokenExecutorImpl.java
   projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/TokenImpl.java
   projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/service/ExecutionManagerImpl.java
   projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/service/PersistenceServiceImpl.java
   projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/service/SignalServiceImpl.java
Removed:
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/Deployment.java
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/DialectRegistry.java
   projects/spec/trunk/modules/cts/src/test/java/org/jboss/
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/persistence/
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/processbuilder/
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/Node.java
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/NodeImpl.java
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/PersistenceServiceTest.java
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/PersistenceTest.java
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/Process.java
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/ProcessImpl.java
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/SequenceFlow.java
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/SequenceFlowImpl.java
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/processbuilder/ProcessBuilderTest.java
   projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/processbuilder/TestProcessBuilder.java
   projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/service/HibernatePersistenceService.java
Modified:
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Node.java
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Process.java
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Property.java
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/PropertySupport.java
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/DeploymentService.java
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/DialectHandler.java
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessService.java
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/CTSTestCase.java
   projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/model/NodeImpl.java
   projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/model/ProcessImpl.java
   projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/model/SequenceFlowImpl.java
   projects/spec/trunk/modules/impl/src/main/resources/jbpm-cfg-beans.xml
Log:
wip

Copied: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client/Deployment.java (from rev 2418, projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/Deployment.java)
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client/Deployment.java	                        (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client/Deployment.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -0,0 +1,126 @@
+/*
+ * 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.jbpm.api.client;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Serializable;
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.service.DialectHandler;
+import org.jbpm.api.service.DialectHandlerService;
+import org.jbpm.api.service.ProcessService;
+
+/**
+ * A deployment, containing all information to create a process that will be deployed to the {@link ProcessService}
+ * 
+ * @author Tom Baeyens
+ * @author thomas.diesler at jboss.com
+ * @since 25-Sep-2008
+ */
+public class Deployment implements Serializable
+{
+  private static final long serialVersionUID = 1L;
+  
+  private String procXML;
+  private Process process;
+
+  public Deployment(String procXML)
+  {
+    if (procXML == null)
+      throw new IllegalArgumentException("Null process definition");
+    
+    this.procXML = procXML;
+  }
+  
+  public Deployment(URL procURL) throws IOException
+  {
+    if (procURL == null)
+      throw new IllegalArgumentException("Null process definition");
+    
+    StringBuilder strBuilder = new StringBuilder();
+    BufferedReader br = new BufferedReader(new InputStreamReader(procURL.openStream()));
+    String line = br.readLine();
+    while (line != null)
+    {
+      strBuilder.append(line);
+      line = br.readLine();
+    }
+    procXML = strBuilder.toString();
+  }
+
+  public Deployment(Process process)
+  {
+    this.process = process;
+  }
+
+  public Process getProcess()
+  {
+    if (process == null)
+    {
+      ProcessEngine engine = ProcessEngine.getProcessEngine();
+      DialectHandlerService dhService = engine.getService(DialectHandlerService.class);
+      if (dhService == null)
+        throw new IllegalStateException("DialectHandlerService not registered");
+      
+      URI nsURI = getNamespaceURI();
+      DialectHandler dialectHandler = dhService.getDialectHandler(nsURI);
+      if (dialectHandler == null)
+        throw new IllegalStateException("Cannot obtain DialectHandler for: " + nsURI);
+      
+      process = dialectHandler.createProcess(procXML);
+    }
+    return process;
+  }
+  
+  private URI getNamespaceURI()
+  {
+    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+    dbf.setNamespaceAware(true);
+    Document doc;
+    try
+    {
+      DocumentBuilder db = dbf.newDocumentBuilder();
+      doc = db.parse(new ByteArrayInputStream(procXML.getBytes()));
+    }
+    catch (Exception ex)
+    {
+      throw new IllegalStateException("Cannot parse process descriptor", ex);
+    }
+
+    Element root = doc.getDocumentElement();
+    String nsURI = root.getNamespaceURI();
+    if (nsURI == null)
+      throw new IllegalStateException("Cannot get namespace URI from root element");
+
+    return URI.create(nsURI);
+  }
+}

Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client/SignalListener.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client/SignalListener.java	                        (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client/SignalListener.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -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.jbpm.api.client;
+
+//$Id$
+
+import org.jbpm.api.model.Signal;
+
+/**
+ * A signal listener that can be registered with the {@link SignalService}
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface SignalListener
+{
+  /**
+   * Returns true if the listener accepts a given signal  
+   */
+  boolean acceptSignal(Signal signal);
+  
+  /** 
+   * Catch a previously accepted signal 
+   */
+  void catchSignal(Signal signal);
+}
\ No newline at end of file


Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client/SignalListener.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Node.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Node.java	2008-09-29 13:35:02 UTC (rev 2438)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Node.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -21,23 +21,32 @@
  */
 package org.jbpm.api.model;
 
-// $Id$
+//$Id$
 
+import org.jbpm.api.runtime.ExecutionHandler;
+import org.jbpm.api.runtime.FlowHandler;
+import org.jbpm.api.runtime.SignalHandler;
+
 /**
  * A Node is an abstract element with a name and an associated process
  * 
  * @author thomas.diesler at jboss.com
  * @since 08-Jul-2008
  */
-public interface Node extends AbstractElement 
+public interface Node extends AbstractElement, PropertySupport
 {
-  /**
-   * Get the unique name.
-   */
+  /** Get the associated Process */
+  Process getProcess();
+
+  /** Get the unique name. */
   String getName();
 
-  /**
-   * Get the associated Process
-   */
-  Process getProcess();
+  /** Get the associated ExecutionHandler */
+  ExecutionHandler getExecutionHandler();
+
+  /** Get the associated SignalHandler */
+  SignalHandler getSignalHandler();
+
+  /** Get the associated FlowHandler */
+  FlowHandler getFlowHandler();
 }
\ No newline at end of file

Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Process.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Process.java	2008-09-29 13:35:02 UTC (rev 2438)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Process.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -35,7 +35,7 @@
  * @author thomas.diesler at jboss.com
  * @since 08-Jul-2008
  */
-public interface Process extends AbstractElement
+public interface Process extends AbstractElement, PropertySupport
 {
   /**
    * Defines the status a {@link Process} can be in

Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Property.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Property.java	2008-09-29 13:35:02 UTC (rev 2438)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Property.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -21,6 +21,8 @@
  */
 package org.jbpm.api.model;
 
+import java.io.Serializable;
+
 // $Id$
 
 /**
@@ -29,7 +31,7 @@
  * @author thomas.diesler at jboss.com
  * @since 21-Jul-2008
  */
-public interface Property 
+public interface Property extends Serializable
 {
   /**
    * Each Property has a Name (e.g., name=”Customer Name”).
@@ -37,9 +39,9 @@
   String getName();
   
   /**
-   * Get the body of the expression value.
+   * Get the property value.
    */
-  Object getValue();
+  String getValue();
   
   /**
    * If the Correlation attribute is set to True, then the Property is marked to be used for

Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/PropertySupport.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/PropertySupport.java	2008-09-29 13:35:02 UTC (rev 2438)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/PropertySupport.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -23,7 +23,7 @@
 
 //$Id$
 
-import java.util.List;
+import java.util.Set;
 
 /**
  * Property support
@@ -41,5 +41,5 @@
   /**
    * Get the list of property names
    */
-  List<String> getPropertyNames();
+  Set<String> getPropertyNames();
 }
\ No newline at end of file

Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/ExecutionHandler.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/ExecutionHandler.java	                        (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/ExecutionHandler.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -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.jbpm.api.runtime;
+
+//$Id$
+
+
+/**
+ * The ProcessEngine invokes the ExecutionHandler on a 
+ * {@link Node} to execute user provided business logic.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface ExecutionHandler
+{
+  /**
+   * Execute the associated business logic.
+   */
+  void execute(Token token);
+
+}
\ No newline at end of file


Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/ExecutionHandler.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/FlowHandler.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/FlowHandler.java	                        (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/FlowHandler.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -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.jbpm.api.runtime;
+
+// $Id$
+
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.Node;
+
+/**
+ * The {@link ProcessEngine} invokes the FlowHandler on a {@link Node} 
+ * to move the {@link Token} to the next {@link Node}.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface FlowHandler
+{
+  /**
+   * Execute the FlowHandler.
+   * <p/>
+   * The FlowHandler typically invoves one of the {@link TokenExecutor} 
+   * methods to move the {@link Token} to the next {@link Node}.    
+   */
+  void execute(TokenExecutor tokenExecutor, Token token);
+
+}
\ No newline at end of file


Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/FlowHandler.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/SignalHandler.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/SignalHandler.java	                        (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/SignalHandler.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -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.jbpm.api.runtime;
+
+// $Id$
+
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.Node;
+import org.jbpm.api.model.Signal;
+
+/**
+ * The {@link ProcessEngine} invokes the SignalHandler on a {@link Node} 
+ * to send {@link Signal}s.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface SignalHandler
+{
+  /** 
+   * Get signal for enter 
+   */
+  void throwEnterSignal(Token token);
+
+  /** 
+   * Get signal for exit 
+   */
+  void throwExitSignal(Token token);
+}
\ No newline at end of file


Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/SignalHandler.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Deleted: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/Deployment.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/Deployment.java	2008-09-29 13:35:02 UTC (rev 2438)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/Deployment.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -1,102 +0,0 @@
-/*
- * 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.jbpm.api.service;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Serializable;
-import java.net.URI;
-import java.net.URL;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * A deployment, containing all information to create a process that will be deployed to the {@link ProcessService}
- * 
- * @author Tom Baeyens
- * @author thomas.diesler at jboss.com
- * @since 25-Sep-2008
- */
-public class Deployment implements Serializable
-{
-  private static final long serialVersionUID = 1L;
-  
-  private String procXML;
-
-  public Deployment(String procXML)
-  {
-    if (procXML == null)
-      throw new IllegalArgumentException("Null process definition");
-    
-    this.procXML = procXML;
-  }
-  
-  public Deployment(URL procURL) throws IOException
-  {
-    if (procURL == null)
-      throw new IllegalArgumentException("Null process definition");
-    
-    StringBuilder strBuilder = new StringBuilder();
-    BufferedReader br = new BufferedReader(new InputStreamReader(procURL.openStream()));
-    String line = br.readLine();
-    while (line != null)
-    {
-      strBuilder.append(line);
-      line = br.readLine();
-    }
-    procXML = strBuilder.toString();
-  }
-
-  public String getProcessXML()
-  {
-    return procXML;
-  }
-  
-  public URI getNamespaceURI()
-  {
-    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-    dbf.setNamespaceAware(true);
-    Document doc;
-    try
-    {
-      DocumentBuilder db = dbf.newDocumentBuilder();
-      doc = db.parse(new ByteArrayInputStream(procXML.getBytes()));
-    }
-    catch (Exception ex)
-    {
-      throw new IllegalStateException("Cannot parse process descriptor", ex);
-    }
-
-    Element root = doc.getDocumentElement();
-    String nsURI = root.getNamespaceURI();
-    if (nsURI == null)
-      throw new IllegalStateException("Cannot get namespace URI from root element");
-
-    return URI.create(nsURI);
-  }
-}

Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/DeploymentService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/DeploymentService.java	2008-09-29 13:35:02 UTC (rev 2438)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/DeploymentService.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -25,6 +25,7 @@
 
 import javax.management.ObjectName;
 
+import org.jbpm.api.client.Deployment;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/DialectHandler.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/DialectHandler.java	2008-09-29 13:35:02 UTC (rev 2438)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/DialectHandler.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -27,6 +27,7 @@
 import java.io.Writer;
 import java.net.URI;
 import java.net.URL;
+import org.jbpm.api.model.Process;
 
 /**
  * The DialectHandler converts a supported dialect to the Process model.

Copied: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/DialectHandlerService.java (from rev 2418, projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/DialectRegistry.java)
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/DialectHandlerService.java	                        (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/DialectHandlerService.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -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.jbpm.api.service;
+
+//$Id$
+
+import java.net.URI;
+import java.util.Map;
+
+
+/**
+ * A registry that maps namespaceURI to a {@link DialectHandler}
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jul-2008
+ */
+public abstract class DialectHandlerService
+{
+  // Maps namespaceURI to a DialectHandler
+  protected Map<URI, DialectHandler> dialectHandlers;
+
+  /**
+   * Get the handler for the dialect with the given namespace URI
+   */
+  public DialectHandler getDialectHandler(URI nsURI)
+  {
+    DialectHandler dialectHandler = dialectHandlers.get(nsURI);
+    if (dialectHandler == null)
+      throw new IllegalStateException("No dialect handler registered for: " + nsURI);
+
+    return dialectHandler;
+  }
+
+}

Deleted: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/DialectRegistry.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/DialectRegistry.java	2008-09-29 13:35:02 UTC (rev 2438)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/DialectRegistry.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -1,53 +0,0 @@
-/*
- * 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.jbpm.api.service;
-
-//$Id$
-
-import java.net.URI;
-import java.util.Map;
-
-
-/**
- * A registry that maps namespaceURI to a {@link DialectHandler}
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Jul-2008
- */
-public abstract class DialectRegistry
-{
-  // Maps namespaceURI to a DialectHandler
-  protected Map<URI, DialectHandler> dialectHandlers;
-
-  /**
-   * Get the handler for the dialect with the given namespace URI
-   */
-  public DialectHandler getDialectHandler(URI nsURI)
-  {
-    DialectHandler dialectHandler = dialectHandlers.get(nsURI);
-    if (dialectHandler == null)
-      throw new IllegalStateException("No dialect handler registered for: " + nsURI);
-
-    return dialectHandler;
-  }
-
-}

Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ExecutionService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ExecutionService.java	                        (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ExecutionService.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -0,0 +1,86 @@
+/*
+ * 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.jbpm.api.service;
+
+// $Id$
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.jbpm.api.model.Process;
+import org.jbpm.api.model.StartEvent;
+import org.jbpm.api.model.Process.ProcessStatus;
+import org.jbpm.api.runtime.Attachments;
+
+/**
+ * The ExecutionService executes processes
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public abstract class ExecutionService implements Service
+{
+  private ExecutorService procExecutor = Executors.newCachedThreadPool();
+
+  // Hide public constructor
+  protected ExecutionService()
+  {
+  }
+
+  /**
+   * Get the process executor service
+   */
+  public ExecutorService getProcessExecutor()
+  {
+    return procExecutor;
+  }
+
+  /**
+   * Start the Process
+   * 
+   * @param proc The Process to start
+   * @param att The Attachments in the ExecutionContext
+   */
+  public abstract void startProcess(Process proc, Attachments att);
+
+  /**
+   * Start the Process from a given start event
+   * 
+   * @param start The StartEvent that triggers the process
+   * @param att The Attachments in the ExecutionContext
+   */
+  public abstract void startProcess(StartEvent start, Attachments att);
+
+  /**
+   * All Tokens that are generated at the Start Event for that Process must eventually arrive at an End Event. The
+   * Process will be in a running state until all Tokens are consumed. <p/> This method until the process ends without
+   * timeout.
+   */
+  public abstract ProcessStatus waitForEnd(Process proc);
+
+  /**
+   * All Tokens that are generated at the Start Event for that Process must eventually arrive at an End Event. The
+   * Process will be in a running state until all Tokens are consumed. <p/> This method until the process ends with a
+   * given timeout.
+   */
+  public abstract ProcessStatus waitForEnd(Process proc, long timeout);
+}


Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ExecutionService.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessService.java	2008-09-29 13:35:02 UTC (rev 2438)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessService.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -31,7 +31,10 @@
 
 import javax.management.ObjectName;
 
+import org.jbpm.api.client.Deployment;
 import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.model.Process.ProcessStatus;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -46,44 +49,99 @@
   // Provide logging
   final static Logger log = LoggerFactory.getLogger(ProcessService.class);
 
-  // The associated ProcessEngine
-  private ProcessEngine processEngine;
   // The set of registered processes
-  private Map<ObjectName, Process> procs = new HashMap<ObjectName, Process>();
+  private Map<ObjectName, Process> registeredProcs = new HashMap<ObjectName, Process>();
 
   // Hide public constructor
   protected ProcessService()
   {
   }
 
+  /** 
+   * Deploy a new process to the process service. 
+   */
+  public ObjectName deploy(Deployment dep)
+  {
+    // Get the process from the deployment
+    Process proc = dep.getProcess();
+    if (proc == null)
+      throw new IllegalStateException("Cannot obtain process from: " + dep);
+    
+    // Save the process if the PersistenceService is registered
+    ProcessEngine engine = ProcessEngine.getProcessEngine();
+    PersistenceService dbService = engine.getService(PersistenceService.class);
+    if (dbService != null)
+      dbService.saveProcess(proc);
+
+    registerProcess(proc);
+    return proc.getKey();
+  }
+  
   /**
-   * Get the associated ProcessEngine
+   * Register a Process.
    */
-  public ProcessEngine getProcessEngine()
+  public void registerProcess(Process proc)
   {
-    return processEngine;
+    log.debug("registerProcess: " + proc);
+    registeredProcs.put(proc.getKey(), proc);
   }
 
-  public void setProcessEngine(ProcessEngine processEngine)
+  /**
+   * Unregister a Process.
+   */
+  public void unregisterProcess(Process proc)
   {
-    this.processEngine = processEngine;
+    log.debug("unregisterProcess: " + proc);
+    registeredProcs.remove(proc.getKey());
   }
-  
-  /** 
-   * Deploy a new process to the process service. 
+
+  /**
+   * Unregister a set of Processes by name.
    */
-  public ObjectName deploy(Deployment deployment)
+  public void unregisterProcess(String procName)
   {
+    log.debug("unregisterProcess: " + procName);
     
-    return null;
+    for (Process proc : getProcesses(procName, null))
+      unregisterProcess(proc);
   }
-  
+
   /**
+   * Get a Process for a given id
+   */
+  public Process getProcessByKey(ObjectName procID)
+  {
+    Process proc = registeredProcs.get(procID);
+    return proc;
+  }
+
+  /**
    * Get the set of registered Processes
    */
   public Set<Process> getProcesses()
   {
-    Set<Process> procSet = new HashSet<Process>(procs.values());
+    Set<Process> procSet = new HashSet<Process>(registeredProcs.values());
     return Collections.unmodifiableSet(procSet);
   }
+
+  /**
+   * Find the set of Processes for a given name
+   * 
+   * @param name The process name
+   * @param status The optional process status
+   * @return An empty set if the process cannot be found
+   */
+  public Set<Process> getProcesses(String name, ProcessStatus status)
+  {
+    Set<Process> procSet = new HashSet<Process>();
+    for (Process aux : registeredProcs.values())
+    {
+      if (aux.getName().equals(name))
+      {
+        if (status == null || aux.getProcessStatus() == status)
+          procSet.add(aux);
+      }
+    }
+    return procSet;
+  }
 }
\ No newline at end of file

Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/SignalService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/SignalService.java	                        (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/SignalService.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -0,0 +1,125 @@
+/*
+ * 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.jbpm.api.service;
+
+//$Id$
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jbpm.api.client.SignalListener;
+import org.jbpm.api.model.Signal;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A {@link Signal} is like an undirected flare shot up
+ * into the air. A component can register a {@link SignalListener} with the SignalService.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public abstract class SignalService implements Service
+{
+  // provide logging
+  final static Logger log = LoggerFactory.getLogger(SignalService.class);
+
+  // The map of registered signal listeners
+  private Set<SignalListener> listeners = new HashSet<SignalListener>();
+
+  /**
+   * Add a SignalListener for a given source
+   */
+  public void addSignalListener(SignalListener listener)
+  {
+    synchronized (listeners)
+    {
+      log.debug("addSignalListener: " + listener);
+      listeners.add(listener);
+    }
+  }
+
+  /**
+   * Get the set of registered SignalListeners 
+   */
+  public Set<SignalListener> getSignalListeners()
+  {
+    synchronized (listeners)
+    {
+      HashSet<SignalListener> set = new HashSet<SignalListener>(listeners);
+      return Collections.unmodifiableSet(set);
+    }
+  }
+
+  /**
+   * Remove a SignalListener for a given source
+   */
+  public void removeSignalListener(SignalListener listener)
+  {
+    synchronized (listeners)
+    {
+      log.debug("removeSignalListener: " + listener);
+      listeners.remove(listener);
+    }
+  }
+
+  /**
+   * Throw a signal to all registered listeners
+   */
+  public void throwSignal(Signal signal)
+  {
+    log.debug("throwSignal: " + signal);
+    Set<SignalListener> currentSet = getSignalListeners();
+    for (SignalListener listener : currentSet)
+    {
+      if (failsafeAccept(listener, signal))
+        failsafeThrow(listener, signal);
+    }
+  }
+
+  private boolean failsafeAccept(SignalListener listener, Signal signal)
+  {
+    try
+    {
+      boolean accept = listener.acceptSignal(signal);
+      return accept;
+    }
+    catch (RuntimeException rte)
+    {
+      log.error("Signal processing error", rte);
+      return false;
+    }
+  }
+
+  private void failsafeThrow(SignalListener listener, Signal signal)
+  {
+    try
+    {
+      listener.catchSignal(signal);
+    }
+    catch (RuntimeException rte)
+    {
+      log.error("Signal processing error", rte);
+    }
+  }
+}
\ No newline at end of file


Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/SignalService.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/CTSTestCase.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/CTSTestCase.java	2008-09-29 13:35:02 UTC (rev 2438)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/CTSTestCase.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -24,9 +24,21 @@
 import java.io.File;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
 
+import javax.management.ObjectName;
+
 import junit.framework.TestCase;
 
+import org.jbpm.api.Constants;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.client.SignalListener;
+import org.jbpm.api.model.Signal;
+import org.jbpm.api.model.builder.ObjectNameFactory;
+import org.jbpm.api.service.SignalService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -42,18 +54,47 @@
   final Logger log = LoggerFactory.getLogger(CTSTestCase.class);
 
   private CTSTestHelper delegate = new CTSTestHelper();
+  // The embedded SignalListener
+  private SignalListener signalListener;
+  // The signals caught by this test case
+  private List<Signal> signals = new ArrayList<Signal>();
 
   @Override
   protected void setUp() throws Exception
   {
     log.debug("### START " + getLongName());
     super.setUp();
+    
+    // Setup the SignalListener
+    clearAllSignalListeners();
+    ProcessEngine engine = ProcessEngine.getProcessEngine();
+    SignalService sigService = engine.getService(SignalService.class);
+    sigService.addSignalListener(getSignalListener());
+    synchronized (signals)
+    {
+      signals.clear();
+    }
   }
 
   @Override
   protected void tearDown() throws Exception
   {
     super.tearDown();
+    
+    // Tear down the SignalListener
+    ProcessEngine engine = ProcessEngine.getProcessEngine();
+    SignalService sigService = engine.getService(SignalService.class);
+    sigService.removeSignalListener(getSignalListener());
+    
+    // Check that there are no registered signal listeners left
+    Set<SignalListener> sigListeners = sigService.getSignalListeners();
+    if (sigListeners.size() > 0)
+    {
+      String logMsg = "Registered signal listeners on tear down of " + getName() + ": " + sigListeners;
+      System.out.println(logMsg);
+      log.warn(logMsg);
+    }
+    
     log.debug("### END " + getLongName());
   }
 
@@ -67,8 +108,84 @@
     return delegate.getResourceFile(resource);
   }
 
+  protected String getShortName()
+  {
+    String shortName = getClass().getName();
+    shortName = shortName.substring(shortName.lastIndexOf(".") + 1);
+    return shortName;
+  }
+  
   protected String getLongName()
   {
     return getClass().getName() + "." + getName();
   }
+
+  public ObjectName getTestID()
+  {
+    String shortName = getShortName();
+    shortName = shortName.replace("DescriptorTest", "Test"); 
+    shortName = shortName.replace("MarshallerTest", "Test"); 
+    return ObjectNameFactory.create(Constants.ID_DOMAIN, "test", shortName);
+  }
+  
+  public List<Signal> getSignals()
+  {
+    synchronized (signals)
+    {
+      return Collections.unmodifiableList(signals);
+    }
+  }
+
+  public List<Signal> getSignals(Signal.SignalType type)
+  {
+    synchronized (signals)
+    {
+      List<Signal> retSignals = new ArrayList<Signal>();
+      for (Signal sig : signals)
+      {
+        if (sig.getSignalType() == type)
+          retSignals.add(sig);
+      }
+      return Collections.unmodifiableList(retSignals);
+    }
+  }
+  
+  private void clearAllSignalListeners()
+  {
+    ProcessEngine engine = ProcessEngine.getProcessEngine();
+    SignalService sigService = engine.getService(SignalService.class);
+    Set<SignalListener> sigListeners = sigService.getSignalListeners();
+    for (SignalListener sigListener : sigListeners)
+    {
+      sigService.removeSignalListener(sigListener);
+    }
+  }
+  
+  public SignalListener getSignalListener()
+  {
+    if (signalListener == null)
+    {
+      signalListener = new SignalListener()
+      {
+        public boolean acceptSignal(Signal signal)
+        {
+          return true;
+        }
+        
+        public void catchSignal(Signal signal)
+        {
+          synchronized (signals)
+          {
+            signals.add(signal);
+          }
+        }
+
+        public String toString()
+        {
+          return "SignalListener[" + getShortName() + "]";
+        }
+      };
+    }
+    return signalListener;
+  }
 }

Copied: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence (from rev 2418, projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/persistence)

Deleted: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/Node.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/persistence/Node.java	2008-09-29 05:50:29 UTC (rev 2418)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/Node.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -1,16 +0,0 @@
-package org.jbpm.test.cts.persistence;
-
-import java.util.List;
-
-public interface Node
-{
-
-  public abstract Process getProcess();
-
-  public abstract String getName();
-
-  public abstract List<SequenceFlow> getInFlows();
-
-  public abstract List<SequenceFlow> getOutFlows();
-
-}
\ No newline at end of file

Deleted: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/NodeImpl.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/persistence/NodeImpl.java	2008-09-29 05:50:29 UTC (rev 2418)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/NodeImpl.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -1,92 +0,0 @@
-/**
- * 
- */
-package org.jbpm.test.cts.persistence;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.Basic;
-import javax.persistence.CascadeType;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
-
-import org.hibernate.annotations.IndexColumn;
-
- at Entity
-public class NodeImpl implements Node
-{
-  @Id
-  @GeneratedValue
-  public Integer id;
-  @Basic
-  private String name;
-  @ManyToOne(targetEntity = ProcessImpl.class)
-  private Process process;
-  @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER, mappedBy = "target", targetEntity = SequenceFlowImpl.class)
-  @IndexColumn(name = "targetIndex")
-  private List<SequenceFlow> inFlows = new ArrayList<SequenceFlow>();
-  @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER, mappedBy = "source", targetEntity = SequenceFlowImpl.class)
-  @IndexColumn(name = "sourceIndex")
-  private List<SequenceFlow> outFlows = new ArrayList<SequenceFlow>();
-
-  public NodeImpl()
-  {
-  }
-
-  public NodeImpl(String name)
-  {
-    this.name = name;
-  }
-
-  public Process getProcess()
-  {
-    return process;
-  }
-
-  public void setProcess(Process process)
-  {
-    this.process = process;
-  }
-
-  public String getName()
-  {
-    return name;
-  }
-
-  public void setName(String name)
-  {
-    this.name = name;
-  }
-
-  public List<SequenceFlow> getInFlows()
-  {
-    return inFlows;
-  }
-
-  public void setInFlows(List<SequenceFlow> inFlows)
-  {
-    this.inFlows = inFlows;
-  }
-
-  public List<SequenceFlow> getOutFlows()
-  {
-    return outFlows;
-  }
-
-  public void setOutFlows(List<SequenceFlow> flows)
-  {
-    this.outFlows = flows;
-  }
-
-  @Override
-  public String toString()
-  {
-    return "[name=" + name + ",in=" + inFlows + ",out=" + outFlows + "]";
-  }
-
-}
\ No newline at end of file

Deleted: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/PersistenceServiceTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/persistence/PersistenceServiceTest.java	2008-09-29 05:50:29 UTC (rev 2418)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/PersistenceServiceTest.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -1,72 +0,0 @@
-/*
- * 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.jbpm.test.cts.persistence;
-
-// $Id$
-
-import javax.management.ObjectName;
-
-import org.jbpm.api.ProcessNotFoundException;
-import org.jbpm.api.client.ProcessEngine;
-import org.jbpm.api.model.Process;
-import org.jbpm.api.service.PersistenceService;
-import org.jbpm.api.test.CTSTestCase;
-import org.jbpm.test.cts.processbuilder.TestProcessBuilder;
-
-/**
- * Test the ExecutionManager
- * 
- * @author thomas.diesler at jboss.com
- * @since 08-Jul-2008
- */
-public class PersistenceServiceTest extends CTSTestCase
-{
-  /**
-   * Test save, load, delete of a trivial process
-   */
-  public void testSaveLoadDelete() throws Exception
-  {
-    ProcessEngine engine = ProcessEngine.getProcessEngine();
-    PersistenceService service = engine.getService(PersistenceService.class);
-
-    // Save the process
-    Process proc = TestProcessBuilder.getTrivalProcess();
-    service.saveProcess(proc);
-
-    // Load the process
-    ObjectName procID = proc.getKey();
-    Process procLoad = service.loadProcess(procID);
-    TestProcessBuilder.validateTrivialProcess(procLoad);
-
-    // Delete the process
-    service.deleteProcess(proc);
-    try
-    {
-      service.loadProcess(procID);
-      fail("ProcessNotFoundException expected");
-    }
-    catch (ProcessNotFoundException ex)
-    {
-      // expected
-    }
-  }
-}

Copied: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/PersistenceServiceTest.java (from rev 2438, projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/persistence/PersistenceServiceTest.java)
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/PersistenceServiceTest.java	                        (rev 0)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/PersistenceServiceTest.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -0,0 +1,72 @@
+/*
+ * 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.jbpm.test.cts.service.persistence;
+
+// $Id: PersistenceServiceTest.java 2419 2008-09-29 07:22:59Z thomas.diesler at jboss.com $
+
+import javax.management.ObjectName;
+
+import org.jbpm.api.ProcessNotFoundException;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.service.PersistenceService;
+import org.jbpm.api.test.CTSTestCase;
+import org.jbpm.test.cts.service.processbuilder.TestProcessBuilder;
+
+/**
+ * Test the PersistenceService
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class PersistenceServiceTest extends CTSTestCase
+{
+  /**
+   * Test save, load, delete of a trivial process
+   */
+  public void testSaveLoadDelete() throws Exception
+  {
+    ProcessEngine engine = ProcessEngine.getProcessEngine();
+    PersistenceService service = engine.getService(PersistenceService.class);
+
+    // Save the process
+    Process proc = TestProcessBuilder.getTrivalProcess();
+    service.saveProcess(proc);
+
+    // Load the process
+    ObjectName procID = proc.getKey();
+    Process procLoad = service.loadProcess(procID);
+    TestProcessBuilder.validateTrivialProcess(procLoad);
+
+    // Delete the process
+    service.deleteProcess(proc);
+    try
+    {
+      service.loadProcess(procID);
+      fail("ProcessNotFoundException expected");
+    }
+    catch (ProcessNotFoundException ex)
+    {
+      // expected
+    }
+  }
+}

Deleted: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/PersistenceTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/persistence/PersistenceTest.java	2008-09-29 05:50:29 UTC (rev 2418)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/PersistenceTest.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -1,142 +0,0 @@
-/*
- * 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.jbpm.test.cts.persistence;
-
-// $Id$
-
-import org.hibernate.Hibernate;
-import org.hibernate.ObjectNotFoundException;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.cfg.AnnotationConfiguration;
-import org.hibernate.classic.Session;
-import org.jbpm.api.ProcessNotFoundException;
-import org.jbpm.api.test.CTSTestCase;
-
-/**
- * Test the ExecutionManager
- * 
- * @author thomas.diesler at jboss.com
- * @since 08-Jul-2008
- */
-public class PersistenceTest extends CTSTestCase
-{
-  private String hibernateConfig;
-  private SessionFactory sessionFactory;
-
-  /**
-   * Test save, load, delete of a trivial process
-   */
-  public void testSaveLoadDelete() throws Exception
-  {
-    NodeImpl na = new NodeImpl("A");
-    NodeImpl nb = new NodeImpl("B");
-    NodeImpl nc = new NodeImpl("C");
-
-    ProcessImpl proc = new ProcessImpl("P");
-    proc.addNode(na);
-    proc.addNode(nb);
-    proc.addNode(nc);
-
-    new SequenceFlowImpl(na, nb);
-    new SequenceFlowImpl(nb, nc);
-
-    System.out.println(proc);
-
-    Session session = getSessionFactory().openSession();
-    Transaction tx = session.beginTransaction();
-    try
-    {
-      session.save(proc);
-
-      tx.commit();
-    }
-    finally
-    {
-      session.close();
-    }
-
-    Process loadProc = loadProcess(proc.id);
-
-    System.out.println();
-    System.out.println(loadProc);
-
-    deleteProcess(proc);
-  }
-
-  public Process loadProcess(Integer id)
-  {
-    Process proc = null;
-    Session session = getSessionFactory().openSession();
-    try
-    {
-      proc = (Process)session.load(ProcessImpl.class, id);
-      Hibernate.initialize(proc);
-    }
-    catch (ObjectNotFoundException ex)
-    {
-      throw new ProcessNotFoundException("Cannot find process: " + id);
-    }
-    finally
-    {
-      session.close();
-    }
-    return proc;
-  }
-
-  public void deleteProcess(Process proc)
-  {
-    Session session = getSessionFactory().openSession();
-    Transaction tx = session.beginTransaction();
-    try
-    {
-      session.delete(proc);
-      tx.commit();
-    }
-    finally
-    {
-      session.close();
-    }
-  }
-
-  private SessionFactory getSessionFactory()
-  {
-    // If this property is not explicitly set in the beans config
-    // fall back to the -Ddatabase property that also activates
-    // the corresponding mvn profiles
-    if (hibernateConfig == null)
-    {
-      String database = System.getProperty("database", "mysql");
-      hibernateConfig = "hibernate.cfg." + database + ".xml";
-    }
-
-    if (sessionFactory == null)
-    {
-      AnnotationConfiguration anConfig = new AnnotationConfiguration();
-      anConfig.addAnnotatedClass(ProcessImpl.class);
-      anConfig.addAnnotatedClass(NodeImpl.class);
-      anConfig.addAnnotatedClass(SequenceFlowImpl.class);
-      sessionFactory = anConfig.configure(hibernateConfig).buildSessionFactory();
-    }
-    return sessionFactory;
-  }
-}

Deleted: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/Process.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/persistence/Process.java	2008-09-29 05:50:29 UTC (rev 2418)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/Process.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -1,12 +0,0 @@
-package org.jbpm.test.cts.persistence;
-
-import java.util.List;
-
-public interface Process
-{
-
-  public abstract String getName();
-
-  public abstract List<Node> getNodes();
-
-}
\ No newline at end of file

Deleted: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/ProcessImpl.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/persistence/ProcessImpl.java	2008-09-29 05:50:29 UTC (rev 2418)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/ProcessImpl.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -1,69 +0,0 @@
-/**
- * 
- */
-package org.jbpm.test.cts.persistence;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.Basic;
-import javax.persistence.CascadeType;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.OneToMany;
-
- at Entity
-public class ProcessImpl implements Process
-{
-  @Id
-  @GeneratedValue
-  public Integer id;
-  @Basic
-  private String name;
-  @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER, mappedBy = "process", targetEntity = NodeImpl.class)
-  private List<Node> nodes = new ArrayList<Node>();
-
-  public ProcessImpl()
-  {
-  }
-
-  public ProcessImpl(String name)
-  {
-    this.name = name;
-  }
-
-  public String getName()
-  {
-    return name;
-  }
-
-  public void setName(String name)
-  {
-    this.name = name;
-  }
-
-  public List<Node> getNodes()
-  {
-    return nodes;
-  }
-
-  public void setNodes(List<Node> nodes)
-  {
-    this.nodes = nodes;
-  }
-
-  public void addNode(Node node)
-  {
-    ((NodeImpl)node).setProcess(this);
-    nodes.add(node);
-  }
-
-  @Override
-  public String toString()
-  {
-    return "[name=" + name + ",nodes=" + nodes + "]";
-  }
-
-}
\ No newline at end of file

Deleted: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/SequenceFlow.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/persistence/SequenceFlow.java	2008-09-29 05:50:29 UTC (rev 2418)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/SequenceFlow.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -1,12 +0,0 @@
-package org.jbpm.test.cts.persistence;
-
-public interface SequenceFlow
-{
-
-  public abstract String getTargetName();
-
-  public abstract Node getSource();
-
-  public abstract Node getTarget();
-
-}
\ No newline at end of file

Deleted: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/SequenceFlowImpl.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/persistence/SequenceFlowImpl.java	2008-09-29 05:50:29 UTC (rev 2418)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/persistence/SequenceFlowImpl.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -1,109 +0,0 @@
-/**
- * 
- */
-package org.jbpm.test.cts.persistence;
-
-import javax.persistence.Basic;
-import javax.persistence.CascadeType;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-
- at Entity
-public class SequenceFlowImpl implements SequenceFlow
-{
-  @Id
-  @GeneratedValue
-  public Integer id;
-  @Basic
-  private String targetName;
-  @Basic
-  private int sourceIndex;
-  @Basic
-  private int targetIndex;
-  @ManyToOne(cascade = CascadeType.ALL, targetEntity = NodeImpl.class)
-  private Node source;
-  @ManyToOne(cascade = CascadeType.ALL, targetEntity = NodeImpl.class)
-  private Node target;
-
-  public SequenceFlowImpl()
-  {
-  }
-
-  public SequenceFlowImpl(Node source, Node target)
-  {
-    this.source = source;
-    this.target = target;
-    this.targetName = target.getName();
-    this.sourceIndex = source.getOutFlows().size();
-    this.targetIndex = target.getInFlows().size();
-    source.getOutFlows().add(this);
-    target.getInFlows().add(this);
-  }
-
-  public int getSourceIndex()
-  {
-    return sourceIndex;
-  }
-
-  public void setSourceIndex(int sourceIndex)
-  {
-    this.sourceIndex = sourceIndex;
-  }
-
-  public int getTargetIndex()
-  {
-    return targetIndex;
-  }
-
-  public void setTargetIndex(int targetIndex)
-  {
-    this.targetIndex = targetIndex;
-  }
-
-  /* (non-Javadoc)
-   * @see org.jbpm.test.cts.persistence.SequenceFlow#getTargetName()
-   */
-  public String getTargetName()
-  {
-    return targetName;
-  }
-
-  public void setTargetName(String targetName)
-  {
-    this.targetName = targetName;
-  }
-
-  /* (non-Javadoc)
-   * @see org.jbpm.test.cts.persistence.SequenceFlow#getSource()
-   */
-  public Node getSource()
-  {
-    return source;
-  }
-
-  public void setSource(Node source)
-  {
-    this.source = source;
-  }
-
-  /* (non-Javadoc)
-   * @see org.jbpm.test.cts.persistence.SequenceFlow#getTarget()
-   */
-  public Node getTarget()
-  {
-    return target;
-  }
-
-  public void setTarget(Node target)
-  {
-    this.target = target;
-  }
-
-  @Override
-  public String toString()
-  {
-    return "[" + source.getName() + "->" + target.getName() + "]";
-  }
-}
\ No newline at end of file

Copied: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/processbuilder (from rev 2418, projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/processbuilder)

Deleted: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/processbuilder/ProcessBuilderTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/processbuilder/ProcessBuilderTest.java	2008-09-29 05:50:29 UTC (rev 2418)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/processbuilder/ProcessBuilderTest.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -1,180 +0,0 @@
-/*
- * 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.jbpm.test.cts.processbuilder;
-
-// $Id$
-
-import org.jbpm.api.InvalidProcessException;
-import org.jbpm.api.client.ProcessEngine;
-import org.jbpm.api.model.Process;
-import org.jbpm.api.model.builder.ProcessBuilder;
-import org.jbpm.api.test.CTSTestCase;
-
-/**
- * Test the ProcessBuilder
- * 
- * @author thomas.diesler at jboss.com
- * @since 24-Sep-2008
- */
-public class ProcessBuilderTest extends CTSTestCase
-{
-  public void testBasicProcess() throws Exception
-  {
-    Process proc = TestProcessBuilder.getTrivalProcess();
-    TestProcessBuilder.validateTrivialProcess(proc);
-  }
-
-  public void testNoProcessName() throws Exception
-  {
-    ProcessEngine engine = ProcessEngine.getProcessEngine();
-    ProcessBuilder builder = engine.getService(ProcessBuilder.class);
-    builder.addProcess(null).addStartEvent("Start").addSequenceFlow("Task");
-    builder.addTask("Task").addSequenceFlow("End").addEndEvent("End");
-    try
-    {
-      builder.getProcess();
-      fail("Process name required");
-    }
-    catch (InvalidProcessException e)
-    {
-      // expected
-    }
-  }
-
-  public void testNoStartName() throws Exception
-  {
-    ProcessEngine engine = ProcessEngine.getProcessEngine();
-    ProcessBuilder builder = engine.getService(ProcessBuilder.class);
-    builder.addProcess("Proc").addStartEvent(null).addSequenceFlow("Task");
-    builder.addTask("Task").addSequenceFlow("End").addEndEvent("End");
-    try
-    {
-      builder.getProcess();
-      fail("StartEvent name required");
-    }
-    catch (InvalidProcessException e)
-    {
-      // expected
-    }
-  }
-
-  public void testNoTaskName() throws Exception
-  {
-    ProcessEngine engine = ProcessEngine.getProcessEngine();
-    ProcessBuilder builder = engine.getService(ProcessBuilder.class);
-    builder.addProcess("Proc").addStartEvent("Start").addSequenceFlow("Task");
-    builder.addTask(null).addSequenceFlow("End").addEndEvent("End");
-    try
-    {
-      builder.getProcess();
-      fail("Task name required");
-    }
-    catch (InvalidProcessException e)
-    {
-      // expected
-    }
-  }
-
-  public void testNoEndName() throws Exception
-  {
-    ProcessEngine engine = ProcessEngine.getProcessEngine();
-    ProcessBuilder builder = engine.getService(ProcessBuilder.class);
-    builder.addProcess("Proc").addStartEvent("Start").addSequenceFlow("Task");
-    builder.addTask("Task").addSequenceFlow("End").addEndEvent(null);
-    try
-    {
-      builder.getProcess();
-      fail("EndEvent name required");
-    }
-    catch (InvalidProcessException e)
-    {
-      // expected
-    }
-  }
-
-  public void testNoStartEvent() throws Exception
-  {
-    ProcessEngine engine = ProcessEngine.getProcessEngine();
-    ProcessBuilder builder = engine.getService(ProcessBuilder.class);
-    builder.addProcess("Proc").addTask("Task").addSequenceFlow("End").addEndEvent("End");
-    try
-    {
-      builder.getProcess();
-      fail("StartEvent required");
-    }
-    catch (InvalidProcessException e)
-    {
-      // expected
-    }
-  }
-
-  public void testNoEndEvent() throws Exception
-  {
-    ProcessEngine engine = ProcessEngine.getProcessEngine();
-    ProcessBuilder builder = engine.getService(ProcessBuilder.class);
-    builder.addProcess("Proc").addStartEvent("Start").addSequenceFlow("Task");
-    builder.addTask("Task");
-    try
-    {
-      builder.getProcess();
-      fail("EndEvent required");
-    }
-    catch (InvalidProcessException e)
-    {
-      // expected
-    }
-  }
-
-  public void testUnreachableNode() throws Exception
-  {
-    ProcessEngine engine = ProcessEngine.getProcessEngine();
-    ProcessBuilder builder = engine.getService(ProcessBuilder.class);
-    builder.addProcess("Proc").addStartEvent("Start").addSequenceFlow("Task1");
-    builder.addTask("Task1").addSequenceFlow("End").addTask("Task2").addSequenceFlow("End").addEndEvent("End");
-    try
-    {
-      builder.getProcess();
-      fail("Unreachable node Task2");
-    }
-    catch (InvalidProcessException e)
-    {
-      // expected
-    }
-  }
-
-  public void testDeadEndNode() throws Exception
-  {
-    ProcessEngine engine = ProcessEngine.getProcessEngine();
-    ProcessBuilder builder = engine.getService(ProcessBuilder.class);
-    builder.addProcess("Proc").addStartEvent("Start").addSequenceFlow("Task");
-    builder.addTask("Task").addEndEvent("End");
-    try
-    {
-      builder.getProcess();
-      fail("Dead end Task");
-    }
-    catch (InvalidProcessException e)
-    {
-      // expected
-    }
-  }
-}

Copied: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/processbuilder/ProcessBuilderTest.java (from rev 2438, projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/processbuilder/ProcessBuilderTest.java)
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/processbuilder/ProcessBuilderTest.java	                        (rev 0)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/processbuilder/ProcessBuilderTest.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -0,0 +1,180 @@
+/*
+ * 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.jbpm.test.cts.service.processbuilder;
+
+// $Id$
+
+import org.jbpm.api.InvalidProcessException;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.model.builder.ProcessBuilder;
+import org.jbpm.api.test.CTSTestCase;
+
+/**
+ * Test the ProcessBuilder
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 24-Sep-2008
+ */
+public class ProcessBuilderTest extends CTSTestCase
+{
+  public void testBasicProcess() throws Exception
+  {
+    Process proc = TestProcessBuilder.getTrivalProcess();
+    TestProcessBuilder.validateTrivialProcess(proc);
+  }
+
+  public void testNoProcessName() throws Exception
+  {
+    ProcessEngine engine = ProcessEngine.getProcessEngine();
+    ProcessBuilder builder = engine.getService(ProcessBuilder.class);
+    builder.addProcess(null).addStartEvent("Start").addSequenceFlow("Task");
+    builder.addTask("Task").addSequenceFlow("End").addEndEvent("End");
+    try
+    {
+      builder.getProcess();
+      fail("Process name required");
+    }
+    catch (InvalidProcessException e)
+    {
+      // expected
+    }
+  }
+
+  public void testNoStartName() throws Exception
+  {
+    ProcessEngine engine = ProcessEngine.getProcessEngine();
+    ProcessBuilder builder = engine.getService(ProcessBuilder.class);
+    builder.addProcess("Proc").addStartEvent(null).addSequenceFlow("Task");
+    builder.addTask("Task").addSequenceFlow("End").addEndEvent("End");
+    try
+    {
+      builder.getProcess();
+      fail("StartEvent name required");
+    }
+    catch (InvalidProcessException e)
+    {
+      // expected
+    }
+  }
+
+  public void testNoTaskName() throws Exception
+  {
+    ProcessEngine engine = ProcessEngine.getProcessEngine();
+    ProcessBuilder builder = engine.getService(ProcessBuilder.class);
+    builder.addProcess("Proc").addStartEvent("Start").addSequenceFlow("Task");
+    builder.addTask(null).addSequenceFlow("End").addEndEvent("End");
+    try
+    {
+      builder.getProcess();
+      fail("Task name required");
+    }
+    catch (InvalidProcessException e)
+    {
+      // expected
+    }
+  }
+
+  public void testNoEndName() throws Exception
+  {
+    ProcessEngine engine = ProcessEngine.getProcessEngine();
+    ProcessBuilder builder = engine.getService(ProcessBuilder.class);
+    builder.addProcess("Proc").addStartEvent("Start").addSequenceFlow("Task");
+    builder.addTask("Task").addSequenceFlow("End").addEndEvent(null);
+    try
+    {
+      builder.getProcess();
+      fail("EndEvent name required");
+    }
+    catch (InvalidProcessException e)
+    {
+      // expected
+    }
+  }
+
+  public void testNoStartEvent() throws Exception
+  {
+    ProcessEngine engine = ProcessEngine.getProcessEngine();
+    ProcessBuilder builder = engine.getService(ProcessBuilder.class);
+    builder.addProcess("Proc").addTask("Task").addSequenceFlow("End").addEndEvent("End");
+    try
+    {
+      builder.getProcess();
+      fail("StartEvent required");
+    }
+    catch (InvalidProcessException e)
+    {
+      // expected
+    }
+  }
+
+  public void testNoEndEvent() throws Exception
+  {
+    ProcessEngine engine = ProcessEngine.getProcessEngine();
+    ProcessBuilder builder = engine.getService(ProcessBuilder.class);
+    builder.addProcess("Proc").addStartEvent("Start").addSequenceFlow("Task");
+    builder.addTask("Task");
+    try
+    {
+      builder.getProcess();
+      fail("EndEvent required");
+    }
+    catch (InvalidProcessException e)
+    {
+      // expected
+    }
+  }
+
+  public void testUnreachableNode() throws Exception
+  {
+    ProcessEngine engine = ProcessEngine.getProcessEngine();
+    ProcessBuilder builder = engine.getService(ProcessBuilder.class);
+    builder.addProcess("Proc").addStartEvent("Start").addSequenceFlow("Task1");
+    builder.addTask("Task1").addSequenceFlow("End").addTask("Task2").addSequenceFlow("End").addEndEvent("End");
+    try
+    {
+      builder.getProcess();
+      fail("Unreachable node Task2");
+    }
+    catch (InvalidProcessException e)
+    {
+      // expected
+    }
+  }
+
+  public void testDeadEndNode() throws Exception
+  {
+    ProcessEngine engine = ProcessEngine.getProcessEngine();
+    ProcessBuilder builder = engine.getService(ProcessBuilder.class);
+    builder.addProcess("Proc").addStartEvent("Start").addSequenceFlow("Task");
+    builder.addTask("Task").addEndEvent("End");
+    try
+    {
+      builder.getProcess();
+      fail("Dead end Task");
+    }
+    catch (InvalidProcessException e)
+    {
+      // expected
+    }
+  }
+}

Deleted: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/processbuilder/TestProcessBuilder.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/processbuilder/TestProcessBuilder.java	2008-09-29 05:50:29 UTC (rev 2418)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/processbuilder/TestProcessBuilder.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -1,87 +0,0 @@
-/*
- * 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.jbpm.test.cts.processbuilder;
-
-// $Id$
-
-import junit.framework.TestCase;
-
-import org.jbpm.api.client.ProcessEngine;
-import org.jbpm.api.model.EndEvent;
-import org.jbpm.api.model.Process;
-import org.jbpm.api.model.SequenceFlow;
-import org.jbpm.api.model.StartEvent;
-import org.jbpm.api.model.Task;
-import org.jbpm.api.model.builder.ProcessBuilder;
-
-/**
- * A catalog of CTS test processes
- * 
- * @author thomas.diesler at jboss.com
- * @since 24-Sep-2008
- */
-public abstract class TestProcessBuilder
-{
-  public static Process getTrivalProcess()
-  {
-    ProcessEngine engine = ProcessEngine.getProcessEngine();
-    ProcessBuilder builder = engine.getService(ProcessBuilder.class);
-    builder.addProcess("Proc").addStartEvent("Start").addSequenceFlow("Task");
-    builder.addTask("Task").addSequenceFlow("End").addEndEvent("End");
-    Process proc = builder.getProcess();
-    return proc;
-  }
-
-  public static void validateTrivialProcess(Process wasProc)
-  {
-    TestCase.assertNotNull("Process not null", wasProc);
-    TestCase.assertEquals("Proc", wasProc.getName());
-
-    StartEvent start = (StartEvent)wasProc.getNode("Start");
-    Task task = (Task)wasProc.getNode("Task");
-    EndEvent end = (EndEvent)wasProc.getNode("End");
-
-    TestCase.assertNotNull("Start not null", start);
-    TestCase.assertNotNull("Task not null", task);
-    TestCase.assertNotNull("End not null", end);
-
-    TestCase.assertSame(wasProc, start.getProcess());
-    TestCase.assertSame(wasProc, task.getProcess());
-    TestCase.assertSame(wasProc, end.getProcess());
-
-    TestCase.assertSame(start, wasProc.getNode(StartEvent.class, "Start"));
-    TestCase.assertSame(task, wasProc.getNode(Task.class, "Task"));
-    TestCase.assertSame(end, wasProc.getNode(EndEvent.class, "End"));
-
-    SequenceFlow startFlow = start.getOutFlow();
-    TestCase.assertNotNull("Start flow not null", startFlow);
-    TestCase.assertEquals("Task", startFlow.getTargetName());
-    TestCase.assertSame(start, startFlow.getSourceRef());
-    TestCase.assertSame(task, startFlow.getTargetRef());
-
-    SequenceFlow taskFlow = task.getOutFlow();
-    TestCase.assertNotNull("Task flow not null", taskFlow);
-    TestCase.assertEquals("End", taskFlow.getTargetName());
-    TestCase.assertSame(task, taskFlow.getSourceRef());
-    TestCase.assertSame(end, taskFlow.getTargetRef());
-  }
-}

Copied: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/processbuilder/TestProcessBuilder.java (from rev 2438, projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/processbuilder/TestProcessBuilder.java)
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/processbuilder/TestProcessBuilder.java	                        (rev 0)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/processbuilder/TestProcessBuilder.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -0,0 +1,87 @@
+/*
+ * 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.jbpm.test.cts.service.processbuilder;
+
+// $Id$
+
+import junit.framework.TestCase;
+
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.EndEvent;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.model.SequenceFlow;
+import org.jbpm.api.model.StartEvent;
+import org.jbpm.api.model.Task;
+import org.jbpm.api.model.builder.ProcessBuilder;
+
+/**
+ * A catalog of CTS test processes
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 24-Sep-2008
+ */
+public abstract class TestProcessBuilder
+{
+  public static Process getTrivalProcess()
+  {
+    ProcessEngine engine = ProcessEngine.getProcessEngine();
+    ProcessBuilder builder = engine.getService(ProcessBuilder.class);
+    builder.addProcess("Proc").addStartEvent("Start").addSequenceFlow("Task");
+    builder.addTask("Task").addSequenceFlow("End").addEndEvent("End");
+    Process proc = builder.getProcess();
+    return proc;
+  }
+
+  public static void validateTrivialProcess(Process wasProc)
+  {
+    TestCase.assertNotNull("Process not null", wasProc);
+    TestCase.assertEquals("Proc", wasProc.getName());
+
+    StartEvent start = (StartEvent)wasProc.getNode("Start");
+    Task task = (Task)wasProc.getNode("Task");
+    EndEvent end = (EndEvent)wasProc.getNode("End");
+
+    TestCase.assertNotNull("Start not null", start);
+    TestCase.assertNotNull("Task not null", task);
+    TestCase.assertNotNull("End not null", end);
+
+    TestCase.assertSame(wasProc, start.getProcess());
+    TestCase.assertSame(wasProc, task.getProcess());
+    TestCase.assertSame(wasProc, end.getProcess());
+
+    TestCase.assertSame(start, wasProc.getNode(StartEvent.class, "Start"));
+    TestCase.assertSame(task, wasProc.getNode(Task.class, "Task"));
+    TestCase.assertSame(end, wasProc.getNode(EndEvent.class, "End"));
+
+    SequenceFlow startFlow = start.getOutFlow();
+    TestCase.assertNotNull("Start flow not null", startFlow);
+    TestCase.assertEquals("Task", startFlow.getTargetName());
+    TestCase.assertSame(start, startFlow.getSourceRef());
+    TestCase.assertSame(task, startFlow.getTargetRef());
+
+    SequenceFlow taskFlow = task.getOutFlow();
+    TestCase.assertNotNull("Task flow not null", taskFlow);
+    TestCase.assertEquals("End", taskFlow.getTargetName());
+    TestCase.assertSame(task, taskFlow.getSourceRef());
+    TestCase.assertSame(end, taskFlow.getTargetRef());
+  }
+}

Added: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/signal/SignalServiceTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/signal/SignalServiceTest.java	                        (rev 0)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/signal/SignalServiceTest.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -0,0 +1,62 @@
+/*
+ * 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.jbpm.test.cts.service.signal;
+
+// $Id$
+
+import java.util.List;
+
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.Signal;
+import org.jbpm.api.model.Signal.SignalType;
+import org.jbpm.api.service.SignalService;
+import org.jbpm.api.test.CTSTestCase;
+
+/**
+ * Test the SignalService
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class SignalServiceTest extends CTSTestCase
+{
+  /**
+   * Throw a signal to the automatically registered signal listener
+   */
+  public void testSignalListener() throws Exception
+  {
+    ProcessEngine engine = ProcessEngine.getProcessEngine();
+    SignalService sigService = engine.getService(SignalService.class);
+    
+    Signal signal = new Signal(getTestID(), SignalType.USER_SIGNAL, "HelloWorld");
+    sigService.throwSignal(signal);
+    
+    List<Signal> signals = getSignals();
+    assertNotNull("Received signals not null", signals);
+    assertEquals("One signal", 1, signals.size());
+    assertEquals("HelloWorld", signals.get(0).getMessage());
+
+    // test the the signal can be retrieved by type
+    assertEquals("No signal", 0, getSignals(SignalType.SYSTEM_PROCESS_ENTER));
+    assertEquals("One signal", 1, getSignals(SignalType.USER_SIGNAL));
+  }
+}


Property changes on: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/signal/SignalServiceTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/pattern/control/sequence/SequenceTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/pattern/control/sequence/SequenceTest.java	                        (rev 0)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/pattern/control/sequence/SequenceTest.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -0,0 +1,80 @@
+/*
+ * 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.jbpm.test.pattern.control.sequence;
+
+// $Id$
+
+import java.io.IOException;
+import java.util.List;
+
+import org.jbpm.api.client.Deployment;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.model.Signal;
+import org.jbpm.api.model.Signal.SignalType;
+import org.jbpm.api.model.builder.ProcessBuilder;
+import org.jbpm.api.service.ProcessService;
+import org.jbpm.api.test.CTSTestCase;
+
+
+/**
+ * Test the basic execution sequence
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 03-Jul-2008
+ */
+public class SequenceTest extends CTSTestCase
+{
+  public void testSequence() throws Exception
+  {
+    // Start the Process
+    Process proc = getProcess();
+    
+    ProcessEngine engine = ProcessEngine.getProcessEngine();
+    ProcessService procService = engine.getService(ProcessService.class);
+    procService.registerProcess(proc);
+    
+    proc.startProcess();
+    proc.waitForEnd();
+
+    // Validate received signals
+    List<Signal> signals = getSignals();
+    assertEquals(SignalType.SYSTEM_PROCESS_ENTER, signals.get(0).getSignalType());
+    assertEquals(SignalType.SYSTEM_START_EVENT_ENTER, signals.get(1).getSignalType());
+    assertEquals(SignalType.SYSTEM_START_EVENT_EXIT, signals.get(2).getSignalType());
+    assertEquals(SignalType.SYSTEM_TASK_ENTER, signals.get(3).getSignalType());
+    assertEquals(SignalType.SYSTEM_TASK_EXIT, signals.get(4).getSignalType());
+    assertEquals(SignalType.SYSTEM_END_EVENT_ENTER, signals.get(5).getSignalType());
+    assertEquals(SignalType.SYSTEM_END_EVENT_EXIT, signals.get(6).getSignalType());
+    assertEquals(SignalType.SYSTEM_PROCESS_EXIT, signals.get(7).getSignalType());
+  }
+
+  public Process getProcess() throws IOException
+  {
+    ProcessEngine engine = ProcessEngine.getProcessEngine();
+    ProcessBuilder builder = engine.getService(ProcessBuilder.class);
+    builder.addProcess("Proc").addStartEvent("Start").addSequenceFlow("Task");
+    builder.addTask("Task").addSequenceFlow("End").addEndEvent("End");
+    Process proc = builder.getProcess();
+    return proc;
+  }
+}


Property changes on: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/pattern/control/sequence/SequenceTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/model/NodeImpl.java
===================================================================
--- projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/model/NodeImpl.java	2008-09-29 13:35:02 UTC (rev 2438)
+++ projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/model/NodeImpl.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -24,7 +24,10 @@
 //$Id$
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import javax.persistence.Basic;
 import javax.persistence.CascadeType;
@@ -34,6 +37,7 @@
 import javax.persistence.InheritanceType;
 import javax.persistence.ManyToOne;
 import javax.persistence.OneToMany;
+import javax.persistence.Transient;
 
 import org.hibernate.annotations.IndexColumn;
 import org.jbpm.api.InvalidProcessException;
@@ -41,8 +45,13 @@
 import org.jbpm.api.model.EndEvent;
 import org.jbpm.api.model.Node;
 import org.jbpm.api.model.Process;
+import org.jbpm.api.model.Property;
 import org.jbpm.api.model.SequenceFlow;
 import org.jbpm.api.model.StartEvent;
+import org.jbpm.api.runtime.ExecutionHandler;
+import org.jbpm.api.runtime.FlowHandler;
+import org.jbpm.api.runtime.SignalHandler;
+import org.jbpm.api.runtime.Token;
 import org.jbpm.ri.model.builder.MultipleInFlowSupport;
 import org.jbpm.ri.model.builder.MultipleOutFlowSupport;
 import org.jbpm.ri.model.builder.SingleInFlowSupport;
@@ -63,17 +72,32 @@
 
   @Basic
   private String name;
+
   @ManyToOne(targetEntity = ProcessImpl.class)
   private Process process;
+
   @Basic
   private int nodeIndex;
+
+  @IndexColumn(name = "targetIndex")
   @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER, mappedBy = "targetRef", targetEntity = SequenceFlowImpl.class)
-  @IndexColumn(name = "targetIndex")
   protected List<SequenceFlow> inFlows = new ArrayList<SequenceFlow>();
+
+  @IndexColumn(name = "sourceIndex")
   @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER, mappedBy = "sourceRef", targetEntity = SequenceFlowImpl.class)
-  @IndexColumn(name = "sourceIndex")
   protected List<SequenceFlow> outFlows = new ArrayList<SequenceFlow>();
 
+  @Transient
+  // @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, targetEntity = PropertyImpl.class)
+  private Set<Property> properties = new HashSet<Property>();
+
+  @Basic
+  private String executionHandler;
+  @Basic
+  private String signalHandler;
+  @Basic
+  private String flowHandler;
+  
   public NodeImpl(String name)
   {
     this.name = name;
@@ -110,6 +134,26 @@
     this.name = name;
   }
 
+  public Property getProperty(String name)
+  {
+    for (Property prop : properties)
+    {
+      if (prop.getName().equals(name))
+        return prop;
+    }
+    return null;
+  }
+
+  public Set<String> getPropertyNames()
+  {
+    Set<String> propNames = new HashSet<String>();
+    for (Property prop : properties)
+    {
+      propNames.add(prop.getName());
+    }
+    return Collections.unmodifiableSet(propNames);
+  }
+
   public List<SequenceFlow> getInFlows()
   {
     return inFlows;
@@ -120,6 +164,21 @@
     return outFlows;
   }
 
+  public ExecutionHandler getExecutionHandler()
+  {
+    return new ExecutionHandler()
+    {
+      public void execute(Token token)
+      {
+        // nothing to do
+      }
+    };
+  }
+
+  public abstract FlowHandler getFlowHandler();
+
+  public abstract SignalHandler getSignalHandler();
+
   @Override
   protected void initialize(Process proc)
   {
@@ -180,6 +239,14 @@
       throw new InvalidProcessException("Dead end node: " + this);
   }
 
+  /**
+   * Reset the Node's state
+   */
+  public void reset()
+  {
+    // noting to do
+  }
+
   private void initFlow(Process proc, SequenceFlowImpl flow)
   {
     if (flow != null)

Modified: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/model/ProcessImpl.java
===================================================================
--- projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/model/ProcessImpl.java	2008-09-29 13:35:02 UTC (rev 2438)
+++ projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/model/ProcessImpl.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -24,7 +24,10 @@
 //$Id$
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import javax.management.ObjectName;
 import javax.persistence.Basic;
@@ -40,12 +43,15 @@
 import org.jbpm.api.Constants;
 import org.jbpm.api.InvalidProcessException;
 import org.jbpm.api.NotImplementedException;
+import org.jbpm.api.client.ProcessEngine;
 import org.jbpm.api.model.EndEvent;
 import org.jbpm.api.model.Node;
 import org.jbpm.api.model.Process;
+import org.jbpm.api.model.Property;
 import org.jbpm.api.model.StartEvent;
 import org.jbpm.api.model.builder.ObjectNameFactory;
 import org.jbpm.api.runtime.Attachments;
+import org.jbpm.api.service.ExecutionService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -66,13 +72,16 @@
   @Basic
   private String name;
   
+  @Enumerated(EnumType.STRING)
+  private ProcessStatus status = ProcessStatus.None;
+  
+  @IndexColumn(name = "nodeIndex")
   @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "process", targetEntity = NodeImpl.class)
-  @IndexColumn(name = "nodeIndex")
   private List<Node> nodes = new ArrayList<Node>();
   
-  @Enumerated(EnumType.STRING)
-  private ProcessStatus status = ProcessStatus.None;
-  
+  @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, targetEntity = PropertyImpl.class)
+  private Set<Property> properties = new HashSet<Property>();
+
   @Transient 
   private transient RuntimeException runtimeException; 
 
@@ -116,6 +125,26 @@
     this.status = status;
   }
 
+  public Property getProperty(String name)
+  {
+    for (Property prop : properties)
+    {
+      if (prop.getName().equals(name))
+        return prop;
+    }
+    return null;
+  }
+
+  public Set<String> getPropertyNames()
+  {
+    Set<String> propNames = new HashSet<String>();
+    for (Property prop : properties)
+    {
+      propNames.add(prop.getName());
+    }
+    return Collections.unmodifiableSet(propNames);
+  }
+  
   public void addNode(NodeImpl nodeImpl)
   {
     if (nodeImpl == null)
@@ -202,6 +231,18 @@
     status = ProcessStatus.Ready;
   }
   
+  public void resetProcess()
+  {
+    log.debug("Reset process: " + this);
+    for (Node node : getNodes())
+    {
+      NodeImpl nodeImpl = (NodeImpl)node;
+      nodeImpl.reset();
+    }
+    status = ProcessStatus.Ready;
+    runtimeException = null;
+  }
+
   // Runtime Aspects ====================================================================================================
   
   public RuntimeException getRuntimeException()
@@ -227,6 +268,9 @@
 
   private ObjectName startProcessInternal(Attachments att)
   {
+    ProcessEngine engine = ProcessEngine.getProcessEngine();
+    ExecutionService exService = engine.getService(ExecutionService.class);
+    exService.startProcess(this, att);
     return getKey();
   }
 

Added: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/model/PropertyImpl.java
===================================================================
--- projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/model/PropertyImpl.java	                        (rev 0)
+++ projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/model/PropertyImpl.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -0,0 +1,83 @@
+/*
+ * 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.jbpm.ri.model;
+
+//$Id$
+
+import javax.persistence.Basic;
+import javax.persistence.Entity;
+
+import org.jbpm.api.model.Property;
+
+/**
+ * A Property, which is used in the definition of attributes for a Process and common activity attributes
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+ at Entity (name = "Property")
+public class PropertyImpl implements Property
+{
+  private static final long serialVersionUID = 1L;
+  
+  @Basic
+  private String name;
+  
+  @Basic
+  private String value;
+  
+  @Basic
+  private boolean isCorrelation;
+
+  public PropertyImpl(String name, String value)
+  {
+    this.value = value;
+    this.name = name;
+  }
+
+  public PropertyImpl(String name, String value, boolean isCorrelation)
+  {
+    this.name = name;
+    this.value = value;
+    this.isCorrelation = isCorrelation;
+  }
+
+  // persistence ctor
+  protected PropertyImpl()
+  {
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public String getValue()
+  {
+    return value;
+  }
+  
+  public boolean isCorrelation()
+  {
+    return isCorrelation;
+  }
+}


Property changes on: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/model/PropertyImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/model/SequenceFlowImpl.java
===================================================================
--- projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/model/SequenceFlowImpl.java	2008-09-29 13:35:02 UTC (rev 2438)
+++ projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/model/SequenceFlowImpl.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -117,7 +117,7 @@
     return sourceRef;
   }
 
-  void setSourceRef(Node source)
+  protected void setSourceRef(Node source)
   {
     this.sourceRef = source;
   }
@@ -127,7 +127,7 @@
     return targetRef;
   }
 
-  void setTargetRef(Node target)
+  protected void setTargetRef(Node target)
   {
     this.targetRef = target;
   }

Added: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/DelegatingExecutionContext.java
===================================================================
--- projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/DelegatingExecutionContext.java	                        (rev 0)
+++ projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/DelegatingExecutionContext.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -0,0 +1,184 @@
+/*
+ * 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.jbpm.ri.runtime;
+
+//$Id$
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.bpm.model.Activity;
+import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.Property;
+import org.jboss.bpm.runtime.ExecutionContext;
+
+/**
+ * An ExecutionContext that delegates to the current {@link Activity} or {@link Process} for property rerieval.
+ * 
+ * @author Thomas.Diesler at jboss.com
+ * @since 15-Aug-2008
+ */
+public class DelegatingExecutionContext implements ExecutionContext
+{
+  private FlowObject flowObject;
+  private ExecutionContext delegate;
+  private String activityPrefix;
+  private String procPrefix;
+  private Process proc;
+
+  DelegatingExecutionContext(FlowObject flowObject, ExecutionContext delegate)
+  {
+    this.flowObject = flowObject;
+    this.delegate = delegate;
+
+    proc = flowObject.getProcess();
+    procPrefix = proc.getName() + ".";
+    activityPrefix = procPrefix + flowObject.getName() + ".";
+  }
+
+  public Object getAttachment(String name)
+  {
+    Object value = null;
+
+    // Get activity property
+    if (flowObject instanceof Activity && name.startsWith(activityPrefix))
+    {
+      Activity activity = (Activity)flowObject;
+      String key = name.substring(activityPrefix.length());
+      Property prop = activity.getProperty(key);
+      if (prop != null)
+      {
+        value = prop.getValue();
+      }
+    }
+
+    // Get process property
+    else if (name.startsWith(procPrefix))
+    {
+      String key = name.substring(procPrefix.length());
+      Property prop = proc.getProperty(key);
+      if (prop != null)
+      {
+        value = prop.getValue();
+      }
+    }
+
+    // Fallback to execution context
+    if (value == null)
+    {
+      value = delegate.getAttachment(name);
+    }
+
+    return value;
+  }
+
+  public Collection<Key> getAttachmentKeys()
+  {
+    Collection<Key> keys = new ArrayList<Key>(delegate.getAttachmentKeys());
+
+    // Add activity property keys
+    if (flowObject instanceof Activity)
+    {
+      Activity activity = (Activity)flowObject;
+      for (Property prop : activity.getProperties())
+      {
+        Key key = new Key(null, activityPrefix + prop.getName());
+        keys.add(key);
+      }
+    }
+
+    // Add process property keys
+    for (Property prop : proc.getProperties())
+    {
+      Key key = new Key(null, procPrefix + prop.getName());
+      keys.add(key);
+    }
+
+    return keys;
+  }
+
+  public <T> T getAttachment(Class<T> clazz)
+  {
+    return delegate.getAttachment(clazz);
+  }
+
+  public <T> T getAttachment(Class<T> clazz, String name)
+  {
+    return delegate.getAttachment(clazz, name);
+  }
+
+  public <T> T addAttachment(Class<T> clazz, Object value)
+  {
+    return delegate.addAttachment(clazz, value);
+  }
+
+  public <T> T addAttachment(Class<T> clazz, String name, Object value)
+  {
+    validateAttachmentKey(name);
+    return delegate.addAttachment(clazz, name, value);
+  }
+
+  public Object addAttachment(String name, Object value)
+  {
+    validateAttachmentKey(name);
+    return delegate.addAttachment(name, value);
+  }
+
+  public <T> T removeAttachment(Class<T> clazz)
+  {
+    return delegate.removeAttachment(clazz);
+  }
+
+  public <T> T removeAttachment(Class<T> clazz, String name)
+  {
+    validateAttachmentKey(name);
+    return delegate.removeAttachment(clazz, name);
+  }
+
+  public Object removeAttachment(String name)
+  {
+    validateAttachmentKey(name);
+    return delegate.removeAttachment(name);
+  }
+
+  private void validateAttachmentKey(String name)
+  {
+    if (name.startsWith(procPrefix) || name.startsWith(activityPrefix))
+      throw new IllegalArgumentException("Invalid attachment key: " + name);
+  }
+
+  public String toString()
+  {
+    Map<Key,Object> combined = new HashMap<Key,Object>();
+    for (Key key : getAttachmentKeys())
+    {
+      if (key.getClassPart() != null)
+        combined.put(key, getAttachment(key.getClassPart(), key.getNamePart()));
+      else
+        combined.put(key, getAttachment(key.getNamePart()));
+    }
+    return combined.toString();
+  }
+}
\ No newline at end of file


Property changes on: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/DelegatingExecutionContext.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/DelegatingToken.java
===================================================================
--- projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/DelegatingToken.java	                        (rev 0)
+++ projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/DelegatingToken.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -0,0 +1,96 @@
+/*
+ * 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.jbpm.ri.runtime;
+
+//$Id$
+
+import org.jbpm.api.model.Node;
+import org.jbpm.api.model.SequenceFlow;
+import org.jbpm.api.runtime.ExecutionContext;
+import org.jbpm.api.runtime.Token;
+
+/**
+ * A {@link Token} that includes properties from the current {@link Activity}
+ * 
+ * @author Thomas.Diesler at jboss.com
+ * @since 15-Aug-2008
+ */
+public class DelegatingToken implements MutableToken
+{
+  private MutableToken delegateToken;
+  private ExecutionContext delegateContext;
+
+  public DelegatingToken(MutableToken token)
+  {
+    this.delegateToken = token;
+    
+    Node targetRef = token.getFlow().getTargetRef();
+    ExecutionContext exContext = token.getExecutionContext();
+    this.delegateContext = new DelegatingExecutionContext(targetRef, exContext);
+  }
+
+  public ExecutionContext getExecutionContext()
+  {
+    return delegateContext;
+  }
+
+  public Token copyToken()
+  {
+    return delegateToken.copyToken();
+  }
+
+  public SequenceFlow getFlow()
+  {
+    return delegateToken.getFlow();
+  }
+
+  public String getTokenID()
+  {
+    return delegateToken.getTokenID();
+  }
+
+  public TokenStatus getTokenStatus()
+  {
+    return delegateToken.getTokenStatus();
+  }
+
+  public void mergeToken(Token token)
+  {
+    delegateToken.mergeToken(token);
+  }
+
+  public void setFlow(SequenceFlow flow)
+  {
+    delegateToken.setFlow(flow);
+  }
+
+  public void setTokenStatus(TokenStatus status)
+  {
+    delegateToken.setTokenStatus(status);
+  }
+
+  public String toString()
+  {
+    Node node = getFlow().getTargetRef();
+    return "[fo=" + node + ",ctx=" + getExecutionContext() + "]";
+  }
+}
\ No newline at end of file


Property changes on: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/DelegatingToken.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/MutableToken.java
===================================================================
--- projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/MutableToken.java	                        (rev 0)
+++ projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/MutableToken.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -0,0 +1,40 @@
+/*
+ * 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.jbpm.ri.runtime;
+
+//$Id$
+
+import org.jbpm.api.model.SequenceFlow;
+import org.jbpm.api.runtime.Token;
+
+/**
+ * A Token is a descriptive construct used to describe how the flow of a Process will proceed at runtime.
+ * 
+ * @author Thomas.Diesler at jboss.com
+ * @since 20-Apr-2007
+ */
+public interface MutableToken extends Token
+{
+  void setTokenStatus(TokenStatus status);
+
+  void setFlow(SequenceFlow flow);
+}
\ No newline at end of file


Property changes on: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/MutableToken.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/RuntimeProcess.java
===================================================================
--- projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/RuntimeProcess.java	                        (rev 0)
+++ projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/RuntimeProcess.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -0,0 +1,47 @@
+/*
+ * 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.jbpm.ri.runtime;
+
+//$Id$
+
+import org.jbpm.api.runtime.TokenExecutor;
+import org.jbpm.api.model.Process;
+
+/**
+ * A RuntimeProcess add runtime behaviour to the {@link Process} <p/> To protect the engine from maligious user code it
+ * does not extend {@link Process} directly.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface RuntimeProcess
+{
+  /**
+   * Get the associated {@link Process}
+   */
+  Process getProcess();
+
+  /**
+   * Get the {@link TokenExecutor} for this {@link Process}
+   */
+  TokenExecutor getTokenExecutor();
+}
\ No newline at end of file


Property changes on: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/RuntimeProcess.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/RuntimeProcessImpl.java
===================================================================
--- projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/RuntimeProcessImpl.java	                        (rev 0)
+++ projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/RuntimeProcessImpl.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -0,0 +1,60 @@
+/*
+ * 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.jbpm.ri.runtime;
+
+//$Id$
+
+import org.jbpm.api.runtime.TokenExecutor;
+import org.jbpm.api.model.Process;
+
+/**
+ * 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 proc;
+  private TokenExecutor tokenExecutor;
+
+  public RuntimeProcessImpl(Process proc)
+  {
+    this.proc = proc;
+    this.tokenExecutor = new TokenExecutorImpl(this);
+  }
+
+  public Process getProcess()
+  {
+    return proc;
+  }
+
+  public TokenExecutor getTokenExecutor()
+  {
+    return tokenExecutor;
+  }
+  
+  public String toString()
+  {
+    return "RuntimeProcess[" + proc.getName() + ",status=" + proc.getProcessStatus() + "]";
+  }
+}
\ No newline at end of file


Property changes on: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/RuntimeProcessImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/TokenExecutorImpl.java
===================================================================
--- projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/TokenExecutorImpl.java	                        (rev 0)
+++ projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/TokenExecutorImpl.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -0,0 +1,314 @@
+/*
+ * 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.jbpm.ri.runtime;
+
+//$Id$
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.api.model.Node;
+import org.jbpm.api.model.SequenceFlow;
+import org.jbpm.api.model.Process.ProcessStatus;
+import org.jbpm.api.runtime.Token;
+import org.jbpm.api.runtime.TokenExecutor;
+import org.jbpm.api.runtime.Token.TokenStatus;
+import org.jbpm.ri.model.NodeImpl;
+import org.jbpm.ri.model.ProcessImpl;
+import org.jbpm.api.model.Process;
+
+/**
+ * The {@link FlowHandler} invokes the TokenExecutor to schedule {@link ConnectingObject} objects together with their
+ * associated {@link Token}.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class TokenExecutorImpl implements TokenExecutor
+{
+  // provide logging
+  private static final Log log = LogFactory.getLog(TokenExecutorImpl.class);
+
+  private RuntimeProcess rtProc;
+  private ExecutorService executor = Executors.newCachedThreadPool();
+  private Map<String, RunnableToken> runnableTokens = new HashMap<String, RunnableToken>();
+
+  public TokenExecutorImpl(RuntimeProcess rtProc)
+  {
+    this.rtProc = rtProc;
+  }
+
+  public Set<Token> getRunnableTokens()
+  {
+    synchronized (runnableTokens)
+    {
+      Set<Token> tokenSet = new HashSet<Token>();
+      for (RunnableToken rt : runnableTokens.values())
+        tokenSet.add(rt.getToken());
+
+      return Collections.unmodifiableSet(tokenSet);
+    }
+  }
+
+  public boolean hasRunnableTokens()
+  {
+    synchronized (runnableTokens)
+    {
+      return runnableTokens.size() > 0;
+    }
+  }
+
+  public void create(Token token, SequenceFlow initialFlow)
+  {
+    synchronized (runnableTokens)
+    {
+      MutableToken mutableToken = (MutableToken)token;
+      mutableToken.setTokenStatus(TokenStatus.Created);
+      mutableToken.setFlow(initialFlow);
+
+      log.debug("Create Token: " + token);
+
+      RunnableToken rtToken = new RunnableToken(rtProc, mutableToken);
+      runnableTokens.put(token.getTokenID(), rtToken);
+    }
+  }
+
+  public void start(Token token)
+  {
+    synchronized (runnableTokens)
+    {
+      ProcessStatus procStatus = getProcess(token).getProcessStatus();
+      if (procStatus != ProcessStatus.Ready && procStatus != ProcessStatus.Active)
+        throw new IllegalStateException("Cannot start token to process in state: " + procStatus);
+
+      log.debug("Sart Token: " + token);
+      MutableToken mutableToken = (MutableToken)token;
+      mutableToken.setTokenStatus(TokenStatus.Started);
+
+      RunnableToken rtToken = runnableTokens.get(token.getTokenID());
+      executor.submit(rtToken);
+    }
+  }
+
+  public void move(Token token, SequenceFlow flow)
+  {
+    synchronized (runnableTokens)
+    {
+      if (flow == null)
+        throw new IllegalArgumentException("Flow cannot be null");
+
+      MutableToken mutableToken = (MutableToken)token;
+      mutableToken.setFlow(flow);
+    }
+  }
+
+  public void stop(Token token)
+  {
+    synchronized (runnableTokens)
+    {
+      log.debug("Stop Token: " + token);
+      MutableToken mutableToken = (MutableToken)token;
+      mutableToken.setTokenStatus(TokenStatus.Stoped);
+    }
+  }
+
+  public void destroy(Token token)
+  {
+    synchronized (runnableTokens)
+    {
+      log.debug("Destroy Token: " + token);
+      MutableToken mutableToken = (MutableToken)token;
+      mutableToken.setTokenStatus(TokenStatus.Destroyed);
+      runnableTokens.remove(token.getTokenID());
+    }
+  }
+
+  public String suspend(Token token)
+  {
+    synchronized (runnableTokens)
+    {
+      log.debug("Suspend Token: " + token);
+      MutableToken mutableToken = (MutableToken)token;
+      mutableToken.setTokenStatus(TokenStatus.Suspended);
+      return token.getTokenID();
+    }
+  }
+
+  public Token activate(String tokenID)
+  {
+    synchronized (runnableTokens)
+    {
+      RunnableToken rtToken = runnableTokens.get(tokenID);
+      if (rtToken == null)
+        throw new IllegalStateException("Not a runnable token: " + tokenID);
+
+      Token token = rtToken.getToken();
+      if (token.getTokenStatus() != TokenStatus.Suspended)
+        throw new IllegalStateException("Activate token in state: " + token.getTokenStatus());
+
+      log.debug("Activate Token: " + token);
+      MutableToken mutableToken = (MutableToken)token;
+      mutableToken.setTokenStatus(TokenStatus.Started);
+
+      executor.submit(rtToken);
+      return token;
+    }
+  }
+
+  private Process getProcess(Token token)
+  {
+    return token.getFlow().getTargetRef().getProcess();
+  }
+
+  /****************************************************
+   * The runnable Token
+   */
+  class RunnableToken implements Runnable
+  {
+    private RuntimeProcess rtProc;
+    private TokenExecutor tokenExecutor;
+    private MutableToken token;
+
+    public RunnableToken(RuntimeProcess rtProc, MutableToken token)
+    {
+      this.tokenExecutor = rtProc.getTokenExecutor();
+      this.rtProc = rtProc;
+      this.token = token;
+    }
+
+    public Token getToken()
+    {
+      return token;
+    }
+
+    public void run()
+    {
+      Process proc = rtProc.getProcess();
+      try
+      {
+        SequenceFlow flow = token.getFlow();
+        if (flow == null)
+          throw new IllegalStateException("Cannot obtain initial flow");
+
+        TokenStatus tokStatus = token.getTokenStatus();
+        ProcessStatus procStatus = proc.getProcessStatus();
+        while (procStatus == ProcessStatus.Active && tokStatus == TokenStatus.Started)
+        {
+          // Get the target and its handlers
+          Node flowObject = token.getFlow().getTargetRef();
+          NodeImpl flowObjectImpl = (NodeImpl)flowObject;
+          SignalHandler sigHandler = getSignalHandler(flowObject);
+
+          // Synchronize execution on the target FlowObject
+          synchronized (flowObject)
+          {
+            // Create a Token that includes properties from the current Activity
+            DelegatingToken tokCopy = new DelegatingToken(token);
+
+            // Throw the Enter Signal
+            sigHandler.throwEnterSignal(tokCopy);
+
+            // Execute the target FlowObject
+            flowObjectImpl.execute(tokCopy);
+
+            // Transfer the token to the FlowHandler
+            flowObjectImpl.executeFlowHandler(tokenExecutor, tokCopy);
+
+            // Throw the Exit Signal
+            sigHandler.throwExitSignal(tokCopy);
+
+            tokStatus = token.getTokenStatus();
+            procStatus = proc.getProcessStatus();
+          }
+        }
+
+        // Notify Process on token termination
+        terminateToken(proc);
+      }
+      catch (RuntimeException rte)
+      {
+        log.error("Process aborted: " + proc, rte);
+        ((ProcessImpl)proc).setRuntimeException(rte);
+
+        log.debug("Terminate all suspended tokens");
+        Set<String> keySet = new HashSet<String>(runnableTokens.keySet());
+        for (String tokID : keySet)
+        {
+          RunnableToken rtTok = runnableTokens.get(tokID);
+          Token auxToken = rtTok.getToken();
+          if (auxToken.getTokenStatus() == TokenStatus.Suspended)
+            tokenExecutor.destroy(auxToken);
+        }
+
+        // Notify Process on token termination
+        terminateToken(proc);
+      }
+    }
+
+    private void terminateToken(Process proc)
+    {
+      // Destroy the token if not already done
+      synchronized (runnableTokens)
+      {
+        TokenStatus status = token.getTokenStatus();
+        if (status != TokenStatus.Suspended && status != TokenStatus.Destroyed)
+          tokenExecutor.destroy(token);
+      }
+
+      // Notify the runtime process
+      synchronized (rtProc)
+      {
+        rtProc.notifyAll();
+      }
+    }
+
+    private SignalHandler getSignalHandler(Node target)
+    {
+      HandlerSupport handlerSupport = getHandlerSupport(target);
+      SignalHandler handler = handlerSupport.getSignalHandler();
+      if (handler == null)
+        throw new IllegalStateException("Cannot obtain signal handler from: " + target);
+
+      return handler;
+    }
+
+    private HandlerSupport getHandlerSupport(FlowObject fo)
+    {
+      if (fo instanceof HandlerSupport == false)
+        throw new IllegalStateException("Flow object does not implement handler support: " + fo);
+      return (HandlerSupport)fo;
+    }
+
+    @Override
+    public String toString()
+    {
+      return token.toString();
+    }
+  }
+}
\ No newline at end of file


Property changes on: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/TokenExecutorImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/TokenImpl.java
===================================================================
--- projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/TokenImpl.java	                        (rev 0)
+++ projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/TokenImpl.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -0,0 +1,124 @@
+/*
+ * 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.jbpm.ri.runtime;
+
+//$Id$
+
+import org.jboss.util.id.UID;
+import org.jbpm.api.model.SequenceFlow;
+import org.jbpm.api.runtime.Attachments;
+import org.jbpm.api.runtime.BasicExecutionContext;
+import org.jbpm.api.runtime.ExecutionContext;
+import org.jbpm.api.runtime.Token;
+import org.jbpm.api.runtime.Attachments.Key;
+
+/**
+ * A Token is a descriptive construct used to describe how the flow of a Process will proceed at runtime.
+ * 
+ * By tracking how the Token traverses the Flow Objects, gets diverted through alternative paths, 
+ * and gets split into parallel paths, the normal Sequence Flow should be completely definable.
+ * 
+ * A Token will have a unique identity that can be used to separate multiple Tokens that may exist because of 
+ * concurrent process instances or the splitting of the Token for parallel processing within a single process instance.
+ * 
+ * @author Thomas.Diesler at jboss.com
+ * @since 20-Apr-2007
+ */
+public class TokenImpl implements MutableToken
+{
+  private String id;
+  private SequenceFlow flow;
+  private ExecutionContext context;
+  private TokenStatus status;
+
+  /**
+   * Construct a Token with given {@link Attachments}
+   */
+  public TokenImpl(Attachments att)
+  {
+    this.context = new BasicExecutionContext(att);
+    this.id = new UID().toString();
+    this.status = TokenStatus.Created;
+  }
+
+  public String getTokenID()
+  {
+    return id;
+  }
+
+  public TokenStatus getTokenStatus()
+  {
+    return status;
+  }
+
+  public void setTokenStatus(TokenStatus status)
+  {
+    this.status = status;
+  }
+  
+  public ExecutionContext getExecutionContext()
+  {
+    return context;
+  }
+  
+  public SequenceFlow getFlow()
+  {
+    return flow;
+  }
+
+  public void setFlow(SequenceFlow flow)
+  {
+    this.flow = flow;
+  }
+
+  /**
+   * Create a schallow copy of this Token.
+   * <p/>
+   * The content in the {@link ExecutionContext} will be copied by reference. 
+   */
+  public Token copyToken()
+  {
+    return new TokenImpl(context);
+  }
+  
+  /**
+   * Merge this Token with another token.
+   */
+  public void mergeToken(Token token)
+  {
+    ExecutionContext mergeContext = token.getExecutionContext();
+    for(Key key : mergeContext.getAttachmentKeys())
+    {
+      Object mergeValue = mergeContext.getAttachment(key.getClassPart(), key.getNamePart());
+      Object existValue = context.getAttachment(key.getClassPart(), key.getNamePart());
+      if (existValue != null && existValue.equals(mergeValue) == false)
+        throw new IllegalStateException("Cannot merge the same key with different values: " + key);
+      
+      context.addAttachment(key.getClassPart(), key.getNamePart(), mergeValue);
+    }
+  }
+  
+  public String toString()
+  {
+    return "[sf=" + getFlow() + ",status=" + getTokenStatus() + ",ctx=" + getExecutionContext() + "]";
+  }
+}
\ No newline at end of file


Property changes on: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/runtime/TokenImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/service/ExecutionManagerImpl.java
===================================================================
--- projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/service/ExecutionManagerImpl.java	                        (rev 0)
+++ projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/service/ExecutionManagerImpl.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -0,0 +1,354 @@
+/*
+ * 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.jbpm.ri.service;
+
+// $Id$
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.ObjectName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.api.BPMException;
+import org.jbpm.api.InvalidProcessException;
+import org.jbpm.api.ProcessTimeoutException;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.model.Signal;
+import org.jbpm.api.model.StartEvent;
+import org.jbpm.api.model.Process.ProcessStatus;
+import org.jbpm.api.model.Signal.SignalType;
+import org.jbpm.api.model.StartEvent.TriggerType;
+import org.jbpm.api.runtime.Attachments;
+import org.jbpm.api.runtime.TokenExecutor;
+import org.jbpm.api.service.ExecutionService;
+import org.jbpm.api.service.ProcessService;
+import org.jbpm.api.service.SignalService;
+import org.jbpm.ri.model.ProcessImpl;
+import org.jbpm.ri.model.SequenceFlowImpl;
+import org.jbpm.ri.runtime.RuntimeProcess;
+import org.jbpm.ri.runtime.RuntimeProcessImpl;
+import org.jbpm.ri.runtime.TokenImpl;
+
+/**
+ * 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 ExecutionService
+{
+  // provide logging
+  private static final Log log = LogFactory.getLog(ExecutionManagerImpl.class);
+
+  // The map of active runtime processes
+  private Map<ObjectName, RuntimeProcess> runtimeProcesses = new HashMap<ObjectName, RuntimeProcess>();
+
+  @Override
+  public void startProcess(Process proc, Attachments att)
+  {
+    // Prepare the process for start
+    startProcessPrepare(proc);
+    
+    // Get the None Start Event if there is one and start the initial flow
+    StartEvent start = getNoneStartEvent(proc);
+    if (start != null)
+    {
+      if (proc.getProcessStatus() == ProcessStatus.Active)
+        throw new IllegalStateException("Cannot start an already active process");
+      
+      startProcessInternal(start, att);
+    }
+  }
+
+  @Override
+  public void startProcess(StartEvent start, Attachments att)
+  {
+    // Prepare the process for start
+    startProcessPrepare(start.getProcess());
+    
+    startProcessInternal(start, att);
+  }
+
+  private synchronized void startProcessInternal(StartEvent start, Attachments att)
+  {
+    @SuppressWarnings("serial")
+    class InitialFlow extends SequenceFlowImpl
+    {
+      InitialFlow(StartEvent start)
+      {
+        super(start.getName());
+        setTargetRef(start);
+      }
+    }
+    
+    Process proc = start.getProcess();
+    RuntimeProcess rtProc = getRuntimeProcess(proc, false);
+    boolean startProcessThread = (rtProc == null); 
+
+    // Create initial Token
+    TokenImpl initialToken = new TokenImpl(att);
+    InitialFlow initialFlow = new InitialFlow(start);
+    initialToken.setFlow(initialFlow);
+    
+    // Register the initial Token 
+    rtProc = getRuntimeProcess(proc, true);
+    TokenExecutor tokenExecutor = rtProc.getTokenExecutor();
+    tokenExecutor.create(initialToken, initialFlow);
+    
+    // Start a new process thread
+    if (startProcessThread)
+    {
+      RunnableProcess runnable = new RunnableProcess(rtProc);
+      getProcessExecutor().execute(runnable);
+      synchronized (proc)
+      {
+        while (proc.getProcessStatus() != ProcessStatus.Active)
+        {
+          try
+          {
+            proc.wait();
+          }
+          catch (InterruptedException ex)
+          {
+            log.error(ex);
+          }
+        }
+      }
+    }
+    
+    // Do the start time assignments
+    // startTimeAssignments(proc, initialToken);
+    
+    // Start the initial token
+    tokenExecutor.start(initialToken);
+  }
+
+  private void startProcessPrepare(Process proc)
+  {
+    // Reset the process if already terminated
+    ProcessImpl procImpl = (ProcessImpl)proc;
+    if (isProcessTerminated(proc))
+      procImpl.resetProcess();
+    
+    ProcessStatus procStatus = proc.getProcessStatus();
+    if (procStatus != ProcessStatus.Ready && procStatus != ProcessStatus.Active)
+      throw new IllegalStateException("Cannot start process in state: " + procStatus);
+
+    // Register the process if needed
+    ProcessEngine engine = ProcessEngine.getProcessEngine();
+    ProcessService procService = engine.getService(ProcessService.class);
+    if (procService.getProcessByKey(proc.getKey()) == null)
+      procService.registerProcess(proc);
+  }
+
+  public ProcessStatus waitForEnd(Process proc)
+  {
+    return waitForEndInternal(proc, 0);
+  }
+
+  public ProcessStatus waitForEnd(Process proc, long timeout)
+  {
+    return waitForEndInternal(proc, timeout);
+  }
+
+  /**
+   * Wait for the Process to end. All Tokens that are generated at the Start Event for that Process must eventually
+   * arrive at an End Event. The Process will be in a running state until all Tokens are consumed. If the process was
+   * aborted this method throws the causing RuntimeException if avaialable.
+   */
+  private ProcessStatus waitForEndInternal(Process proc, long timeout)
+  {
+    ProcessImpl procImpl = (ProcessImpl)proc;
+    
+    ProcessStatus status = proc.getProcessStatus();
+    if (status == ProcessStatus.None)
+      throw new IllegalStateException("Cannot wait for process in state: " + status);
+
+    // Wait a little for the process to end
+    boolean forever = (timeout < 1);
+    long now = System.currentTimeMillis();
+    long until = now + timeout;
+    try
+    {
+      while (forever || now < until)
+      {
+        synchronized (proc)
+        {
+          if (isProcessTerminated(proc))
+          {
+            if (procImpl.getRuntimeException() != null)
+            {
+              throw new BPMException("Process aborted", procImpl.getRuntimeException());
+            }
+            else
+            {
+              break;
+            }
+          }
+          
+          // Start waiting to get notified
+          long waitTimeout = forever ? 0 : until - now;
+          proc.wait(waitTimeout);
+        }
+        now = System.currentTimeMillis();
+      }
+      
+      // Throw timeout exception if it took too long
+      if (isProcessTerminated(proc) == false)
+      {
+        RuntimeException rte = new ProcessTimeoutException("Process timeout after " + timeout + "ms for: " + proc.getKey());
+        procImpl.setRuntimeException(rte);
+        log.error(rte);
+        throw rte;
+      }
+    }
+    catch (InterruptedException ex)
+    {
+      log.warn(ex);
+    }
+    finally
+    {
+      // Unregister the process if not done already
+      // this could happen when the Process never received a start signal
+      // and then we get here because of a ProcessTimeoutException
+      ProcessEngine engine = ProcessEngine.getProcessEngine();
+      ProcessService procService = engine.getService(ProcessService.class);
+      if (procService.getProcessByKey(proc.getKey()) != null)
+        procService.unregisterProcess(proc);
+    }
+
+    
+    status = proc.getProcessStatus();
+    return status;
+  }
+  
+  private boolean isProcessTerminated(Process proc)
+  {
+    ProcessStatus status = proc.getProcessStatus();
+    return status == ProcessStatus.Cancelled || status == ProcessStatus.Completed || status == ProcessStatus.Aborted;
+  }
+  
+  private StartEvent getNoneStartEvent(Process proc)
+  {
+    StartEvent start = null;
+    for (StartEvent aux : proc.getNodes(StartEvent.class))
+    {
+      if (aux.getTriggerType() == TriggerType.None)
+      {
+        if (start != null)
+          throw new InvalidProcessException("Process cannot have multiple start events with no trigger");
+        start = aux;
+      }
+    }
+    return start;
+  }
+
+  private RuntimeProcess getRuntimeProcess(Process proc, boolean createNew)
+  {
+    RuntimeProcess rtProcess;
+    synchronized (runtimeProcesses)
+    {
+      rtProcess = runtimeProcesses.get(proc.getKey());
+      if (rtProcess == null && createNew)
+      {
+        rtProcess = new RuntimeProcessImpl(proc);
+        runtimeProcesses.put(proc.getKey(), rtProcess);
+      }
+    }
+    return rtProcess;
+  }
+
+  /***************************************************************
+   * The runnable Process
+   */
+  class RunnableProcess implements Runnable
+  {
+    private RuntimeProcess rtProc;
+
+    public RunnableProcess(RuntimeProcess rtProc)
+    {
+      this.rtProc = rtProc;
+    }
+
+    public void run()
+    {
+      TokenExecutor tokenExecutor = rtProc.getTokenExecutor();
+      ProcessImpl procImpl = (ProcessImpl)rtProc.getProcess();
+      Process proc = rtProc.getProcess();
+
+      ProcessEngine engine = ProcessEngine.getProcessEngine();
+      SignalService sigService = engine.getService(SignalService.class);
+      
+      ObjectName procID = proc.getKey();
+      String procName = proc.getName();
+      try
+      {
+        synchronized (proc)
+        {
+          procImpl.setProcessStatus(ProcessStatus.Active);
+          sigService.throwSignal(new Signal(procID, SignalType.SYSTEM_PROCESS_ENTER));
+
+          // Notify that the process is now Active
+          proc.notifyAll();
+        }
+        
+        synchronized (rtProc)
+        {
+          // Wait until there are no more runnable tokens
+          while (tokenExecutor.hasRunnableTokens())
+          {
+            try
+            {
+              rtProc.wait();
+            }
+            catch (InterruptedException ex)
+            {
+              log.error(ex);
+            }
+          }
+          
+          log.debug("End execution thread [proc=" + procName + ",status=" + proc.getProcessStatus() + "]");
+          
+          if (proc.getProcessStatus() == ProcessStatus.Active)
+            procImpl.setProcessStatus(ProcessStatus.Completed);
+        }
+      }
+      finally
+      {
+        sigService.throwSignal(new Signal(procID, Signal.SignalType.SYSTEM_PROCESS_EXIT));
+
+        synchronized (proc)
+        {
+          ProcessService procService = engine.getService(ProcessService.class);
+          procService.unregisterProcess(proc);
+          runtimeProcesses.remove(procID);
+          
+          // Notify that the process has now ended
+          proc.notifyAll();
+        }
+      }
+    }
+  }
+}
\ No newline at end of file


Property changes on: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/service/ExecutionManagerImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Deleted: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/service/HibernatePersistenceService.java
===================================================================
--- projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/service/HibernatePersistenceService.java	2008-09-29 13:35:02 UTC (rev 2438)
+++ projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/service/HibernatePersistenceService.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -1,149 +0,0 @@
-/*
- * 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.jbpm.ri.service;
-
-// $Id$
-
-import javax.management.ObjectName;
-
-import org.hibernate.Hibernate;
-import org.hibernate.ObjectNotFoundException;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.cfg.AnnotationConfiguration;
-import org.hibernate.classic.Session;
-import org.jbpm.api.ProcessNotFoundException;
-import org.jbpm.api.model.Process;
-import org.jbpm.api.service.PersistenceService;
-import org.jbpm.ri.model.AbstractElementImpl;
-import org.jbpm.ri.model.EndEventImpl;
-import org.jbpm.ri.model.NodeImpl;
-import org.jbpm.ri.model.ProcessImpl;
-import org.jbpm.ri.model.SequenceFlowImpl;
-import org.jbpm.ri.model.StartEventImpl;
-import org.jbpm.ri.model.TaskImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A Hibernate based persistence service for a process.
- * 
- * @author thomas.diesler at jboss.com
- * @since 17-Sep-2008
- */
-public class HibernatePersistenceService implements PersistenceService
-{
-  // Provide logging
-  final Logger log = LoggerFactory.getLogger(HibernatePersistenceService.class);
-  
-  private String hibernateConfig;
-  private SessionFactory sessionFactory;
-
-  public void setHibernateConfig(String hibernateConfig)
-  {
-    this.hibernateConfig = hibernateConfig;
-  }
-
-  public ObjectName saveProcess(Process proc)
-  {
-    log.debug("START saveProcess: " + proc.getKey());
-    Session session = getSessionFactory().openSession();
-    Transaction tx = session.beginTransaction();
-    try
-    {
-      session.saveOrUpdate(proc);
-      tx.commit();
-    }
-    finally
-    {
-      session.close();
-    }
-    log.debug("END saveProcess: " + proc.getKey());
-    return proc.getKey();
-  }
-
-  public Process loadProcess(ObjectName procID)
-  {
-    log.debug("START loadProcess: " + procID);
-    ProcessImpl procImpl = null;
-    Session session = getSessionFactory().openSession();
-    try
-    {
-      Integer id = Integer.valueOf(procID.getKeyProperty("id"));
-      procImpl = (ProcessImpl)session.load(ProcessImpl.class, id);
-      Hibernate.initialize(procImpl);
-    }
-    catch (ObjectNotFoundException ex)
-    {
-      throw new ProcessNotFoundException("Cannot find process: " + procID);
-    }
-    finally
-    {
-      session.close();
-    }
-    log.debug("END loadProcess: " + procID);
-    return procImpl;
-  }
-
-  public void deleteProcess(Process proc)
-  {
-    log.debug("START deleteProcess: " + proc.getKey());
-    Session session = getSessionFactory().openSession();
-    Transaction tx = session.beginTransaction();
-    try
-    {
-      session.delete(proc);
-      tx.commit();
-    }
-    finally
-    {
-      session.close();
-    }
-    log.debug("END deleteProcess: " + proc.getKey());
-  }
-
-  private SessionFactory getSessionFactory()
-  {
-    // If this property is not explicitly set in the beans config
-    // fall back to the -Ddatabase property that also activates 
-    // the corresponding mvn profiles
-    if (hibernateConfig == null)
-    {
-      String database = System.getProperty("database", "mysql");
-      hibernateConfig = "hibernate.cfg." + database + ".xml";
-    }
-
-    if (sessionFactory == null)
-    {
-      AnnotationConfiguration anConfig = new AnnotationConfiguration();
-      anConfig.addAnnotatedClass(AbstractElementImpl.class);
-      anConfig.addAnnotatedClass(EndEventImpl.class);
-      anConfig.addAnnotatedClass(NodeImpl.class);
-      anConfig.addAnnotatedClass(ProcessImpl.class);
-      anConfig.addAnnotatedClass(SequenceFlowImpl.class);
-      anConfig.addAnnotatedClass(StartEventImpl.class);
-      anConfig.addAnnotatedClass(TaskImpl.class);
-      sessionFactory = anConfig.configure(hibernateConfig).buildSessionFactory();
-    }
-    return sessionFactory;
-  }
-}

Copied: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/service/PersistenceServiceImpl.java (from rev 2422, projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/service/HibernatePersistenceService.java)
===================================================================
--- projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/service/PersistenceServiceImpl.java	                        (rev 0)
+++ projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/service/PersistenceServiceImpl.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -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.jbpm.ri.service;
+
+// $Id$
+
+import javax.management.ObjectName;
+
+import org.hibernate.Hibernate;
+import org.hibernate.ObjectNotFoundException;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.hibernate.cfg.AnnotationConfiguration;
+import org.hibernate.classic.Session;
+import org.jbpm.api.ProcessNotFoundException;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.service.PersistenceService;
+import org.jbpm.ri.model.AbstractElementImpl;
+import org.jbpm.ri.model.EndEventImpl;
+import org.jbpm.ri.model.NodeImpl;
+import org.jbpm.ri.model.ProcessImpl;
+import org.jbpm.ri.model.SequenceFlowImpl;
+import org.jbpm.ri.model.StartEventImpl;
+import org.jbpm.ri.model.TaskImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A Hibernate based persistence service for a process.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 17-Sep-2008
+ */
+public class PersistenceServiceImpl implements PersistenceService
+{
+  // Provide logging
+  final Logger log = LoggerFactory.getLogger(PersistenceServiceImpl.class);
+  
+  private String hibernateConfig;
+  private SessionFactory sessionFactory;
+
+  public void setHibernateConfig(String hibernateConfig)
+  {
+    this.hibernateConfig = hibernateConfig;
+  }
+
+  public ObjectName saveProcess(Process proc)
+  {
+    log.debug("START saveProcess: " + proc.getKey());
+    Session session = getSessionFactory().openSession();
+    Transaction tx = session.beginTransaction();
+    try
+    {
+      session.saveOrUpdate(proc);
+      tx.commit();
+    }
+    finally
+    {
+      session.close();
+    }
+    log.debug("END saveProcess: " + proc.getKey());
+    return proc.getKey();
+  }
+
+  public Process loadProcess(ObjectName procID)
+  {
+    log.debug("START loadProcess: " + procID);
+    ProcessImpl procImpl = null;
+    Session session = getSessionFactory().openSession();
+    try
+    {
+      Integer id = Integer.valueOf(procID.getKeyProperty("id"));
+      procImpl = (ProcessImpl)session.load(ProcessImpl.class, id);
+      Hibernate.initialize(procImpl);
+    }
+    catch (ObjectNotFoundException ex)
+    {
+      throw new ProcessNotFoundException("Cannot find process: " + procID);
+    }
+    finally
+    {
+      session.close();
+    }
+    log.debug("END loadProcess: " + procID);
+    return procImpl;
+  }
+
+  public void deleteProcess(Process proc)
+  {
+    log.debug("START deleteProcess: " + proc.getKey());
+    Session session = getSessionFactory().openSession();
+    Transaction tx = session.beginTransaction();
+    try
+    {
+      session.delete(proc);
+      tx.commit();
+    }
+    finally
+    {
+      session.close();
+    }
+    log.debug("END deleteProcess: " + proc.getKey());
+  }
+
+  private SessionFactory getSessionFactory()
+  {
+    // If this property is not explicitly set in the beans config
+    // fall back to the -Ddatabase property that also activates 
+    // the corresponding mvn profiles
+    if (hibernateConfig == null)
+    {
+      String database = System.getProperty("database", "mysql");
+      hibernateConfig = "hibernate.cfg." + database + ".xml";
+    }
+
+    if (sessionFactory == null)
+    {
+      AnnotationConfiguration anConfig = new AnnotationConfiguration();
+      anConfig.addAnnotatedClass(AbstractElementImpl.class);
+      anConfig.addAnnotatedClass(EndEventImpl.class);
+      anConfig.addAnnotatedClass(NodeImpl.class);
+      anConfig.addAnnotatedClass(ProcessImpl.class);
+      anConfig.addAnnotatedClass(SequenceFlowImpl.class);
+      anConfig.addAnnotatedClass(StartEventImpl.class);
+      anConfig.addAnnotatedClass(TaskImpl.class);
+      sessionFactory = anConfig.configure(hibernateConfig).buildSessionFactory();
+    }
+    return sessionFactory;
+  }
+}

Added: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/service/SignalServiceImpl.java
===================================================================
--- projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/service/SignalServiceImpl.java	                        (rev 0)
+++ projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/service/SignalServiceImpl.java	2008-09-29 15:55:54 UTC (rev 2439)
@@ -0,0 +1,36 @@
+/*
+ * 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.jbpm.ri.service;
+
+// $Id$
+
+import org.jbpm.api.service.SignalService;
+
+/**
+ * An implementation of the SignalService
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 17-Sep-2008
+ */
+public class SignalServiceImpl extends SignalService
+{
+}


Property changes on: projects/spec/trunk/modules/impl/src/main/java/org/jbpm/ri/service/SignalServiceImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/spec/trunk/modules/impl/src/main/resources/jbpm-cfg-beans.xml
===================================================================
--- projects/spec/trunk/modules/impl/src/main/resources/jbpm-cfg-beans.xml	2008-09-29 13:35:02 UTC (rev 2438)
+++ projects/spec/trunk/modules/impl/src/main/resources/jbpm-cfg-beans.xml	2008-09-29 15:55:54 UTC (rev 2439)
@@ -10,12 +10,14 @@
         <set elementClass="org.jbpm.api.service.Service">
           <inject bean="jBPMProcessBuilder" />
           <inject bean="jBPMPersistenceService" />
+          <inject bean="jBPMSignalService" />
         </set>
       </property>
     </bean>
 
     <!-- The Services -->
     <bean name="jBPMProcessBuilder" class="org.jbpm.ri.model.builder.ProcessBuilderImpl" />
-    <bean name="jBPMPersistenceService" class="org.jbpm.ri.service.HibernatePersistenceService" />
+    <bean name="jBPMPersistenceService" class="org.jbpm.ri.service.PersistenceServiceImpl" />
+    <bean name="jBPMSignalService" class="org.jbpm.ri.service.SignalServiceImpl" />
 
   </deployment>




More information about the jbpm-commits mailing list