[jbpm-commits] JBoss JBPM SVN: r3729 - in jbpm3/trunk/modules/core/src: main/java/org/jbpm/graph/action and 5 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Jan 29 02:36:26 EST 2009


Author: alex.guizar at jboss.com
Date: 2009-01-29 02:36:26 -0500 (Thu, 29 Jan 2009)
New Revision: 3729

Added:
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/InstantiatorUtil.java
Removed:
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/util/StaticUtil.java
Modified:
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/AbstractGetObjectBaseCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/action/Script.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/node/Join.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/BeanInstantiator.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/ConfigurationPropertyInstantiator.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/ConstructorInstantiator.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/DefaultInstantiator.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/Delegation.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/FieldInstantiator.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/Instantiator.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/ProcessClassLoader.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/XmlInstantiator.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/util/CollectionUtil.java
   jbpm3/trunk/modules/core/src/main/resources/hibernate.properties.mysql.xml
   jbpm3/trunk/modules/core/src/test/java/org/jbpm/graph/def/ExceptionHandlerTest.java
Log:
JBPM-1991 change default parentLockMode from FORCE to UPGRADE
eliminate the many NPEs that appeared in the test log
generalize instantiation package

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/AbstractGetObjectBaseCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/AbstractGetObjectBaseCommand.java	2009-01-29 04:23:29 UTC (rev 3728)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/AbstractGetObjectBaseCommand.java	2009-01-29 07:36:26 UTC (rev 3729)
@@ -1,6 +1,6 @@
 package org.jbpm.command;
 
-import java.util.Iterator;
+import java.util.Map;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -13,15 +13,13 @@
 import org.jbpm.taskmgmt.exe.TaskInstance;
 
 /**
- * abstract base class for "get" commands which also implements default pre-fetching.
+ * abstract base class for "get" commands which also implements default pre-fetching. Note:
+ * pre-fetching logs is not possible here, so you have to load Logs explicitly with
+ * GetProcessInstanceLogCommand
  * 
- * Note: pre-fetching logs is not possible here, so you have to load Logs explicitly
- * with GetProcessInstanceLogCommand
- * 
  * @author Bernd Ruecker (bernd.ruecker at camunda.com)
  */
-public abstract class AbstractGetObjectBaseCommand extends AbstractBaseCommand
-{
+public abstract class AbstractGetObjectBaseCommand extends AbstractBaseCommand {
 
   static final Log log = LogFactory.getLog(AbstractGetObjectBaseCommand.class);
 
@@ -39,24 +37,19 @@
 
   private transient JbpmContext jbpmContext;
 
-  public AbstractGetObjectBaseCommand()
-  {
+  public AbstractGetObjectBaseCommand() {
   }
 
-  public AbstractGetObjectBaseCommand(boolean includeAllVariables, boolean includeLogs)
-  {
+  public AbstractGetObjectBaseCommand(boolean includeAllVariables, boolean includeLogs) {
     this.includeAllVariables = includeAllVariables;
   }
 
-  public AbstractGetObjectBaseCommand(String[] variablesToInclude)
-  {
+  public AbstractGetObjectBaseCommand(String[] variablesToInclude) {
     this.variablesToInclude = variablesToInclude;
   }
 
-  public void retrieveTaskInstanceDetails(TaskInstance ti)
-  {
-    try
-    {
+  public void retrieveTaskInstanceDetails(TaskInstance ti) {
+    try {
       ti.getToken().getProcessInstance().getProcessDefinition().getName();
 
       // in TaskInstances created with jbpm 3.1, this association was
@@ -69,160 +62,130 @@
 
       retrieveVariables(ti);
     }
-    catch (Exception ex)
-    {
+    catch (Exception ex) {
       log.warn("exception while retrieving task instance data for task instance " + ti.getId(), ex);
     }
   }
 
-  public ProcessInstance retrieveProcessInstance(ProcessInstance pi)
-  {
-    try
-    {
+  public ProcessInstance retrieveProcessInstance(ProcessInstance pi) {
+    try {
       pi.getProcessDefinition().getName();
       retrieveToken(pi.getRootToken());
 
       // load at least the super process id and token id
-      if (pi.getSuperProcessToken() != null)
-      {
+      if (pi.getSuperProcessToken() != null) {
         pi.getSuperProcessToken().getId();
         pi.getSuperProcessToken().getProcessInstance().getId();
       }
 
       retrieveVariables(pi);
     }
-    catch (Exception ex)
-    {
-      log.warn("exception while retrieving process instance data for process instance " + pi.getId(), ex);
+    catch (Exception ex) {
+      log.warn("exception while retrieving process instance data for process instance "
+          + pi.getId(), ex);
     }
     return pi;
   }
 
-  public ProcessDefinition retrieveProcessDefinition(ProcessDefinition pd)
-  {
-    try
-    {
+  public ProcessDefinition retrieveProcessDefinition(ProcessDefinition pd) {
+    try {
       pd.getName();
       // often needed to start a process:
-      Iterator iter = pd.getStartState().getLeavingTransitions().iterator();
-      while (iter.hasNext())
-      {
-        Transition t = (Transition)iter.next();
-        t.getName();
+      for (Transition transition : pd.getStartState().getLeavingTransitions()) {
+        transition.getName();
       }
     }
-    catch (Exception ex)
-    {
-      log.warn("exception while retrieving process instance data for process definiton " + pd.getName(), ex);
+    catch (Exception ex) {
+      log.warn("exception while retrieving process instance data for process definiton "
+          + pd.getName(), ex);
     }
     return pd;
   }
 
-  protected void retrieveToken(Token t)
-  {
-    retrieveNode(t.getNode());
-    t.getAvailableTransitions();
+  protected void retrieveToken(Token token) {
+    retrieveNode(token.getNode());
+    token.getAvailableTransitions();
 
-    // if (includeLogs)
-    // t.getProcessInstance().getLoggingInstance().
-
-    Iterator iter = t.getChildren().values().iterator();
-    while (iter.hasNext())
-    {
-      retrieveToken((Token)iter.next());
+    Map<String, Token> children = token.getChildren();
+    if (children != null) {
+      for (Token childToken : children.values()) {
+        retrieveToken(childToken);
+      }
     }
   }
 
-  protected void retrieveNode(Node n)
-  {
-    n.getName();
-    n.getLeavingTransitions();
-    if (n.getSuperState() != null)
-      retrieveNode(n.getSuperState());
+  protected void retrieveNode(Node node) {
+    while (node != null) {
+      node.getName();
+      node.getLeavingTransitions();
+      node = node.getSuperState();
+    }
   }
 
-  public void retrieveVariables(ProcessInstance pi)
-  {
-    if (includeAllVariables)
-    {
+  public void retrieveVariables(ProcessInstance pi) {
+    if (includeAllVariables) {
       pi.getContextInstance().getVariables();
     }
-    else
-    {
-      for (int i = 0; i < variablesToInclude.length; i++)
-      {
+    else {
+      for (int i = 0; i < variablesToInclude.length; i++) {
         pi.getContextInstance().getVariable(variablesToInclude[i]);
       }
     }
   }
 
-  public void retrieveVariables(TaskInstance ti)
-  {
-    if (includeAllVariables)
-    {
+  public void retrieveVariables(TaskInstance ti) {
+    if (includeAllVariables) {
       ti.getVariables();
     }
-    else
-    {
-      for (int i = 0; i < variablesToInclude.length; i++)
-      {
+    else {
+      for (int i = 0; i < variablesToInclude.length; i++) {
         ti.getVariable(variablesToInclude[i]);
       }
     }
   }
 
-  public boolean isIncludeAllVariables()
-  {
+  public boolean isIncludeAllVariables() {
     return includeAllVariables;
   }
 
-  public void setIncludeAllVariables(boolean includeAllVariables)
-  {
+  public void setIncludeAllVariables(boolean includeAllVariables) {
     this.includeAllVariables = includeAllVariables;
   }
 
-  public String[] getVariablesToInclude()
-  {
+  public String[] getVariablesToInclude() {
     return variablesToInclude;
   }
 
-  public void setVariablesToInclude(String[] variablesToInclude)
-  {
+  public void setVariablesToInclude(String[] variablesToInclude) {
     this.variablesToInclude = variablesToInclude;
   }
 
-  public void setVariablesToInclude(String variableToInclude)
-  {
+  public void setVariablesToInclude(String variableToInclude) {
     this.variablesToInclude = new String[] { variableToInclude };
   }
 
-  protected JbpmContext getJbpmContext()
-  {
+  protected JbpmContext getJbpmContext() {
     return jbpmContext;
   }
 
-  protected void setJbpmContext(JbpmContext jbpmContext)
-  {
+  protected void setJbpmContext(JbpmContext jbpmContext) {
     this.jbpmContext = jbpmContext;
   }
-  
+
   // methods for fluent programming
-  
-  public AbstractGetObjectBaseCommand variablesToInclude(String[] variablesToInclude)
-  {
+
+  public AbstractGetObjectBaseCommand variablesToInclude(String[] variablesToInclude) {
     setVariablesToInclude(variablesToInclude);
     return this;
   }
 
-  public AbstractGetObjectBaseCommand variablesToInclude(String variableToInclude)
-  {
+  public AbstractGetObjectBaseCommand variablesToInclude(String variableToInclude) {
     setVariablesToInclude(variableToInclude);
     return this;
   }
-  
-  public AbstractGetObjectBaseCommand includeAllVariables(boolean includeAllVariables)
-  {
-    setIncludeAllVariables( includeAllVariables );
+
+  public AbstractGetObjectBaseCommand includeAllVariables(boolean includeAllVariables) {
+    setIncludeAllVariables(includeAllVariables);
     return this;
   }
 

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/action/Script.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/action/Script.java	2009-01-29 04:23:29 UTC (rev 3728)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/action/Script.java	2009-01-29 07:36:26 UTC (rev 3729)
@@ -43,17 +43,19 @@
 import bsh.TargetError;
 
 public class Script extends Action {
-  
+
   private static final long serialVersionUID = 1L;
-  
+
   protected String expression = null;
   protected Set<VariableAccess> variableAccesses = null;
 
   public void read(Element scriptElement, JpdlXmlReader jpdlReader) {
     if (scriptElement.isTextOnly()) {
       expression = scriptElement.getText();
-    } else {
-      this.variableAccesses = new HashSet<VariableAccess>(jpdlReader.readVariableAccesses(scriptElement));
+    }
+    else {
+      this.variableAccesses = new HashSet<VariableAccess>(
+          jpdlReader.readVariableAccesses(scriptElement));
       expression = scriptElement.element("expression").getText();
     }
   }
@@ -63,11 +65,11 @@
     setVariables(outputMap, executionContext);
   }
 
-  public Map<String, Object> eval(Token token) throws DelegationException {
+  public Map<String, Object> eval(Token token) {
     return eval(new ExecutionContext(token));
   }
 
-  public Map<String, Object> eval(ExecutionContext executionContext) throws DelegationException {
+  public Map<String, Object> eval(ExecutionContext executionContext) {
     Map<String, Object> inputMap = createInputMap(executionContext);
     Set<String> outputNames = getOutputNames();
     return eval(inputMap, outputNames);
@@ -77,18 +79,18 @@
     Token token = executionContext.getToken();
 
     Map<String, Object> inputMap = new HashMap<String, Object>();
-    inputMap.put( "executionContext", executionContext );
-    inputMap.put( "token", token );
-    inputMap.put( "node", executionContext.getNode() );
-    inputMap.put( "task", executionContext.getTask() );
-    inputMap.put( "taskInstance", executionContext.getTaskInstance() );
-    
-    // if no readable variableInstances are specified, 
+    inputMap.put("executionContext", executionContext);
+    inputMap.put("token", token);
+    inputMap.put("node", executionContext.getNode());
+    inputMap.put("task", executionContext.getTask());
+    inputMap.put("taskInstance", executionContext.getTaskInstance());
+
+    // if no readable variableInstances are specified,
     ContextInstance contextInstance = executionContext.getContextInstance();
-    if (! hasReadableVariable()) {
-      // we copy all the variableInstances of the context into the interpreter 
+    if (!hasReadableVariable()) {
+      // we copy all the variableInstances of the context into the interpreter
       Map<String, Object> variables = contextInstance.getVariables(token);
-      if ( variables != null ) {
+      if (variables != null) {
         for (Map.Entry<String, Object> entry : variables.entrySet()) {
           String variableName = entry.getKey();
           Object variableValue = entry.getValue();
@@ -96,7 +98,8 @@
         }
       }
 
-    } else {
+    }
+    else {
       // we only copy the specified variableInstances into the interpreter
       for (VariableAccess variableAccess : variableAccesses) {
         if (variableAccess.isReadable()) {
@@ -107,15 +110,15 @@
         }
       }
     }
-    
+
     return inputMap;
   }
 
-  public Map<String, Object> eval(Map<String, Object> inputMap, Set<String> outputNames) throws DelegationException {
+  public Map<String, Object> eval(Map<String, Object> inputMap, Set<String> outputNames) {
     Map<String, Object> outputMap = new HashMap<String, Object>();
-    
+
     try {
-      log.debug("script input: "+inputMap);
+      log.debug("script input: " + inputMap);
       Interpreter interpreter = new Interpreter();
       for (Map.Entry<String, Object> entry : inputMap.entrySet()) {
         String inputName = entry.getKey();
@@ -127,12 +130,15 @@
         Object outputValue = interpreter.get(outputName);
         outputMap.put(outputName, outputValue);
       }
-      log.debug("script output: "+outputMap);
-    } catch (ParseException e) {
+      log.debug("script output: " + outputMap);
+    }
+    catch (ParseException e) {
       throw new DelegationException("parse error occurred", e);
-    } catch (TargetError e) {
+    }
+    catch (TargetError e) {
       throw new DelegationException("script threw exception", e.getTarget());
-    } catch (EvalError e) {
+    }
+    catch (EvalError e) {
       log.warn("exception during evaluation of script expression", e);
       throw new DelegationException("script evaluation failed", e);
     }
@@ -141,13 +147,13 @@
   }
 
   public void addVariableAccess(VariableAccess variableAccess) {
-    if (variableAccesses==null) variableAccesses = new HashSet<VariableAccess>();
+    if (variableAccesses == null) variableAccesses = new HashSet<VariableAccess>();
     variableAccesses.add(variableAccess);
   }
 
   Set<String> getOutputNames() {
     Set<String> outputNames = new HashSet<String>();
-    if (variableAccesses!=null) {
+    if (variableAccesses != null) {
       for (VariableAccess variableAccess : variableAccesses) {
         if (variableAccess.isWritable()) {
           outputNames.add(variableAccess.getMappedName());
@@ -158,7 +164,7 @@
   }
 
   boolean hasReadableVariable() {
-    if (variableAccesses==null) return false;
+    if (variableAccesses == null) return false;
     for (VariableAccess variableAccess : variableAccesses) {
       if (variableAccess.isReadable()) {
         return true;
@@ -168,14 +174,11 @@
   }
 
   void setVariables(Map<String, Object> outputMap, ExecutionContext executionContext) {
-    if ( (outputMap!=null)
-         && (!outputMap.isEmpty()) 
-         && (executionContext!=null)
-       ) {
+    if ((outputMap != null) && (!outputMap.isEmpty()) && (executionContext != null)) {
       Map<String, String> variableNames = getVariableNames();
       ContextInstance contextInstance = executionContext.getContextInstance();
       Token token = executionContext.getToken();
-      
+
       for (Map.Entry<String, String> entry : variableNames.entrySet()) {
         String mappedName = entry.getKey();
         String variableName = entry.getValue();
@@ -189,7 +192,7 @@
     for (VariableAccess variableAccess : variableAccesses) {
       if (variableAccess.isWritable()) {
         variableNames.put(variableAccess.getMappedName(), variableAccess.getVariableName());
-      }      
+      }
     }
     return variableNames;
   }
@@ -197,15 +200,18 @@
   public String getExpression() {
     return expression;
   }
+
   public void setExpression(String expression) {
     this.expression = expression;
   }
+
   public Set<VariableAccess> getVariableAccesses() {
     return variableAccesses;
   }
+
   public void setVariableAccesses(Set<VariableAccess> variableAccesses) {
     this.variableAccesses = variableAccesses;
   }
-  
+
   private static final Log log = LogFactory.getLog(Script.class);
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/node/Join.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/node/Join.java	2009-01-29 04:23:29 UTC (rev 3728)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/node/Join.java	2009-01-29 07:36:26 UTC (rev 3729)
@@ -35,21 +35,18 @@
 import org.jbpm.graph.exe.ExecutionContext;
 import org.jbpm.graph.exe.Token;
 import org.jbpm.jpdl.xml.JpdlXmlReader;
+import org.jbpm.util.CollectionUtil;
 
 public class Join extends Node {
 
-  private static final long serialVersionUID = 1L;
-  
-  /** 
+  /**
    * specifies what type of hibernate lock should be acquired.
-   * null value defaults to LockMode.FORCE 
-   */ 
+   */
   String parentLockMode;
 
   /**
-   * specifies if this joinhandler is a discriminator.
-   * a descriminator reactivates the parent when the first 
-   * concurrent token enters the join. 
+   * specifies if this join is a discriminator. a descriminator reactivates the parent when the
+   * first concurrent token enters the join.
    */
   boolean isDiscriminator = false;
 
@@ -62,13 +59,14 @@
    * a script that calculates concurrent tokens at runtime.
    */
   Script script = null;
-  
+
   /**
    * reactivate the parent if the n-th token arrives in the join.
    */
   int nOutOfM = -1;
-  
 
+  private static final long serialVersionUID = 1L;
+
   public Join() {
   }
 
@@ -77,17 +75,15 @@
   }
 
   @Override
-  public NodeType getNodeType()
-  {
+  public NodeType getNodeType() {
     return NodeType.Join;
   }
 
   public void read(Element element, JpdlXmlReader jpdlReader) {
     String lock = element.attributeValue("lock");
     if (lock != null) {
-      LockMode lockMode = LockMode.parse(lock);
-      if (lockMode != null)
-        parentLockMode = lockMode.toString();
+      if (LockMode.parse(lock) != null)
+        parentLockMode = lock;
       else if ("pessimistic".equals(lock))
         parentLockMode = LockMode.UPGRADE.toString();
       else
@@ -97,30 +93,25 @@
 
   public void execute(ExecutionContext executionContext) {
     Token token = executionContext.getToken();
-    
+
     boolean isAbleToReactivateParent = token.isAbleToReactivateParent();
-    
-    if (!token.hasEnded()) {
-      token.end(false);
-    }
-    
-    // if this token is not able to reactivate the parent, 
-    // we don't need to check anything
-    if ( isAbleToReactivateParent ) {
 
-      // the token arrived in the join and can only reactivate 
-      // the parent once
+    if (!token.hasEnded()) token.end(false);
+
+    // if this token is not able to reactivate the parent,
+    // we don't need to check anything
+    if (isAbleToReactivateParent) {
+      // the token arrived in the join and can only reactivate the parent once
       token.setAbleToReactivateParent(false);
 
       Token parentToken = token.getParent();
-      
-      if ( parentToken != null ) {
-        
+      if (parentToken != null) {
         JbpmContext jbpmContext = executionContext.getJbpmContext();
-        Session session = (jbpmContext!=null ? jbpmContext.getSession() : null);
-        if (session!=null) {
-          // force version increment by default (LockMode.FORCE)
-          LockMode lockMode = parentLockMode != null ? LockMode.parse(parentLockMode) : LockMode.FORCE;
+        Session session = jbpmContext != null ? jbpmContext.getSession() : null;
+        if (session != null) {
+          // obtain update lock by default (LockMode.UPGRADE)
+          LockMode lockMode = parentLockMode != null ? LockMode.parse(parentLockMode)
+              : LockMode.UPGRADE;
           log.debug("acquiring " + lockMode + " lock on " + parentToken);
           // lock updates as appropriate, no need to flush here
           session.lock(parentToken, lockMode);
@@ -129,68 +120,64 @@
         boolean reactivateParent = true;
 
         // if this is a discriminator
-        if ( isDiscriminator ) {
+        if (isDiscriminator) {
           // reactivate the parent when the first token arrives in the join.
           // this must be the first token arriving, otherwise isAbleToReactivateParent()
           // should have been false above.
           reactivateParent = true;
-
+        }
         // if a fixed set of tokenNames is specified at design time...
-        } else if ( tokenNames != null ) {
+        else if (tokenNames != null) {
           // check reactivation on the basis of those tokenNames
-          reactivateParent = mustParentBeReactivated(parentToken, tokenNames.iterator() );
-
+          reactivateParent = mustParentBeReactivated(parentToken, tokenNames.iterator());
+        }
         // if a script is specified
-        } else if ( script != null ) {
-
+        else if (script != null) {
           // check if the script returns a collection or a boolean
           Object result = null;
           try {
-            result = script.eval( token );
-          } catch (Exception e) {
+            result = script.eval(token);
+          }
+          catch (Exception e) {
             this.raiseException(e, executionContext);
           }
-          // if the result is a collection 
-          if ( result instanceof Collection ) {
-            // it must be a collection of tokenNames 
-            Collection<?> runtimeTokenNames = (Collection<?>) result;
-            reactivateParent = mustParentBeReactivated(parentToken, runtimeTokenNames.iterator() );
-
-          // if it's a boolean... 
-          } else if ( result instanceof Boolean ) {
+          // if the result is a collection
+          if (result instanceof Collection) {
+            // it must be a collection of tokenNames
+            Collection<String> runtimeTokenNames = CollectionUtil.checkCollection(
+                (Collection<?>) result, String.class);
+            reactivateParent = mustParentBeReactivated(parentToken, runtimeTokenNames.iterator());
+          }
+          // if it's a boolean...
+          else if (result instanceof Boolean) {
             // the boolean specifies if the parent needs to be reactivated
-            reactivateParent = ((Boolean)result).booleanValue();
+            reactivateParent = (Boolean) result;
           }
-
+        }
         // if a nOutOfM is specified
-        } else if ( nOutOfM != -1 ) {
-
+        else if (nOutOfM != -1) {
           int n = 0;
-          // wheck how many tokens already arrived in the join
+          // check how many tokens already arrived in the join
           for (Token concurrentToken : parentToken.getChildren().values()) {
-            if (equals(concurrentToken.getNode())) {
-              n++;
-            }            
+            if (equals(concurrentToken.getNode())) n++;
           }
-          if ( n < nOutOfM ) {
-            reactivateParent = false;
-          }
-          
+          if (n < nOutOfM) reactivateParent = false;
+        }
         // if no configuration is specified..
-        } else {
+        else {
           // the default behaviour is to check all concurrent tokens and reactivate
           // the parent if the last token arrives in the join
-          reactivateParent = mustParentBeReactivated(parentToken, parentToken.getChildren().keySet().iterator() );
+          reactivateParent = mustParentBeReactivated(parentToken, parentToken.getChildren()
+              .keySet()
+              .iterator());
         }
 
         // if the parent token needs to be reactivated from this join node
         if (reactivateParent) {
-
           // write to all child tokens that the parent is already reactivated
           for (Token child : parentToken.getChildren().values()) {
             child.setAbleToReactivateParent(false);
           }
-
           // write to all child tokens that the parent is already reactivated
           ExecutionContext parentContext = new ExecutionContext(parentToken);
           leave(parentContext);
@@ -199,49 +186,54 @@
     }
   }
 
-  public boolean mustParentBeReactivated(Token parentToken, Iterator<?> childTokenNameIterator) {
-    boolean reactivateParent = true;
-    while ( (childTokenNameIterator.hasNext())
-            && (reactivateParent) ){
-      String concurrentTokenName = (String) childTokenNameIterator.next();
-      
-      Token concurrentToken = parentToken.getChild( concurrentTokenName );
-      
+  public boolean mustParentBeReactivated(Token parentToken, Iterator<String> childTokenNames) {
+    while (childTokenNames.hasNext()) {
+      String concurrentTokenName = childTokenNames.next();
+      Token concurrentToken = parentToken.getChild(concurrentTokenName);
       if (concurrentToken.isAbleToReactivateParent()) {
-        log.debug("join will not yet reactivate parent: found concurrent token '"+concurrentToken+"'");
-        reactivateParent = false;
+        log.debug("join will not reactivate parent: found concurrent " + concurrentToken);
+        return false;
       }
     }
-    return reactivateParent;
+    return true;
   }
 
   public String getParentLockMode() {
     return parentLockMode;
   }
+
   public void setParentLockMode(String parentLockMode) {
     this.parentLockMode = parentLockMode;
   }
+
   public Script getScript() {
     return script;
   }
+
   public void setScript(Script script) {
     this.script = script;
   }
+
   public Collection<String> getTokenNames() {
     return tokenNames;
   }
+
   public void setTokenNames(Collection<String> tokenNames) {
     this.tokenNames = tokenNames;
   }
+
   public boolean isDiscriminator() {
     return isDiscriminator;
   }
+
   public void setDiscriminator(boolean isDiscriminator) {
     this.isDiscriminator = isDiscriminator;
   }
+
   public int getNOutOfM() {
     return nOutOfM;
   }
+
   public void setNOutOfM(int nOutOfM) {
     this.nOutOfM = nOutOfM;
   }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/BeanInstantiator.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/BeanInstantiator.java	2009-01-29 04:23:29 UTC (rev 3728)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/BeanInstantiator.java	2009-01-29 07:36:26 UTC (rev 3729)
@@ -21,6 +21,7 @@
  */
 package org.jbpm.instantiation;
 
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
 import org.apache.commons.logging.Log;
@@ -28,47 +29,49 @@
 import org.dom4j.Element;
 
 public class BeanInstantiator extends FieldInstantiator {
-  
-  protected void setPropertyValue(Class clazz, Object newInstance, String propertyName, Element propertyElement) {
-    try {
-      // create the setter method name from the property name
-      String setterMethodName = "set"+propertyName.substring(0,1).toUpperCase()+propertyName.substring(1);
-      
-      // find the setter method
-      Method method = findSetter(clazz, setterMethodName);
 
-      // if the setter method was found
-      if (method!=null) {
-        // make it accessible
-        method.setAccessible(true);
-        // invoke it
-        Class propertyType = method.getParameterTypes()[0];
-        method.invoke(newInstance, new Object[]{ getValue(propertyType, propertyElement) });
-      } else {
-        log.error( "couldn't set property '"+propertyName+"' to value '"+propertyElement.asXML()+"'" );
+  protected void setPropertyValue(Object instance, String propertyName, Element propertyElement) {
+    // create the setter method name from the property name
+    String setterName = "set"
+        + Character.toUpperCase(propertyName.charAt(0))
+        + propertyName.substring(1);
+
+    // find the setter method
+    Method method = findSetter(instance.getClass(), setterName);
+
+    // if the setter method was found
+    if (method != null) {
+      // make it accessible
+      method.setAccessible(true);
+      // invoke it
+      Class<?> propertyType = method.getParameterTypes()[0];
+      Object value = getValue(propertyType, propertyElement);
+      try {
+        method.invoke(instance, value);
       }
-    } catch (Exception e) {
-      log.error( "couldn't parse property '"+propertyName+"' to value '"+propertyElement.asXML()+"'", e );
+      catch (IllegalAccessException e) {
+        log.error("property '" + propertyName + "' is inaccesible", e);
+      }
+      catch (IllegalArgumentException e) {
+        log.error("property '" + propertyName + "' cannot be set to value " + value, e);
+      }
+      catch (InvocationTargetException e) {
+        log.error("write method for property '" + propertyName + "' threw exception", e.getCause());
+      }
     }
+    else {
+      log.error("property '" + propertyName + "' does not exist or is not writeable");
+    }
   }
-  
-  private Method findSetter(Class clazz, String setterMethodName) {
-    Method method = null;
-    Method[] methods = clazz.getDeclaredMethods();
-    for( int i=0; ( (i<methods.length)
-                    && (method==null) ); i++) {
-      if ( (setterMethodName.equals(methods[i].getName()))
-           && (methods[i].getParameterTypes()!=null)
-           && (methods[i].getParameterTypes().length==1) ) {
-        method = methods[i];
+
+  private Method findSetter(Class<?> clazz, String setterName) {
+    for (Method method : clazz.getDeclaredMethods()) {
+      if (setterName.equals(method.getName()) && method.getParameterTypes().length == 1) {
+        return method;
       }
     }
-    if ( (method==null)
-         && (clazz!=Object.class)
-       ) {
-      method = findSetter(clazz.getSuperclass(), setterMethodName);
-    }
-    return method;
+    Class<?> superclass = clazz.getSuperclass();
+    return superclass != null ? findSetter(superclass, setterName) : null;
   }
 
   private static final Log log = LogFactory.getLog(BeanInstantiator.class);

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/ConfigurationPropertyInstantiator.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/ConfigurationPropertyInstantiator.java	2009-01-29 04:23:29 UTC (rev 3728)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/ConfigurationPropertyInstantiator.java	2009-01-29 07:36:26 UTC (rev 3729)
@@ -21,33 +21,41 @@
  */
 package org.jbpm.instantiation;
 
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jbpm.JbpmException;
 
 public class ConfigurationPropertyInstantiator implements Instantiator {
 
-  private static final Class[] parameterTypes = new Class[] {String.class};
+  private static final Class<?>[] parameterTypes = { String.class };
 
-  public Object instantiate(Class clazz, String configuration) {
-    Object newInstance = null;
+  public <T> T instantiate(Class<T> type, String configuration) {
+    // create a new instance with the default constructor
+    T instance = InstantiatorUtil.instantiate(type);
+
     try {
-      // create the object
-      newInstance = clazz.newInstance();
-      
       // set the configuration with the bean-style setter
-      Method setter = clazz.getDeclaredMethod( "setConfiguration", parameterTypes );
+      Method setter = type.getDeclaredMethod("setConfiguration", parameterTypes);
       setter.setAccessible(true);
-      setter.invoke( newInstance, new Object[]{ configuration } );
-      
-    } catch (Exception e) {
-      log.error( "couldn't instantiate '" + clazz.getName() + "'", e );
-      throw new JbpmException( e );
+      setter.invoke(instance, configuration);
     }
-    return newInstance;
+    catch (NoSuchMethodException e) {
+      log.error("configuration setter does not exist", e);
+    }
+    catch (IllegalAccessException e) {
+      log.error("configuration setter is inaccesible", e);
+    }
+    catch (IllegalArgumentException e) {
+      log.error("configuration cannot be set to value " + configuration, e);
+    }
+    catch (InvocationTargetException e) {
+      log.error("configuration setter threw exception", e.getCause());
+    }
+
+    return instance;
   }
-  
+
   private static final Log log = LogFactory.getLog(ConfigurationPropertyInstantiator.class);
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/ConstructorInstantiator.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/ConstructorInstantiator.java	2009-01-29 04:23:29 UTC (rev 3728)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/ConstructorInstantiator.java	2009-01-29 07:36:26 UTC (rev 3729)
@@ -21,28 +21,10 @@
  */
 package org.jbpm.instantiation;
 
-import java.lang.reflect.Constructor;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jbpm.JbpmException;
-
 public class ConstructorInstantiator implements Instantiator {
-  
-  private static final Class[] parameterTypes = new Class[] {String.class};
 
-  public Object instantiate(Class clazz, String configuration) {
-    Object newInstance = null;
-    try {
-      Constructor constructor = clazz.getDeclaredConstructor( parameterTypes );
-      constructor.setAccessible(true);
-      newInstance = constructor.newInstance( new Object[] { configuration } );
-    } catch (Exception e) {
-      log.error( "couldn't instantiate '" + clazz.getName() + "'", e );
-      throw new JbpmException( e );
-    }
-    return newInstance;
+  public <T> T instantiate(Class<T> type, String configuration) {
+    return InstantiatorUtil.instantiate(type, configuration);
   }
 
-  private static final Log log = LogFactory.getLog(ConstructorInstantiator.class);
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/DefaultInstantiator.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/DefaultInstantiator.java	2009-01-29 04:23:29 UTC (rev 3728)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/DefaultInstantiator.java	2009-01-29 07:36:26 UTC (rev 3729)
@@ -21,20 +21,11 @@
  */
 package org.jbpm.instantiation;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jbpm.JbpmException;
 
 public class DefaultInstantiator implements Instantiator {
 
-  public Object instantiate(Class clazz, String configuration) {
-    try {
-      return clazz.newInstance();
-    } catch (Exception e) {
-      log.error( "couldn't instantiate '" + clazz.getName() + "'", e );
-      throw new JbpmException( e );
-    }
+  public <T> T instantiate(Class<T> type, String configuration) {
+    return InstantiatorUtil.instantiate(type);
   }
 
-  private static final Log log = LogFactory.getLog(DefaultInstantiator.class);
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/Delegation.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/Delegation.java	2009-01-29 04:23:29 UTC (rev 3728)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/Delegation.java	2009-01-29 07:36:26 UTC (rev 3729)
@@ -24,9 +24,7 @@
 import java.io.IOException;
 import java.io.Serializable;
 import java.io.StringWriter;
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.commons.logging.Log;
@@ -34,28 +32,30 @@
 import org.dom4j.DocumentException;
 import org.dom4j.DocumentHelper;
 import org.dom4j.Element;
-import org.dom4j.Node;
 import org.dom4j.io.OutputFormat;
 import org.dom4j.io.XMLWriter;
-import org.jbpm.JbpmConfiguration;
 import org.jbpm.JbpmException;
+import org.jbpm.graph.def.DelegationException;
 import org.jbpm.graph.def.ProcessDefinition;
 import org.jbpm.jpdl.xml.JpdlXmlReader;
 import org.jbpm.jpdl.xml.Parsable;
-import org.jbpm.util.ClassLoaderUtil;
 import org.jbpm.util.EqualsUtil;
 
 public class Delegation implements Parsable, Serializable {
 
   private static final long serialVersionUID = 1L;
-  
-  protected static Map instantiatorCache = new HashMap();
-  static {
-    instantiatorCache.put(null, new FieldInstantiator());
-    instantiatorCache.put("field", new FieldInstantiator());
-    instantiatorCache.put("bean", new BeanInstantiator());
-    instantiatorCache.put("constructor", new ConstructorInstantiator());
-    instantiatorCache.put("configuration-property", new ConfigurationPropertyInstantiator());
+
+  protected static Map<String, Instantiator> instantiatorCache = createInstantiatorCache();
+
+  private static Map<String, Instantiator> createInstantiatorCache() {
+    Map<String, Instantiator> instantiators = new HashMap<String, Instantiator>();
+    instantiators.put(null, new FieldInstantiator());
+    instantiators.put("field", new FieldInstantiator());
+    instantiators.put("bean", new BeanInstantiator());
+    instantiators.put("constructor", new ConstructorInstantiator());
+    instantiators.put("configuration-property", new ConfigurationPropertyInstantiator());
+    instantiators.put("xml", new XmlInstantiator());
+    return instantiators;
   }
 
   long id = 0;
@@ -79,26 +79,27 @@
   public void read(Element delegateElement, JpdlXmlReader jpdlReader) {
     processDefinition = jpdlReader.getProcessDefinition();
     className = delegateElement.attributeValue("class");
-    if (className==null) {
-      jpdlReader.addWarning("no class specified in "+delegateElement.asXML());
+    if (className == null) {
+      jpdlReader.addWarning("no class specified in " + delegateElement.asXML());
     }
-      
+
     configType = delegateElement.attributeValue("config-type");
-    if ( delegateElement.hasContent() ) {
+    if (delegateElement.hasContent()) {
       try {
         StringWriter stringWriter = new StringWriter();
-        // when parsing, it could be to store the config in the database, so we want to make the configuration compact
-        XMLWriter xmlWriter = new XMLWriter( stringWriter, OutputFormat.createCompactFormat() );
-        Iterator iter = delegateElement.content().iterator();
-        while (iter.hasNext()) {
-          Object node = iter.next();
-          xmlWriter.write( node );
+        // when parsing, it could be to store the config in the database, so we want to make the
+        // configuration compact
+        XMLWriter xmlWriter = new XMLWriter(stringWriter, OutputFormat.createCompactFormat());
+        for (Object node : delegateElement.content()) {
+          xmlWriter.write(node);
         }
         xmlWriter.flush();
         configuration = stringWriter.toString();
-      } catch (IOException e) {
-        jpdlReader.addWarning("io problem while parsing the configuration of "+delegateElement.asXML());
       }
+      catch (IOException e) {
+        jpdlReader.addWarning("io problem while parsing the configuration of "
+            + delegateElement.asXML());
+      }
     }
   }
 
@@ -106,71 +107,66 @@
     element.addAttribute("class", className);
     element.addAttribute("config-type", configType);
     String configuration = this.configuration;
-    if (configuration!=null) {
+    if (configuration != null) {
       try {
-        Element actionElement = DocumentHelper.parseText( "<action>"+configuration+"</action>" ).getRootElement();
-        Iterator iter = new ArrayList( actionElement.content() ).iterator();
-        while (iter.hasNext()) {
-          Node node = (Node)iter.next();
-          node.setParent(null);
-          element.add( node );
-        }
-      } catch (DocumentException e) {
-        log.error("couldn't create dom-tree for action configuration '"+configuration+"'", e);
+        Element actionElement = DocumentHelper.parseText("<action>" + configuration + "</action>")
+            .getRootElement();
+        element.appendContent(actionElement);
       }
+      catch (DocumentException e) {
+        log.error("couldn't create dom-tree for action configuration '" + configuration + "'", e);
+      }
     }
   }
 
   public Object getInstance() {
-    if (instance==null) {
+    if (instance == null) {
       instance = instantiate();
     }
     return instance;
   }
 
   public Object instantiate() {
-
-    Object newInstance = null; 
-
-    // The thread class loader was set before the instantiation correctly 
+    // The thread class loader was set before the instantiation correctly
     // to the ProcesClassLoader which can be directly used here
     // If we would construct a JbpmConfiguration.getProcessClassLoder here
     // we would have the hierarchy ProcessClassLoader -> ProcessClassLoader -> Context...
     // this is one ProcessClassLoader too much
     ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-    
+
     // load the class that needs to be instantiated
-    Class clazz = null;
+    Class<?> delegationClass = null;
     try {
-      clazz = classLoader.loadClass(className);
-    } catch (ClassNotFoundException e) {
-      log.error("couldn't load delegation class '"+className+"'", e);
+      delegationClass = classLoader.loadClass(className);
     }
+    catch (ClassNotFoundException e) {
+      throw new DelegationException("could not load delegation class '" + className + "'", e);
+    }
 
-    Instantiator instantiator = null;
-    try {
-      // find the instantiator
-      instantiator = (Instantiator) instantiatorCache.get(configType);
-      if (instantiator == null) {
+    // find the instantiator
+    Instantiator instantiator = instantiatorCache.get(configType);
+    if (instantiator == null) {
+      Class<?> instantiatorClass = null;
+      try {
         // load the instantiator class
-        Class instantiatorClass = classLoader.loadClass(configType);
-        // instantiate the instantiator with the default constructor
+        instantiatorClass = classLoader.loadClass(configType);
+        // create the instantiator with the default constructor
         instantiator = (Instantiator) instantiatorClass.newInstance();
         instantiatorCache.put(configType, instantiator);
       }
-    } catch (Exception e) {
-      log.error(e);
-      throw new JbpmException("couldn't instantiate custom instantiator '" + configType + "'", e);
+      catch (ClassNotFoundException e) {
+        throw new JbpmException("could not load instantiator class '" + configType + "'", e);
+      }
+      catch (InstantiationException e) {
+        throw new JbpmException("could not instantiate " + instantiatorClass, e);
+      }
+      catch (IllegalAccessException e) {
+        throw new JbpmException("could not access " + instantiatorClass, e);
+      }
     }
-      
-    try {
-      // instantiate the object
-      newInstance = instantiator.instantiate(clazz, configuration);
-    } catch (RuntimeException e) {
-      log.error("couldn't instantiate delegation class '"+className+"'", e);
-    }
 
-    return newInstance; 
+    // instantiate the object
+    return instantiator.instantiate(delegationClass, configuration);
   }
 
   // equals ///////////////////////////////////////////////////////////////////
@@ -179,36 +175,45 @@
   public boolean equals(Object o) {
     return EqualsUtil.equals(this, o);
   }
-  
+
   // getters and setters //////////////////////////////////////////////////////
 
   public String getClassName() {
     return className;
   }
+
   public void setClassName(String className) {
     this.className = className;
   }
+
   public String getConfiguration() {
     return configuration;
   }
+
   public void setConfiguration(String configuration) {
     this.configuration = configuration;
   }
+
   public String getConfigType() {
     return configType;
   }
+
   public void setConfigType(String instantiatorType) {
     this.configType = instantiatorType;
   }
+
   public long getId() {
     return id;
   }
+
   public void setId(long id) {
     this.id = id;
   }
- public ProcessDefinition getProcessDefinition() {
+
+  public ProcessDefinition getProcessDefinition() {
     return processDefinition;
   }
+
   public void setProcessDefinition(ProcessDefinition processDefinition) {
     this.processDefinition = processDefinition;
   }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/FieldInstantiator.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/FieldInstantiator.java	2009-01-29 04:23:29 UTC (rev 3728)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/FieldInstantiator.java	2009-01-29 07:36:26 UTC (rev 3729)
@@ -23,13 +23,15 @@
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Queue;
 import java.util.Set;
 import java.util.SortedMap;
 import java.util.SortedSet;
@@ -38,170 +40,184 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.dom4j.DocumentException;
-import org.dom4j.DocumentHelper;
 import org.dom4j.Element;
-import org.jbpm.JbpmException;
 import org.jbpm.util.ClassLoaderUtil;
+import org.jbpm.util.CollectionUtil;
 
 public class FieldInstantiator implements Instantiator {
 
-  public Object instantiate(Class clazz, String configuration) {
-
+  public <T> T instantiate(Class<T> type, String configuration) {
     // create a new instance with the default constructor
-    Object newInstance = newInstance(clazz);
+    T instance = InstantiatorUtil.instantiate(type);
 
-    if ( (configuration!=null)
-         && (! "".equals(configuration))
-       ) {
+    if (configuration != null && configuration.length() > 0) {
       // parse the bean configuration
-      Element configurationElement = parseConfiguration(configuration);
-      
+      Element configurationElement = InstantiatorUtil.parseConfiguration(configuration);
+
       // loop over the configured properties
-      Iterator iter = configurationElement.elements().iterator();
-      while( iter.hasNext() ) {
-        Element propertyElement = (Element) iter.next();
+      for (Object i : configurationElement.elements()) {
+        Element propertyElement = (Element) i;
         String propertyName = propertyElement.getName();
-        setPropertyValue(clazz, newInstance, propertyName, propertyElement);
+        setPropertyValue(instance, propertyName, propertyElement);
       }
     }
-    return newInstance;
+    return instance;
   }
-  
-  protected void setPropertyValue(Class clazz, Object newInstance, String propertyName, Element propertyElement) {
-    try {
-      Field f = findField(clazz, propertyName);
-      f.setAccessible(true);
-      f.set(newInstance, getValue(f.getType(), propertyElement));
-    } catch (Exception e) {
-      log.error( "couldn't parse set field '"+propertyName+"' to value '"+propertyElement.asXML()+"'", e );
-    }
-  }
 
-  private Field findField(Class clazz, String propertyName) throws NoSuchFieldException {
-    Field f = null;
-    if (clazz!=null) {
+  protected void setPropertyValue(Object instance, String propertyName, Element propertyElement) {
+    Field field = findField(instance.getClass(), propertyName);
+    if (field != null) {
+      field.setAccessible(true);
+      Object value = getValue(field.getType(), propertyElement);
       try {
-        f = clazz.getDeclaredField(propertyName);
-      } catch (NoSuchFieldException e) {
-        f = findField(clazz.getSuperclass(), propertyName);
+        field.set(instance, value);
       }
+      catch (IllegalArgumentException e) {
+        log.error("field '" + propertyName + "' cannot be set to value " + value, e);
+      }
+      catch (IllegalAccessException e) {
+        log.error(" field '" + propertyName + "' is inaccessible", e);
+      }
     }
-    return f;
   }
 
-  protected Element parseConfiguration(String configuration) {
-    Element element = null;
+  private Field findField(Class<?> clazz, String propertyName) {
     try {
-      element = DocumentHelper.parseText( "<action>"+configuration+"</action>" ).getRootElement();
-    } catch (DocumentException e) {
-      log.error( "couldn't parse bean configuration : " + configuration, e );
-      throw new JbpmException(e);
+      return clazz.getDeclaredField(propertyName);
     }
-    return element;
-  }
-
-  protected Object newInstance(Class clazz) {
-    Object newInstance = null;
-    try {
-      newInstance = clazz.newInstance();
-    } catch (Exception e) {
-      log.error( "couldn't instantiate type '" + clazz.getName() + "' with the default constructor" );
-      throw new JbpmException(e);
+    catch (NoSuchFieldException e) {
+      Class<?> superclass = clazz.getSuperclass();
+      return superclass != null ? findField(superclass, propertyName) : null;
     }
-    return newInstance;
   }
 
-  public static Object getValue(Class type, Element propertyElement) {
-    // parse the value
+  public static Object getValue(Class<?> type, Element propertyElement) {
     Object value = null;
-    try {
-      
-      if ( type == String.class ) {
-        value = propertyElement.getText();
-      } else if ( (type==Integer.class) || (type==int.class) ) {
-        value = new Integer( propertyElement.getTextTrim() );
-      } else if ( (type==Long.class) || (type==long.class) ) {
-        value = new Long( propertyElement.getTextTrim() );
-      } else if ( (type==Float.class ) || (type==float.class) ) {
-        value = new Float( propertyElement.getTextTrim() );
-      } else if ( (type==Double.class ) || (type==double.class) ) {
-        value = new Double( propertyElement.getTextTrim() );
-      } else if ( (type==Boolean.class ) || (type==boolean.class) ) {
-        value = Boolean.valueOf( propertyElement.getTextTrim() );
-      } else if ( (type==Character.class ) || (type==char.class) ) {
-        value = new Character( propertyElement.getTextTrim().charAt(0) );
-      } else if ( (type==Short.class ) || (type==short.class) ) {
-        value = new Short( propertyElement.getTextTrim() );
-      } else if ( (type==Byte.class ) || (type==byte.class) ) {
-        value = new Byte( propertyElement.getTextTrim() );
-      } else if (type==List.class || type==Collection.class) {
-        value = getCollection(propertyElement, new ArrayList());
-      } else if (type==Set.class) {
-        value = getCollection(propertyElement, new HashSet());
-      } else if (type==SortedSet.class) {
-        value = getCollection(propertyElement, new TreeSet());
-      } else if (Collection.class.isAssignableFrom(type)) {
-        value = getCollection(propertyElement, (Collection)type.newInstance());
-      } else if (type==Map.class) {
-        value = getMap(propertyElement, new HashMap());
-      } else if (type==SortedMap.class) {
-        value = getMap(propertyElement, new TreeMap());
-      } else if (Map.class.isAssignableFrom(type)) {
-        value = getMap(propertyElement, (Map)type.newInstance());
-      } else if ( Element.class.isAssignableFrom(type) ) {
-        value = propertyElement;
-      } else {
-        Constructor constructor = type.getConstructor(new Class[]{String.class});
-        if ( (propertyElement.isTextOnly())
-             && (constructor!=null) ) {
-          value = constructor.newInstance(new Object[]{propertyElement.getTextTrim()});
+    if (type == String.class) {
+      value = propertyElement.getText();
+    }
+    else if ((type == Integer.class) || (type == int.class)) {
+      value = new Integer(propertyElement.getTextTrim());
+    }
+    else if ((type == Long.class) || (type == long.class)) {
+      value = new Long(propertyElement.getTextTrim());
+    }
+    else if ((type == Float.class) || (type == float.class)) {
+      value = new Float(propertyElement.getTextTrim());
+    }
+    else if ((type == Double.class) || (type == double.class)) {
+      value = new Double(propertyElement.getTextTrim());
+    }
+    else if ((type == Boolean.class) || (type == boolean.class)) {
+      value = Boolean.valueOf(propertyElement.getTextTrim());
+    }
+    else if ((type == Character.class) || (type == char.class)) {
+      value = new Character(propertyElement.getTextTrim().charAt(0));
+    }
+    else if ((type == Short.class) || (type == short.class)) {
+      value = new Short(propertyElement.getTextTrim());
+    }
+    else if ((type == Byte.class) || (type == byte.class)) {
+      value = new Byte(propertyElement.getTextTrim());
+    }
+    else if (type == List.class || type == Collection.class) {
+      value = getCollection(propertyElement, new ArrayList<Object>());
+    }
+    else if (type == Queue.class) {
+      value = getCollection(propertyElement, new LinkedList<Object>());
+    }
+    else if (type == Set.class) {
+      value = getCollection(propertyElement, new HashSet<Object>());
+    }
+    else if (type == SortedSet.class) {
+      value = getCollection(propertyElement, new TreeSet<Object>());
+    }
+    else if (type == Map.class) {
+      value = getMap(propertyElement, new HashMap<Object, Object>());
+    }
+    else if (type == SortedMap.class) {
+      value = getMap(propertyElement, new TreeMap<Object, Object>());
+    }
+    else if (Element.class.isAssignableFrom(type)) {
+      value = propertyElement;
+    }
+    else {
+      try {
+        if (Collection.class.isAssignableFrom(type)) {
+          value = getCollection(propertyElement, CollectionUtil.checkCollection(
+              (Collection<?>) type.newInstance(), Object.class));
         }
+        else if (Map.class.isAssignableFrom(type)) {
+          value = getMap(propertyElement, CollectionUtil.checkMap((Map<?, ?>) type.newInstance(),
+              Object.class, Object.class));
+        }
+        else {
+          try {
+            Constructor<?> constructor = type.getConstructor(String.class);
+            if (propertyElement.isTextOnly()) {
+              value = constructor.newInstance(propertyElement.getTextTrim());
+            }
+            else {
+              log.error("element '" + propertyElement.getName() + "' has non-text content");
+            }
+          }
+          catch (NoSuchMethodException e) {
+            log.error(type + " does not have a string constructor", e);
+          }
+          catch (IllegalArgumentException e) {
+            log.error(type + " cannot be constructed with value " + propertyElement.getTextTrim(),
+                e);
+          }
+        }
       }
-    } catch (Exception e) {
-      log.error("couldn't parse the bean property value '" + propertyElement.asXML() + "' to a '" + type.getName() + "'" );
-      throw new JbpmException( e );
+      catch (InstantiationException e) {
+        log.error("could not instantiate " + type, e);
+      }
+      catch (IllegalAccessException e) {
+        log.error(type + " is inaccessible", e);
+      }
+      catch (InvocationTargetException e) {
+        log.error("constructor for " + type + " threw exception", e.getCause());
+      }
     }
     return value;
   }
 
-  static Object getMap(Element mapElement, Map map) {
-    Class keyClass = String.class;
-    String keyType = mapElement.attributeValue("key-type");
-    if (keyType!=null) {
-      keyClass = ClassLoaderUtil.loadClass(keyType);
-    }
+  private static Map<Object, Object> getMap(Element mapElement, Map<Object, Object> map) {
+    Class<?> keyClass = classForAttributeValue(mapElement, "key-type");
+    Class<?> valueClass = classForAttributeValue(mapElement, "value-type");
 
-    Class valueClass = String.class;
-    String valueType = mapElement.attributeValue("value-type");
-    if (valueType!=null) {
-      valueClass = ClassLoaderUtil.loadClass(valueType);
-    }
-
-    Iterator iter = mapElement.elementIterator();
-    while (iter.hasNext()) {
-      Element element = (Element) iter.next();
+    for (Object o : mapElement.elements()) {
+      Element element = (Element) o;
       Element keyElement = element.element("key");
       Element valueElement = element.element("value");
-      
+
       map.put(getValue(keyClass, keyElement), getValue(valueClass, valueElement));
     }
     return map;
   }
 
-  static Object getCollection(Element collectionElement, Collection collection) {
-    Class elementClass = String.class;
-    String elementType = collectionElement.attributeValue("element-type");
-    if (elementType!=null) {
-      elementClass = ClassLoaderUtil.loadClass(elementType);
+  private static Collection<Object> getCollection(Element collectionElement,
+      Collection<Object> collection) {
+    Class<?> elementClass = classForAttributeValue(collectionElement, "element-type");
+
+    for (Object element : collectionElement.elements()) {
+      collection.add(getValue(elementClass, (Element) element));
     }
-    Iterator iter = collectionElement.elementIterator();
-    while (iter.hasNext()) {
-      Element element = (Element) iter.next();
-      collection.add(getValue(elementClass, element));
-    }
     return collection;
   }
 
+  /**
+   * Returns the <code>Class</code> associated with the value for the attribute with the given name.
+   */
+  private static Class<?> classForAttributeValue(Element element, String attributeName) {
+    Class<?> type = String.class;
+    String attributeValue = element.attributeValue(attributeName);
+    if (attributeValue != null) {
+      type = ClassLoaderUtil.loadClass(attributeValue);
+    }
+    return type;
+  }
+
   private static final Log log = LogFactory.getLog(FieldInstantiator.class);
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/Instantiator.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/Instantiator.java	2009-01-29 04:23:29 UTC (rev 3728)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/Instantiator.java	2009-01-29 07:36:26 UTC (rev 3729)
@@ -23,5 +23,5 @@
 
 public interface Instantiator {
 
-  Object instantiate(Class clazz, String configuration);
+  <T> T instantiate(Class<T> type, String configuration);
 }

Added: jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/InstantiatorUtil.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/InstantiatorUtil.java	                        (rev 0)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/InstantiatorUtil.java	2009-01-29 07:36:26 UTC (rev 3729)
@@ -0,0 +1,89 @@
+/*
+ * 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.instantiation;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+import org.dom4j.DocumentException;
+import org.dom4j.DocumentHelper;
+import org.dom4j.Element;
+import org.jbpm.JbpmException;
+
+/**
+ * @author Alejandro Guizar
+ */
+class InstantiatorUtil {
+
+  private InstantiatorUtil() {
+    // hide default constructor to prevent instantiation
+  }
+
+  public static <T> T instantiate(Class<T> type) {
+    try {
+      return type.newInstance();
+    }
+    catch (InstantiationException e) {
+      throw new JbpmException("could not instantiate " + type, e);
+    }
+    catch (IllegalAccessException e) {
+      throw new JbpmException(type + " is inaccessible", e);
+    }
+  }
+
+  public static <T> T instantiate(Class<T> type, Object configuration) {
+    try {
+      Constructor<T> constructor = type.getDeclaredConstructor(configuration.getClass());
+      constructor.setAccessible(true);
+      return constructor.newInstance(configuration);
+    }
+    catch (NoSuchMethodException e) {
+      throw new JbpmException(type
+          + " does not have a "
+          + configuration.getClass().getSimpleName()
+          + " constructor", e);
+    }
+    catch (InstantiationException e) {
+      throw new JbpmException("could not instantiate " + type, e);
+    }
+    catch (IllegalAccessException e) {
+      throw new JbpmException(type + " is inaccessible", e);
+    }
+    catch (IllegalArgumentException e) {
+      throw new JbpmException(type + " cannot be constructed with value " + configuration, e);
+    }
+    catch (InvocationTargetException e) {
+      throw new JbpmException("constructor for " + type + " threw exception", e.getCause());
+    }
+  }
+
+  public static Element parseConfiguration(String configuration) {
+    Element element = null;
+    try {
+      element = DocumentHelper.parseText("<action>" + configuration + "</action>").getRootElement();
+    }
+    catch (DocumentException e) {
+      throw new JbpmException("failed to parse configuration: " + configuration, e);
+    }
+    return element;
+  }
+}


Property changes on: jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/InstantiatorUtil.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/ProcessClassLoader.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/ProcessClassLoader.java	2009-01-29 04:23:29 UTC (rev 3728)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/ProcessClassLoader.java	2009-01-29 07:36:26 UTC (rev 3729)
@@ -34,10 +34,10 @@
 import org.jbpm.graph.def.ProcessDefinition;
 
 public class ProcessClassLoader extends ClassLoader {
-  
+
   private ProcessDefinition processDefinition = null;
 
-  public ProcessClassLoader( ClassLoader parent, ProcessDefinition processDefinition ) {
+  public ProcessClassLoader(ClassLoader parent, ProcessDefinition processDefinition) {
     super(parent);
     this.processDefinition = processDefinition;
   }
@@ -45,42 +45,49 @@
   public URL findResource(String name) {
     URL url = null;
     FileDefinition fileDefinition = processDefinition.getFileDefinition();
-    if (fileDefinition!=null) {
-      // if the name of the resources starts with a / 
+    if (fileDefinition != null) {
+      // if the name of the resources starts with a /
       if (name.startsWith("/")) {
         // then we start searching from the root of the process archive
 
-        // we know that the leading slashes are removed in the names of the 
-        // file definitions, therefor we skip the leading slashes
+        // we know that the leading slashes are removed in the names of the
+        // file definitions, therefore we skip the leading slashes
         while (name.startsWith("/")) {
           name = name.substring(1);
         }
-      } else {
+      }
+      else {
         // otherwise, (if the resource is relative), we look in the classes
         // directory in the process archive
-        name = "classes/"+name;
+        name = "classes/" + name;
       }
 
       byte[] bytes = null;
       if (fileDefinition.hasFile(name)) {
         bytes = fileDefinition.getBytes(name);
       }
-      if (bytes!=null) {
+      if (bytes != null) {
         try {
-          url = new URL(null, "processresource://"+processDefinition.getName()+"/classes/"+name, new BytesUrlStreamHandler(bytes));
-        } catch (MalformedURLException e) {
+          url = new URL(null, "processresource://"
+              + processDefinition.getName()
+              + "/classes/"
+              + name, new BytesUrlStreamHandler(bytes));
+        }
+        catch (MalformedURLException e) {
           throw new JbpmException("couldn't create url", e);
         }
       }
     }
     return url;
   }
-  
+
   public static class BytesUrlStreamHandler extends URLStreamHandler {
     byte[] bytes;
+
     public BytesUrlStreamHandler(byte[] bytes) {
       this.bytes = bytes;
     }
+
     protected URLConnection openConnection(URL u) throws IOException {
       return new BytesUrlConnection(bytes, u);
     }
@@ -88,47 +95,42 @@
 
   public static class BytesUrlConnection extends URLConnection {
     byte[] bytes = null;
+
     public BytesUrlConnection(byte[] bytes, URL u) {
       super(u);
       this.bytes = bytes;
     }
+
     public void connect() throws IOException {
     }
+
     public InputStream getInputStream() throws IOException {
       return new ByteArrayInputStream(bytes);
     }
   }
 
-  public Class findClass(String name) throws ClassNotFoundException {
-    Class clazz = null;
+  public Class<?> findClass(String className) throws ClassNotFoundException {
+    FileDefinition fileDefinition = processDefinition.getFileDefinition();
+    if (fileDefinition != null) {
+      String fileName = "classes/" + className.replace('.', '/') + ".class";
+      byte[] classBytes = fileDefinition.getBytes(fileName);
 
-    FileDefinition fileDefinition = processDefinition.getFileDefinition();
-    if (fileDefinition!=null) {
-      String fileName = "classes/" + name.replace( '.', '/' ) + ".class";
-      byte[] classBytes;
-      try {
-        classBytes = fileDefinition.getBytes(fileName);
-        clazz = defineClass(name, classBytes, 0, classBytes.length);
-      } catch (JbpmException e) {
-        clazz = null;
-      }
-      
-      // Add the package information
-      // see https://jira.jboss.org/jira/browse/JBPM-1404
-      final int packageIndex = name.lastIndexOf('.');
-      if (packageIndex != -1) {
-        final String packageName = name.substring(0, packageIndex);
-        final Package classPackage = getPackage(packageName);
-        if (classPackage == null) {
-          definePackage(packageName, null, null, null, null, null, null, null);
+      if (classBytes != null) {
+        // define the package before defining the class
+        // see https://jira.jboss.org/jira/browse/JBPM-1404
+        int packageIndex = className.lastIndexOf('.');
+
+        if (packageIndex != -1) {
+          String packageName = className.substring(0, packageIndex);
+
+          if (getPackage(packageName) == null) {
+            definePackage(packageName, null, null, null, processDefinition.getName(),
+                Integer.toString(processDefinition.getVersion()), null, null);
+          }
         }
+        return defineClass(className, classBytes, 0, classBytes.length);
       }
     }
-
-    if (clazz==null) {
-      throw new ClassNotFoundException("class '"+name+"' could not be found by the process classloader");
-    }
-
-    return clazz;
+    throw new ClassNotFoundException(className);
   }
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/XmlInstantiator.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/XmlInstantiator.java	2009-01-29 04:23:29 UTC (rev 3728)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/XmlInstantiator.java	2009-01-29 07:36:26 UTC (rev 3729)
@@ -21,45 +21,9 @@
  */
 package org.jbpm.instantiation;
 
-import java.lang.reflect.Constructor;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.dom4j.DocumentException;
-import org.dom4j.DocumentHelper;
-import org.dom4j.Element;
-import org.jbpm.JbpmException;
-
 public class XmlInstantiator implements Instantiator {
 
-  private static final Class[] parameterTypes = new Class[] {Element.class};
-
-  public Object instantiate(Class clazz, String configuration) {
-    Object newInstance = null;
-    try {
-      // parse the bean configuration
-      Element configurationElement = parseConfiguration(configuration);
-
-      Constructor constructor = clazz.getDeclaredConstructor( parameterTypes );
-      constructor.setAccessible(true);
-      newInstance = constructor.newInstance( new Object[] { configurationElement } );
-    } catch (Exception e) {
-      log.error( "couldn't instantiate '" + clazz.getName() + "'", e );
-      throw new JbpmException( e );
-    }
-    return newInstance;
+  public <T> T instantiate(Class<T> type, String configuration) {
+    return InstantiatorUtil.instantiate(type, InstantiatorUtil.parseConfiguration(configuration));
   }
-  
-  protected Element parseConfiguration(String configuration) {
-    Element element = null;
-    try {
-      element = DocumentHelper.parseText( "<action>"+configuration+"</action>" ).getRootElement();
-    } catch (DocumentException e) {
-      log.error( "couldn't parse bean configuration : " + configuration, e );
-      throw new JbpmException(e);
-    }
-    return element;
-  }
-
-  private static final Log log = LogFactory.getLog(XmlInstantiator.class);
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/util/CollectionUtil.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/util/CollectionUtil.java	2009-01-29 04:23:29 UTC (rev 3728)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/util/CollectionUtil.java	2009-01-29 07:36:26 UTC (rev 3729)
@@ -23,6 +23,7 @@
 
 import java.util.Collection;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 /**
@@ -40,7 +41,7 @@
   /**
    * Ensures that all elements of the given collection can be cast to a desired type.
    * 
-   * @param collection the collection to check 
+   * @param collection the collection to check
    * @param type the desired type
    * @return a collection of the desired type
    * @throws ClassCastException if an element cannot be cast to the desired type
@@ -49,8 +50,7 @@
   public static <E> Collection<E> checkCollection(Collection<?> collection, Class<E> type) {
     if (DEBUG) {
       for (Object element : collection) {
-        if (element != null && !type.isInstance(element))
-          throw new ClassCastException(element.getClass().toString());
+        type.cast(element);
       }
     }
     return (Collection<E>) collection;
@@ -59,7 +59,7 @@
   /**
    * Ensures that all elements of the given list can be cast to a desired type.
    * 
-   * @param list the list to check 
+   * @param list the list to check
    * @param type the desired type
    * @return a list of the desired type
    * @throws ClassCastException if an element cannot be cast to the desired type
@@ -68,8 +68,7 @@
   public static <E> List<E> checkList(List<?> list, Class<E> type) {
     if (DEBUG) {
       for (Object element : list) {
-        if (element != null && !type.isInstance(element))
-          throw new ClassCastException(element.getClass().toString());
+        type.cast(element);
       }
     }
     return (List<E>) list;
@@ -78,7 +77,7 @@
   /**
    * Ensures that all elements of the given set can be cast to a desired type.
    * 
-   * @param list the set to check 
+   * @param list the set to check
    * @param type the desired type
    * @return a set of the desired type
    * @throws ClassCastException if an element cannot be cast to the desired type
@@ -87,10 +86,20 @@
   public static <E> Set<E> checkSet(Set<?> set, Class<E> type) {
     if (DEBUG) {
       for (Object element : set) {
-        if (element != null && !type.isInstance(element))
-          throw new ClassCastException(element.getClass().toString());
+        type.cast(element);
       }
     }
     return (Set<E>) set;
   }
+
+  @SuppressWarnings("unchecked")
+  public static <K, V> Map<K, V> checkMap(Map<?, ?> map, Class<K> keyType, Class<V> valueType) {
+    if (DEBUG) {
+      for (Map.Entry<?, ?> entry : map.entrySet()) {
+        keyType.cast(entry.getKey());
+        valueType.cast(entry.getValue());
+      }
+    }
+    return (Map<K, V>) map;
+  }
 }

Deleted: jbpm3/trunk/modules/core/src/main/java/org/jbpm/util/StaticUtil.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/util/StaticUtil.java	2009-01-29 04:23:29 UTC (rev 3728)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/util/StaticUtil.java	2009-01-29 07:36:26 UTC (rev 3729)
@@ -1,96 +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.util;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-public class StaticUtil {
-
-  /*
-  public class MyClass ... {
-    static AType aStaticInMyClass = null;
-    static AnotherType anotherStaticInMyClass = null;
-    
-    static {
-      new StaticUtil.Initializer(MyClass.class) {
-        public void init() {
-          // initialize static members here
-          aStaticInMyClass = ...;
-          anotherStaticInMyClass = ...;
-        }
-      };
-    }
-    ...
-  }
-  */
-
-  static Map initializers = Collections.synchronizedMap(new HashMap());
-
-  public abstract static class Initializer {
-    public Initializer(Class clazz) {
-      add(clazz, this);
-      init();
-    }
-    public abstract void init();
-  }
-
-  /*
-  public class MyClass ... {
-    static AType aStaticInMyClass = null;
-    static AnotherType anotherStaticInMyClass = null;
-    
-    static {
-      new StaticUtil.Initializer(MyClass.class) {
-        public void init() {
-          // initialize static members here
-          aStaticInMyClass = ...;
-          anotherStaticInMyClass = ...;
-        }
-      };
-    }
-    ...
-  }
-  */
-
-  private StaticUtil() {
-    // hide default constructor to prevent instantiation
-  }
-
-  public static void add(Class clazz, Initializer initializer) {
-    initializers.put(clazz, initializer);
-  }
-
-  public static void remove(Class clazz) {
-    initializers.remove(clazz);
-  }
-
-  public static void reinitialize() {
-    Iterator iter = initializers.values().iterator();
-    while (iter.hasNext()) {
-      Initializer initializer = (Initializer) iter.next();
-      initializer.init();
-    }
-  }
-}

Modified: jbpm3/trunk/modules/core/src/main/resources/hibernate.properties.mysql.xml
===================================================================
--- jbpm3/trunk/modules/core/src/main/resources/hibernate.properties.mysql.xml	2009-01-29 04:23:29 UTC (rev 3728)
+++ jbpm3/trunk/modules/core/src/main/resources/hibernate.properties.mysql.xml	2009-01-29 07:36:26 UTC (rev 3729)
@@ -1,6 +1,6 @@
 
     <!-- hibernate dialect -->
-    <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
+    <property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
 
     <!-- JDBC connection properties (begin) -->
     <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>

Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/graph/def/ExceptionHandlerTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/graph/def/ExceptionHandlerTest.java	2009-01-29 04:23:29 UTC (rev 3728)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/graph/def/ExceptionHandlerTest.java	2009-01-29 07:36:26 UTC (rev 3729)
@@ -116,7 +116,7 @@
     catch (DelegationException ex)
     {
       // check that exception is thrown to the client nested in a DelegationException
-      assertEquals(NullPointerException.class, ex.getCause().getClass());
+      assertEquals(ClassNotFoundException.class, ex.getCause().getClass());
     }
   }
 




More information about the jbpm-commits mailing list