[jbpm-commits] JBoss JBPM SVN: r3653 - in jbpm4/trunk/modules: jpdl/src/main/java/org/jbpm/jpdl/activity and 17 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Jan 15 12:01:17 EST 2009


Author: tom.baeyens at jboss.com
Date: 2009-01-15 12:01:17 -0500 (Thu, 15 Jan 2009)
New Revision: 3653

Added:
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/ActivityBehaviourBuilder.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/ActivityBuilder.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/EnvironmentDefaults.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/DefaultTypeSet.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/TypeSet.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/TestBehaviourBuilder.java
Removed:
   jbpm4/trunk/modules/api/src/main/java/org/jbpm/builder/
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/builder/
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/DescriptorBuilder.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/NodeBuilder.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/WebRequestContext.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/WebSessionContext.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/DefaultVariableTypeResolver.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/VariableTypeResolver.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/TestActivityBuilder.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/execution/
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/externalactivity/
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/variables/VariablesTest.java
Modified:
   jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ExclusiveBuilder.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/CompositeBuilder.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/EventBuilder.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/FlowBuilder.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/ProcessDefinitionBuilder.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionEvaluator.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessElementImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/ScriptManager.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/VariableTypeResolverDescriptor.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/PrintLnBuilder.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/BuilderTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/EventListenerTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/EventPropagationTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/embedded/Loan.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/object/ObjectExecutionModeTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessCacheDbTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/GroovyExpressionTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/JuelExpressionTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/println/PrintlnTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/variables/CustomTypeVariableTest.java
Log:
JBPM-1973 further conversions to ProcessDefinitionBuilder

Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ExclusiveBuilder.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ExclusiveBuilder.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ExclusiveBuilder.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -21,18 +21,19 @@
  */
 package org.jbpm.jpdl.activity;
 
+import org.jbpm.pvm.builder.ActivityBehaviourBuilder;
 import org.jbpm.pvm.builder.CompositeBuilder;
-import org.jbpm.pvm.builder.NodeBuilder;
+import org.jbpm.pvm.builder.ActivityBuilder;
 import org.jbpm.pvm.internal.wire.Descriptor;
 
 
 /**
  * @author Tom Baeyens
  */
-public class ExclusiveBuilder extends NodeBuilder<ExclusiveBuilder> {
+public class ExclusiveBuilder extends ActivityBehaviourBuilder {
 
-  public ExclusiveBuilder(CompositeBuilder compositeBuilder, String nodeName) {
-    super(compositeBuilder, nodeName);
+  public ExclusiveBuilder(ActivityBuilder activityBuilder) {
+    super(activityBuilder);
   }
 
   public ExclusiveBuilder handler(Descriptor descriptor) {

Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/ActivityBehaviourBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/ActivityBehaviourBuilder.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/ActivityBehaviourBuilder.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.builder;
+
+import org.jbpm.pvm.internal.model.NodeImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ActivityBehaviourBuilder {
+  
+  protected ActivityBuilder activityBuilder;
+  protected NodeImpl node;
+
+  public ActivityBehaviourBuilder(ActivityBuilder activityBuilder) {
+    this.activityBuilder = activityBuilder;
+    this.node = activityBuilder.node;
+  }
+  
+  public ActivityBuilder endBehaviour() {
+    return activityBuilder;
+  }
+}


Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/ActivityBehaviourBuilder.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/ActivityBuilder.java (from rev 3641, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/NodeBuilder.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/ActivityBuilder.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/ActivityBuilder.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -0,0 +1,102 @@
+/*
+ * 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.builder;
+
+import java.lang.reflect.Constructor;
+
+import org.jbpm.pvm.internal.model.NodeImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+
+/**
+ * @author Tom Baeyens
+ */
+public class ActivityBuilder extends CompositeBuilder {
+  
+  private static final Class<?>[] ACTIVITYBEHAVIOURBUILDER_PARAMTYPES = new Class<?>[]{ActivityBuilder.class};
+
+  /** the enclosing composite */
+  protected CompositeBuilder compositeBuilder;
+  protected NodeImpl node;
+  
+  public ActivityBuilder(CompositeBuilder compositeBuilder, String nodeName) {
+    this.compositeBuilder = compositeBuilder;
+    this.node = compositeBuilder.createActivity();
+    this.compositeElement = node;
+    this.node.setName(nodeName);
+  }
+  
+  public ActivityBuilder initial() {
+    setProcessDefinitionInitial(node);
+    return this;
+  }
+  
+  protected void setProcessDefinitionInitial(NodeImpl initial) {
+    compositeBuilder.setProcessDefinitionInitial(initial);
+  }
+
+  public <T extends ActivityBehaviourBuilder> T startBehaviour(Class<T> activityBehaviourBuilderType) {
+    return startBehaviour(null, activityBehaviourBuilderType);
+  }
+
+  public <T extends ActivityBehaviourBuilder> T startBehaviour(String nodeName, Class<T> activityBehaviourBuilderType) {
+    if (activityBehaviourBuilderType==null) {
+      throw new RuntimeException("activityBuilderType is null");
+    }
+    try {
+      Constructor<T> constructor = activityBehaviourBuilderType.getConstructor(ACTIVITYBEHAVIOURBUILDER_PARAMTYPES);
+      T nodeBuilder = constructor.newInstance(new Object[]{this});
+      return nodeBuilder;
+    } catch (Exception e) {
+      throw new RuntimeException("couldn't instantiate activity behaviour builder type "+activityBehaviourBuilderType.getName(), e);
+    }
+  }
+  
+  public CompositeBuilder endActivity() {
+    return compositeBuilder;
+  }
+  
+  public FlowBuilder startFlow(String to) {
+    UnresolvedFlow unresolvedFlow = new UnresolvedFlow();
+    unresolvedFlow.transition = node.createOutgoingTransition();
+    unresolvedFlow.destinationName = to;
+    addUnresolvedFlow(unresolvedFlow);
+    return new FlowBuilder(this, unresolvedFlow.transition);
+  }
+  
+  public ProcessDefinitionImpl endProcess() {
+    return compositeBuilder.endProcess();
+  }
+  
+  public ActivityBuilder flow(String to) {
+    startFlow(to);
+    return this;
+  }
+
+  public ActivityBuilder flow(String to, String name) {
+    startFlow(to).name(name);
+    return this;
+  }
+
+  protected void addUnresolvedFlow(UnresolvedFlow unresolvedFlow) {
+    compositeBuilder.addUnresolvedFlow(unresolvedFlow);
+  }
+}


Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/ActivityBuilder.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/CompositeBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/CompositeBuilder.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/CompositeBuilder.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -21,86 +21,88 @@
  */
 package org.jbpm.pvm.builder;
 
-import java.lang.reflect.Constructor;
-
 import org.jbpm.JbpmException;
 import org.jbpm.activity.Activity;
 import org.jbpm.pvm.internal.model.CompositeElementImpl;
 import org.jbpm.pvm.internal.model.EventImpl;
 import org.jbpm.pvm.internal.model.NodeImpl;
 import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
 import org.jbpm.pvm.internal.wire.Descriptor;
 
-
 /**
  * @author Tom Baeyens
  */
 public abstract class CompositeBuilder {
 
-  private static final Class<?>[] NODEBUILDER_PARAMTYPES = new Class<?>[]{CompositeBuilder.class, String.class};
+  private static final Class<?>[] ACTIVITYBUILDER_PARAMTYPES = new Class<?>[]{CompositeBuilder.class, String.class};
   
   protected CompositeElementImpl compositeElement;
   
+  public abstract ProcessDefinitionImpl endProcess();
   protected abstract void addUnresolvedFlow(UnresolvedFlow unresolvedFlow);
-  public abstract ProcessDefinitionImpl endProcess();
+  protected abstract void setProcessDefinitionInitial(NodeImpl initial);
 
-  protected NodeImpl createNode() {
+  protected NodeImpl createActivity() {
     return compositeElement.createNode();
   }
 
   public EventImpl createEvent(String eventName) {
     return compositeElement.createEvent(eventName);
   }
+  
+  public CompositeBuilder variable(String name, String type) {
+    variable(name, type, null);
+    return this;
+  }
 
+  public CompositeBuilder variable(String name, String type, Descriptor descriptor) {
+    VariableDefinitionImpl variableDefinition = compositeElement.createVariableDefinition();
+    variableDefinition.setDestination(name);
+    variableDefinition.setTypeName(type);
+    variableDefinition.setSourceDescriptor(descriptor);
+    return this;
+  }
 
-  public <T extends NodeBuilder> T startNode(Descriptor activityDescriptor) {
-    return (T) startNode(null, activityDescriptor);
+  public ActivityBuilder startActivity() {
+    return startActivity((String)null);
   }
 
-  public NodeBuilder<NodeBuilder<?>> startNode(String nodeName, Descriptor activityDescriptor) {
+  public ActivityBuilder startActivity(String nodeName) {
+    return new ActivityBuilder(this, nodeName);
+  }
+
+  public ActivityBuilder startActivity(Descriptor activityDescriptor) {
+    return startActivity(null, activityDescriptor);
+  }
+
+  public ActivityBuilder startActivity(String nodeName, Descriptor activityDescriptor) {
     if (activityDescriptor==null) {
       throw new RuntimeException("activityDescriptor is null");
     }
-    NodeBuilder<NodeBuilder<?>> nodeBuilder = new NodeBuilder<NodeBuilder<?>>(this, nodeName);
-    nodeBuilder.node.setBehaviour(activityDescriptor);
-    return nodeBuilder;
+    ActivityBuilder activityBuilder = new ActivityBuilder(this, nodeName);
+    activityBuilder.node.setBehaviour(activityDescriptor);
+    return activityBuilder;
   }
 
-  public NodeBuilder<NodeBuilder<?>> startNode(Activity activity) {
-    return startNode(null, activity);
+  public ActivityBuilder startActivity(Activity activity) {
+    return startActivity(null, activity);
   }
 
-  public NodeBuilder<NodeBuilder<?>> startNode(String nodeName, Activity activity) {
+  public ActivityBuilder startActivity(String nodeName, Activity activity) {
     if (activity==null) {
       throw new RuntimeException("activity is null");
     }
-    NodeBuilder<NodeBuilder<?>> nodeBuilder = new NodeBuilder<NodeBuilder<?>>(this, nodeName);
-    nodeBuilder.node.setBehaviour(activity);
-    return nodeBuilder;
+    ActivityBuilder activityBuilder = new ActivityBuilder(this, nodeName);
+    activityBuilder.node.setBehaviour(activity);
+    return activityBuilder;
   }
 
-  public <T extends NodeBuilder> T startNode(Class<T> nodeBuilderType) {
-    return startNode(null, nodeBuilderType);
-  }
-
-  public <T extends NodeBuilder> T startNode(String nodeName, Class<T> nodeBuilderType) {
-    if (nodeBuilderType==null) {
-      throw new RuntimeException("nodeBuilderType is null");
-    }
-    try {
-      Constructor<T> constructor = nodeBuilderType.getConstructor(NODEBUILDER_PARAMTYPES);
-      T nodeBuilder = constructor.newInstance(new Object[]{this, nodeName});
-      return nodeBuilder;
-    } catch (Exception e) {
-      throw new RuntimeException("couldn't instantiate node builder type "+nodeBuilderType.getName(), e);
-    }
-  }
-  
   public EventBuilder startEvent(String eventName) {
     return new EventBuilder(this, compositeElement, eventName);
   }
 
-  public CompositeBuilder endNode() {
+  public CompositeBuilder endActivity() {
     throw new JbpmException("calling endNode on a processBuilder is invalid");
   }
 

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/DescriptorBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/DescriptorBuilder.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/DescriptorBuilder.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -1,83 +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.builder;
-
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.descriptor.LongDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ReferenceDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.StringDescriptor;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DescriptorBuilder {
-  
-  ObjectDescriptor objectDescriptor;
-
-  protected DescriptorBuilder(String className) {
-    objectDescriptor = new ObjectDescriptor();
-    objectDescriptor.setClassName(className);
-  }
-  
-  public static DescriptorBuilder startObjectDescriptor(String className) {
-    return new DescriptorBuilder(className);
-  }
-
-  public static Descriptor createObjectDescriptor(String className) {
-    return new ObjectDescriptor(className);
-  }
-
-  public static Descriptor createReferenceDescriptor(String objectName) {
-    return new ReferenceDescriptor(objectName);
-  }
-
-  public static Descriptor createStringDescriptor(String text) {
-    return new StringDescriptor(text);
-  }
-  
-  public static Descriptor createLongDescriptor(Long l) {
-    return new LongDescriptor(l);
-  }
-  
-  public DescriptorBuilder inject(String fieldName, Descriptor valueDescriptor) {
-    objectDescriptor.addInjection(fieldName, valueDescriptor);
-    return this;
-  }
-
-  public DescriptorBuilder inject(String fieldName, String value) {
-    StringDescriptor stringDescriptor = new StringDescriptor(value);
-    objectDescriptor.addInjection(fieldName, stringDescriptor);
-    return this;
-  }
-
-  public DescriptorBuilder inject(String fieldName, Long value) {
-    LongDescriptor longDescriptor = new LongDescriptor(value);
-    objectDescriptor.addInjection(fieldName, longDescriptor);
-    return this;
-  }
-
-  public Descriptor endObjectDescriptor() {
-    return objectDescriptor;
-  }
-}

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/EventBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/EventBuilder.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/EventBuilder.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -49,6 +49,12 @@
     return this;
   }
 
+  public EventBuilder listener(EventListener eventListener, boolean propagation) {
+    EventListenerReference eventListenerReference = getEvent().createEventListenerReference(eventListener);
+    eventListenerReference.setPropagationEnabled(propagation);
+    return this;
+  }
+
   private EventImpl getEvent() {
     if (event==null) {
       this.event = observableElement.createEvent(eventName);
@@ -60,8 +66,7 @@
     return compositeBuilder;
   }
   
-  public NodeBuilder<NodeBuilder<?>> endFlow() {
+  public ActivityBuilder endFlow() {
     throw new JbpmException("endFlow is only allowed on flows");
   }
-
 }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/FlowBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/FlowBuilder.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/FlowBuilder.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -30,12 +30,12 @@
  */
 public class FlowBuilder extends EventBuilder {
 
-  protected NodeBuilder<?> nodeBuilder;
+  protected ActivityBuilder activityBuilder;
   protected TransitionImpl transition;
   
-  public FlowBuilder(NodeBuilder<?> nodeBuilder, TransitionImpl transition) {
+  public FlowBuilder(ActivityBuilder nodeBuilder, TransitionImpl transition) {
     super(nodeBuilder, transition, Event.TRANSITION_TAKE);
-    this.nodeBuilder = nodeBuilder;
+    this.activityBuilder = nodeBuilder;
     this.transition = transition;
   }
   
@@ -49,7 +49,7 @@
     return this;
   }
   
-  public NodeBuilder<NodeBuilder<?>> endFlow() {
-    return (NodeBuilder) nodeBuilder;
+  public ActivityBuilder endFlow() {
+    return (ActivityBuilder) activityBuilder;
   }
 }

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/NodeBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/NodeBuilder.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/NodeBuilder.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -1,72 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.builder;
-
-import org.jbpm.pvm.internal.model.NodeImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-
-/**
- * @author Tom Baeyens
- */
-public class NodeBuilder<T> extends CompositeBuilder {
-
-  /** the enclosing composite */
-  protected CompositeBuilder compositeBuilder;
-  protected NodeImpl node;
-  
-  public NodeBuilder(CompositeBuilder compositeBuilder, String nodeName) {
-    this.compositeBuilder = compositeBuilder;
-    this.node = compositeBuilder.createNode();
-    this.compositeElement = node;
-    this.node.setName(nodeName);
-  }
-
-  public CompositeBuilder endNode() {
-    return compositeBuilder;
-  }
-  
-  public FlowBuilder startFlow(String to) {
-    UnresolvedFlow unresolvedFlow = new UnresolvedFlow();
-    unresolvedFlow.transition = node.createOutgoingTransition();
-    unresolvedFlow.destinationName = to;
-    addUnresolvedFlow(unresolvedFlow);
-    return new FlowBuilder(this, unresolvedFlow.transition);
-  }
-  
-  public ProcessDefinitionImpl endProcess() {
-    return compositeBuilder.endProcess();
-  }
-  
-  public T flow(String to) {
-    startFlow(to);
-    return (T) this;
-  }
-
-  public T flow(String to, String name) {
-    startFlow(to).name(name);
-    return (T) this;
-  }
-
-  protected void addUnresolvedFlow(UnresolvedFlow unresolvedFlow) {
-    compositeBuilder.addUnresolvedFlow(unresolvedFlow);
-  }
-}

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/ProcessDefinitionBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/ProcessDefinitionBuilder.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/builder/ProcessDefinitionBuilder.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -36,7 +36,6 @@
   private static final Log log = Log.getLog(ProcessDefinitionBuilder.class.getName());
   
   protected ProcessDefinitionImpl processDefinition;
-  protected String initialNodeName = null;
   protected List<UnresolvedFlow> unresolvedFlows = new ArrayList<UnresolvedFlow>();
 
   protected ProcessDefinitionBuilder(ProcessDefinitionImpl processDefinition) {
@@ -55,17 +54,15 @@
   }
 
   public ProcessDefinitionImpl endProcess() {
-    resolveInitialNode();
+    verifyInitial();
     resolveFlows();
     return processDefinition;
   }
 
-  protected void resolveInitialNode() {
-    NodeImpl initial = (NodeImpl) processDefinition.findNode(initialNodeName);
-    if (initial==null) {
-      errorUnexistingInitial();
+  protected void verifyInitial() {
+    if (processDefinition.getInitial()==null) {
+      errorNoInitial();
     }
-    processDefinition.setInitial(initial);
   }
 
   protected void resolveFlows() {
@@ -78,15 +75,6 @@
     }
   }
 
-  protected void errorUnexistingInitial() {
-    log.error("unexisting initial "+initialNodeName);
-  }
-
-  protected void errorUnexistingFlowDestination(UnresolvedFlow unresolvedFlow) {
-    String sourceNodeName = unresolvedFlow.transition.getSource().getName();
-    log.error("unexisting flow destination: "+sourceNodeName+"-->"+unresolvedFlow.destinationName);
-  }
-
   public ProcessDefinitionBuilder key(String key) {
     processDefinition.setKey(key);
     return this;
@@ -102,12 +90,27 @@
     return this;
   }
 
-  public ProcessDefinitionBuilder initial(String initialNodeName) {
-    this.initialNodeName = initialNodeName;
-    return this;
-  }
-
   protected void addUnresolvedFlow(UnresolvedFlow unresolvedFlow) {
     unresolvedFlows.add(unresolvedFlow);
   }
+
+  protected void setProcessDefinitionInitial(NodeImpl initial) {
+    if (processDefinition.getInitial()!=null) {
+      errorMultipleInitials(initial);
+    }
+    processDefinition.setInitial(initial);
+  }
+
+  protected void errorMultipleInitials(NodeImpl initial) {
+    log.error("multiple initial activities: "+processDefinition.getInitial()+" and "+initial);
+  }
+
+  protected void errorNoInitial() {
+    log.error("no initial activity");
+  }
+
+  protected void errorUnexistingFlowDestination(UnresolvedFlow unresolvedFlow) {
+    String sourceNodeName = unresolvedFlow.transition.getSource().getName();
+    log.error("unexisting flow destination: "+sourceNodeName+"-->"+unresolvedFlow.destinationName);
+  }
 }

Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/EnvironmentDefaults.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/EnvironmentDefaults.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/EnvironmentDefaults.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -0,0 +1,57 @@
+/*
+ * 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.env;
+
+import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.script.ScriptManager;
+import org.jbpm.pvm.internal.type.DefaultTypeSet;
+import org.jbpm.pvm.internal.type.TypeSet;
+
+
+/** central location for configuration objects that also 
+ * have a default so that they can be obtained without a 
+ * configuration and an environment block.
+ * 
+ * for every object, first, the current environment will 
+ * be searched if there is one,  if not, the default object 
+ * is returned.
+ *  
+ * @author Tom Baeyens
+ */
+public abstract class EnvironmentDefaults {
+
+  public static ScriptManager getScriptManager() {
+    ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
+    if (scriptManager!=null) {
+      return scriptManager;
+    }
+    return ScriptManager.getDefaultScriptManager();
+  }
+
+  public static TypeSet getTypeSet() {
+    TypeSet typeSet = Environment.getFromCurrent(TypeSet.class);
+    if (typeSet!=null) {
+      return typeSet;
+    }
+    return DefaultTypeSet.getDefaultTypeSet();
+  }
+}


Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/EnvironmentDefaults.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/WebRequestContext.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/WebRequestContext.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/WebRequestContext.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -1,61 +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.env;
-
-import java.util.Set;
-
-import org.jbpm.env.Context;
-import org.jbpm.env.Environment;
-
-public class WebRequestContext implements Context {
-
-  /*
-  HttpServletRequest request;
-  public WebRequestScope(HttpServletRequest request) {
-    this.request = request;
-  }
-  */
-
-  public Object get(String key) {
-    return null;
-  }
-
-  public boolean has(String key) {
-    return false;
-  }
-
-  public Set<String> keys() {
-    return null;
-  }
-
-  public Object set(String key, Object value) {
-    return null;
-  }
-
-  public <T> T get(Class<T> type) {
-    return null;
-  }
-
-  public String getName() {
-    return null;
-  }
-}

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/WebSessionContext.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/WebSessionContext.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/WebSessionContext.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -1,61 +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.env;
-
-import java.util.Set;
-
-import org.jbpm.env.Context;
-
-public class WebSessionContext implements Context {
-
-  /*
-  HttpSession session;
-  public WebRequestScope(HttpSession session) {
-    this.session = session;
-  }
-  */
-
-  public Object get(String key) {
-    return null;
-  }
-
-  public boolean has(String key) {
-    return false;
-  }
-
-  public Set<String> keys() {
-    return null;
-  }
-
-  public Object set(String key, Object value) {
-    return null;
-  }
-
-  public <T> T get(Class<T> type) {
-    return null;
-  }
-
-  public String getName() {
-    return null;
-  }
-
-}

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -67,7 +67,7 @@
 import org.jbpm.pvm.internal.type.Converter;
 import org.jbpm.pvm.internal.type.Type;
 import org.jbpm.pvm.internal.type.Variable;
-import org.jbpm.pvm.internal.type.VariableTypeResolver;
+import org.jbpm.pvm.internal.type.TypeSet;
 import org.jbpm.pvm.internal.type.variable.NullVariable;
 import org.jbpm.pvm.internal.type.variable.UnpersistableVariable;
 import org.jbpm.pvm.internal.util.Clock;

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionEvaluator.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionEvaluator.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionEvaluator.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -23,6 +23,7 @@
 
 import org.jbpm.model.Condition;
 import org.jbpm.model.OpenExecution;
+import org.jbpm.pvm.internal.env.EnvironmentDefaults;
 import org.jbpm.pvm.internal.script.ScriptManager;
 
 /**
@@ -47,7 +48,7 @@
   }
 
   public Object evaluateExpression(OpenExecution execution) {
-    ScriptManager scriptManager = ScriptManager.getScriptManager();
+    ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
     return scriptManager.evaluateExpression(expr, execution, lang);
   }
 

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessElementImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessElementImpl.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessElementImpl.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -92,7 +92,7 @@
   public long getDbid() {
     return dbid;
   }
-  public OpenProcessDefinition getProcessDefinition() {
+  public ProcessDefinitionImpl getProcessDefinition() {
     return processDefinition;
   }
   public void setProcessDefinition(ProcessDefinitionImpl processDefinition) {

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -40,7 +40,7 @@
 import org.jbpm.pvm.internal.type.Converter;
 import org.jbpm.pvm.internal.type.Type;
 import org.jbpm.pvm.internal.type.Variable;
-import org.jbpm.pvm.internal.type.VariableTypeResolver;
+import org.jbpm.pvm.internal.type.TypeSet;
 import org.jbpm.pvm.internal.type.variable.NullVariable;
 import org.jbpm.pvm.internal.type.variable.UnpersistableVariable;
 import org.jbpm.session.TimerSession;
@@ -125,13 +125,13 @@
     if (type==null) {
       Environment environment = Environment.getCurrent();
       if (environment!=null) {
-        VariableTypeResolver variableTypeResolver = environment.get(VariableTypeResolver.class);
-        if (variableTypeResolver!=null) {
+        TypeSet typeSet = environment.get(TypeSet.class);
+        if (typeSet!=null) {
           if (typeName!=null) {
-            type = variableTypeResolver.findTypeByName(typeName);
+            type = typeSet.findTypeByName(typeName);
           }
           if (type==null) {
-            type = variableTypeResolver.findTypeByMatch(key, value);
+            type = typeSet.findTypeByMatch(key, value);
           }
         }
       }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -23,10 +23,9 @@
 
 import java.io.Serializable;
 
-import org.jbpm.env.Context;
-import org.jbpm.env.Environment;
-import org.jbpm.pvm.internal.env.PvmEnvironment;
+import org.jbpm.pvm.internal.env.EnvironmentDefaults;
 import org.jbpm.pvm.internal.type.Type;
+import org.jbpm.pvm.internal.type.TypeSet;
 import org.jbpm.pvm.internal.wire.Descriptor;
 import org.jbpm.pvm.internal.wire.WireContext;
 
@@ -83,6 +82,11 @@
     return null;
   }
 
+  public void setTypeName(String typeName) {
+    TypeSet typeSet = EnvironmentDefaults.getTypeSet();
+    type = typeSet.findTypeByName(typeName);
+  }
+
   public long getDbid() {
     return dbid;
   }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/ScriptManager.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/ScriptManager.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/ScriptManager.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -43,44 +43,38 @@
 public class ScriptManager {
 
   private static Log log = Log.getLog(ScriptManager.class.getName());
-  private static final ScriptManager defaultScriptManager = createDefault();
 
+  private static ScriptManager defaultScriptManager = null;
+
   protected String defaultExpressionLanguage;
   protected String defaultScriptLanguage;
   protected ScriptEngineManager scriptEngineManager;
   protected String[] readContextNames = null;
   protected String writeContextName;
   
-  public static ScriptManager getScriptManager() {
-    Environment environment = Environment.getCurrent();
-    if (environment!=null) {
-      ScriptManager scriptManager = environment.get(ScriptManager.class);
-      if (scriptManager!=null) {
-        return scriptManager;
-      }
-    }
-    return defaultScriptManager;
-  }
-  
-  public static ScriptManager createDefault() {
-    WireDefinition wireDefinition = (WireDefinition) new WireParser().createParse()
+  public static synchronized ScriptManager getDefaultScriptManager() {
+    if (defaultScriptManager==null) {
+      WireDefinition wireDefinition = (WireDefinition) new WireParser()
+        .createParse()
         .setString(
-            "<objects>" +
-            "  <script-manager default-expression-language='juel'" +
-            "                  default-script-language='beanshell' " +
-            "                  read-contexts='execution, environment, process-engine' " +
-            "                  write-context='execution'>" +
-            "    <script-language name='juel' factory='com.sun.script.juel.JuelScriptEngineFactory' />" +
-            "  </script-manager>" +
-            "</objects>"
+          "<objects>" +
+          "  <script-manager default-expression-language='juel'" +
+          "                  default-script-language='beanshell' " +
+          "                  read-contexts='execution, environment, process-engine' " +
+          "                  write-context=''>" +
+          "    <script-language name='juel' factory='com.sun.script.juel.JuelScriptEngineFactory' />" +
+          "  </script-manager>" +
+          "</objects>"
         )
         .execute()
         .getDocumentObject();
-    
-    WireContext wireContext = new WireContext(wireDefinition);
-    return wireContext.get(ScriptManager.class);
+  
+      WireContext wireContext = new WireContext(wireDefinition);
+      defaultScriptManager = wireContext.get(ScriptManager.class);
+    }
+    return defaultScriptManager;
   }
-
+  
   /** {@link #evaluate(String, Execution, String) evaluates} the expression 
    * with the given language or with the defaultExpressionLanguage if the 
    * given language is null. */

Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/DefaultTypeSet.java (from rev 3641, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/DefaultVariableTypeResolver.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/DefaultTypeSet.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/DefaultTypeSet.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -0,0 +1,77 @@
+/*
+ * 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.type;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.log.Log;
+
+/**
+ * @author Tom Baeyens
+ */
+public class DefaultTypeSet implements TypeSet, Serializable {
+
+  private static final long serialVersionUID = 1L;
+
+  private static final Log log = Log.getLog(DefaultTypeSet.class.getName());
+  
+  protected List<TypeMapping> typeMappings;
+
+  public static TypeSet getDefaultTypeSet() {
+    return null;
+  }
+
+  public Type findTypeByMatch(String key, Object value) {
+    if (typeMappings!=null) {
+      for (TypeMapping typeMapping: typeMappings) {
+        if (typeMapping.matches(key, value)) {
+          return typeMapping.getType();
+        }
+      }
+    }
+    
+    return null;
+  }
+
+  public Type findTypeByName(String typeName) {
+    if ( (typeMappings!=null)
+           && (typeName!=null)
+       ) {
+      for (TypeMapping typeMapping: typeMappings) {
+        Type type = typeMapping.getType();
+        if (typeName.equals(type.getName())) {
+          return type;
+        }
+      }
+    }
+    return null;
+  }
+
+  public void addTypeMapping(TypeMapping typeMapping) {
+    if (typeMappings==null) {
+      typeMappings = new ArrayList<TypeMapping>();
+    }
+    typeMappings.add(typeMapping);
+  }
+}


Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/DefaultTypeSet.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + LF

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/DefaultVariableTypeResolver.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/DefaultVariableTypeResolver.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/DefaultVariableTypeResolver.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -1,73 +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.type;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jbpm.log.Log;
-
-/**
- * @author Tom Baeyens
- */
-public class DefaultVariableTypeResolver implements VariableTypeResolver, Serializable {
-
-  private static final long serialVersionUID = 1L;
-
-  private static final Log log = Log.getLog(DefaultVariableTypeResolver.class.getName());
-  
-  List<TypeMapping> typeMappings;
-  
-  public Type findTypeByMatch(String key, Object value) {
-    if (typeMappings!=null) {
-      for (TypeMapping typeMapping: typeMappings) {
-        if (typeMapping.matches(key, value)) {
-          return typeMapping.getType();
-        }
-      }
-    }
-    
-    return null;
-  }
-
-  public Type findTypeByName(String typeName) {
-    if ( (typeMappings!=null)
-           && (typeName!=null)
-       ) {
-      for (TypeMapping typeMapping: typeMappings) {
-        Type type = typeMapping.getType();
-        if (typeName.equals(type.getName())) {
-          return type;
-        }
-      }
-    }
-    return null;
-  }
-
-  public void addTypeMapping(TypeMapping typeMapping) {
-    if (typeMappings==null) {
-      typeMappings = new ArrayList<TypeMapping>();
-    }
-    typeMappings.add(typeMapping);
-  }
-}

Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/TypeSet.java (from rev 3641, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/VariableTypeResolver.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/TypeSet.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/TypeSet.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -0,0 +1,33 @@
+/*
+ * 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.type;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface TypeSet {
+
+  Type findTypeByMatch(String key, Object value);
+  Type findTypeByName(String typeName);
+
+}


Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/TypeSet.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + LF

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/VariableTypeResolver.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/VariableTypeResolver.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/VariableTypeResolver.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -1,33 +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.type;
-
-
-/**
- * @author Tom Baeyens
- */
-public interface VariableTypeResolver {
-
-  Type findTypeByMatch(String key, Object value);
-  Type findTypeByName(String typeName);
-
-}

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/VariableTypeResolverDescriptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/VariableTypeResolverDescriptor.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/VariableTypeResolverDescriptor.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -21,7 +21,7 @@
  */
 package org.jbpm.pvm.internal.wire.descriptor;
 
-import org.jbpm.pvm.internal.type.DefaultVariableTypeResolver;
+import org.jbpm.pvm.internal.type.DefaultTypeSet;
 import org.jbpm.pvm.internal.type.TypeMapping;
 import org.jbpm.pvm.internal.wire.WireContext;
 import org.jbpm.pvm.internal.wire.WireDefinition;
@@ -33,17 +33,17 @@
 
   private static final long serialVersionUID = 1L;
   
-  DefaultVariableTypeResolver defaultVariableTypeResolver = new DefaultVariableTypeResolver();
+  DefaultTypeSet defaultTypeSet = new DefaultTypeSet();
   
   public Object construct(WireContext wireContext) {
-    return defaultVariableTypeResolver;
+    return defaultTypeSet;
   }
   
   public Class< ? > getType(WireDefinition wireDefinition) {
-    return DefaultVariableTypeResolver.class;
+    return DefaultTypeSet.class;
   }
 
   public void addTypeMapping(TypeMapping typeMapping) {
-    defaultVariableTypeResolver.addTypeMapping(typeMapping);
+    defaultTypeSet.addTypeMapping(typeMapping);
   }
 }

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/PrintLnBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/PrintLnBuilder.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/activities/PrintLnBuilder.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -21,19 +21,19 @@
  */
 package org.jbpm.pvm.activities;
 
-import org.jbpm.pvm.builder.CompositeBuilder;
-import org.jbpm.pvm.builder.NodeBuilder;
+import org.jbpm.pvm.builder.ActivityBehaviourBuilder;
+import org.jbpm.pvm.builder.ActivityBuilder;
 
 
 /**
  * @author Tom Baeyens
  */
-public class PrintLnBuilder extends NodeBuilder<PrintLnBuilder> {
+public class PrintLnBuilder extends ActivityBehaviourBuilder {
 
   PrintLn printLn = new PrintLn();
   
-  public PrintLnBuilder(CompositeBuilder compositeBuilder, String nodeName) {
-    super(compositeBuilder, nodeName);
+  public PrintLnBuilder(ActivityBuilder activityBuilder) {
+    super(activityBuilder);
     node.setBehaviour(printLn);
   }
   

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/BuilderTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/BuilderTest.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/BuilderTest.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -52,9 +52,9 @@
   public void testBuilderInitialNode() {
     ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
     .startProcess("p")
-      .initial("start")
-      .startNode("start", TestActivityBuilder.class)
-      .endNode()
+      .startActivity("start")
+        .initial()
+      .endActivity()
     .endProcess();
  
     NodeImpl start = (NodeImpl) processDefinition.getInitial();
@@ -65,9 +65,11 @@
   public void testBuilderActivityProperties() {
     ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
     .startProcess("p")
-      .startNode("start", TestActivityBuilder.class)
-        .testActivityProperty("some cfg value")
-      .endNode()
+      .startActivity("start")
+        .startBehaviour(TestBehaviourBuilder.class)
+          .testActivityProperty("some cfg value")
+        .endBehaviour()
+      .endActivity()
     .endProcess();
     
     NodeImpl decisionNode = (NodeImpl) processDefinition.getNode("start");
@@ -81,19 +83,20 @@
   public void testBuilderMultipleOutgoingFlows() {
     ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
     .startProcess("p")
-      .startNode("x", TestActivityBuilder.class)
+      .startActivity("x")
         .flow("a")
         .flow("b", "to b")
         .startFlow("c")
           .name("to c")
         .endFlow()
-      .endNode()
-      .startNode("a", TestActivityBuilder.class)
-      .endNode()
-      .startNode("b", TestActivityBuilder.class)
-      .endNode()
-      .startNode("c", TestActivityBuilder.class)
-      .endNode()
+        .flow("x")
+      .endActivity()
+      .startActivity("a")
+      .endActivity()
+      .startActivity("b")
+      .endActivity()
+      .startActivity("c")
+      .endActivity()
     .endProcess();
 
     NodeImpl decisionNode = (NodeImpl) processDefinition.getNode("x");
@@ -101,7 +104,7 @@
     
     List<Transition> outgoingTransitions = decisionNode.getOutgoingTransitions();
     assertNotNull(outgoingTransitions);
-    assertEquals("expected 3 transitions: "+outgoingTransitions, 3, outgoingTransitions.size());
+    assertEquals("expected 4 transitions: "+outgoingTransitions, 4, outgoingTransitions.size());
     Transition toA = outgoingTransitions.get(0);
     assertNull(toA.getName());
     assertEquals("a", toA.getDestination().getName());
@@ -114,6 +117,10 @@
     assertEquals("to c", toC.getName());
     assertEquals("c", toC.getDestination().getName());
     
+    Transition toX = outgoingTransitions.get(3);
+    assertNull(toX.getName());
+    assertEquals("x", toX.getDestination().getName());
+    
     Map<String, Transition> outgoingTransitionsMap = decisionNode.getOutgoingTransitionsMap();
     assertSame(toA, outgoingTransitionsMap.get(null));
     assertSame(toB, outgoingTransitionsMap.get("to b"));
@@ -123,23 +130,23 @@
   public void testBuilderCompositeNodes() {
     ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
     .startProcess()
-      .initial("1.2.2")
-      .startNode("1", TestActivityBuilder.class)
-        .startNode("1.1", TestActivityBuilder.class)
+      .startActivity("1")
+        .startActivity("1.1")
           .flow("1.2.1", "to onedottwodotone")
-        .endNode()
-        .startNode("1.2", TestActivityBuilder.class)
-          .startNode("1.2.1", TestActivityBuilder.class)
-          .endNode()
-          .startNode("1.2.2", TestActivityBuilder.class)
+        .endActivity()
+        .startActivity("1.2")
+          .startActivity("1.2.1")
+          .endActivity()
+          .startActivity("1.2.2")
+            .initial()
             .flow("1", "to one")
-          .endNode()
-          .startNode("1.2.3", TestActivityBuilder.class)
-          .endNode()
-        .endNode()
-        .startNode("1.3", TestActivityBuilder.class)
-        .endNode()
-      .endNode()
+          .endActivity()
+          .startActivity("1.2.3")
+          .endActivity()
+        .endActivity()
+        .startActivity("1.3")
+        .endActivity()
+      .endActivity()
     .endProcess();
 
     NodeImpl node1 = (NodeImpl) processDefinition.findNode("1");
@@ -186,5 +193,4 @@
     assertSame(node1, node122.getOutgoingTransition("to one").getDestination());
     assertSame(node121, node11.getOutgoingTransition("to onedottwodotone").getDestination());
   }
-
 }

Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/TestActivityBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/TestActivityBuilder.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/TestActivityBuilder.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -1,45 +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.builder;
-
-import org.jbpm.pvm.builder.CompositeBuilder;
-import org.jbpm.pvm.builder.NodeBuilder;
-
-
-
-/**
- * @author Tom Baeyens
- */
-public class TestActivityBuilder extends NodeBuilder<TestActivityBuilder> {
-  
-  TestActivity testActivity = new TestActivity();
-
-  public TestActivityBuilder(CompositeBuilder compositeBuilder, String nodeName) {
-    super(compositeBuilder, nodeName);
-    node.setBehaviour(testActivity);
-  }
-
-  public TestActivityBuilder testActivityProperty(String testActivityProperty) {
-    testActivity.testActivityProperty = testActivityProperty;
-    return this;
-  }
-}

Copied: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/TestBehaviourBuilder.java (from rev 3641, jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/TestActivityBuilder.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/TestBehaviourBuilder.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/TestBehaviourBuilder.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.builder;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TestBehaviourBuilder extends ActivityBehaviourBuilder {
+  
+  TestActivity testActivity = new TestActivity();
+
+  public TestBehaviourBuilder(ActivityBuilder activityBuilder) {
+    super(activityBuilder);
+    node.setBehaviour(testActivity);
+  }
+
+  public TestBehaviourBuilder testActivityProperty(String testActivityProperty) {
+    testActivity.testActivityProperty = testActivityProperty;
+    return this;
+  }
+}


Property changes on: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/TestBehaviourBuilder.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/EventListenerTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/EventListenerTest.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/EventListenerTest.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -35,8 +35,8 @@
   public void testEventListener() {
     ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
       .startProcess()
-      .initial("a")
-      .startNode("a", new AutomaticActivity())
+      .startActivity("a", new AutomaticActivity())
+        .initial()
         .startEvent(Event.NODE_END)
           .listener(new PrintLn("leaving a"))
           .listener(new PrintLn("second message while leaving a"))
@@ -44,12 +44,12 @@
         .startFlow("b")
           .listener(new PrintLn("taking transition"))
         .endFlow()
-      .endNode()
-      .startNode("b", new WaitState())
+      .endActivity()
+      .startActivity("b", new WaitState())
         .startEvent(Event.NODE_BEGIN)
           .listener(new PrintLn("entering b"))
         .endEvent()
-      .endNode()
+      .endActivity()
     .endProcess();
 
     ClientExecution execution = processDefinition.startProcessInstance();

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/EventPropagationTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/EventPropagationTest.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/eventlistener/EventPropagationTest.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -30,7 +30,7 @@
 import org.jbpm.pvm.activities.DisplaySource;
 import org.jbpm.pvm.activities.TestConsole;
 import org.jbpm.pvm.activities.WaitState;
-import org.jbpm.pvm.model.ProcessFactory;
+import org.jbpm.pvm.builder.ProcessDefinitionBuilder;
 import org.jbpm.test.JbpmTestCase;
 
 
@@ -48,18 +48,24 @@
   }
 
   public void testEventPropagation() {
-    ClientProcessDefinition processDefinition = ProcessFactory.build("propagate")
-      .compositeNode("composite")
-        .event(Event.NODE_END) 
+    ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
+    .startProcess("propagate")
+      .startActivity("composite")
+        .startEvent(Event.NODE_END)
           .listener(new DisplaySource())
-        .node("a").initial().behaviour(new WaitState())
-          .transition().to("b")
-        .node("b").behaviour(new WaitState())
-          .transition().to("c")
-      .compositeEnd()
-      .node("c").behaviour(new WaitState())
-    .done();
-    
+        .endEvent()
+        .startActivity("a", new WaitState())
+          .initial()
+          .flow("b")
+        .endActivity()
+        .startActivity("b", new WaitState())
+          .flow("c")
+        .endActivity()
+      .endActivity()
+      .startActivity("c", new WaitState())
+      .endActivity()
+    .endProcess();
+
     ClientExecution execution = processDefinition.startProcessInstance();
     
     List<String> expectedLines = new ArrayList<String>(); 
@@ -78,19 +84,24 @@
   }
   
   public void testEventPropagationDisabled() {
-    ClientProcessDefinition processDefinition = ProcessFactory.build("propagate")
-      .compositeNode("composite")
-        .event(Event.NODE_END) 
-          .listener(new DisplaySource())
-          .propagationDisabled()
-        .node("a").initial().behaviour(new WaitState())
-          .transition().to("b")
-        .node("b").behaviour(new WaitState())
-          .transition().to("c")
-      .compositeEnd()
-      .node("c").behaviour(new WaitState())
-    .done();
-    
+    ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
+    .startProcess("propagate")
+      .startActivity("composite")
+        .startEvent(Event.NODE_END)
+          .listener(new DisplaySource(), false)
+        .endEvent()
+        .startActivity("a", new WaitState())
+          .initial()
+          .flow("b")
+        .endActivity()
+        .startActivity("b", new WaitState())
+          .flow("c")
+        .endActivity()
+      .endActivity()
+      .startActivity("c", new WaitState())
+      .endActivity()
+    .endProcess();
+
     ClientExecution execution = processDefinition.startProcessInstance();
     
     List<String> expectedLines = new ArrayList<String>(); 

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/embedded/Loan.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/embedded/Loan.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/embedded/Loan.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -24,7 +24,7 @@
 
 import org.jbpm.client.ClientExecution;
 import org.jbpm.client.ClientProcessDefinition;
-import org.jbpm.pvm.model.ProcessFactory;
+import org.jbpm.pvm.builder.ProcessDefinitionBuilder;
 
 /**
  * @author Tom Baeyens
@@ -35,18 +35,25 @@
   private static final ClientProcessDefinition processDefinition = createLoanProcess();
   
   private static ClientProcessDefinition createLoanProcess() {
-    ClientProcessDefinition processDefinition = ProcessFactory.build("loan")
-      .node("submit loan request").initial().behaviour(AutomaticActivity.class)
-        .transition().to("evaluate")
-      .node("evaluate").behaviour(WaitState.class)
-        .transition("approve").to("wire money")
-        .transition("reject").to("end")
-      .node("wire money").behaviour(AutomaticActivity.class)
-        .transition().to("archive")
-      .node("archive").behaviour(WaitState.class)
-        .transition().to("end")
-      .node("end").behaviour(WaitState.class)
-    .done();
+    ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
+    .startProcess("loan")
+      .startActivity("submit loan request", new AutomaticActivity())
+        .initial()
+        .flow("evaluate")
+      .endActivity()
+      .startActivity("evaluate", new WaitState())
+        .flow("wire money", "approve")
+        .flow("end", "reject")
+      .endActivity()
+      .startActivity("wire money", new AutomaticActivity())
+        .flow("archive")
+      .endActivity()
+      .startActivity("archive", new WaitState())
+        .flow("end")
+      .endActivity()
+      .startActivity("end", new WaitState())
+      .endActivity()
+    .endProcess();
     
     return processDefinition;
   }

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/object/ObjectExecutionModeTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/object/ObjectExecutionModeTest.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/object/ObjectExecutionModeTest.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -27,25 +27,31 @@
 import org.jbpm.client.ClientProcessDefinition;
 import org.jbpm.pvm.activities.AutomaticActivity;
 import org.jbpm.pvm.activities.WaitState;
-import org.jbpm.pvm.model.ProcessFactory;
+import org.jbpm.pvm.builder.ProcessDefinitionBuilder;
 
-
 public class ObjectExecutionModeTest extends TestCase {
 
   
   public void testObjectExecutionMode(){
-    ClientProcessDefinition processDefinition = ProcessFactory.build("loan")
-      .node("submit loan request").initial().behaviour(AutomaticActivity.class)
-        .transition().to("evaluate")
-      .node("evaluate").behaviour(WaitState.class)
-        .transition("approve").to("wire money")
-        .transition("reject").to("end")
-      .node("wire money").behaviour(AutomaticActivity.class)
-        .transition().to("archive")
-      .node("archive").behaviour(WaitState.class)
-        .transition().to("end")
-      .node("end").behaviour(WaitState.class)
-    .done();
+    ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
+    .startProcess("loan")
+      .startActivity("submit loan request", new AutomaticActivity())
+        .initial()
+        .flow("evaluate")
+      .endActivity()
+      .startActivity("evaluate", new WaitState())
+        .flow("wire money", "approve")
+        .flow("end", "reject")
+      .endActivity()
+      .startActivity("wire money", new AutomaticActivity())
+        .flow("archive")
+      .endActivity()
+      .startActivity("archive", new WaitState())
+        .flow("end")
+      .endActivity()
+      .startActivity("end", new WaitState())
+      .endActivity()
+    .endProcess();
     
     ClientExecution execution = processDefinition.startProcessInstance();
     

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessCacheDbTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessCacheDbTest.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessCacheDbTest.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -15,8 +15,6 @@
 
 import java.util.List;
 
-import junit.framework.Test;
-
 import org.hibernate.Session;
 import org.jbpm.client.ClientProcessDefinition;
 import org.jbpm.model.Node;
@@ -28,7 +26,6 @@
 import org.jbpm.session.DbSession;
 import org.jbpm.session.PvmDbSession;
 import org.jbpm.test.EnvironmentDbTestCase;
-import org.jbpm.test.EnvironmentFactoryTestSetup;
 
 /**
  * @author Guillaume Porcher

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/GroovyExpressionTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/GroovyExpressionTest.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/GroovyExpressionTest.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -25,7 +25,7 @@
 import org.jbpm.client.ClientExecution;
 import org.jbpm.env.Environment;
 import org.jbpm.env.EnvironmentFactory;
-import org.jbpm.pvm.externalactivity.WaitState;
+import org.jbpm.pvm.activities.WaitState;
 import org.jbpm.pvm.internal.script.ScriptManager;
 import org.jbpm.pvm.model.ProcessFactory;
 import org.jbpm.test.JbpmTestCase;

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/JuelExpressionTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/JuelExpressionTest.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/JuelExpressionTest.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -25,7 +25,7 @@
 import org.jbpm.client.ClientExecution;
 import org.jbpm.env.Environment;
 import org.jbpm.env.EnvironmentFactory;
-import org.jbpm.pvm.externalactivity.WaitState;
+import org.jbpm.pvm.activities.WaitState;
 import org.jbpm.pvm.internal.script.ScriptManager;
 import org.jbpm.pvm.model.ProcessFactory;
 import org.jbpm.test.JbpmTestCase;

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/println/PrintlnTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/println/PrintlnTest.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/println/PrintlnTest.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -30,9 +30,12 @@
   
   public void testHelloWorld() {
     ClientProcessDefinition processDefinition = ProcessDefinitionBuilder.startProcess()
-      .startNode(PrintLnBuilder.class)
-        .message("print me")
-      .endNode()
+      .startActivity()
+        .initial()
+        .startBehaviour(PrintLnBuilder.class)
+          .message("print me")
+        .endBehaviour()
+      .endActivity()
     .endProcess();
 
     processDefinition.startProcessInstance();

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/variables/CustomTypeVariableTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/variables/CustomTypeVariableTest.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/variables/CustomTypeVariableTest.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -23,20 +23,15 @@
 
 import java.util.Calendar;
 import java.util.GregorianCalendar;
-import java.util.Map;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.jbpm.activity.ActivityExecution;
-import org.jbpm.activity.ExternalActivity;
 import org.jbpm.client.ClientProcessDefinition;
+import org.jbpm.pvm.activities.WaitState;
+import org.jbpm.pvm.builder.ProcessDefinitionBuilder;
 import org.jbpm.pvm.internal.model.ExecutionImpl;
 import org.jbpm.pvm.internal.type.Variable;
 import org.jbpm.pvm.internal.type.variable.DateVariable;
-import org.jbpm.pvm.model.ProcessFactory;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
 import org.jbpm.test.EnvironmentDbTestCase;
-import org.jbpm.test.EnvironmentFactoryTestSetup;
 
 /**
  * @author Guillaume Porcher
@@ -49,21 +44,15 @@
     super(ENVIRONMENT_CFG_XML);
   }
 
-  public static class WaitState implements ExternalActivity {
-
-    private static final long serialVersionUID = 1L;
-
-    public void execute(ActivityExecution execution) {
-      execution.waitForSignal();
-    }
-
-    public void signal(ActivityExecution execution, String signalName, Map<String, Object> parameters) {
-      execution.take(signalName);
-    }
-  }
-
   public void testDateVariable() {
-    ClientProcessDefinition clientProcessDefinition = ProcessFactory.build().node().initial().behaviour(WaitState.class).done();
+    ClientProcessDefinition clientProcessDefinition = ProcessDefinitionBuilder
+    .startProcess()
+      .startActivity(
+          new ObjectDescriptor(WaitState.class)
+        )
+        .initial()
+      .endActivity()
+    .endProcess();
 
     getDbSession().save(clientProcessDefinition);
 

Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/variables/VariablesTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/variables/VariablesTest.java	2009-01-15 16:44:27 UTC (rev 3652)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/variables/VariablesTest.java	2009-01-15 17:01:17 UTC (rev 3653)
@@ -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.pvm.variables;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-import org.jbpm.client.ClientProcessDefinition;
-import org.jbpm.client.ClientProcessInstance;
-import org.jbpm.pvm.externalactivity.WaitState;
-import org.jbpm.pvm.model.ProcessFactory;
-
-
-/**
- * @author Tom Baeyens
- */
-public class VariablesTest extends TestCase {
-
-  public void testVariables() {
-    ClientProcessDefinition processDefinition = ProcessFactory.build("expenses")
-      .node("evaluate").initial().behaviour(WaitState.class)
-        .transition().to("pay back")
-      .node("pay back").behaviour(WaitState.class)
-    .done();
-    
-    Map<String, Object> variables = new HashMap<String, Object>();
-    variables.put("reason", "business trip");
-    variables.put("total amount", "$1500");
-
-    ClientProcessInstance execution = processDefinition.createProcessInstance();
-    execution.setVariables(variables);
-    execution.start();
-    
-    assertEquals("business trip", execution.getVariable("reason"));
-    assertEquals("$1500", execution.getVariable("total amount"));
-    
-    execution.setVariable("total amount", "$1400");
-    execution.setVariable("approver", "me");
-    execution.setVariable("cost center", 87364);
-
-    execution.signal();
-
-    assertEquals("business trip", execution.getVariable("reason"));
-    assertEquals("$1400", execution.getVariable("total amount"));
-    assertEquals("me", execution.getVariable("approver"));
-    assertEquals(new Integer(87364), execution.getVariable("cost center"));
-  }
-}




More information about the jbpm-commits mailing list