[jbpm-commits] JBoss JBPM SVN: r5678 - in jbpm4/branches/tbaeyens/modules: jpdl/src/main/java/org/jbpm/jpdl/internal/activity and 14 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Oct 2 14:10:53 EDT 2009


Author: tom.baeyens at jboss.com
Date: 2009-10-02 14:10:51 -0400 (Fri, 02 Oct 2009)
New Revision: 5678

Added:
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/UserCodeEventListener.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/JpdlBinding.java
Removed:
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBuilder.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionConditionActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionExpressionActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndCancelBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndErrorBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlAutomaticActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlExternalActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailListener.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SqlActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SqlBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessInParameterImpl.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessOutParameterImpl.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessParameterImpl.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java
   jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/ProcessDeployer.java
Modified:
   jbpm4/branches/tbaeyens/modules/bpmn/src/main/java/org/jbpm/bpmn/deployer/BpmnDeployer.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlBindingsParser.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlDeployer.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlParser.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlVersionDeployer.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/JpdlParserV40.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/CustomActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionExpressionActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JavaActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlAutomaticActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessInParameterImpl.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessOutParameterImpl.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/CustomBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/DecisionBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EventListenerBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/GroupBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JavaBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JpdlBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/MailBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/TaskBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/JpdlParserV42.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/DecisionHandlerActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/JavaActivity.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/CustomBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/DecisionBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/EventListenerBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/GroupBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/JavaBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/MailBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/TaskBinding.java
   jbpm4/branches/tbaeyens/modules/jpdl/src/main/resources/jbpm.jpdl.bindings.v40.xml
   jbpm4/branches/tbaeyens/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlSchemaTest.java
   jbpm4/branches/tbaeyens/modules/pvm/src/main/resources/jbpm.wire.bindings.xml
   jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/classloading/DelayedInstantiationTest.java
   jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/DescriptionTest.java
   jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/taskactivity/TaskReassignTest.java
Log:
further parsing splitup

Modified: jbpm4/branches/tbaeyens/modules/bpmn/src/main/java/org/jbpm/bpmn/deployer/BpmnDeployer.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/bpmn/src/main/java/org/jbpm/bpmn/deployer/BpmnDeployer.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/bpmn/src/main/java/org/jbpm/bpmn/deployer/BpmnDeployer.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -21,20 +21,157 @@
  */
 package org.jbpm.bpmn.deployer;
 
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.List;
+
+import org.jbpm.api.ProcessDefinition;
+import org.jbpm.api.ProcessDefinitionQuery;
 import org.jbpm.bpmn.parser.BpmnParser;
-import org.jbpm.pvm.internal.repository.ProcessDeployer;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.repository.Deployer;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
+import org.jbpm.pvm.internal.session.RepositorySession;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
 
 
 /**
  * @author Tom Baeyens
  */
-public class BpmnDeployer extends ProcessDeployer {
+public class BpmnDeployer implements Deployer {
   
-  static BpmnParser bpmnParser = new BpmnParser();
-  static final String bpmnExtension = ".bpmn.xml";
+  private static final Log log = Log.getLog(BpmnDeployer.class.getName());
   
-  public BpmnDeployer() {
-    super(bpmnExtension, bpmnParser);
+  protected String extension = ".bpmn.xml";
+  protected Parser parser = new BpmnParser();
+
+  public void deploy(DeploymentImpl deployment) {
+    
+    for (String resourceName: deployment.getResourceNames()) {
+      
+      if (resourceName.endsWith(extension)) {
+        byte[] bytes = deployment.getBytes(resourceName);
+        InputStream inputStream = new ByteArrayInputStream(bytes);
+        Parse parse = parser.createParse();
+        parse.setProblems(deployment.getProblems());
+        parse.setInputStream(inputStream);
+        parse.execute();
+        List<ProcessDefinitionImpl> processDefinitions = (List<ProcessDefinitionImpl>) parse.getDocumentObject();
+        if (processDefinitions!=null) {
+          for (ProcessDefinitionImpl processDefinition : processDefinitions) {
+            if ((processDefinition != null) && (processDefinition.getName() != null)) {
+              String processDefinitionName = processDefinition.getName();
+
+              processDefinition.setSuspended(deployment.isSuspended());
+
+              String imageResourceName = resourceName.substring(0, resourceName.lastIndexOf(extension)) + ".png";
+              if (deployment.getResourceNames().contains(imageResourceName)) {
+                processDefinition.setImageResourceName(imageResourceName);
+              }
+
+              processDefinition.setDeploymentDbid(deployment.getDbid());
+
+              if (deployment.hasObjectProperties(processDefinitionName)) {
+                String key = deployment.getProcessDefinitionKey(processDefinitionName);
+                String id = deployment.getProcessDefinitionId(processDefinitionName);
+                Long version = deployment.getProcessDefinitionVersion(processDefinitionName);
+                processDefinition.setId(id);
+                processDefinition.setKey(key);
+                processDefinition.setVersion(version.intValue());
+
+              } else {
+                checkKey(processDefinition, deployment);
+                checkVersion(processDefinition, deployment);
+                checkId(processDefinition, deployment);
+
+                deployment.setProcessDefinitionId(processDefinitionName, processDefinition.getId());
+                deployment.setProcessDefinitionKey(processDefinitionName, processDefinition.getKey());
+                deployment.setProcessDefinitionVersion(processDefinitionName, new Long(processDefinition.getVersion()));
+              }
+
+              deployment.addObject(processDefinitionName, processDefinition);
+            }
+          }
+        }
+      }
+    }
   }
+  
+  protected void checkKey(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
+    String processDefinitionName = processDefinition.getName();
+    String processDefinitionKey = processDefinition.getKey();
 
+    // if no key was specified in the jpdl process file
+    if (processDefinitionKey==null) {
+      // derive the key from the name
+      // replace any non-word character with an underscore
+      processDefinitionKey = processDefinitionName.replaceAll("\\W", "_");
+      processDefinition.setKey(processDefinitionKey);
+    }
+    
+    RepositorySession repositorySession = EnvironmentImpl.getFromCurrent(RepositorySession.class);
+
+    List<ProcessDefinition> existingProcesses = repositorySession.createProcessDefinitionQuery()
+        .processDefinitionName(processDefinitionName)
+        .list();
+    
+    for (ProcessDefinition existingProcess: existingProcesses) {
+      if (!processDefinitionKey.equals(existingProcess.getKey())) {
+        deployment.addProblem("invalid key '"+processDefinitionKey+"' in process "+processDefinition.getName()+".  Existing process has name '"+processDefinitionName+"' and key '"+processDefinitionKey+"'");
+      }
+    }
+
+    existingProcesses = repositorySession.createProcessDefinitionQuery()
+        .processDefinitionKey(processDefinitionKey)
+        .list();
+    
+    for (ProcessDefinition existingProcess: existingProcesses) {
+      if (!processDefinitionName.equals(existingProcess.getName())) {
+        deployment.addProblem("invalid name '"+processDefinitionName+"' in process "+processDefinition.getName()+".  Existing process has name '"+processDefinitionName+"' and key '"+processDefinitionKey+"'");
+      }
+    }
+  }
+
+  protected void checkId(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
+    String id = processDefinition.getId();
+    if (id==null) {
+      id = processDefinition.getKey()+"-"+processDefinition.getVersion();
+      if (log.isTraceEnabled()) log.trace("created id '"+id+"' for "+processDefinition);
+      processDefinition.setId(id);
+    }
+    
+    RepositorySession repositorySession = EnvironmentImpl.getFromCurrent(RepositorySession.class);
+    ProcessDefinition existingProcessDefinition = repositorySession.createProcessDefinitionQuery()
+        .processDefinitionId(id)
+        .uniqueResult();
+    if (existingProcessDefinition != null) {
+      deployment.addProblem("process '" + id + "' already exists");
+    }
+  }
+  
+  protected void checkVersion(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
+    int version = processDefinition.getVersion();
+    String key = processDefinition.getKey();
+    if (version==ProcessDefinitionImpl.UNASSIGNED_VERSION) {
+      RepositorySession repositorySession = EnvironmentImpl.getFromCurrent(RepositorySession.class);
+      
+      ProcessDefinition latestDeployedVersion = repositorySession
+          .createProcessDefinitionQuery()
+          .processDefinitionKey(key)
+          .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+          .page(0, 1)
+          .uniqueResult();
+
+      if (latestDeployedVersion!=null) {
+        version = latestDeployedVersion.getVersion() + 1;
+      } else {
+        version = 1;
+      }
+      if (log.isTraceEnabled()) log.trace("assigning version "+version+" to process definition "+key);
+      processDefinition.setVersion(version);
+    }
+  }
 }

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBuilder.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBuilder.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBuilder.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,43 +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.jpdl.internal.activity;
-
-import org.jbpm.pvm.internal.builder.ActivityBehaviourBuilder;
-import org.jbpm.pvm.internal.builder.ActivityBuilder;
-import org.jbpm.pvm.internal.builder.CompositeBuilder;
-import org.jbpm.pvm.internal.wire.Descriptor;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DecisionBuilder extends ActivityBehaviourBuilder {
-
-  public DecisionBuilder(ActivityBuilder activityBuilder) {
-    super(activityBuilder);
-  }
-
-  public DecisionBuilder handler(Descriptor descriptor) {
-    // TODO finish this
-    return null;
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionConditionActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionConditionActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionConditionActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,69 +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.jpdl.internal.activity;
-
-import java.util.List;
-
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.pvm.internal.model.Activity;
-import org.jbpm.pvm.internal.model.Condition;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.Transition;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DecisionConditionActivity extends JpdlActivity {
-
-  private static final long serialVersionUID = 1L;
-
-  public void execute(ActivityExecution execution) {
-    execute((ExecutionImpl) execution); 
-  }
-  
-  public void execute(ExecutionImpl execution) {
-    Transition transition = findTransition(execution);
-    if (transition==null) {
-      throw new JbpmException("no outgoing transition condition evaluated to true for decision "+execution.getActivity());
-    }
-    if (transition.getName()!=null) {
-      execution.historyDecision(transition.getName());
-    }
-    execution.take(transition);
-  }
-
-  private Transition findTransition(ExecutionImpl execution) {
-    Activity activity = execution.getActivity();
-    List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
-    for (Transition transition : outgoingTransitions) {
-      Condition condition = transition.getCondition();
-      if  ( (condition==null)
-            || (condition.evaluate(execution))
-          ) {
-        return transition;
-      }
-    }
-    return null;
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionExpressionActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionExpressionActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionExpressionActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,74 +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.jpdl.internal.activity;
-
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.pvm.internal.model.Activity;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.Transition;
-import org.jbpm.pvm.internal.script.ScriptManager;
-
-/**
- * @author Tom Baeyens
- */
-public class DecisionExpressionActivity extends JpdlActivity {
-
-  private static final long serialVersionUID = 1L;
-
-  protected String expr;
-  protected String lang;
-
-  public void execute(ActivityExecution execution) {
-    execute((ExecutionImpl) execution); 
-  }
-  
-  public void execute(ExecutionImpl execution) {
-    Activity activity = execution.getActivity();
-    String transitionName = null;
-
-    ScriptManager scriptManager = ScriptManager.getScriptManager();
-    Object result = scriptManager.evaluateExpression(expr, lang);
-    if ( (result!=null)
-         && (! (result instanceof String))
-       ) {
-      throw new JbpmException("expression '"+expr+"' in decision '"+activity.getName()+"' returned "+result.getClass().getName()+" instead of a transitionName (String): "+result);
-    }
-    transitionName = (String) result;
-    
-    Transition transition = activity.getOutgoingTransition(transitionName);
-    if (transition==null) {
-      throw new JbpmException("expression '"+expr+"' in decision '"+activity.getName()+"' returned unexisting outgoing transition name: "+transitionName);
-    }
-    
-    execution.historyDecision(transitionName);
-
-    execution.take(transition);
-  }
-
-  public void setExpr(String expr) {
-    this.expr = expr;
-  }
-  public void setLang(String lang) {
-    this.lang = lang;
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,105 +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.jpdl.internal.activity;
-
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.ProcessDefinition;
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.api.jpdl.DecisionHandler;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.model.Activity;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.internal.model.Transition;
-import org.jbpm.pvm.internal.util.ReflectUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
-
-/**
- * @author Tom Baeyens
- */
-public class DecisionHandlerActivity extends JpdlActivity {
-
-  private static final long serialVersionUID = 1L;
-  
-  protected String decisionHandlerName;
-  protected Descriptor decisionHandlerDescriptor;
-  protected DecisionHandler decisionHandler;
-
-  public void execute(ActivityExecution execution) {
-    execute((ExecutionImpl) execution); 
-  }
-  
-  public void execute(ExecutionImpl execution) {
-    Activity activity = execution.getActivity();
-    
-    String transitionName = null;
-
-    DecisionHandler usedDecisionHandler = null;
-    if (decisionHandlerDescriptor!=null) {
-      
-      usedDecisionHandler = getDecisionHandler(activity.getProcessDefinition());
-      
-    } else if (decisionHandlerName!=null) {
-      EnvironmentImpl environment = EnvironmentImpl.getCurrent();
-      Object object = environment.get(decisionHandlerName);
-      if (object==null) {
-        throw new JbpmException("decision handler for "+activity+" is null");
-      }
-      if (! (object instanceof DecisionHandler)) {
-        throw new JbpmException("handler for decision is not a "+DecisionHandler.class.getName()+": "+object.getClass().getName());
-      }
-      usedDecisionHandler = (DecisionHandler) object;
-    } else {
-      throw new JbpmException("no decision handler specified");
-    }
-    
-    transitionName = usedDecisionHandler.decide(execution);
-
-    Transition transition = activity.getOutgoingTransition(transitionName);
-    if (transition==null) {
-      throw new JbpmException("handler in decision '"+activity.getName()+"' returned unexisting outgoing transition name: "+transitionName);
-    }
-    
-    execution.historyDecision(transitionName);
-
-    execution.take(transition);
-  }
-
-  public synchronized DecisionHandler getDecisionHandler(ProcessDefinition processDefinition) {
-    if ( (decisionHandlerDescriptor!=null)
-         && (decisionHandler==null)
-       ) {
-      decisionHandler = (DecisionHandler) ReflectUtil.instantiateUserCode(decisionHandlerDescriptor, (ProcessDefinitionImpl) processDefinition);
-    }
-    return decisionHandler; 
-  }
-
-  public void setDecisionHandlerName(String decisionHandlerName) {
-    this.decisionHandlerName = decisionHandlerName;
-  }
-  public void setDecisionHandler(DecisionHandler decisionHandler) {
-    this.decisionHandler = decisionHandler;
-  }
-  public void setDecisionHandlerDescriptor(Descriptor decisionHandlerDescriptor) {
-    this.decisionHandlerDescriptor = decisionHandlerDescriptor;
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,93 +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.jpdl.internal.activity;
-
-import java.util.List;
-
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.api.model.OpenExecution;
-import org.jbpm.pvm.internal.model.Activity;
-import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.Transition;
-
-
-/**
- * @author Tom Baeyens
- */
-public class EndActivity extends JpdlActivity {
-
-  private static final long serialVersionUID = 1L;
-  
-  protected boolean endProcessInstance = true;
-  protected String state = null;
-
-  public void execute(ActivityExecution execution) {
-    execute((ExecutionImpl)execution);
-  }
-  
-  public void execute(ExecutionImpl execution) {
-    Activity activity = execution.getActivity();
-    List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
-    ActivityImpl parentActivity = (ActivityImpl) activity.getParentActivity();
-
-    if ( (parentActivity!=null)
-         && ("group".equals(parentActivity.getType())) 
-       ) {
-      // if the end activity itself has an outgoing transition 
-      // (such end activities should be drawn on the border of the group)
-      if ( (outgoingTransitions!=null)
-              && (outgoingTransitions.size()==1)
-          ) {
-         Transition outgoingTransition = outgoingTransitions.get(0);
-         // taking the transition that goes over the group boundaries will 
-         // destroy the scope automatically (see atomic operation TakeTransition)
-         execution.take(outgoingTransition);
-
-      } else {
-        execution.setActivity(parentActivity);
-        execution.signal();
-      }
-        
-    } else {
-      ExecutionImpl executionToEnd = null;
-      if (endProcessInstance) {
-        executionToEnd = execution.getProcessInstance();
-      } else {
-        executionToEnd = execution;
-      }
-      
-      if (state==null) {
-        executionToEnd.end();
-      } else {
-        executionToEnd.end(state);
-      }
-    }
-  }
-  
-  public void setEndProcessInstance(boolean endProcessInstance) {
-    this.endProcessInstance = endProcessInstance;
-  }
-  public void setState(String state) {
-    this.state = state;
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,60 +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.jpdl.internal.activity;
-
-import org.jbpm.jpdl.internal.parser.JpdlBinding;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class EndBinding extends JpdlBinding {
-
-  public EndBinding() {
-    super("end");
-  }
-
-  protected EndBinding(String tag) {
-    super(tag);
-  }
-
-  public Object parse(Element element, Parse parse, Parser parser) {
-    
-    boolean endProcessInstance = true;
-    String ends = XmlUtil.attribute(element, "ends", false, parse);
-    if ("execution".equalsIgnoreCase(ends)) {
-      endProcessInstance = false;
-    }
-    
-    String state = XmlUtil.attribute(element, "state", false, parse);
-    
-    EndActivity endActivity = new EndActivity();
-    endActivity.setEndProcessInstance(endProcessInstance);
-    endActivity.setState(state);
-    
-    return endActivity;
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndCancelBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndCancelBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndCancelBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,43 +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.jpdl.internal.activity;
-
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class EndCancelBinding extends EndBinding {
-
-  public EndCancelBinding() {
-    super("end-cancel");
-  }
-
-  public Object parse(Element element, Parse parse, Parser parser) {
-    EndActivity endActivity = (EndActivity) super.parse(element, parse, parser);
-    endActivity.setState("cancel");
-    return endActivity;
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndErrorBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndErrorBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndErrorBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,43 +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.jpdl.internal.activity;
-
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class EndErrorBinding extends EndBinding {
-
-  public EndErrorBinding() {
-    super("end-error");
-  }
-
-  public Object parse(Element element, Parse parse, Parser parser) {
-    EndActivity endActivity = (EndActivity) super.parse(element, parse, parser);
-    endActivity.setState("error");
-    return endActivity;
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,95 +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.jpdl.internal.activity;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jbpm.api.Execution;
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.pvm.internal.model.Activity;
-import org.jbpm.pvm.internal.model.Condition;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.Transition;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ForkActivity extends JpdlActivity {
-
-  private static final long serialVersionUID = 1L;
-  
-  public void execute(ActivityExecution execution) {
-    execute((ExecutionImpl)execution);
-  }
-
-  public void execute(ExecutionImpl execution) {
-    Activity activity = execution.getActivity();
-
-    // evaluate the conditions and find the transitions that should be forked
-    List<Transition> forkingTransitions = new ArrayList<Transition>();
-    List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
-    for (Transition transition: outgoingTransitions) {
-      Condition condition = transition.getCondition();
-      if  ( (condition==null)
-            || (condition.evaluate(execution))
-          ) {
-        forkingTransitions.add(transition);
-      }
-    }
-
-    // if no outgoing transitions should be forked, 
-    if (forkingTransitions.size()==0) {
-      // end this execution
-      execution.end();
-      
-    // if there is exactly 1 transition to be taken, just use the incoming execution
-    } else if (forkingTransitions.size()==1) {
-      execution.take(forkingTransitions.get(0));
-      
-    // if there are more transitions
-    } else {
-      ExecutionImpl concurrentRoot = null;
-      if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
-        concurrentRoot = execution;
-        execution.setState(Execution.STATE_INACTIVE_CONCURRENT_ROOT);
-        execution.setActivity(null);
-      } else if (Execution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) {
-        concurrentRoot = execution.getParent();
-      }
-
-      for (Transition transition: forkingTransitions) {
-        // launch a concurrent path of execution
-        String childExecutionName = transition.getName();
-        ExecutionImpl concurrentExecution = concurrentRoot.createExecution(childExecutionName);
-        concurrentExecution.setActivity(activity);
-        concurrentExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
-        concurrentExecution.take(transition);
-        
-        if (concurrentRoot.isEnded()) {
-          break;
-        }
-      }
-    }
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,43 +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.jpdl.internal.activity;
-
-import org.jbpm.jpdl.internal.parser.JpdlBinding;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ForkBinding extends JpdlBinding {
-
-  public ForkBinding() {
-    super("fork");
-  }
-
-  public Object parse(Element element, Parse parse, Parser parser) {
-    return new ForkActivity();
-  }
-
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,107 +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.jpdl.internal.activity;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.jbpm.api.Execution;
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.pvm.internal.model.Activity;
-import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.Transition;
-
-
-/**
- * @author Tom Baeyens
- */
-public class GroupActivity extends JpdlExternalActivity {
-
-  private static final long serialVersionUID = 1L;
-
-  public void execute(ActivityExecution execution) {
-    execute((ExecutionImpl)execution);
-  }
-  
-  public void execute(ExecutionImpl execution) {
-    // find the start activity
-    Activity activity = execution.getActivity();
-    List<Activity> startActivities = findStartActivities(activity);
-    if (startActivities.size()==1) {
-      execution.execute(startActivities.get(0));
-    } else {
-      
-      ExecutionImpl concurrentRoot = null;
-      if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
-        concurrentRoot = execution;
-      } else if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
-        concurrentRoot = execution.getParent();
-        
-      } else {
-        throw new JbpmException("illegal state");
-      }
-      
-      for (Activity startActivity: startActivities) {
-        ExecutionImpl concurrentExecution = concurrentRoot.createExecution();
-        concurrentExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
-        concurrentExecution.execute(startActivity);
-      }
-    }
-  }
-
-  private List<Activity> findStartActivities(Activity activity) {
-    List<Activity> startActivities = new ArrayList<Activity>();
-    List nestedActivities = activity.getActivities();
-    for (ActivityImpl nestedActivity : (List<ActivityImpl>) nestedActivities) {
-      if ( (nestedActivity.getIncomingTransitions()==null)
-           || (nestedActivity.getIncomingTransitions().isEmpty())
-         ) {
-        startActivities.add(nestedActivity);
-      }
-    }
-    return startActivities;
-  }
-
-  public void signal(ActivityExecution execution, String signalName, Map<String, ?> parameters) throws Exception {
-    signal((ExecutionImpl)execution, signalName, parameters);
-  }
-
-  public void signal(ExecutionImpl execution, String signalName, Map<String, ?> parameters) throws Exception {
-    Transition transition = null;
-    Activity activity = execution.getActivity();
-    List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
-    
-    int nbrOfOutgoingTransitions  = (outgoingTransitions!=null ? outgoingTransitions.size() : 0);
-    if ( (signalName==null)
-         && (nbrOfOutgoingTransitions==1)
-       ) {
-      transition = outgoingTransitions.get(0);
-    } else {
-      transition = activity.getOutgoingTransition(signalName);
-    }
-    
-    execution.take(transition);
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -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.jpdl.internal.activity;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.model.OpenExecution;
-import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
-
-
-/**
- * @author Tom Baeyens
- */
-public class HqlActivity extends JpdlAutomaticActivity {
-  
-  private static final Log log = Log.getLog(HqlActivity.class.getName());
-
-  private static final long serialVersionUID = 1L;
-  
-  protected String query;
-  protected ListDescriptor parametersDescriptor;
-  protected String resultVariableName;
-  protected boolean isResultUnique;
-
-  public void perform(OpenExecution execution) {
-    EnvironmentImpl environment = EnvironmentImpl.getCurrent();
-    if (environment==null) {
-      throw new JbpmException("no environment for jpdl activity "+HqlBinding.TAG);
-    }
-    Session session = environment.get(Session.class);
-    
-    Query q = createQuery(session);
-    
-    if (parametersDescriptor!=null) {
-      for (Descriptor valueDescriptor: parametersDescriptor.getValueDescriptors()) {
-        String parameterName = valueDescriptor.getName();
-        Object value = WireContext.create(valueDescriptor);
-        applyParameter(q, parameterName, value);
-      }
-    }
-    
-    Object result = null;
-    if (isResultUnique) {
-      result = q.uniqueResult();
-    } else {
-      result = q.list();
-    }
-    
-    execution.setVariable(resultVariableName, result);
-  }
-
-  protected Query createQuery(Session session) {
-    return session.createQuery(query);
-  }
-
-  public void applyParameter(Query q, String parameterName, Object value) {
-    if (value instanceof String) {
-      q.setString(parameterName, (String) value);
-    } else if (value instanceof Long) {
-      q.setLong(parameterName, (Long) value);
-    } else {
-      log.error("unknown hql parameter type: "+value.getClass().getName());
-    }
-  }
-
-  public void setQuery(String query) {
-    this.query = query;
-  }
-  public void setParametersDescriptor(ListDescriptor parametersDescriptor) {
-    this.parametersDescriptor = parametersDescriptor;
-  }
-  public void setResultUnique(boolean isResultUnique) {
-    this.isResultUnique = isResultUnique;
-  }
-  public void setResultVariableName(String resultVariableName) {
-    this.resultVariableName = resultVariableName;
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,89 +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.jpdl.internal.activity;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jbpm.jpdl.internal.parser.JpdlBinding;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
-import org.jbpm.pvm.internal.wire.xml.WireParser;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class HqlBinding extends JpdlBinding {
-
-  public static final String TAG = "hql";
-
-  public HqlBinding() {
-    super(TAG);
-  }
-  
-  protected HqlBinding(String tagName) {
-    super(tagName);
-  }
-
-  public Object parse(Element element, Parse parse, Parser parser) {
-    HqlActivity hqlActivity = createHqlActivity();
-    
-    Element queryElement = XmlUtil.element(element, "query", true, parse);
-    if (queryElement!=null) {
-      String query = XmlUtil.getContentText(queryElement);
-      hqlActivity.setQuery(query);
-    }
-    
-    if (XmlUtil.attributeBoolean(element, "unique", false, parse, Boolean.FALSE)) {
-      hqlActivity.setResultUnique(true);
-    }
-    
-    String variableName = XmlUtil.attribute(element, "var", true, parse);
-    hqlActivity.setResultVariableName(variableName);
-    
-    Element parametersElement = XmlUtil.element(element, "parameters");
-    List<Element> paramElements = XmlUtil.elements(parametersElement);
-    if (!paramElements.isEmpty()) {
-      List<Descriptor> parametersDescriptor = new ArrayList<Descriptor>();
-      for (Element paramElement: paramElements) {
-        WireParser wireParser = WireParser.getInstance();
-        Descriptor paramDescriptor = (Descriptor) wireParser.parseElement(paramElement, parse, WireParser.CATEGORY_DESCRIPTOR);
-        parametersDescriptor.add(paramDescriptor);
-      }
-
-      ListDescriptor parametersListDescriptor = new ListDescriptor();
-      parametersListDescriptor.setValueDescriptors(parametersDescriptor);
-      hqlActivity.setParametersDescriptor(parametersListDescriptor);
-    }
-      
-    return hqlActivity;
-  }
-
-  protected HqlActivity createHqlActivity() {
-    return new HqlActivity();
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,118 +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.jpdl.internal.activity;
-
-import java.lang.reflect.Method;
-import java.util.List;
-
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.model.OpenExecution;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.script.ScriptManager;
-import org.jbpm.pvm.internal.util.ReflectUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.WireException;
-import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.operation.InvokeOperation;
-
-
-/**
- * @author Tom Baeyens
- */
-public class JavaActivity extends JpdlAutomaticActivity {
-
-  private static final long serialVersionUID = 1L;
-  
-  protected String targetExpression;
-  protected String targetLanguage;
-  protected Object target;
-
-  protected String methodName;
-  protected String variableName;
-  protected InvokeOperation invokeOperation;
-  
-  public void perform(OpenExecution execution) throws Exception {
-    
-    Object invocationTarget = null;
-
-    WireContext wireContext = new WireContext();
-
-    if (target!=null) {
-      invocationTarget = target;
-
-    } else if (targetExpression!=null) {
-      ScriptManager scriptManager = ScriptManager.getScriptManager();
-      invocationTarget = scriptManager.evaluateExpression(targetExpression, targetLanguage);
-    
-    } else {
-      throw new JbpmException("no target specified");
-    }
-
-    try {
-      List<ArgDescriptor> argDescriptors = null;
-      Object[] args = null;
-      if (invokeOperation!=null) {
-        argDescriptors = invokeOperation.getArgDescriptors();
-        args = ObjectDescriptor.getArgs(wireContext, argDescriptors);
-      }
-      
-      Class<?> clazz = invocationTarget.getClass();
-      Method method = ReflectUtil.findMethod(clazz, methodName, argDescriptors, args);
-      if (method==null) {
-        throw new WireException("method "+ReflectUtil.getSignature(methodName, argDescriptors, args)+" unavailable");
-      }
-
-      Object returnValue = ReflectUtil.invoke(method, invocationTarget, args);
-      
-      if (variableName!=null) {
-        execution.setVariable(variableName, returnValue);
-      }
-      
-    } catch (WireException e) {
-      throw e;
-    } catch (Exception e) {
-      throw new WireException("couldn't invoke method "+methodName+": "+e.getMessage(), e);
-    }
-  }
-
-  public void setTarget(Object target) {
-    this.target = target;
-  }
-  public void setMethodName(String methodName) {
-    this.methodName = methodName;
-  }
-  public void setVariableName(String variableName) {
-    this.variableName = variableName;
-  }
-  public void setInvokeOperation(InvokeOperation invokeOperation) {
-    this.invokeOperation = invokeOperation;
-  }
-  public void setTargetExpression(String expression) {
-    this.targetExpression = expression;
-  }
-  public void setTargetLanguage(String language) {
-    this.targetLanguage = language;
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,134 +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.jpdl.internal.activity;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.LockMode;
-import org.hibernate.Session;
-import org.jbpm.api.Execution;
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.model.Activity;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.Transition;
-
-
-/**
- * @author Tom Baeyens
- */
-public class JoinActivity extends JpdlActivity {
-
-  private static final long serialVersionUID = 1L;
-  
-  int multiplicity = -1;
-  LockMode lockMode = LockMode.UPGRADE;
-
-  public void execute(ActivityExecution execution) {
-    execute((ExecutionImpl)execution);
-  }
-
-  public void execute(ExecutionImpl execution) {
-    Activity activity = execution.getActivity();
-    
-    // if this is a single, non concurrent root
-    if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
-      // just pass through
-      Transition transition = activity.getDefaultOutgoingTransition();
-      if (transition==null) {
-        throw new JbpmException("join must have an outgoing transition");
-      }
-      execution.take(transition);
-      
-    } else if (Execution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) {
-      
-      // force version increment in the parent execution
-      Session session = EnvironmentImpl.getFromCurrent(Session.class);
-      session.lock(execution.getParent(), lockMode);
-
-      execution.setState(Execution.STATE_INACTIVE_JOIN);
-      execution.waitForSignal();
-
-      ExecutionImpl concurrentRoot = execution.getParent();
-      List<ExecutionImpl> joinedExecutions = getJoinedExecutions(concurrentRoot, activity);
-      
-      if (isComplete(joinedExecutions, activity)) {
-        endJoinedExecutions(joinedExecutions);
-
-        ExecutionImpl outgoingExecution = null;
-        if (concurrentRoot.getExecutions().size()==0) {
-          outgoingExecution = concurrentRoot;
-          outgoingExecution.setState(Execution.STATE_ACTIVE_ROOT);
-        } else {
-          outgoingExecution = concurrentRoot.createExecution();
-          outgoingExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
-        }
-
-        execution.setActivity(activity, outgoingExecution);
-        Transition transition = activity.getDefaultOutgoingTransition();
-        if (transition==null) {
-          throw new JbpmException("join must have an outgoing transition");
-        }
-        outgoingExecution.take(transition);
-      }
-      
-    } else {
-      throw new JbpmException("invalid execution state");
-    }
-  }
-  
-  protected boolean isComplete(List<ExecutionImpl> joinedExecutions, Activity activity) {
-    int nbrOfExecutionsToJoin = multiplicity;
-    if (multiplicity==-1) {
-      nbrOfExecutionsToJoin = activity.getIncomingTransitions().size();
-    }
-    return joinedExecutions.size()==nbrOfExecutionsToJoin;
-  }
-
-  protected List<ExecutionImpl> getJoinedExecutions(ExecutionImpl concurrentRoot, Activity activity) {
-    List<ExecutionImpl> joinedExecutions = new ArrayList<ExecutionImpl>();
-    List concurrentExecutions = (List)concurrentRoot.getExecutions();
-    for (ExecutionImpl concurrentExecution: (List<ExecutionImpl>)concurrentExecutions) {
-      if ( (Execution.STATE_INACTIVE_JOIN.equals(concurrentExecution.getState()))
-           && (concurrentExecution.getActivity()==activity)
-         ) {
-        joinedExecutions.add(concurrentExecution);
-      }
-    }
-    return joinedExecutions;
-  }
-
-  protected void endJoinedExecutions(List<ExecutionImpl> joinedExecutions) {
-    for (ExecutionImpl joinedExecution: joinedExecutions) {
-      joinedExecution.end();
-    }
-  }
-
-  public void setMultiplicity(int multiplicity) {
-    this.multiplicity = multiplicity;
-  }
-  public void setLockMode(LockMode lockMode) {
-    this.lockMode = lockMode;
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,70 +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.jpdl.internal.activity;
-
-import org.hibernate.LockMode;
-import org.jbpm.jpdl.internal.parser.JpdlBinding;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class JoinBinding extends JpdlBinding {
-  
-  private static final String MULTIPLICITY = "multiplicity";
-  
-  private static final String LOCKMODE = "lockmode";
-
-  public JoinBinding() {
-    super("join");
-  }
-
-  public Object parse(Element element, Parse parse, Parser parser) {
-    JoinActivity joinActivity = new JoinActivity();
-                            
-    if (element.hasAttribute(MULTIPLICITY)) {
-      String multiplicictyText = element.getAttribute(MULTIPLICITY);
-      try {
-        int multiplicity = Integer.parseInt(multiplicictyText);
-        joinActivity.setMultiplicity(multiplicity);
-      } catch (NumberFormatException e) {
-        parse.addProblem(MULTIPLICITY + " " + multiplicictyText + " is not a valid integer", element);
-      }
-    }
-
-    if (element.hasAttribute(LOCKMODE)) {
-      String lockModeText = element.getAttribute(LOCKMODE);
-      LockMode lockMode = LockMode.parse(lockModeText.toUpperCase());
-      if (lockMode==null) {
-        parse.addProblem(LOCKMODE + " " + lockModeText + " is not a valid lock mode", element);
-      } else {
-        joinActivity.setLockMode(lockMode);
-      }
-    }
-
-    return joinActivity;
-  }
-
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,35 +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.jpdl.internal.activity;
-
-import org.jbpm.api.activity.ActivityBehaviour;
-
-/**
- * @author Tom Baeyens
- */
-public abstract class JpdlActivity implements ActivityBehaviour {
-  
-  private static final long serialVersionUID = 1L;
-
-  protected long dbid;
-
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlAutomaticActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlAutomaticActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlAutomaticActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,24 +0,0 @@
-package org.jbpm.jpdl.internal.activity;
-
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.api.listener.EventListener;
-import org.jbpm.api.listener.EventListenerExecution;
-import org.jbpm.api.model.OpenExecution;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-
-
-public abstract class JpdlAutomaticActivity extends JpdlActivity implements EventListener {
-
-  private static final long serialVersionUID = 1L;
-
-  public void execute(ActivityExecution execution) throws Exception {
-    perform(execution);
-    ((ExecutionImpl)execution).historyAutomatic();
-  }
-    
-  public void notify(EventListenerExecution execution) throws Exception {
-    perform(execution);
-  }    
-    
-  abstract void perform(OpenExecution execution) throws Exception;
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlExternalActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlExternalActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlExternalActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,31 +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.jpdl.internal.activity;
-
-import org.jbpm.api.activity.ExternalActivityBehaviour;
-
-/**
- * @author Tom Baeyens
- */
-public abstract class JpdlExternalActivity extends JpdlActivity implements ExternalActivityBehaviour {
-
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,51 +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.jpdl.internal.activity;
-
-import java.util.Collection;
-
-import javax.mail.Message;
-
-import org.jbpm.api.model.OpenExecution;
-import org.jbpm.pvm.internal.email.spi.MailProducer;
-import org.jbpm.pvm.internal.email.spi.MailSession;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-
-/**
- * @author Alejandro Guizar
- */
-public class MailActivity extends JpdlAutomaticActivity {
-
-  protected MailProducer mailProducer;
-
-  private static final long serialVersionUID = 1L;
-
-  void perform(OpenExecution execution) throws Exception {
-    Collection<Message> messages = mailProducer.produce(execution);
-    EnvironmentImpl.getFromCurrent(MailSession.class).send(messages);
-  }
-
-  public void setMailProducer(MailProducer mailProducer) {
-    this.mailProducer = mailProducer;
-  }
-
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailListener.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailListener.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailListener.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,67 +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.jpdl.internal.activity;
-
-import java.util.Collection;
-
-import javax.mail.Message;
-
-import org.jbpm.api.listener.EventListener;
-import org.jbpm.api.listener.EventListenerExecution;
-import org.jbpm.pvm.internal.email.spi.MailProducer;
-import org.jbpm.pvm.internal.email.spi.MailSession;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.env.TaskContext;
-import org.jbpm.pvm.internal.session.DbSession;
-import org.jbpm.pvm.internal.task.TaskImpl;
-
-/**
- * @author Alejandro Guizar
- */
-public class MailListener implements EventListener {
-
-  protected transient MailProducer mailProducer;
-
-  private static final long serialVersionUID = 1L;
-
-  public void notify(EventListenerExecution execution) throws Exception {
-    // find current task
-    EnvironmentImpl environment = EnvironmentImpl.getCurrent();
-    DbSession dbSession = environment.get(DbSession.class);
-    TaskImpl task = dbSession.findTaskByExecution(execution);
-
-    // make task available to mail templates through task context
-    TaskContext taskContext = new TaskContext(task);
-    environment.setContext(taskContext);
-    try {
-      Collection<Message> messages = mailProducer.produce(execution);
-      environment.get(MailSession.class).send(messages);
-    } finally {
-      environment.removeContext(taskContext);
-    }
-  }
-
-  public void setMailProducer(MailProducer mailProducer) {
-    this.mailProducer = mailProducer;
-  }
-
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,59 +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.jpdl.internal.activity;
-
-import org.jbpm.api.model.OpenExecution;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.script.ScriptManager;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ScriptActivity extends JpdlAutomaticActivity {
-
-  private static final long serialVersionUID = 1L;
-  
-  protected String script;
-  protected String language;
-  protected String variableName;
-
-  public void perform(OpenExecution execution) {
-    ScriptManager scriptManager = EnvironmentImpl.getFromCurrent(ScriptManager.class);
-    Object returnValue = scriptManager.evaluateScript(script, language);
-    
-    if (variableName!=null) {
-      execution.setVariable(variableName, returnValue);
-    }
-  }
-
-  public void setScript(String script) {
-    this.script = script;
-  }
-  public void setLanguage(String language) {
-    this.language = language;
-  }
-  public void setVariableName(String variableName) {
-    this.variableName = variableName;
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,70 +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.jpdl.internal.activity;
-
-import org.jbpm.jpdl.internal.parser.JpdlBinding;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.script.ScriptManager;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ScriptBinding extends JpdlBinding {
-
-  private static final String TAG = "script";
-
-  public ScriptBinding() {
-    super(TAG);
-  }
-
-  public Object parse(Element element, Parse parse, Parser parser) {
-    String language = null;
-
-    String script = XmlUtil.attribute(element, "expr");
-    Element textElement = XmlUtil.element(element, "text");
-    if(script!=null) {
-      ScriptManager scriptManager = EnvironmentImpl.getFromCurrent(ScriptManager.class);
-      language = scriptManager.getDefaultExpressionLanguage();
-      if (textElement!=null) {
-        parse.addProblem("in <script ...> attribute expr can't be combined with a nexted text element", element);
-      }
-    } else {
-      language = XmlUtil.attribute(element, "lang");
-      script = XmlUtil.getContentText(textElement);
-    }
-
-    String variableName = XmlUtil.attribute(element, "var");
-    
-    ScriptActivity scriptActivity = new ScriptActivity();
-    scriptActivity.setScript(script);
-    scriptActivity.setLanguage(language);
-    scriptActivity.setVariableName(variableName);
-
-    return scriptActivity;
-  }
-
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SqlActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SqlActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SqlActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,37 +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.jpdl.internal.activity;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-
-/**
- * @author Tom Baeyens
- */
-public class SqlActivity extends HqlActivity {
-
-  private static final long serialVersionUID = 1L;
-
-  protected Query createQuery(Session session) {
-    return session.createSQLQuery(query);
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SqlBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SqlBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SqlBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,39 +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.jpdl.internal.activity;
-
-
-/**
- * @author Tom Baeyens
- */
-public class SqlBinding extends HqlBinding {
-
-  public static final String TAG = "sql";
-
-  public SqlBinding() {
-    super(TAG);
-  }
-
-  protected HqlActivity createHqlActivity() {
-    return new SqlActivity();
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,46 +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.jpdl.internal.activity;
-
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.pvm.internal.task.FormBehaviour;
-
-
-/**
- * @author Tom Baeyens
- */
-public class StartActivity extends JpdlActivity implements FormBehaviour {
-
-  private static final long serialVersionUID = 1L;
-  
-  String formResourceName;
-
-  public void execute(ActivityExecution execution) {
-  }
-
-  public String getFormResourceName() {
-    return formResourceName;
-  }
-  public void setFormResourceName(String formResourceName) {
-    this.formResourceName = formResourceName;
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,63 +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.jpdl.internal.activity;
-
-import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
-import org.jbpm.jpdl.internal.parser.JpdlBinding;
-import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class StartBinding extends JpdlBinding {
-
-  public StartBinding() {
-    super("start");
-  }
-
-  public Object parse(Element element, Parse parse, Parser parser) {
-    ActivityImpl startActivity = parse.findObject(ActivityImpl.class);
-    JpdlProcessDefinition processDefinition = parse.findObject(JpdlProcessDefinition.class);
-    
-    if (processDefinition.getInitial()==null) {
-      processDefinition.setInitial(startActivity);
-      
-    } else if (startActivity.getParentActivity()==null) {
-      parse.addProblem("multiple start events not yet supported", element);
-    }
-    
-    StartActivity startActivityBehaviour = new StartActivity();
-    
-    startActivityBehaviour.setFormResourceName(XmlUtil.attribute(element, "form"));
-    
-    return startActivityBehaviour;
-  }
-
-  public boolean isNameRequired() {
-    return false;
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,78 +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.jpdl.internal.activity;
-
-import java.util.Map;
-
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.pvm.internal.model.Activity;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.Transition;
-
-/**
- * @author Tom Baeyens
- */
-public class StateActivity extends JpdlExternalActivity {
-
-  private static final long serialVersionUID = 1L;
-  
-  public void execute(ActivityExecution execution) {
-    execute((ExecutionImpl)execution);
-  }
-
-  public void execute(ExecutionImpl execution) {
-    execution.historyActivityStart();
-
-    execution.waitForSignal();
-  }
-
-  public void signal(ActivityExecution execution, String signalName, Map<String, ?> parameters) throws Exception {
-    signal((ExecutionImpl)execution, signalName, parameters);
-  }
-
-  public void signal(ExecutionImpl execution, String signalName, Map<String, ?> parameters) throws Exception {
-    Activity activity = execution.getActivity();
-    
-    if (parameters!=null) {
-      execution.setVariables(parameters);
-    }
-    
-    execution.fire(signalName, activity);
-    
-    Transition transition = null;
-    if ( (signalName==null)
-         && (activity.getOutgoingTransitions()!=null)
-         && (activity.getOutgoingTransitions().size()==1)
-       ) {
-      transition = activity.getOutgoingTransitions().get(0);
-    } else {
-      transition = activity.findOutgoingTransition(signalName);
-    }
-    
-    if (transition!=null) {
-      execution.historyActivityEnd(signalName);
-      execution.take(transition);
-    } else {
-      execution.waitForSignal();
-    }
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,43 +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.jpdl.internal.activity;
-
-import org.jbpm.jpdl.internal.parser.JpdlBinding;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class StateBinding extends JpdlBinding {
-
-  public StateBinding() {
-    super("state");
-  }
-
-  public Object parse(Element element, Parse parse, Parser parser) {
-    return new StateActivity();
-  }
-
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,192 +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.jpdl.internal.activity;
-
-import java.util.List;
-import java.util.Map;
-
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.pvm.internal.client.ClientProcessDefinition;
-import org.jbpm.pvm.internal.env.Context;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.env.ExecutionContext;
-import org.jbpm.pvm.internal.model.Activity;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.script.ScriptManager;
-import org.jbpm.pvm.internal.session.DbSession;
-import org.jbpm.pvm.internal.session.RepositorySession;
-import org.jbpm.pvm.internal.task.SwimlaneImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public class SubProcessActivity extends JpdlExternalActivity {
-
-  private static final long serialVersionUID = 1L;
-  
-  protected String subProcessKey;
-  protected String subProcessId;
-  protected Map<String, String> swimlaneMappings;
-
-  protected List<SubProcessInParameterImpl> inParameters;
-  protected List<SubProcessOutParameterImpl> outParameters;
-  
-  protected String outcomeExpression;
-  protected Map<Object, String> outcomeVariableMappings;
-
-  public void execute(ActivityExecution execution) {
-    ExecutionImpl executionImpl = (ExecutionImpl) execution;
-    
-    RepositorySession repositorySession = EnvironmentImpl.getFromCurrent(RepositorySession.class);
-    
-    ClientProcessDefinition processDefinition = null;
-    
-    if (subProcessId!=null) {
-      processDefinition = repositorySession.findProcessDefinitionById(subProcessId);
-    } else {
-      processDefinition = repositorySession.findProcessDefinitionByKey(subProcessKey);
-    }
-    
-    ExecutionImpl subProcessInstance = (ExecutionImpl) processDefinition.createProcessInstance(null, execution);
-    
-    for (String swimlaneName: swimlaneMappings.keySet()) {
-      String subSwimlaneName = swimlaneMappings.get(swimlaneName);
-      SwimlaneImpl subSwimlane = subProcessInstance.createSwimlane(subSwimlaneName);
-      SwimlaneImpl swimlane = executionImpl.getSwimlane(swimlaneName);
-      if (swimlane!=null) {
-        subSwimlane.initialize(swimlane);
-      }
-    }
-    
-    for (SubProcessInParameterImpl inParameter: inParameters) {
-      inParameter.produce(executionImpl, subProcessInstance);
-    }
-
-    executionImpl.historyActivityStart();
-    
-    subProcessInstance.start();
-
-    DbSession dbSession = EnvironmentImpl.getFromCurrent(DbSession.class, false);
-    if (dbSession!=null) {
-      dbSession.save(subProcessInstance);
-    }
-    
-    execution.waitForSignal();
-  }
-
-  public void signal(ActivityExecution execution, String signalName, Map<String, ?> parameters) throws Exception {
-    signal((ExecutionImpl)execution, signalName, parameters);
-  }
-
-  public void signal(ExecutionImpl execution, String signalName, Map<String, ?> parameters) throws Exception {
-    ExecutionImpl executionImpl = (ExecutionImpl) execution;
-
-    ExecutionImpl subProcessInstance = executionImpl.getSubProcessInstance();
-
-    String transitionName = null;
-
-    ExecutionContext originalExecutionContext = null;
-    ExecutionContext subProcessExecutionContext = null;
-    EnvironmentImpl environment = EnvironmentImpl.getCurrent();
-    if (environment!=null) {
-      originalExecutionContext = (ExecutionContext) environment.removeContext(Context.CONTEXTNAME_EXECUTION);
-      subProcessExecutionContext = new ExecutionContext((ExecutionImpl) subProcessInstance);
-      environment.setContext(subProcessExecutionContext);
-    }
-
-    try {
-      subProcessInstance.setSuperProcessExecution(null);
-      executionImpl.setSubProcessInstance(null);
-      
-
-      for (SubProcessOutParameterImpl outParameter: outParameters) {
-        outParameter.consume(executionImpl, subProcessInstance);
-      }
-      
-      Activity activity = execution.getActivity();
-      String subProcessActivityName = subProcessInstance.getActivityName();
-      
-      if (outcomeExpression!=null) {
-        ScriptManager scriptManager = EnvironmentImpl.getFromCurrent(ScriptManager.class);
-        Object value = scriptManager.evaluateExpression(outcomeExpression, null);
-        // if the value is a String and matches the name of an outgoing transition
-        if ( (value instanceof String)
-             && (activity.hasOutgoingTransition(((String) value)))
-           ) {
-          // then take that one
-          transitionName = (String) value; 
-        } else {
-          // else see if there is a value mapping
-          transitionName = outcomeVariableMappings.get(value);
-        }
-
-      } else if (activity.hasOutgoingTransition(subProcessActivityName)) {
-        transitionName = subProcessActivityName;
-      }
-
-    } finally {
-      if (subProcessExecutionContext!=null) {
-        environment.removeContext(subProcessExecutionContext);
-      }
-      if (originalExecutionContext!=null) {
-        environment.setContext(originalExecutionContext);
-      }
-    }
-    
-    executionImpl.historyActivityEnd();
-
-    if (transitionName!=null) {
-      execution.take(transitionName);
-    } else {
-      execution.takeDefaultTransition();
-    }
-  }
-
-  public void setSwimlaneMappings(Map<String, String> swimlaneMappings) {
-    this.swimlaneMappings = swimlaneMappings;
-  }
-  public void setOutcomeVariableMappings(Map<Object, String> outcomeVariableMappings) {
-    this.outcomeVariableMappings = outcomeVariableMappings;
-  }
-  public void setSubProcessKey(String subProcessKey) {
-    this.subProcessKey = subProcessKey;
-  }
-  public void setSubProcessId(String subProcessId) {
-    this.subProcessId = subProcessId;
-  }
-  public void setOutcomeExpression(String outcomeExpression) {
-    this.outcomeExpression = outcomeExpression;
-  }
-  public List<SubProcessInParameterImpl> getInParameters() {
-    return inParameters;
-  }
-  public void setInParameters(List<SubProcessInParameterImpl> inParameters) {
-    this.inParameters = inParameters;
-  }
-  public List<SubProcessOutParameterImpl> getOutParameters() {
-    return outParameters;
-  }
-  public void setOutParameters(List<SubProcessOutParameterImpl> outParameters) {
-    this.outParameters = outParameters;
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,165 +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.jpdl.internal.activity;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jbpm.jpdl.internal.parser.JpdlBinding;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.xml.WireParser;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class SubProcessBinding extends JpdlBinding {
-
-  public SubProcessBinding() {
-    super("sub-process");
-  }
-
-  public Object parse(Element element, Parse parse, Parser parser) {
-    SubProcessActivity subProcessActivity = new SubProcessActivity();
-    
-    String subProcessKey = XmlUtil.attribute(element, "sub-process-key");
-    subProcessActivity.setSubProcessKey(subProcessKey);
-    
-    String subProcessId = XmlUtil.attribute(element, "sub-process-id");
-    subProcessActivity.setSubProcessId(subProcessId);
-    
-    List<SubProcessInParameterImpl> inParameters = new ArrayList<SubProcessInParameterImpl>();
-    for (Element inElement: XmlUtil.elements(element, "parameter-in")) {
-      SubProcessInParameterImpl inParameter = new SubProcessInParameterImpl();
-      parseParameter(inElement, inParameter);
-      inParameters.add(inParameter);
-
-      if (inParameter.getSubVariableName()==null) {
-        parse.addProblem("no 'subvar' specified for parameter-in", element);
-      }
-      if ( (inParameter.getExpression()==null)
-           && (inParameter.getVariableName()==null)
-         ) {
-        parse.addProblem("no 'expr' or 'variable' specified for parameter-in '"+inParameter.getSubVariableName()+"'", element);
-      }
-      if ( (inParameter.getExpression()!=null)
-           && (inParameter.getVariableName()!=null)
-         ) {
-        parse.addProblem("attributes 'expr' and 'variable' are mutually exclusive on parameter-in", element);
-      }
-    }
-    subProcessActivity.setInParameters(inParameters);
-
-    List<SubProcessOutParameterImpl> outParameters = new ArrayList<SubProcessOutParameterImpl>();
-    for (Element outElement: XmlUtil.elements(element, "parameter-out")) {
-      SubProcessOutParameterImpl outParameter = new SubProcessOutParameterImpl();
-      parseParameter(outElement, outParameter);
-      outParameters.add(outParameter);
-      
-      if (outParameter.getVariableName()==null) {
-        parse.addProblem("no 'variable' specified for parameter-in", element);
-      }
-      if ( (outParameter.getExpression()==null)
-           && (outParameter.getSubVariableName()==null)
-         ) {
-        parse.addProblem("no 'expr' or 'subvar' specified for parameter-out '"+outParameter.getVariableName()+"'", element);
-      }
-      if ( (outParameter.getExpression()!=null)
-           && (outParameter.getSubVariableName()!=null)
-         ) {
-        parse.addProblem("attributes 'expr' and 'subvar' are mutually exclusive on parameter-out '"+outParameter.getVariableName()+"'", element);
-      }
-    }
-    subProcessActivity.setOutParameters(outParameters);
-
-    Map<String, String> swimlaneMappings = parseSwimlaneMappings(element, parse);
-    subProcessActivity.setSwimlaneMappings(swimlaneMappings);
-
-    Map<Object, String> outcomeVariableMappings = new HashMap<Object, String>();
-
-    String outcomeExpression = XmlUtil.attribute(element, "outcome");
-    if (outcomeExpression!=null) {
-      subProcessActivity.setOutcomeExpression(outcomeExpression);
-      
-      for (Element transitionElement: XmlUtil.elements(element, "transition")) {
-        Element outcomeValueElement = XmlUtil.element(transitionElement, "outcome-value");
-        if (outcomeValueElement!=null) {
-          String transitionName = XmlUtil.attribute(transitionElement, "name");
-          if (transitionName==null) {
-            parse.addProblem("transitions with an outcome-value must have a name", transitionElement);
-          }
-          Element valueElement = XmlUtil.element(outcomeValueElement);
-          if (valueElement!=null) {
-            Descriptor descriptor = (Descriptor) WireParser.getInstance().parseElement(valueElement, parse);
-            Object value = WireContext.create(descriptor);
-            outcomeVariableMappings.put(value, transitionName);
-          } else {
-            parse.addProblem("outcome-value must contain exactly one element", outcomeValueElement);
-          }
-        }
-      }
-
-    }
-
-    return subProcessActivity;
-  }
-
-  void parseParameter(Element element, SubProcessParameterImpl parameter) {
-    String name = XmlUtil.attribute(element, "subvar");
-    parameter.setSubVariableName(name);
-    
-    String expr = XmlUtil.attribute(element, "expr");
-    if (expr!=null) {
-      parameter.setExpression(expr);
-    }
- 
-    String language = XmlUtil.attribute(element, "lang");
-    if (language!=null) {
-      parameter.setLanguage(language);
-    }
-
-    String variable = XmlUtil.attribute(element, "var");
-    if (variable!=null) {
-      parameter.setVariableName(variable);
-    }
-  }
-
-  public static Map<String, String> parseSwimlaneMappings(Element element, Parse parse) {
-    Map<String, String> swimlaneMappings = new HashMap<String, String>();
-    
-    for (Element inElement: XmlUtil.elements(element, "swimlane-mapping")) {
-      String swimlane = XmlUtil.attribute(inElement, "swimlane", true, parse);
-      String subSwimlane = XmlUtil.attribute(inElement, "sub-swimlane", true, parse);
-      
-      swimlaneMappings.put(swimlane, subSwimlane);
-    }
-
-    return swimlaneMappings;
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessInParameterImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessInParameterImpl.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessInParameterImpl.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,46 +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.jpdl.internal.activity;
-
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.script.ScriptManager;
-
-
-/**
- * @author Tom Baeyens
- */
-public class SubProcessInParameterImpl extends SubProcessParameterImpl {
-
-  private static final long serialVersionUID = 1L;
-  
-  public void produce(ExecutionImpl superExecution, ExecutionImpl subProcessInstance) {
-    Object value = null;
-    if (variableName!=null) {
-      value = superExecution.getVariable(variableName);
-    } else {
-      ScriptManager scriptManager = ScriptManager.getScriptManager();
-      value = scriptManager.evaluateExpression(expression, language);
-    }
-    
-    subProcessInstance.setVariable(subVariableName, value);
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessOutParameterImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessOutParameterImpl.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessOutParameterImpl.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,48 +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.jpdl.internal.activity;
-
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.ScopeInstanceImpl;
-import org.jbpm.pvm.internal.script.ScriptManager;
-
-
-/**
- * @author Tom Baeyens
- */
-public class SubProcessOutParameterImpl extends SubProcessParameterImpl {
-
-  private static final long serialVersionUID = 1L;
-  
-  public void consume(ExecutionImpl superExecution, ScopeInstanceImpl subProcessInstance) {
-    Object value = null;
-    
-    if (variableName!=null) {
-      value = subProcessInstance.getVariable(subVariableName);
-    } else {
-      ScriptManager scriptManager = ScriptManager.getScriptManager();
-      value = scriptManager.evaluateExpression(expression, language);
-    }
-
-    superExecution.setVariable(variableName, value);
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessParameterImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessParameterImpl.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessParameterImpl.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,63 +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.jpdl.internal.activity;
-
-import java.io.Serializable;
-
-
-/**
- * @author Tom Baeyens
- */
-public class SubProcessParameterImpl implements Serializable {
-
-  private static final long serialVersionUID = 1L;
-
-  protected String subVariableName;
-  protected String variableName;
-  protected String expression;
-  protected String language;
-
-  public String getVariableName() {
-    return variableName;
-  }
-  public void setVariableName(String variable) {
-    this.variableName = variable;
-  }
-  public String getExpression() {
-    return expression;
-  }
-  public void setExpression(String expression) {
-    this.expression = expression;
-  }
-  public String getLanguage() {
-    return language;
-  }
-  public void setLanguage(String language) {
-    this.language = language;
-  }
-  public String getSubVariableName() {
-    return subVariableName;
-  }
-  public void setSubVariableName(String name) {
-    this.subVariableName = name;
-  }
-}

Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,151 +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.jpdl.internal.activity;
-
-import java.util.List;
-import java.util.Map;
-
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.api.task.Task;
-import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.history.HistoryEvent;
-import org.jbpm.pvm.internal.history.events.TaskActivityStart;
-import org.jbpm.pvm.internal.model.Activity;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.Transition;
-import org.jbpm.pvm.internal.session.DbSession;
-import org.jbpm.pvm.internal.task.ParticipationImpl;
-import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
-import org.jbpm.pvm.internal.task.SwimlaneImpl;
-import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
-import org.jbpm.pvm.internal.task.TaskImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public class TaskActivity extends JpdlExternalActivity {
-
-  private static final long serialVersionUID = 1L;
-  
-  private static final Log log = Log.getLog(TaskActivity.class.getName());
-
-  protected TaskDefinitionImpl taskDefinition;
-  
-  public void execute(ActivityExecution execution) {
-    execute((ExecutionImpl)execution);
-  }
-
-  public void execute(ExecutionImpl execution) {
-    DbSession dbSession = EnvironmentImpl.getFromCurrent(DbSession.class);
-    TaskImpl task = (TaskImpl) dbSession.createTask();
-    task.setTaskDefinition(taskDefinition);
-    task.setExecution(execution);
-    task.setProcessInstance(execution.getProcessInstance());
-    task.setSignalling(true);
-    
-    // initialize the name
-    if (taskDefinition.getName()!=null) {
-      task.setName(taskDefinition.getName());
-    } else {
-      task.setName(execution.getActivityName());
-    }
-
-    task.setDescription(taskDefinition.getDescription());
-    task.setPriority(taskDefinition.getPriority());
-    task.setFormResourceName(taskDefinition.getFormResourceName());
-    
-    // save task so that TaskDbSession.findTaskByExecution works for assign event listeners
-    dbSession.save(task);
-
-    SwimlaneDefinitionImpl swimlaneDefinition = taskDefinition.getSwimlaneDefinition();
-    if (swimlaneDefinition!=null) {
-      SwimlaneImpl swimlane = execution.getInitializedSwimlane(swimlaneDefinition);
-      task.setSwimlane(swimlane);
-      
-      // copy the swimlane assignments to the task
-      task.setAssignee(swimlane.getAssignee());
-      for (ParticipationImpl participant: swimlane.getParticipations()) {
-        task.addParticipation(participant.getUserId(), participant.getGroupId(), participant.getType());
-      }
-    }
-
-    execution.initializeAssignments(taskDefinition, task);
-    
-    HistoryEvent.fire(new TaskActivityStart(task), execution);
-
-    execution.waitForSignal();
-  }
-  
-  public void signal(ActivityExecution execution, String signalName, Map<String, ?> parameters) throws Exception {
-    signal((ExecutionImpl)execution, signalName, parameters);
-  }
-
-  public void signal(ExecutionImpl execution, String signalName, Map<String, ?> parameters) throws Exception {
-    Activity activity = execution.getActivity();
-    
-    if (parameters!=null) {
-      execution.setVariables(parameters);
-    }
-    
-    execution.fire(signalName, activity);
-
-    DbSession taskDbSession = EnvironmentImpl
-        .getFromCurrent(DbSession.class);
-    TaskImpl task = (TaskImpl) taskDbSession.findTaskByExecution(execution);
-    task.setSignalling(false);
-    
-    Transition transition = null;
-    List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
-    if ( (outgoingTransitions!=null)
-         && (!outgoingTransitions.isEmpty())
-       ) {
-      transition = activity.findOutgoingTransition(signalName);
-      if (transition==null) {
-        if (Task.STATE_COMPLETED.equals(signalName)) {
-          if (outgoingTransitions.size()==1) {
-            transition = outgoingTransitions.get(0);
-          } else {
-            transition = activity.getDefaultOutgoingTransition();
-          }
-        } else {
-          // if a user specified outcome was provided and it doesn't
-          // match with an outgoing transition name, then an exception is
-          // thrown since this is likely a programmatic error.
-          throw new JbpmException("No outcome named '" + signalName + "' was found."); 
-        }
-      }
-      if (transition!=null) {
-        execution.take(transition);
-      }
-    }
-  }
-
-  public TaskDefinitionImpl getTaskDefinition() {
-    return taskDefinition;
-  }
-  public void setTaskDefinition(TaskDefinitionImpl taskDefinition) {
-    this.taskDefinition = taskDefinition;
-  }
-}

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlBindingsParser.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlBindingsParser.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlBindingsParser.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -28,6 +28,7 @@
 import org.jbpm.pvm.internal.util.TagBinding;
 import org.jbpm.pvm.internal.util.XmlUtil;
 import org.jbpm.pvm.internal.xml.Binding;
+import org.jbpm.pvm.internal.xml.Bindings;
 import org.jbpm.pvm.internal.xml.Parse;
 import org.jbpm.pvm.internal.xml.Parser;
 import org.w3c.dom.Element;
@@ -43,12 +44,12 @@
   public static final String CATEGORY_EVENT_LISTENER = "eventlistener";
   
   public Object parseDocumentElement(Element documentElement, Parse parse) {
-    List<Binding> bindings = new ArrayList<Binding>();
+    Bindings bindings = parse.findObject(Bindings.class);
     parse.setDocumentObject(bindings);
     
     for (Element bindingElement : XmlUtil.elements(documentElement)) {
       Binding binding = instantiateBinding(bindingElement, parse);
-      bindings.add(binding);
+      bindings.addBinding(binding);
     }
     
     return bindings;
@@ -68,7 +69,7 @@
         String tagLocalName = XmlUtil.getTagLocalName(bindingElement);
         if ("activity".equals(tagLocalName)) {
           binding.setCategory(CATEGORY_ACTIVITY);
-        } else if ("event-listener".equals(tagLocalName)) {
+        } else if ("eventlistener".equals(tagLocalName)) {
           binding.setCategory(CATEGORY_EVENT_LISTENER);
         } else {
           parse.addProblem("unrecognized binding tag: "+tagLocalName);

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlDeployer.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlDeployer.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlDeployer.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -21,18 +21,195 @@
  */
 package org.jbpm.jpdl.internal.parser;
 
-import org.jbpm.pvm.internal.repository.ProcessDeployer;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.util.List;
 
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.jbpm.api.ProcessDefinition;
+import org.jbpm.api.ProcessDefinitionQuery;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.repository.Deployer;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
+import org.jbpm.pvm.internal.session.RepositorySession;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
 /**
  * @author Tom Baeyens
  */
-public class JpdlDeployer extends ProcessDeployer {
+public class JpdlDeployer implements Deployer {
   
+  private static final Log log = Log.getLog(JpdlDeployer.class.getName());
+  
   static JpdlParser JPDL_PARSER = new JpdlParser();
   public static final String JPDL_EXTENSION = ".jpdl.xml";
   
-  public JpdlDeployer() {
-    super(JPDL_EXTENSION, JPDL_PARSER);
+  public void deploy(DeploymentImpl deployment) {
+    
+    for (String resourceName: deployment.getResourceNames()) {
+      
+      if (resourceName.endsWith(JPDL_EXTENSION)) {
+        byte[] bytes = deployment.getBytes(resourceName);
+        InputStream inputStream = new ByteArrayInputStream(bytes);
+        Parse parse = JPDL_PARSER.createParse();
+        parse.setProblems(deployment.getProblems());
+        parse.setInputStream(inputStream);
+        parse.execute();
+        
+        checkNamespaceDeclaration(deployment, resourceName, parse.getDocument());
+        
+        List<ProcessDefinitionImpl> processDefinitions = (List<ProcessDefinitionImpl>) parse.getDocumentObject();
+        if (processDefinitions!=null) {
+          for (ProcessDefinitionImpl processDefinition : processDefinitions) {
+            if ((processDefinition != null) && (processDefinition.getName() != null)) {
+              String processDefinitionName = processDefinition.getName();
+
+              processDefinition.setSuspended(deployment.isSuspended());
+
+              String imageResourceName = resourceName.substring(0, resourceName.lastIndexOf(JPDL_EXTENSION)) + ".png";
+              if (deployment.getResourceNames().contains(imageResourceName)) {
+                processDefinition.setImageResourceName(imageResourceName);
+              }
+
+              processDefinition.setDeploymentDbid(deployment.getDbid());
+
+              if (deployment.hasObjectProperties(processDefinitionName)) {
+                String key = deployment.getProcessDefinitionKey(processDefinitionName);
+                String id = deployment.getProcessDefinitionId(processDefinitionName);
+                Long version = deployment.getProcessDefinitionVersion(processDefinitionName);
+                processDefinition.setId(id);
+                processDefinition.setKey(key);
+                processDefinition.setVersion(version.intValue());
+
+              } else {
+                checkKey(processDefinition, deployment);
+                checkVersion(processDefinition, deployment);
+                checkId(processDefinition, deployment);
+
+                deployment.setProcessDefinitionId(processDefinitionName, processDefinition.getId());
+                deployment.setProcessDefinitionKey(processDefinitionName, processDefinition.getKey());
+                deployment.setProcessDefinitionVersion(processDefinitionName, new Long(processDefinition.getVersion()));
+              }
+
+              deployment.addObject(processDefinitionName, processDefinition);
+            }
+          }
+        }
+      }
+    }
   }
+  
+  protected void checkKey(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
+    String processDefinitionName = processDefinition.getName();
+    String processDefinitionKey = processDefinition.getKey();
 
+    // if no key was specified in the jpdl process file
+    if (processDefinitionKey==null) {
+      // derive the key from the name
+      // replace any non-word character with an underscore
+      processDefinitionKey = processDefinitionName.replaceAll("\\W", "_");
+      processDefinition.setKey(processDefinitionKey);
+    }
+    
+    RepositorySession repositorySession = EnvironmentImpl.getFromCurrent(RepositorySession.class);
+
+    List<ProcessDefinition> existingProcesses = repositorySession.createProcessDefinitionQuery()
+        .processDefinitionName(processDefinitionName)
+        .list();
+    
+    for (ProcessDefinition existingProcess: existingProcesses) {
+      if (!processDefinitionKey.equals(existingProcess.getKey())) {
+        deployment.addProblem("invalid key '"+processDefinitionKey+"' in process "+processDefinition.getName()+".  Existing process has name '"+processDefinitionName+"' and key '"+processDefinitionKey+"'");
+      }
+    }
+
+    existingProcesses = repositorySession.createProcessDefinitionQuery()
+        .processDefinitionKey(processDefinitionKey)
+        .list();
+    
+    for (ProcessDefinition existingProcess: existingProcesses) {
+      if (!processDefinitionName.equals(existingProcess.getName())) {
+        deployment.addProblem("invalid name '"+processDefinitionName+"' in process "+processDefinition.getName()+".  Existing process has name '"+processDefinitionName+"' and key '"+processDefinitionKey+"'");
+      }
+    }
+  }
+
+  protected void checkId(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
+    String id = processDefinition.getId();
+    if (id==null) {
+      id = processDefinition.getKey()+"-"+processDefinition.getVersion();
+      if (log.isTraceEnabled()) log.trace("created id '"+id+"' for "+processDefinition);
+      processDefinition.setId(id);
+    }
+    
+    RepositorySession repositorySession = EnvironmentImpl.getFromCurrent(RepositorySession.class);
+    ProcessDefinition existingProcessDefinition = repositorySession.createProcessDefinitionQuery()
+        .processDefinitionId(id)
+        .uniqueResult();
+    if (existingProcessDefinition != null) {
+      deployment.addProblem("process '" + id + "' already exists");
+    }
+  }
+  
+  protected void checkVersion(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
+    int version = processDefinition.getVersion();
+    String key = processDefinition.getKey();
+    if (version==ProcessDefinitionImpl.UNASSIGNED_VERSION) {
+      RepositorySession repositorySession = EnvironmentImpl.getFromCurrent(RepositorySession.class);
+      
+      ProcessDefinition latestDeployedVersion = repositorySession
+          .createProcessDefinitionQuery()
+          .processDefinitionKey(key)
+          .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+          .page(0, 1)
+          .uniqueResult();
+
+      if (latestDeployedVersion!=null) {
+        version = latestDeployedVersion.getVersion() + 1;
+      } else {
+        version = 1;
+      }
+      if (log.isTraceEnabled()) log.trace("assigning version "+version+" to process definition "+key);
+      processDefinition.setVersion(version);
+    }
+  }
+
+  protected void checkNamespaceDeclaration(DeploymentImpl deployment, String resourceName, Document document) throws TransformerFactoryConfigurationError {
+    try {
+      Element documentElement = document.getDocumentElement();
+      if (documentElement.getNamespaceURI()==null) {
+        String latestVersionNamespaceUri = JpdlParser.LATEST_JPDL_VERSION_NAMESPACE_URI;
+        log.debug("adding namespace "+latestVersionNamespaceUri+" to deployment resource "+resourceName);
+        
+        String prefix = documentElement.getPrefix();
+        String oldNodeName = documentElement.getNodeName();
+        String newTagName = (prefix!=null ? prefix+":"+oldNodeName : oldNodeName);
+        document.renameNode(documentElement, latestVersionNamespaceUri, newTagName);
+   
+        Transformer transformer = TransformerFactory.newInstance().newTransformer();
+        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+        //initialize StreamResult with File object to save to file
+        StreamResult result = new StreamResult(new StringWriter());
+        DOMSource source = new DOMSource(document);
+        transformer.transform(source, result);
+        
+        byte[] bytes = result.getWriter().toString().getBytes();
+        deployment.addResourceFromInputStream(resourceName, new ByteArrayInputStream(bytes));
+      }
+    } catch (Exception e) {
+      log.error("couldn't add namespace to resource "+resourceName+" in deployment "+deployment.getId(), e);
+    }
+  }
+
 }

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlParser.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlParser.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlParser.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -44,10 +44,10 @@
   public static final List<String> schemaResources =  new ArrayList<String>();
   public static final Map<String, JpdlParserVersion> jpdlParserVersions = new HashMap<String, JpdlParserVersion>();
   
-  public static final JpdlParserVersion LATEST_PARSER_VERSION = new JpdlParserV42(); 
+  public static final String LATEST_JPDL_VERSION_NAMESPACE_URI = JpdlParserV40.INSTANCE.getNamespaceUri(); 
   static {
-    addJpdlParserVersion(new JpdlParserV40());
-    addJpdlParserVersion(LATEST_PARSER_VERSION);
+    addJpdlParserVersion(JpdlParserV40.INSTANCE);
+    addJpdlParserVersion(JpdlParserV42.INSTANCE);
   }
   
   static void addJpdlParserVersion(JpdlParserVersion jpdlParserVersion) {
@@ -68,7 +68,8 @@
   public Object parseDocumentElement(Element documentElement, Parse parse) {
     String namespace = documentElement.getNamespaceURI();
     if (namespace==null) {
-      
+      namespace = LATEST_JPDL_VERSION_NAMESPACE_URI;
+      log.info("no namespace specified in process "+documentElement.getAttribute("name")+".  Using "+namespace);
     }
     JpdlParserVersion jpdlParserVersion = jpdlParserVersions.get(namespace);
     if (jpdlParserVersion==null) {

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlVersionDeployer.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlVersionDeployer.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlVersionDeployer.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -30,6 +30,7 @@
 import javax.xml.transform.OutputKeys;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
@@ -59,30 +60,7 @@
 
           DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
           Document document = documentBuilder.parse(xmlInputStream);
-          try {
-            Element documentElement = document.getDocumentElement();
-            if (documentElement.getNamespaceURI()==null) {
-              String latestVersionNamespaceUri = JpdlParser.LATEST_PARSER_VERSION.getNamespaceUri();
-              log.debug("adding namespace "+latestVersionNamespaceUri+" to deployment resource "+resourceName);
-              
-              String prefix = documentElement.getPrefix();
-              String oldNodeName = documentElement.getNodeName();
-              String newTagName = (prefix!=null ? prefix+":"+oldNodeName : oldNodeName);
-              document.renameNode(documentElement, latestVersionNamespaceUri, newTagName);
-      
-              Transformer transformer = TransformerFactory.newInstance().newTransformer();
-              transformer.setOutputProperty(OutputKeys.INDENT, "yes");
-              //initialize StreamResult with File object to save to file
-              StreamResult result = new StreamResult(new StringWriter());
-              DOMSource source = new DOMSource(document);
-              transformer.transform(source, result);
-              
-              bytes = result.getWriter().toString().getBytes();
-              deployment.addResourceFromInputStream(resourceName, new ByteArrayInputStream(bytes));
-            }
-          } catch (Exception e) {
-            log.error("couldn't add namespace to resource "+resourceName+" in deployment "+deployment.getId(), e);
-          }
+          checkNamespaceDeclaration(deployment, resourceName, document);
         } catch (Exception e) {
           log.error("couldn't parse resource "+resourceName+" in deployment "+deployment.getId()+" for checking the namespace", e);
         }
@@ -90,4 +68,32 @@
     }
   }
 
+  private void checkNamespaceDeclaration(DeploymentImpl deployment, String resourceName, Document document) throws TransformerFactoryConfigurationError {
+    byte[] bytes;
+    try {
+      Element documentElement = document.getDocumentElement();
+      if (documentElement.getNamespaceURI()==null) {
+        String latestVersionNamespaceUri = JpdlParser.LATEST_JPDL_VERSION_NAMESPACE_URI;
+        log.debug("adding namespace "+latestVersionNamespaceUri+" to deployment resource "+resourceName);
+        
+        String prefix = documentElement.getPrefix();
+        String oldNodeName = documentElement.getNodeName();
+        String newTagName = (prefix!=null ? prefix+":"+oldNodeName : oldNodeName);
+        document.renameNode(documentElement, latestVersionNamespaceUri, newTagName);
+   
+        Transformer transformer = TransformerFactory.newInstance().newTransformer();
+        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+        //initialize StreamResult with File object to save to file
+        StreamResult result = new StreamResult(new StringWriter());
+        DOMSource source = new DOMSource(document);
+        transformer.transform(source, result);
+        
+        bytes = result.getWriter().toString().getBytes();
+        deployment.addResourceFromInputStream(resourceName, new ByteArrayInputStream(bytes));
+      }
+    } catch (Exception e) {
+      log.error("couldn't add namespace to resource "+resourceName+" in deployment "+deployment.getId(), e);
+    }
+  }
+
 }

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/JpdlParserV40.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/JpdlParserV40.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/JpdlParserV40.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -37,13 +37,13 @@
 import org.jbpm.api.listener.EventListener;
 import org.jbpm.api.model.Event;
 import org.jbpm.internal.log.Log;
-import org.jbpm.jpdl.internal.activity.MailListener;
 import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
 import org.jbpm.jpdl.internal.parser.JpdlBindingsParser;
 import org.jbpm.jpdl.internal.parser.JpdlParser;
 import org.jbpm.jpdl.internal.parser.JpdlParserVersion;
 import org.jbpm.jpdl.internal.parser.UnresolvedTransition;
 import org.jbpm.jpdl.internal.parser.UnresolvedTransitions;
+import org.jbpm.jpdl.internal.v40.activities.MailListener;
 import org.jbpm.jpdl.internal.v40.bindings.JpdlBinding;
 import org.jbpm.pvm.internal.email.impl.MailProducerImpl;
 import org.jbpm.pvm.internal.email.impl.MailTemplate;
@@ -99,13 +99,15 @@
   // array elements are mutable, even when final
   // never make a static array public
   static final String[] DEFAULT_BINDING_RESOURCES = {
-    "jbpm.jpdl.bindings.xml",
-    "jbpm.user.bindings.xml"
+    "jbpm.jpdl.bindings.v40.xml",
+    "jbpm.user.bindings.v40.xml"
   }; 
 
   static JpdlBindingsParser bindingsParser = new JpdlBindingsParser();
+  
+  public final static JpdlParserV40 INSTANCE = new JpdlParserV40(); 
 
-  public JpdlParserV40() {
+  JpdlParserV40() {
     parseBindings();
   }
   
@@ -126,7 +128,7 @@
           while (resourceUrls.hasMoreElements()) {
             URL resourceUrl = resourceUrls.nextElement();
             log.trace("loading jpdl bindings from resource: "+resourceUrl);
-            List<JpdlBinding> activityBindings = (List<JpdlBinding>) bindingsParser.createParse()
+            bindings = (Bindings) bindingsParser.createParse()
               .pushObject(bindings)
               .setUrl(resourceUrl)
               .execute()

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/CustomActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/CustomActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/CustomActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -26,6 +26,7 @@
 import org.jbpm.api.activity.ActivityBehaviour;
 import org.jbpm.api.activity.ActivityExecution;
 import org.jbpm.api.activity.ExternalActivityBehaviour;
+import org.jbpm.pvm.internal.wire.UserCodeReference;
 
 
 /**
@@ -35,21 +36,19 @@
 
   private static final long serialVersionUID = 1L;
 
-  protected ActivityBehaviour customBehaviour;
+  protected UserCodeReference customActivityReference;
 
+  public void execute(ActivityExecution execution) throws Exception {
+    ActivityBehaviour activityBehaviour = (ActivityBehaviour) customActivityReference.getObject(execution);
+    activityBehaviour.execute(execution);
+  }
+
   public void signal(ActivityExecution execution, String signalName, Map<String, ? > parameters) throws Exception {
-    ExternalActivityBehaviour externalActivityBehaviour = (ExternalActivityBehaviour)customBehaviour;
-    externalActivityBehaviour.signal(execution, signalName, parameters);
+    ExternalActivityBehaviour externalActivityBehaviour = (ExternalActivityBehaviour) customActivityReference.getObject(execution);
+    externalActivityBehaviour.execute(execution);
   }
 
-  public void execute(ActivityExecution execution) throws Exception {
-    customBehaviour.execute(execution);
+  public void setCustomActivityReference(UserCodeReference customActivityReference) {
+    this.customActivityReference = customActivityReference;
   }
-  
-  public ActivityBehaviour getCustomBehaviour() {
-    return customBehaviour;
-  }
-  public void setCustomBehaviour(ActivityBehaviour customBehaviour) {
-    this.customBehaviour = customBehaviour;
-  }
 }

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionExpressionActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionExpressionActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionExpressionActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -23,7 +23,6 @@
 
 import org.jbpm.api.JbpmException;
 import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.pvm.internal.env.EnvironmentDefaults;
 import org.jbpm.pvm.internal.model.Activity;
 import org.jbpm.pvm.internal.model.ExecutionImpl;
 import org.jbpm.pvm.internal.model.Transition;
@@ -47,7 +46,7 @@
     Activity activity = execution.getActivity();
     String transitionName = null;
 
-    ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
+    ScriptManager scriptManager = ScriptManager.getScriptManager();
     Object result = scriptManager.evaluateExpression(expr, lang);
     if ( (result!=null)
          && (! (result instanceof String))

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JavaActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JavaActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JavaActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -26,12 +26,8 @@
 
 import org.jbpm.api.JbpmException;
 import org.jbpm.api.model.OpenExecution;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.env.EnvironmentDefaults;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
 import org.jbpm.pvm.internal.script.ScriptManager;
 import org.jbpm.pvm.internal.util.ReflectUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
 import org.jbpm.pvm.internal.wire.WireContext;
 import org.jbpm.pvm.internal.wire.WireException;
 import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
@@ -64,7 +60,7 @@
       invocationTarget = target;
 
     } else if (targetExpression!=null) {
-      ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
+      ScriptManager scriptManager = ScriptManager.getScriptManager();
       invocationTarget = scriptManager.evaluateExpression(targetExpression, targetLanguage);
     
     } else {

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlAutomaticActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlAutomaticActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlAutomaticActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -20,5 +20,5 @@
     perform(execution);
   }    
     
-  abstract void perform(OpenExecution execution) throws Exception;
+  public abstract void perform(OpenExecution execution) throws Exception;
 }

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -39,7 +39,7 @@
 
   private static final long serialVersionUID = 1L;
 
-  void perform(OpenExecution execution) throws Exception {
+  public void perform(OpenExecution execution) throws Exception {
     Collection<Message> messages = mailProducer.produce(execution);
     EnvironmentImpl.getFromCurrent(MailSession.class).send(messages);
   }

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessInParameterImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessInParameterImpl.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessInParameterImpl.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -21,7 +21,6 @@
  */
 package org.jbpm.jpdl.internal.v40.activities;
 
-import org.jbpm.pvm.internal.env.EnvironmentDefaults;
 import org.jbpm.pvm.internal.model.ExecutionImpl;
 import org.jbpm.pvm.internal.script.ScriptManager;
 
@@ -38,7 +37,7 @@
     if (variableName!=null) {
       value = superExecution.getVariable(variableName);
     } else {
-      ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
+      ScriptManager scriptManager = ScriptManager.getScriptManager();
       value = scriptManager.evaluateExpression(expression, language);
     }
     

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessOutParameterImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessOutParameterImpl.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessOutParameterImpl.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -21,7 +21,6 @@
  */
 package org.jbpm.jpdl.internal.v40.activities;
 
-import org.jbpm.pvm.internal.env.EnvironmentDefaults;
 import org.jbpm.pvm.internal.model.ExecutionImpl;
 import org.jbpm.pvm.internal.model.ScopeInstanceImpl;
 import org.jbpm.pvm.internal.script.ScriptManager;
@@ -40,7 +39,7 @@
     if (variableName!=null) {
       value = subProcessInstance.getVariable(subVariableName);
     } else {
-      ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
+      ScriptManager scriptManager = ScriptManager.getScriptManager();
       value = scriptManager.evaluateExpression(expression, language);
     }
 

Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/UserCodeEventListener.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/UserCodeEventListener.java	                        (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/UserCodeEventListener.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -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.jpdl.internal.v40.activities;
+
+import org.jbpm.api.listener.EventListener;
+import org.jbpm.api.listener.EventListenerExecution;
+import org.jbpm.pvm.internal.wire.UserCodeReference;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class UserCodeEventListener implements EventListener {
+
+  private static final long serialVersionUID = 1L;
+  
+  UserCodeReference eventListenerReference;
+
+  public void notify(EventListenerExecution execution) throws Exception {
+    EventListener eventListener = (EventListener) eventListenerReference.getObject(execution);
+    eventListener.notify(execution);
+  }
+
+  public void setEventListenerReference(UserCodeReference eventListenerReference) {
+    this.eventListenerReference = eventListenerReference;
+  }
+}


Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/UserCodeEventListener.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/CustomBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/CustomBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/CustomBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -21,9 +21,8 @@
  */
 package org.jbpm.jpdl.internal.v40.bindings;
 
-import org.jbpm.api.activity.ActivityBehaviour;
 import org.jbpm.jpdl.internal.v40.activities.CustomActivity;
-import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.UserCodeReference;
 import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
 import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
 import org.jbpm.pvm.internal.xml.Parse;
@@ -46,8 +45,9 @@
     CustomActivity customActivity = new CustomActivity();
     ObjectDescriptor descriptor = (ObjectDescriptor) 
         objectBinding.parse(element, parse, wireParser);
-    ActivityBehaviour customActivityBehaviour = (ActivityBehaviour) WireContext.create(descriptor);
-    customActivity.setCustomBehaviour(customActivityBehaviour);
+    UserCodeReference customActivityReference = new UserCodeReference();
+    customActivityReference.setDescriptor(descriptor);
+    customActivity.setCustomActivityReference(customActivityReference);
     return customActivity;
   }
 }

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/DecisionBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/DecisionBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/DecisionBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -30,9 +30,10 @@
 import org.jbpm.pvm.internal.model.ActivityImpl;
 import org.jbpm.pvm.internal.model.TransitionImpl;
 import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.UserCodeReference;
 import org.jbpm.pvm.internal.wire.WireContext;
 import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
-import org.jbpm.pvm.internal.wire.descriptor.ExpressionEvaluatorDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ExpressionConditionDescriptor;
 import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
 import org.jbpm.pvm.internal.wire.descriptor.ReferenceDescriptor;
 import org.jbpm.pvm.internal.wire.xml.WireParser;
@@ -94,17 +95,21 @@
         if (conditionElement.hasAttribute("expr")) {
           String expr = conditionElement.getAttribute("expr");
           String lang = XmlUtil.attribute(conditionElement, "expr-lang");
-          ExpressionEvaluatorDescriptor expressionDescriptor = new ExpressionEvaluatorDescriptor(expr, lang);
-          transition.setConditionDescriptor(expressionDescriptor);
+          UserCodeReference conditionReference = new UserCodeReference();
+          conditionReference.setDescriptor(new ExpressionConditionDescriptor(expr, lang));
+          transition.setConditionReference(conditionReference);
           
         } else if (conditionElement.hasAttribute("ref")) {
           String expr = conditionElement.getAttribute("ref");
-          ReferenceDescriptor refDescriptor = new ReferenceDescriptor(expr);
-          transition.setConditionDescriptor(refDescriptor);
+          UserCodeReference conditionReference = new UserCodeReference();
+          conditionReference.setDescriptor(new ReferenceDescriptor(expr));
+          transition.setConditionReference(conditionReference);
           
         } else if (ObjectBinding.isObjectDescriptor(conditionElement)) {
           ObjectDescriptor conditionDescriptor = (ObjectDescriptor) objectBinding.parse(conditionElement, parse, parser);
-          transition.setConditionDescriptor(conditionDescriptor);
+          UserCodeReference conditionReference = new UserCodeReference();
+          conditionReference.setDescriptor(conditionDescriptor);
+          transition.setConditionReference(conditionReference);
         }
       }
     }

Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndBinding.java	                        (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -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.jpdl.internal.v40.bindings;
+
+import org.jbpm.jpdl.internal.v40.activities.EndActivity;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EndBinding extends JpdlBinding {
+
+  public EndBinding() {
+    super("end");
+  }
+
+  protected EndBinding(String tag) {
+    super(tag);
+  }
+
+  public Object parse(Element element, Parse parse, Parser parser) {
+    
+    boolean endProcessInstance = true;
+    String ends = XmlUtil.attribute(element, "ends", false, parse);
+    if ("execution".equalsIgnoreCase(ends)) {
+      endProcessInstance = false;
+    }
+    
+    String state = XmlUtil.attribute(element, "state", false, parse);
+    
+    EndActivity endActivity = new EndActivity();
+    endActivity.setEndProcessInstance(endProcessInstance);
+    endActivity.setState(state);
+    
+    return endActivity;
+  }
+}


Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndBinding.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EventListenerBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EventListenerBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EventListenerBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -21,10 +21,10 @@
  */
 package org.jbpm.jpdl.internal.v40.bindings;
 
-import org.jbpm.api.listener.EventListener;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.jpdl.internal.v40.JpdlParserV40;
+import org.jbpm.jpdl.internal.v40.activities.UserCodeEventListener;
 import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.UserCodeReference;
 import org.jbpm.pvm.internal.xml.Parse;
 import org.jbpm.pvm.internal.xml.Parser;
 import org.w3c.dom.Element;
@@ -40,9 +40,12 @@
   }
 
   public Object parse(Element element, Parse parse, Parser parser) {
-    Descriptor descriptor = JpdlParser.parseObjectDescriptor(element, parse);
-    EventListener eventListener = (EventListener) WireContext.create(descriptor);
-    return eventListener;
+    Descriptor descriptor = JpdlParserV40.parseObjectDescriptor(element, parse);
+    UserCodeReference userCodeReference = new UserCodeReference();
+    userCodeReference.setDescriptor(descriptor);
+    UserCodeEventListener userCodeEventListener = new UserCodeEventListener();
+    userCodeEventListener.setEventListenerReference(userCodeReference);
+    return userCodeEventListener;
   }
 
 }

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/GroupBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/GroupBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/GroupBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -21,8 +21,8 @@
  */
 package org.jbpm.jpdl.internal.v40.bindings;
 
+import org.jbpm.jpdl.internal.v40.JpdlParserV40;
 import org.jbpm.jpdl.internal.v40.activities.GroupActivity;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
 import org.jbpm.pvm.internal.model.ActivityImpl;
 import org.jbpm.pvm.internal.xml.Parse;
 import org.jbpm.pvm.internal.xml.Parser;
@@ -43,8 +43,8 @@
     
     ActivityImpl activity = parse.findObject(ActivityImpl.class);
 
-    JpdlParser jpdlParser = (JpdlParser) parser;
-    jpdlParser.parseActivities(element, parse, activity);
+    JpdlParserV40 jpdlParserV40 = parse.findObject(JpdlParserV40.class);
+    jpdlParserV40.parseActivities(element, parse, activity);
 
     return groupActivity;
   }

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JavaBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JavaBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JavaBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -23,8 +23,8 @@
 
 import java.util.List;
 
+import org.jbpm.jpdl.internal.v40.JpdlParserV40;
 import org.jbpm.jpdl.internal.v40.activities.JavaActivity;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
 import org.jbpm.pvm.internal.util.XmlUtil;
 import org.jbpm.pvm.internal.wire.WireContext;
 import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
@@ -64,7 +64,7 @@
     }
 
     if (element.hasAttribute("class")) {
-      ObjectDescriptor objectDescriptor = JpdlParser.parseObjectDescriptor(element, parse);
+      ObjectDescriptor objectDescriptor = JpdlParserV40.parseObjectDescriptor(element, parse);
       Object target = WireContext.create(objectDescriptor);
       javaActivity.setTarget(target);
 

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JpdlBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JpdlBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JpdlBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -25,8 +25,9 @@
 import java.util.List;
 
 import org.jbpm.api.model.Event;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.jpdl.internal.xml.UnresolvedTransitions;
+import org.jbpm.jpdl.internal.parser.JpdlParser;
+import org.jbpm.jpdl.internal.parser.UnresolvedTransitions;
+import org.jbpm.jpdl.internal.v40.JpdlParserV40;
 import org.jbpm.pvm.internal.model.ActivityImpl;
 import org.jbpm.pvm.internal.model.TimerDefinitionImpl;
 import org.jbpm.pvm.internal.model.TransitionImpl;
@@ -42,10 +43,10 @@
  */
 public abstract class JpdlBinding extends TagBinding {
   
-  protected static final WireParser wireParser = JpdlParser.wireParser;
+  protected static final WireParser wireParser = WireParser.getInstance();
 
   public JpdlBinding(String tagName) {
-    super(tagName, JpdlParser.JPDL_NAMESPACE, null);
+    super(tagName, JpdlParserV40.NAMESPACE, null);
   }
 
   public void parseName(Element element, ActivityImpl activity, Parse parse) {
@@ -75,7 +76,7 @@
       Element timerElement = XmlUtil.element(transitionElement, "timer");
       if (timerElement!=null) {
         if (transitionName!=null) {
-          TimerDefinitionImpl timerDefinitionImpl = jpdlParser.parseTimerDefinition(timerElement, parse, activity);
+          TimerDefinitionImpl timerDefinitionImpl = JpdlParserV40.parseTimerDefinition(timerElement, parse, activity);
           timerDefinitionImpl.setSignalName(transitionName);
         } else {
           parse.addProblem("a transition name is required when a timer is placed on a transition", element);
@@ -87,7 +88,8 @@
 
       unresolvedTransitions.add(transition, transitionElement);
       
-      jpdlParser.parseOnEvent(transitionElement, parse, transition, Event.TAKE);
+      JpdlParserV40 jpdlParserV40 = parse.findObject(JpdlParserV40.class);
+      jpdlParserV40.parseOnEvent(transitionElement, parse, transition, Event.TAKE);
     }
   }
 }

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/MailBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/MailBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/MailBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -21,12 +21,11 @@
  */
 package org.jbpm.jpdl.internal.v40.bindings;
 
-import org.w3c.dom.Element;
-
+import org.jbpm.jpdl.internal.v40.JpdlParserV40;
 import org.jbpm.jpdl.internal.v40.activities.MailActivity;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
 import org.jbpm.pvm.internal.xml.Parse;
 import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
 
 /**
  * @author Alejandro Guizar
@@ -39,7 +38,7 @@
 
   public Object parse(Element element, Parse parse, Parser parser) {
     MailActivity activity = new MailActivity();
-    activity.setMailProducer(JpdlParser.parseMailProducer(element, parse, null));
+    activity.setMailProducer(JpdlParserV40.parseMailProducer(element, parse, null));
     return activity;
   }
 }

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/TaskBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/TaskBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/TaskBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -21,8 +21,8 @@
  */
 package org.jbpm.jpdl.internal.v40.bindings;
 
+import org.jbpm.jpdl.internal.v40.JpdlParserV40;
 import org.jbpm.jpdl.internal.v40.activities.TaskActivity;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
 import org.jbpm.pvm.internal.model.ScopeElementImpl;
 import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
 import org.jbpm.pvm.internal.xml.Parse;
@@ -44,7 +44,7 @@
     TaskActivity taskActivity = new TaskActivity();
 
     ScopeElementImpl scopeElement = parse.findObject(ScopeElementImpl.class);
-    TaskDefinitionImpl taskDefinition = JpdlParser.parseTaskDefinition(element, parse, scopeElement);
+    TaskDefinitionImpl taskDefinition = JpdlParserV40.parseTaskDefinition(element, parse, scopeElement);
     taskActivity.setTaskDefinition(taskDefinition);
     
     return taskActivity;

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/JpdlParserV42.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/JpdlParserV42.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/JpdlParserV42.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -21,17 +21,59 @@
  */
 package org.jbpm.jpdl.internal.v42;
 
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
 
+import org.jbpm.api.activity.ActivityBehaviour;
+import org.jbpm.api.listener.EventListener;
 import org.jbpm.api.model.Event;
+import org.jbpm.internal.log.Log;
+import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
+import org.jbpm.jpdl.internal.parser.JpdlBindingsParser;
 import org.jbpm.jpdl.internal.parser.JpdlParser;
 import org.jbpm.jpdl.internal.parser.JpdlParserVersion;
+import org.jbpm.jpdl.internal.parser.UnresolvedTransition;
 import org.jbpm.jpdl.internal.parser.UnresolvedTransitions;
+import org.jbpm.jpdl.internal.v40.activities.MailListener;
+import org.jbpm.jpdl.internal.v40.bindings.JpdlBinding;
+import org.jbpm.pvm.internal.email.impl.MailProducerImpl;
+import org.jbpm.pvm.internal.email.impl.MailTemplate;
+import org.jbpm.pvm.internal.email.impl.MailTemplateRegistry;
+import org.jbpm.pvm.internal.email.spi.MailProducer;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.model.ActivityCoordinatesImpl;
 import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.CompositeElementImpl;
+import org.jbpm.pvm.internal.model.Continuation;
+import org.jbpm.pvm.internal.model.EventImpl;
+import org.jbpm.pvm.internal.model.EventListenerReference;
+import org.jbpm.pvm.internal.model.ObservableElementImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.model.ScopeElementImpl;
 import org.jbpm.pvm.internal.model.TimerDefinitionImpl;
 import org.jbpm.pvm.internal.model.TransitionImpl;
+import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
+import org.jbpm.pvm.internal.model.VariableOutDefinitionImpl;
+import org.jbpm.pvm.internal.model.VariableOutDefinitionSet;
+import org.jbpm.pvm.internal.task.AssignableDefinitionImpl;
+import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
+import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
 import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.UserCodeReference;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.binding.MailTemplateBinding;
+import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.operation.Operation;
+import org.jbpm.pvm.internal.wire.xml.WireParser;
 import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.ProblemImpl;
 import org.w3c.dom.Element;
 
 
@@ -40,16 +82,23 @@
  */
 public class JpdlParserV42 extends JpdlParserVersion {
 
+  private static final Log log = Log.getLog(JpdlParserV42.class.getName());
+  
   public static final String NAMESPACE = "http://jbpm.org/4.2/jpdl";
 
+  public final static JpdlParserV42 INSTANCE = new JpdlParserV42(); 
+
+  JpdlParserV42() {
+    parseBindings();
+  }
+  
+  private void parseBindings() {
+  }
+
   public String getNamespaceUri() {
     return NAMESPACE;
   }
 
-  public Object parseDocumentElement(Element documentElement, Parse parse) {
-    return null;
-  }
-
   public void parseActivityName(Element element, ActivityImpl activity, Parse parse, boolean isRequired) {
     String name = XmlUtil.attribute(element, "name", isRequired, parse);
     
@@ -65,6 +114,291 @@
   }
 
   public void parseTransitions(Element element, ActivityImpl activity, Parse parse, JpdlParser jpdlParser) {
+//    List<Element> transitionElements = XmlUtil.elements(element, "transition");
+//    UnresolvedTransitions unresolvedTransitions = parse.findObject(UnresolvedTransitions.class);
+//    for (Element transitionElement: transitionElements) {
+//      String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
+//
+//      Element timerElement = XmlUtil.element(transitionElement, "timer");
+//      if (timerElement!=null) {
+//        if (transitionName!=null) {
+//          TimerDefinitionImpl timerDefinitionImpl = parseTimerDefinition(timerElement, parse, activity);
+//          timerDefinitionImpl.setSignalName(transitionName);
+//        } else {
+//          parse.addProblem("a transition name is required when a timer is placed on a transition", element);
+//        }
+//      }
+//
+//      TransitionImpl transition = activity.createOutgoingTransition();
+//      transition.setName(transitionName);
+//
+//      unresolvedTransitions.add(transition, transitionElement);
+//      
+//      parseOnEvent(transitionElement, parse, transition, Event.TAKE);
+//    }
+  }
+
+  public String getXsdResource() {
+    return "jpdl-4.2.xsd";
+  }
+
+  public static UserCodeReference parseUserCodeReference(Element element, Parse parse) {
+    return null;
+  }
+
+  public Object parseDocumentElement(Element documentElement, Parse parse) {
+    List<ProcessDefinitionImpl> processDefinitions = new ArrayList<ProcessDefinitionImpl>();
+    
+    JpdlProcessDefinition processDefinition = (JpdlProcessDefinition) parse.getDocumentObject();
+    if (processDefinition==null) {
+      processDefinition = new JpdlProcessDefinition();
+      parse.setDocumentObject(processDefinition);
+    }
+    
+    processDefinitions.add(processDefinition);
+    
+    parse.pushObject(processDefinition);
+    try {
+      // process attribues
+      String name = XmlUtil.attribute(documentElement, "name", true, parse);
+      processDefinition.setName(name);
+      
+      String packageName = XmlUtil.attribute(documentElement, "package");
+      processDefinition.setPackageName(packageName);
+
+      Integer version = XmlUtil.attributeInteger(documentElement, "version", false, parse);
+      if (version!=null) {
+        processDefinition.setVersion(version);
+      }
+
+      String key = XmlUtil.attribute(documentElement, "key", false, parse);
+      if (key!=null) {
+        processDefinition.setKey(key);
+      }
+
+      Element descriptionElement = XmlUtil.element(documentElement, "description");
+      if (descriptionElement!=null) {
+        String description = XmlUtil.getContentText(descriptionElement);
+        processDefinition.setDescription(description);
+      }
+      
+      UnresolvedTransitions unresolvedTransitions = new UnresolvedTransitions();
+      parse.pushObject(unresolvedTransitions);
+      
+      // swimlanes
+      List<Element> swimlaneElements = XmlUtil.elements(documentElement, "swimlane");
+      for (Element swimlaneElement: swimlaneElements) {
+        String swimlaneName = XmlUtil.attribute(swimlaneElement, "name", true, parse);
+        if (swimlaneName!=null) {
+          SwimlaneDefinitionImpl swimlaneDefinition = 
+              processDefinition.createSwimlaneDefinition(swimlaneName);
+          parseAssignmentAttributes(swimlaneElement, swimlaneDefinition, parse);
+        }
+      }
+
+      // on events
+      parseOnEvents(documentElement, parse, processDefinition);
+      
+      // activities
+      parseActivities(documentElement, parse, processDefinition);
+
+      // bind activities to their destinations
+      resolveTransitionDestinations(parse, processDefinition, unresolvedTransitions);
+
+    } finally {
+      parse.popObject();
+    }
+
+    if (processDefinition.getInitial()==null) {
+      parse.addProblem("no start activity in process", documentElement);
+    }
+    
+    return processDefinitions;
+  }
+
+  protected void resolveTransitionDestinations(Parse parse, JpdlProcessDefinition processDefinition, UnresolvedTransitions unresolvedTransitions) {
+    for (UnresolvedTransition unresolvedTransition: unresolvedTransitions.list) {
+      unresolvedTransition.resolve(processDefinition, parse);
+    }
+  }
+
+  public void parseActivities(Element documentElement, Parse parse, CompositeElementImpl compositeElement) {
+    List<Element> elements = XmlUtil.elements(documentElement);
+    for (Element nestedElement : elements) {
+      String tagName = XmlUtil.getTagLocalName(nestedElement);
+      if ("on".equals(tagName) 
+          || "timer".equals(tagName)
+          || "swimlane".equals(tagName)) continue;
+
+      JpdlBinding activityBinding = (JpdlBinding) bindings.getBinding(nestedElement, JpdlBindingsParser.CATEGORY_ACTIVITY);
+      if (activityBinding == null) {
+        log.debug("unrecognized activity: " + tagName);
+        continue;
+      }
+
+      ActivityImpl activity = compositeElement.createActivity();
+      parse.pushObject(activity);
+      try {
+        activity.setType(activityBinding.getTagName());
+        activityBinding.parseName(nestedElement, activity, parse);
+        parseTransitions(nestedElement, activity, parse);
+
+        Element descriptionElement = XmlUtil.element(documentElement, "description");
+        if (descriptionElement!=null) {
+          String description = XmlUtil.getContentText(descriptionElement);
+          activity.setDescription(description);
+        }
+
+        String continuationText = XmlUtil.attribute(nestedElement, "continue");
+        if (continuationText!=null) {
+          if ("async".equals(continuationText)) {
+            activity.setContinuation(Continuation.ASYNCHRONOUS);
+          } else if ("exclusive".equals(continuationText)) {
+            activity.setContinuation(Continuation.EXCLUSIVE);
+          }
+        }
+
+        JpdlParser jpdlParser = parse.findObject(JpdlParser.class);
+        ActivityBehaviour activityBehaviour = (ActivityBehaviour) activityBinding.parse(nestedElement, parse, jpdlParser);
+        activity.setActivityBehaviour(activityBehaviour);
+
+        parseOnEvents(nestedElement, parse, activity);
+
+        String g = XmlUtil.attribute(nestedElement, "g");
+        if (g == null) continue;
+
+        StringTokenizer stringTokenizer = new StringTokenizer(g, ",");
+        ActivityCoordinatesImpl coordinates = null;
+        if (stringTokenizer.countTokens() == 4) {
+          try {
+            int x = Integer.parseInt(stringTokenizer.nextToken());
+            int y = Integer.parseInt(stringTokenizer.nextToken());
+            int width = Integer.parseInt(stringTokenizer.nextToken());
+            int height = Integer.parseInt(stringTokenizer.nextToken());
+            coordinates = new ActivityCoordinatesImpl(x, y, width, height);
+          } catch (NumberFormatException e) {
+            coordinates = null;
+          }
+        }
+        if (coordinates != null) {
+          activity.setCoordinates(coordinates);
+        } else {
+          parse.addProblem("invalid coordinates g=\"" + g + "\" in " + activity, nestedElement);
+        }
+      } finally {
+        parse.popObject();
+      }
+    }
+  }
+  
+  public static TimerDefinitionImpl parseTimerDefinition(Element timerElement, Parse parse, ScopeElementImpl scopeElement) {
+    TimerDefinitionImpl timerDefinition = scopeElement.createTimerDefinition();
+
+    String duedate = XmlUtil.attribute(timerElement, "duedate");
+    String duedatetime = XmlUtil.attribute(timerElement, "duedatetime");
+
+    if (duedate!=null) {
+      timerDefinition.setDueDateDescription(duedate);
+      
+    } else if (duedatetime!=null) {
+      String dueDateTimeFormatText = (String) EnvironmentImpl.getFromCurrent("jbpm.duedatetime.format");
+      if (dueDateTimeFormatText==null) {
+        dueDateTimeFormatText = "HH:mm dd/MM/yyyy";
+      }
+      SimpleDateFormat dateFormat = new SimpleDateFormat(dueDateTimeFormatText);
+      try {
+        Date duedatetimeDate = dateFormat.parse(duedatetime);
+        timerDefinition.setDueDate(duedatetimeDate);
+      } catch (ParseException e) {
+        parse.addProblem("couldn't parse duedatetime "+duedatetime, e);
+      }
+    } else {
+      parse.addProblem("either duedate or duedatetime is required in timer", timerElement);
+    }
+    
+    String repeat = XmlUtil.attribute(timerElement, "repeat");
+    timerDefinition.setRepeat(repeat);
+    
+    return timerDefinition;
+  }
+
+  public void parseOnEvents(Element element, Parse parse, ScopeElementImpl scopeElement) {
+    // event listeners
+    List<Element> onElements = XmlUtil.elements(element, "on");
+    for (Element onElement: onElements) {
+      String eventName = XmlUtil.attribute(onElement, "event", true, parse);
+      parseOnEvent(onElement, parse, scopeElement, eventName);
+
+      Element timerElement = XmlUtil.element(onElement, "timer");
+      if (timerElement!=null) {
+        TimerDefinitionImpl timerDefinitionImpl = parseTimerDefinition(timerElement, parse, scopeElement);
+        timerDefinitionImpl.setEventName(eventName);
+      }
+    }
+  }
+
+  public void parseOnEvent(Element element, Parse parse, ObservableElementImpl observableElement, String eventName) {
+    if (eventName!=null) {
+      EventImpl event = observableElement.getEvent(eventName);
+      if (event==null) {
+        event = observableElement.createEvent(eventName);
+      }
+      
+      String continuationText = XmlUtil.attribute(element, "continue");
+      if (continuationText!=null) {
+        if ("async".equals(continuationText)) {
+          event.setContinuation(Continuation.ASYNCHRONOUS);
+        } else if ("exclusive".equals(continuationText)) {
+          event.setContinuation(Continuation.EXCLUSIVE);
+        }
+      }
+
+      for (Element eventListenerElement: XmlUtil.elements(element)) {
+        JpdlBinding eventBinding = (JpdlBinding) bindings.getBinding(eventListenerElement, JpdlBindingsParser.CATEGORY_EVENT_LISTENER);
+        if (eventBinding!=null) {
+          JpdlParser jpdlParser = parse.findObject(JpdlParser.class);
+          EventListener eventListener = (EventListener) eventBinding.parse(eventListenerElement, parse, jpdlParser);
+          EventListenerReference eventListenerReference = event.createEventListenerReference(eventListener);
+          
+          if (XmlUtil.attributeBoolean(eventListenerElement, "propagation", false, parse, false)) {
+            eventListenerReference.setPropagationEnabled(true);
+          }
+          
+          continuationText = XmlUtil.attribute(eventListenerElement, "continue");
+          if (continuationText!=null) {
+            if (observableElement instanceof ActivityImpl) {
+              if (observableElement.getName()==null) {
+                parse.addProblem("async continuation on event listener requires activity name", eventListenerElement);
+              }
+            } else if (observableElement instanceof TransitionImpl) {
+              TransitionImpl transition = (TransitionImpl) observableElement;
+              if (transition.getSource().getName()==null) {
+                parse.addProblem("async continuation on event listener requires name in the transition source activity", eventListenerElement);
+              }
+            }
+            if ("async".equals(continuationText)) {
+              eventListenerReference.setContinuation(Continuation.ASYNCHRONOUS);
+            } else if ("exclusive".equals(continuationText)) {
+              eventListenerReference.setContinuation(Continuation.EXCLUSIVE);
+            }
+          }
+
+        } else {
+          String tagName = XmlUtil.getTagLocalName(eventListenerElement);
+          if ( ! ( (observableElement instanceof TransitionImpl)
+                   && ( "condition".equals(tagName)
+                        || "timer".equals(tagName)
+                      )
+                 )
+             ) {
+            parse.addProblem("unrecognized event listener: "+tagName, null, ProblemImpl.TYPE_WARNING, eventListenerElement);
+          }
+        }
+      }
+    }
+  }
+
+  public void parseTransitions(Element element, ActivityImpl activity, Parse parse) {
     List<Element> transitionElements = XmlUtil.elements(element, "transition");
     UnresolvedTransitions unresolvedTransitions = parse.findObject(UnresolvedTransitions.class);
     for (Element transitionElement: transitionElements) {
@@ -72,22 +406,261 @@
 
       Element timerElement = XmlUtil.element(transitionElement, "timer");
       if (timerElement!=null) {
-        if (transitionName!=null) {
-          TimerDefinitionImpl timerDefinitionImpl = parseTimerDefinition(timerElement, parse, activity);
-          timerDefinitionImpl.setSignalName(transitionName);
-        } else {
-          parse.addProblem("a transition name is required when a timer is placed on a transition", element);
-        }
+        TimerDefinitionImpl timerDefinitionImpl = parseTimerDefinition(timerElement, parse, activity);
+        timerDefinitionImpl.setSignalName(transitionName);
       }
-
+  
       TransitionImpl transition = activity.createOutgoingTransition();
       transition.setName(transitionName);
-
+  
       unresolvedTransitions.add(transition, transitionElement);
       
       parseOnEvent(transitionElement, parse, transition, Event.TAKE);
     }
   }
 
+  public static void parseAssignmentAttributes(Element element, AssignableDefinitionImpl assignableDefinition, Parse parse) {
+    Element descriptionElement = XmlUtil.element(element, "description");
+    if (descriptionElement!=null) {
+      String description = XmlUtil.getContentText(descriptionElement);
+      assignableDefinition.setDescription(description);
+    }
+  
+    Element assignmentHandlerElement = XmlUtil.element(element, "assignment-handler");
+    if (assignmentHandlerElement!=null) {
+      ObjectDescriptor objectDescriptor = parseObjectDescriptor(assignmentHandlerElement, parse);
+      UserCodeReference assignmentHandlerReference = new UserCodeReference();
+      assignmentHandlerReference.setDescriptor(objectDescriptor);
+      assignableDefinition.setAssignmentHandlerReference(assignmentHandlerReference);
+    }
+  
+    String assigneeExpression = XmlUtil.attribute(element, "assignee");
+    assignableDefinition.setAssigneeExpression(assigneeExpression);
+    
+    String assigneeExpressionLanguage = XmlUtil.attribute(element, "assignee-lang");
+    assignableDefinition.setAssigneeExpressionLanguage(assigneeExpressionLanguage);
+    
+    String candidateUsersExpression = XmlUtil.attribute(element, "candidate-users");
+    assignableDefinition.setCandidateUsersExpression(candidateUsersExpression);
+    
+    String candidateUsersExpressionLanguage = XmlUtil.attribute(element, "candidate-users-lang");
+    assignableDefinition.setCandidateUsersExpressionLanguage(candidateUsersExpressionLanguage);
+    
+    String candidateGroupsExpression = XmlUtil.attribute(element, "candidate-groups");
+    assignableDefinition.setCandidateGroupsExpression(candidateGroupsExpression);
+    
+    String candidateGroupsExpressionLanguage = XmlUtil.attribute(element, "candidate-groups-lang");
+    assignableDefinition.setCandidateGroupsExpressionLanguage(candidateGroupsExpressionLanguage);
+  }
 
+  public static TaskDefinitionImpl parseTaskDefinition(Element element, Parse parse, ScopeElementImpl scopeElement) {
+    TaskDefinitionImpl taskDefinition = new TaskDefinitionImpl();
+  
+    String taskName = XmlUtil.attribute(element, "name");
+    taskDefinition.setName(taskName);
+
+    String form = XmlUtil.attribute(element, "form");
+    taskDefinition.setFormResourceName(form);
+    
+    ProcessDefinitionImpl processDefinition = parse.findObject(ProcessDefinitionImpl.class);
+    if (processDefinition.getTaskDefinition(taskName)!=null) {
+      parse.addProblem("duplicate task name "+taskName, element);
+    } else {
+      processDefinition.addTaskDefinitionImpl(taskDefinition);
+    }
+
+    String swimlaneName = XmlUtil.attribute(element, "swimlane");
+    if (swimlaneName!=null) {
+      JpdlProcessDefinition jpdlProcessDefinition = parse.findObject(JpdlProcessDefinition.class);
+      SwimlaneDefinitionImpl swimlaneDefinition = jpdlProcessDefinition.getSwimlaneDefinition(swimlaneName);
+      if (swimlaneDefinition!=null) {
+        taskDefinition.setSwimlaneDefinition(swimlaneDefinition);
+      } else {
+        parse.addProblem("swimlane "+swimlaneName+" not declared", element);
+      }
+    }
+    
+    parseAssignmentAttributes(element, taskDefinition, parse);
+    
+    // parse notification mail producer
+    Element notificationElement = XmlUtil.element(element, "notification");
+    if (notificationElement != null) {
+      parseMailEvent(notificationElement, parse, scopeElement, Event.ASSIGN);
+    }
+
+    Element reminderElement = XmlUtil.element(element, "reminder");
+    if (reminderElement != null) {
+      parseMailEvent(reminderElement, parse, scopeElement, Event.REMIND);
+      // associate timer to event
+      TimerDefinitionImpl timerDefinition = parseTimerDefinition(reminderElement, parse, scopeElement);
+      timerDefinition.setEventName(Event.REMIND);
+    }
+
+    return taskDefinition;
+  }
+
+  public static ObjectDescriptor parseObjectDescriptor(Element element, Parse parse) {
+    ObjectDescriptor objectDescriptor = new ObjectDescriptor();
+  
+    String className = XmlUtil.attribute(element, "class");
+    if (className!=null) {
+      objectDescriptor.setClassName(className);
+  
+      // read the operations elements
+      List<Operation> operations = null;
+      List<Element> elements = XmlUtil.elements(element);
+      
+      Set<String> operationTagNames = WireParser.getInstance().getBindings().getTagNames(WireParser.CATEGORY_OPERATION);
+      for (Element childElement: elements) {
+        if (operationTagNames.contains(childElement.getTagName())) {
+          Operation operation = (Operation) WireParser.getInstance().parseElement(childElement, parse, WireParser.CATEGORY_OPERATION);
+          if (operations==null) {
+            operations = new ArrayList<Operation>();
+          }
+          operations.add(operation);
+        }
+      }
+      objectDescriptor.setOperations(operations);
+  
+      // autowiring
+      Boolean isAutoWireEnabled = XmlUtil.attributeBoolean(element, "auto-wire", false, parse);
+      if (isAutoWireEnabled!=null) {
+        objectDescriptor.setAutoWireEnabled(isAutoWireEnabled.booleanValue());
+      }
+    }
+    return objectDescriptor;
+  }
+  
+
+  public static List<VariableDefinitionImpl> parseVariableDefinitions(Element element, Parse parse, boolean initRequired) {
+    List<VariableDefinitionImpl> variableDefinitions = new ArrayList<VariableDefinitionImpl>();
+    
+    for (Element inElement: XmlUtil.elements(element, "variable")) {
+      VariableDefinitionImpl variableDefinition = new VariableDefinitionImpl();
+
+      String name = XmlUtil.attribute(inElement, "name", true, parse);
+      variableDefinition.setName(name);
+      
+      int sources = 0;
+      
+      String initExpr = XmlUtil.attribute(inElement, "init");
+      if (initExpr!=null) {
+        variableDefinition.setInitExpression(initExpr);
+        sources++;
+      }
+      
+      Element valueElement = XmlUtil.element(inElement);
+      if (valueElement!=null) {
+        Descriptor initValueDescriptor = (Descriptor) WireParser.getInstance().parseElement(valueElement, parse);
+        variableDefinition.setInitDescriptor(initValueDescriptor);
+        sources++;
+      }
+
+      if (initRequired && sources==0) {
+        parse.addProblem("no init specified", inElement);
+      }
+      if (sources>1) {
+        parse.addProblem("init attribute and init element are mutually exclusive on element variable", inElement);
+      }
+      
+      variableDefinitions.add(variableDefinition);
+    }
+
+    return variableDefinitions;
+  }
+
+  public static VariableOutDefinitionSet parseVariableOutDefinitionSet(Element element, Parse parse) {
+    VariableOutDefinitionSet variableOutDefinitionSet = new VariableOutDefinitionSet();
+    
+    for (Element inElement: XmlUtil.elements(element, "out-variable")) {
+      VariableOutDefinitionImpl variableOutDefinition = variableOutDefinitionSet.createVariableOutDefinition();
+
+      String name = XmlUtil.attribute(inElement, "name", true, parse);
+      variableOutDefinition.setName(name);
+      
+      String expression = XmlUtil.attribute(inElement, "init");
+      if (expression!=null) {
+        variableOutDefinition.setExpression(expression);
+      }
+    }
+
+    return variableOutDefinitionSet;
+  }
+
+  public static void parseMailEvent(Element element, Parse parse,
+      ObservableElementImpl observableElement, String eventName) {
+    // obtain assign event
+    EventImpl event = observableElement.getEvent(eventName);
+    if (event == null) {
+      event = observableElement.createEvent(eventName);
+    }
+    // register event listener
+    MailListener eventListener = new MailListener();
+    EventListenerReference eventListenerRef = event.createEventListenerReference(eventListener);
+    // set continuation mode
+    String continuationText = XmlUtil.attribute(element, "continue");
+    if ("async".equals(continuationText)) {
+      eventListenerRef.setContinuation(Continuation.ASYNCHRONOUS);
+    }
+    else if ("exclusive".equals(continuationText)) {
+      eventListenerRef.setContinuation(Continuation.EXCLUSIVE);
+    }
+
+    //https://jira.jboss.org/jira/browse/JBPM-2466
+    String mailTemplateName = eventName;
+    if (Event.ASSIGN.equals(eventName)) {
+        mailTemplateName = "task-notification";
+    } else if (Event.REMIND.equals(eventName)) {
+        mailTemplateName = "task-reminder";
+    }
+    
+    // associate mail producer to event listener
+    MailProducer mailProducer = parseMailProducer(element, parse, mailTemplateName);
+    eventListener.setMailProducer(mailProducer);
+  }
+
+  public static MailProducer parseMailProducer(Element element, Parse parse, String defaultTemplateName) {
+    // check whether the element is a generic object descriptor
+    if (ObjectBinding.isObjectDescriptor(element)) {
+      // TODO test custom mail producer
+      ObjectDescriptor objectDescriptor = parseObjectDescriptor(element, parse);
+      return (MailProducer) WireContext.create(objectDescriptor);
+    }
+
+    // parse the default producer
+    MailProducerImpl mailProducer = new MailProducerImpl();
+    mailProducer.setTemplate(parseMailTemplate(element, parse, defaultTemplateName));
+    return mailProducer;
+  }
+
+  private static MailTemplate parseMailTemplate(Element element, Parse parse,
+      String defaultTemplateName) {
+    if (element.hasAttribute("template")) {
+      // fetch template from configuration
+      return findTemplate(element, parse, element.getAttribute("template"));
+    }
+    if (!XmlUtil.isTextOnly(element)) {
+      // parse inline template
+      return MailTemplateBinding.parseMailTemplate(element, parse);
+    }
+    if (defaultTemplateName != null) {
+      // fetch default template
+      return findTemplate(element, parse, defaultTemplateName);
+    }
+    parse.addProblem("mail template must be referenced in the 'template' attribute "
+        + "or specified inline", element);
+    return null;
+  }
+
+  private static MailTemplate findTemplate(Element element, Parse parse, String templateName) {
+    MailTemplateRegistry templateRegistry = EnvironmentImpl.getFromCurrent(MailTemplateRegistry.class);
+    if (templateRegistry != null) {
+      MailTemplate template = templateRegistry.getTemplate(templateName);
+      if (template != null) return template;
+    }
+    parse.addProblem("mail template not found: " + templateName, element);
+    return null;
+  }
+
+
 }

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/DecisionHandlerActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/DecisionHandlerActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/DecisionHandlerActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -22,9 +22,9 @@
 package org.jbpm.jpdl.internal.v42.activities;
 
 import org.jbpm.api.JbpmException;
+import org.jbpm.api.activity.ActivityBehaviour;
 import org.jbpm.api.activity.ActivityExecution;
 import org.jbpm.api.jpdl.DecisionHandler;
-import org.jbpm.jpdl.internal.activity.JpdlActivity;
 import org.jbpm.pvm.internal.env.EnvironmentImpl;
 import org.jbpm.pvm.internal.model.ActivityImpl;
 import org.jbpm.pvm.internal.model.ExecutionImpl;
@@ -34,7 +34,7 @@
 /**
  * @author Tom Baeyens
  */
-public class DecisionHandlerActivity extends JpdlActivity {
+public class DecisionHandlerActivity implements ActivityBehaviour  {
 
   private static final long serialVersionUID = 1L;
   

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/JavaActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/JavaActivity.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/JavaActivity.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -26,7 +26,7 @@
 
 import org.jbpm.api.JbpmException;
 import org.jbpm.api.model.OpenExecution;
-import org.jbpm.jpdl.internal.activity.JpdlAutomaticActivity;
+import org.jbpm.jpdl.internal.v40.activities.JpdlAutomaticActivity;
 import org.jbpm.pvm.internal.util.ReflectUtil;
 import org.jbpm.pvm.internal.wire.UserCodeReference;
 import org.jbpm.pvm.internal.wire.WireContext;

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/CustomBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/CustomBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/CustomBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -21,8 +21,8 @@
  */
 package org.jbpm.jpdl.internal.v42.binding;
 
-import org.jbpm.jpdl.internal.parser.JpdlBinding;
 import org.jbpm.jpdl.internal.parser.JpdlParser;
+import org.jbpm.jpdl.internal.v42.JpdlParserV42;
 import org.jbpm.jpdl.internal.v42.activities.CustomActivity;
 import org.jbpm.pvm.internal.wire.UserCodeReference;
 import org.jbpm.pvm.internal.xml.Parse;
@@ -42,7 +42,7 @@
   public Object parse(Element element, Parse parse, Parser parser) {
     CustomActivity customActivity = new CustomActivity();
 
-    UserCodeReference customActivityReference = JpdlParser.parseUserCodeReference(element, parse);
+    UserCodeReference customActivityReference = JpdlParserV42.parseUserCodeReference(element, parse);
     customActivity.setCustomActivityReference(customActivityReference);
 
     return customActivity;

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/DecisionBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/DecisionBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/DecisionBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -23,10 +23,10 @@
 
 import java.util.List;
 
-import org.jbpm.jpdl.internal.activity.DecisionConditionActivity;
-import org.jbpm.jpdl.internal.activity.DecisionExpressionActivity;
-import org.jbpm.jpdl.internal.parser.JpdlBinding;
 import org.jbpm.jpdl.internal.parser.JpdlParser;
+import org.jbpm.jpdl.internal.v40.activities.DecisionConditionActivity;
+import org.jbpm.jpdl.internal.v40.activities.DecisionExpressionActivity;
+import org.jbpm.jpdl.internal.v42.JpdlParserV42;
 import org.jbpm.jpdl.internal.v42.activities.DecisionHandlerActivity;
 import org.jbpm.pvm.internal.model.ActivityImpl;
 import org.jbpm.pvm.internal.model.TransitionImpl;
@@ -71,7 +71,7 @@
     Element handlerElement = XmlUtil.element(element, "handler");
     if (handlerElement!=null) {
       DecisionHandlerActivity decisionHandlerActivity = new DecisionHandlerActivity();
-      UserCodeReference decisionHandlerReference = JpdlParser.parseUserCodeReference(handlerElement, parse);
+      UserCodeReference decisionHandlerReference = JpdlParserV42.parseUserCodeReference(handlerElement, parse);
       decisionHandlerActivity.setDecisionHandlerReference(decisionHandlerReference);
       return decisionHandlerActivity;
     }
@@ -107,7 +107,7 @@
           transition.setConditionReference(conditionReference);
           
         } else if (ObjectBinding.isObjectDescriptor(conditionElement)) {
-          UserCodeReference decisionHandlerReference = JpdlParser.parseUserCodeReference(conditionElement, parse);
+          UserCodeReference decisionHandlerReference = JpdlParserV42.parseUserCodeReference(conditionElement, parse);
           transition.setConditionReference(decisionHandlerReference);
         
         } 

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/EventListenerBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/EventListenerBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/EventListenerBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -21,8 +21,7 @@
  */
 package org.jbpm.jpdl.internal.v42.binding;
 
-import org.jbpm.jpdl.internal.parser.JpdlBinding;
-import org.jbpm.jpdl.internal.parser.JpdlParser;
+import org.jbpm.jpdl.internal.v42.JpdlParserV42;
 import org.jbpm.jpdl.internal.v42.activities.UserCodeEventListener;
 import org.jbpm.pvm.internal.wire.UserCodeReference;
 import org.jbpm.pvm.internal.xml.Parse;
@@ -41,7 +40,7 @@
 
   public Object parse(Element element, Parse parse, Parser parser) {
     UserCodeEventListener userCodeEventListener = new UserCodeEventListener();
-    UserCodeReference eventListenerReference = JpdlParser.parseUserCodeReference(element, parse);
+    UserCodeReference eventListenerReference = JpdlParserV42.parseUserCodeReference(element, parse);
     userCodeEventListener.setEventListenerReference(eventListenerReference);
     return userCodeEventListener;
   }

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/GroupBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/GroupBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/GroupBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -21,9 +21,9 @@
  */
 package org.jbpm.jpdl.internal.v42.binding;
 
-import org.jbpm.jpdl.internal.activity.GroupActivity;
-import org.jbpm.jpdl.internal.parser.JpdlBinding;
 import org.jbpm.jpdl.internal.parser.JpdlParser;
+import org.jbpm.jpdl.internal.v40.activities.GroupActivity;
+import org.jbpm.jpdl.internal.v42.JpdlParserV42;
 import org.jbpm.pvm.internal.model.ActivityImpl;
 import org.jbpm.pvm.internal.xml.Parse;
 import org.jbpm.pvm.internal.xml.Parser;
@@ -44,8 +44,8 @@
     
     ActivityImpl activity = parse.findObject(ActivityImpl.class);
 
-    JpdlParser jpdlParser = (JpdlParser) parser;
-    jpdlParser.parseActivities(element, parse, activity);
+    JpdlParserV42 jpdlParserV42 = parse.findObject(JpdlParserV42.class);
+    jpdlParserV42.parseActivities(element, parse, activity);
 
     return groupActivity;
   }

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/JavaBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/JavaBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/JavaBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -23,8 +23,7 @@
 
 import java.util.List;
 
-import org.jbpm.jpdl.internal.parser.JpdlBinding;
-import org.jbpm.jpdl.internal.parser.JpdlParser;
+import org.jbpm.jpdl.internal.v42.JpdlParserV42;
 import org.jbpm.jpdl.internal.v42.activities.JavaActivity;
 import org.jbpm.pvm.internal.util.XmlUtil;
 import org.jbpm.pvm.internal.wire.UserCodeReference;
@@ -65,7 +64,7 @@
     }
 
     if (ObjectBinding.isObjectDescriptor(element)) {
-      UserCodeReference targetReference = JpdlParser.parseUserCodeReference(element, parse);
+      UserCodeReference targetReference = JpdlParserV42.parseUserCodeReference(element, parse);
       javaActivity.setTargetReference(targetReference);
     }
      

Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/JpdlBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/JpdlBinding.java	                        (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/JpdlBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -0,0 +1,95 @@
+/*
+ * 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.jpdl.internal.v42.binding;
+
+
+import java.util.List;
+
+import org.jbpm.api.model.Event;
+import org.jbpm.jpdl.internal.parser.JpdlParser;
+import org.jbpm.jpdl.internal.parser.UnresolvedTransitions;
+import org.jbpm.jpdl.internal.v40.JpdlParserV40;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.TimerDefinitionImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
+import org.jbpm.pvm.internal.util.TagBinding;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.xml.WireParser;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class JpdlBinding extends TagBinding {
+  
+  protected static final WireParser wireParser = WireParser.getInstance();
+
+  public JpdlBinding(String tagName) {
+    super(tagName, JpdlParserV40.NAMESPACE, null);
+  }
+
+  public void parseName(Element element, ActivityImpl activity, Parse parse) {
+    String name = XmlUtil.attribute(element, "name", isNameRequired(), parse);
+    
+    if (name!=null) {
+      // basic name validation
+      if ("".equals(name)) {
+        parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "is empty"), element);
+      } else if (name.indexOf('/')!=-1) {
+        parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "contains slash (/)"), element);
+      }
+      activity.setName(name);
+    }
+  }
+
+  public boolean isNameRequired() {
+    return true;
+  }
+
+  public void parseTransitions(Element element, ActivityImpl activity, Parse parse, JpdlParser jpdlParser) {
+    List<Element> transitionElements = XmlUtil.elements(element, "transition");
+    UnresolvedTransitions unresolvedTransitions = parse.findObject(UnresolvedTransitions.class);
+    for (Element transitionElement: transitionElements) {
+      String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
+
+      Element timerElement = XmlUtil.element(transitionElement, "timer");
+      if (timerElement!=null) {
+        if (transitionName!=null) {
+          TimerDefinitionImpl timerDefinitionImpl = JpdlParserV40.parseTimerDefinition(timerElement, parse, activity);
+          timerDefinitionImpl.setSignalName(transitionName);
+        } else {
+          parse.addProblem("a transition name is required when a timer is placed on a transition", element);
+        }
+      }
+
+      TransitionImpl transition = activity.createOutgoingTransition();
+      transition.setName(transitionName);
+
+      unresolvedTransitions.add(transition, transitionElement);
+      
+      JpdlParserV40 jpdlParserV40 = parse.findObject(JpdlParserV40.class);
+      jpdlParserV40.parseOnEvent(transitionElement, parse, transition, Event.TAKE);
+    }
+  }
+}


Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/JpdlBinding.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/MailBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/MailBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/MailBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -21,13 +21,12 @@
  */
 package org.jbpm.jpdl.internal.v42.binding;
 
-import org.w3c.dom.Element;
-
-import org.jbpm.jpdl.internal.activity.MailActivity;
-import org.jbpm.jpdl.internal.parser.JpdlBinding;
 import org.jbpm.jpdl.internal.parser.JpdlParser;
+import org.jbpm.jpdl.internal.v40.activities.MailActivity;
+import org.jbpm.jpdl.internal.v42.JpdlParserV42;
 import org.jbpm.pvm.internal.xml.Parse;
 import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
 
 /**
  * @author Alejandro Guizar
@@ -40,7 +39,10 @@
 
   public Object parse(Element element, Parse parse, Parser parser) {
     MailActivity activity = new MailActivity();
-    activity.setMailProducer(((JpdlParser)parser).parseMailProducer(element, parse, null));
+
+    JpdlParserV42 jpdlParserV42 = parse.findObject(JpdlParserV42.class);
+    activity.setMailProducer(jpdlParserV42.parseMailProducer(element, parse, null));
+
     return activity;
   }
 }

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/TaskBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/TaskBinding.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/TaskBinding.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -21,9 +21,9 @@
  */
 package org.jbpm.jpdl.internal.v42.binding;
 
-import org.jbpm.jpdl.internal.activity.TaskActivity;
-import org.jbpm.jpdl.internal.parser.JpdlBinding;
 import org.jbpm.jpdl.internal.parser.JpdlParser;
+import org.jbpm.jpdl.internal.v40.activities.TaskActivity;
+import org.jbpm.jpdl.internal.v42.JpdlParserV42;
 import org.jbpm.pvm.internal.model.ScopeElementImpl;
 import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
 import org.jbpm.pvm.internal.xml.Parse;
@@ -45,7 +45,7 @@
     TaskActivity taskActivity = new TaskActivity();
 
     ScopeElementImpl scopeElement = parse.findObject(ScopeElementImpl.class);
-    TaskDefinitionImpl taskDefinition = ((JpdlParser)parser).parseTaskDefinition(element, parse, scopeElement);
+    TaskDefinitionImpl taskDefinition = JpdlParserV42.parseTaskDefinition(element, parse, scopeElement);
     taskActivity.setTaskDefinition(taskDefinition);
     
     return taskActivity;

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/resources/jbpm.jpdl.bindings.v40.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/resources/jbpm.jpdl.bindings.v40.xml	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/resources/jbpm.jpdl.bindings.v40.xml	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,28 +1,28 @@
 <bindings>
 
-  <activity binding="org.jbpm.jpdl.internal.activity.StartBinding" />
-  <activity binding="org.jbpm.jpdl.internal.activity.StateBinding" />
-  <activity binding="org.jbpm.jpdl.internal.activity.DecisionBinding" />
-  <activity binding="org.jbpm.jpdl.internal.activity.EndBinding" />
-  <activity binding="org.jbpm.jpdl.internal.activity.EndCancelBinding" />
-  <activity binding="org.jbpm.jpdl.internal.activity.EndErrorBinding" />
-  <activity binding="org.jbpm.jpdl.internal.activity.ForkBinding" />
-  <activity binding="org.jbpm.jpdl.internal.activity.JoinBinding" />
-  <activity binding="org.jbpm.jpdl.internal.activity.HqlBinding" />
-  <activity binding="org.jbpm.jpdl.internal.activity.SqlBinding" />
-  <activity binding="org.jbpm.jpdl.internal.activity.JavaBinding" />
-  <activity binding="org.jbpm.jpdl.internal.activity.ScriptBinding" />
-  <activity binding="org.jbpm.jpdl.internal.activity.TaskBinding" />
-  <activity binding="org.jbpm.jpdl.internal.activity.SubProcessBinding" />
-  <activity binding="org.jbpm.jpdl.internal.activity.MailBinding" />
-  <activity binding="org.jbpm.jpdl.internal.activity.GroupBinding" />
-  <activity binding="org.jbpm.jpdl.internal.activity.CustomBinding" />
+  <activity binding="org.jbpm.jpdl.internal.v40.bindings.StartBinding" />
+  <activity binding="org.jbpm.jpdl.internal.v40.bindings.StateBinding" />
+  <activity binding="org.jbpm.jpdl.internal.v40.bindings.DecisionBinding" />
+  <activity binding="org.jbpm.jpdl.internal.v40.bindings.EndBinding" />
+  <activity binding="org.jbpm.jpdl.internal.v40.bindings.EndCancelBinding" />
+  <activity binding="org.jbpm.jpdl.internal.v40.bindings.EndErrorBinding" />
+  <activity binding="org.jbpm.jpdl.internal.v40.bindings.ForkBinding" />
+  <activity binding="org.jbpm.jpdl.internal.v40.bindings.JoinBinding" />
+  <activity binding="org.jbpm.jpdl.internal.v40.bindings.HqlBinding" />
+  <activity binding="org.jbpm.jpdl.internal.v40.bindings.SqlBinding" />
+  <activity binding="org.jbpm.jpdl.internal.v40.bindings.JavaBinding" />
+  <activity binding="org.jbpm.jpdl.internal.v40.bindings.ScriptBinding" />
+  <activity binding="org.jbpm.jpdl.internal.v40.bindings.TaskBinding" />
+  <activity binding="org.jbpm.jpdl.internal.v40.bindings.SubProcessBinding" />
+  <activity binding="org.jbpm.jpdl.internal.v40.bindings.MailBinding" />
+  <activity binding="org.jbpm.jpdl.internal.v40.bindings.GroupBinding" />
+  <activity binding="org.jbpm.jpdl.internal.v40.bindings.CustomBinding" />
   
-  <eventlistener binding="org.jbpm.jpdl.internal.activity.EventListenerBinding" />
-  <eventlistener binding="org.jbpm.jpdl.internal.activity.JavaBinding" />
-  <eventlistener binding="org.jbpm.jpdl.internal.activity.HqlBinding" />
-  <eventlistener binding="org.jbpm.jpdl.internal.activity.SqlBinding" />
-  <eventlistener binding="org.jbpm.jpdl.internal.activity.ScriptBinding" />
-  <eventlistener binding="org.jbpm.jpdl.internal.activity.MailBinding" />
+  <eventlistener binding="org.jbpm.jpdl.internal.v40.bindings.EventListenerBinding" />
+  <eventlistener binding="org.jbpm.jpdl.internal.v40.bindings.JavaBinding" />
+  <eventlistener binding="org.jbpm.jpdl.internal.v40.bindings.HqlBinding" />
+  <eventlistener binding="org.jbpm.jpdl.internal.v40.bindings.SqlBinding" />
+  <eventlistener binding="org.jbpm.jpdl.internal.v40.bindings.ScriptBinding" />
+  <eventlistener binding="org.jbpm.jpdl.internal.v40.bindings.MailBinding" />
   
 </bindings>

Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlSchemaTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlSchemaTest.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlSchemaTest.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -23,7 +23,7 @@
 
 import java.util.List;
 
-import org.jbpm.jpdl.internal.parser.JpdlParser;
+import org.jbpm.jpdl.internal.v40.JpdlParserV40;
 import org.jbpm.pvm.internal.xml.Problem;
 
 
@@ -35,7 +35,7 @@
   public void testSimplestValidProcess() {
     List<Problem> problems = jpdlParser.createParse()
       .setString(
-          "<jpdl:process xmlns:jpdl='"+JpdlParser.JPDL_NAMESPACE+"' " +
+          "<jpdl:process xmlns:jpdl='"+JpdlParserV40.NAMESPACE+"' " +
           "              name='p' >" +
           "  <jpdl:start name='n' />" +
           "</jpdl:process>"

Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/ProcessDeployer.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/ProcessDeployer.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/ProcessDeployer.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -1,179 +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.pvm.internal.repository;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.List;
-
-import org.jbpm.api.ProcessDefinition;
-import org.jbpm.api.ProcessDefinitionQuery;
-import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.internal.session.RepositorySession;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ProcessDeployer implements Deployer {
-  
-  private static final Log log = Log.getLog(ProcessDeployer.class.getName());
-
-  protected String extension;
-  protected Parser parser;
-
-  public ProcessDeployer(String extension, Parser parser) {
-    this.extension = extension;
-    this.parser = parser;
-  }
-
-  public void deploy(DeploymentImpl deployment) {
-    
-    for (String resourceName: deployment.getResourceNames()) {
-      
-      if (resourceName.endsWith(extension)) {
-        byte[] bytes = deployment.getBytes(resourceName);
-        InputStream inputStream = new ByteArrayInputStream(bytes);
-        Parse parse = parser.createParse();
-        parse.setProblems(deployment.getProblems());
-        parse.setInputStream(inputStream);
-        parse.execute();
-        List<ProcessDefinitionImpl> processDefinitions = (List<ProcessDefinitionImpl>) parse.getDocumentObject();
-        if (processDefinitions!=null) {
-          for (ProcessDefinitionImpl processDefinition : processDefinitions) {
-            if ((processDefinition != null) && (processDefinition.getName() != null)) {
-              String processDefinitionName = processDefinition.getName();
-
-              processDefinition.setSuspended(deployment.isSuspended());
-
-              String imageResourceName = resourceName.substring(0, resourceName.lastIndexOf(extension)) + ".png";
-              if (deployment.getResourceNames().contains(imageResourceName)) {
-                processDefinition.setImageResourceName(imageResourceName);
-              }
-
-              processDefinition.setDeploymentDbid(deployment.getDbid());
-
-              if (deployment.hasObjectProperties(processDefinitionName)) {
-                String key = deployment.getProcessDefinitionKey(processDefinitionName);
-                String id = deployment.getProcessDefinitionId(processDefinitionName);
-                Long version = deployment.getProcessDefinitionVersion(processDefinitionName);
-                processDefinition.setId(id);
-                processDefinition.setKey(key);
-                processDefinition.setVersion(version.intValue());
-
-              } else {
-                checkKey(processDefinition, deployment);
-                checkVersion(processDefinition, deployment);
-                checkId(processDefinition, deployment);
-
-                deployment.setProcessDefinitionId(processDefinitionName, processDefinition.getId());
-                deployment.setProcessDefinitionKey(processDefinitionName, processDefinition.getKey());
-                deployment.setProcessDefinitionVersion(processDefinitionName, new Long(processDefinition.getVersion()));
-              }
-
-              deployment.addObject(processDefinitionName, processDefinition);
-            }
-          }
-        }
-      }
-    }
-  }
-  
-  protected void checkKey(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
-    String processDefinitionName = processDefinition.getName();
-    String processDefinitionKey = processDefinition.getKey();
-
-    // if no key was specified in the jpdl process file
-    if (processDefinitionKey==null) {
-      // derive the key from the name
-      // replace any non-word character with an underscore
-      processDefinitionKey = processDefinitionName.replaceAll("\\W", "_");
-      processDefinition.setKey(processDefinitionKey);
-    }
-    
-    RepositorySession repositorySession = EnvironmentImpl.getFromCurrent(RepositorySession.class);
-
-    List<ProcessDefinition> existingProcesses = repositorySession.createProcessDefinitionQuery()
-        .processDefinitionName(processDefinitionName)
-        .list();
-    
-    for (ProcessDefinition existingProcess: existingProcesses) {
-      if (!processDefinitionKey.equals(existingProcess.getKey())) {
-        deployment.addProblem("invalid key '"+processDefinitionKey+"' in process "+processDefinition.getName()+".  Existing process has name '"+processDefinitionName+"' and key '"+processDefinitionKey+"'");
-      }
-    }
-
-    existingProcesses = repositorySession.createProcessDefinitionQuery()
-        .processDefinitionKey(processDefinitionKey)
-        .list();
-    
-    for (ProcessDefinition existingProcess: existingProcesses) {
-      if (!processDefinitionName.equals(existingProcess.getName())) {
-        deployment.addProblem("invalid name '"+processDefinitionName+"' in process "+processDefinition.getName()+".  Existing process has name '"+processDefinitionName+"' and key '"+processDefinitionKey+"'");
-      }
-    }
-  }
-
-  protected void checkId(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
-    String id = processDefinition.getId();
-    if (id==null) {
-      id = processDefinition.getKey()+"-"+processDefinition.getVersion();
-      if (log.isTraceEnabled()) log.trace("created id '"+id+"' for "+processDefinition);
-      processDefinition.setId(id);
-    }
-    
-    RepositorySession repositorySession = EnvironmentImpl.getFromCurrent(RepositorySession.class);
-    ProcessDefinition existingProcessDefinition = repositorySession.createProcessDefinitionQuery()
-        .processDefinitionId(id)
-        .uniqueResult();
-    if (existingProcessDefinition != null) {
-      deployment.addProblem("process '" + id + "' already exists");
-    }
-  }
-  
-  protected void checkVersion(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
-    int version = processDefinition.getVersion();
-    String key = processDefinition.getKey();
-    if (version==ProcessDefinitionImpl.UNASSIGNED_VERSION) {
-      RepositorySession repositorySession = EnvironmentImpl.getFromCurrent(RepositorySession.class);
-      
-      ProcessDefinition latestDeployedVersion = repositorySession
-          .createProcessDefinitionQuery()
-          .processDefinitionKey(key)
-          .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
-          .page(0, 1)
-          .uniqueResult();
-
-      if (latestDeployedVersion!=null) {
-        version = latestDeployedVersion.getVersion() + 1;
-      } else {
-        version = 1;
-      }
-      if (log.isTraceEnabled()) log.trace("assigning version "+version+" to process definition "+key);
-      processDefinition.setVersion(version);
-    }
-  }
-}

Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/resources/jbpm.wire.bindings.xml	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/resources/jbpm.wire.bindings.xml	2009-10-02 18:10:51 UTC (rev 5678)
@@ -93,7 +93,7 @@
   <binding class="org.jbpm.enterprise.internal.wire.binding.EjbRemoteCommandServiceBinding" />
 
   <!-- jpdl bindings -->
-  <binding class="org.jbpm.jpdl.internal.xml.JpdlDeployerBinding" />
+  <binding class="org.jbpm.jpdl.internal.parser.JpdlDeployerBinding" />
   
   <!-- spring bindings -->
   <binding class="org.jbpm.pvm.internal.wire.binding.SpringTransactionInterceptorBinding" />

Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/classloading/DelayedInstantiationTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/classloading/DelayedInstantiationTest.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/classloading/DelayedInstantiationTest.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -21,8 +21,6 @@
  */
 package org.jbpm.test.classloading;
 
-import org.jbpm.api.activity.ActivityBehaviour;
-import org.jbpm.api.activity.ActivityExecution;
 import org.jbpm.test.JbpmTestCase;
 
 
@@ -31,48 +29,27 @@
  */
 public class DelayedInstantiationTest extends JbpmTestCase {
   
-  public static class MyActivity implements ActivityBehaviour {
-    private static final long serialVersionUID = 1L;
-    public void execute(ActivityExecution execution) throws Exception {
-    }
-  }
-  
-  public static class StrippingClassLoader extends ClassLoader {
-    public StrippingClassLoader(ClassLoader parent) {
-      super(parent);
-    }
 
-    public Class loadClass(String className) throws ClassNotFoundException {
-      if ( className.startsWith("==")
-           && className.endsWith("==") ) {
-        className = className.substring(2, className.length()-2);
-      }
-      ClassLoader parent = getParent();
-      return parent.loadClass(className);
-    }
-    
-  }
-
   public void testDelayedInstantiation() {
+    // this test verifies that the instantiation is actually done upon first usage,
+    // rather then during the deployment.
     deployJpdlXmlString(
             "<process name='UserClassNotVisibleDuringprocessParsing'>" +
             "  <start>" +
             "    <transition to='a' />" +
             "  </start>" +
-            "  <custom name='a' class='=="+MyActivity.class.getName()+"==' >" +
+            "  <custom name='a' class='unexisting-class' >" +
             "    <transition to='b' />" +
             "  </custom>" + 
             "  <state name='b' />" +
             "</process>"
           );
-
-//    ClassLoader original = Thread.currentThread().getContextClassLoader();
-//    StrippingClassLoader strippingClassLoader = new StrippingClassLoader(original);
-//    Thread.currentThread().setContextClassLoader(strippingClassLoader);
-//    try {
-//      executionService.startProcessInstanceByKey("UserClassNotVisibleDuringprocessParsing");
-//    } finally {
-//      Thread.currentThread().setContextClassLoader(original);
-//    }
+    
+    try {
+      executionService.startProcessInstanceByKey("UserClassNotVisibleDuringprocessParsing");
+    } catch (Exception e) {
+      assertTextPresent("couldn't load class unexisting-class", e.getMessage());
+      // OK
+    }
   }
 }

Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/DescriptionTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/DescriptionTest.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/DescriptionTest.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -33,7 +33,7 @@
 
   public void testProcessDefinitionDescription() {
     deployJpdlXmlString(
-      "<process name='make print' xmlns='"+JpdlParser.JPDL_NAMESPACE+"' >" +
+      "<process name='make print'>" +
       "  <description>This process makes a print</description>" +
       "  <start />" +
       "</process>"

Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/taskactivity/TaskReassignTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/taskactivity/TaskReassignTest.java	2009-10-01 20:56:19 UTC (rev 5677)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/taskactivity/TaskReassignTest.java	2009-10-02 18:10:51 UTC (rev 5678)
@@ -36,7 +36,7 @@
 
   public void testReassignHistory() {
     deployJpdlXmlString(
-      "<process name='ReassignTest' xmlns='"+JpdlParser.JPDL_NAMESPACE+"'>" +
+      "<process name='ReassignTest'>" +
       "  <start>" +
       "    <transition to='write email'/>" +
       "  </start>" +



More information about the jbpm-commits mailing list