[jbpm-commits] JBoss JBPM SVN: r4328 - in jbpm4/trunk/modules: deployment and 20 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Mar 25 14:08:31 EDT 2009


Author: tom.baeyens at jboss.com
Date: 2009-03-25 14:08:31 -0400 (Wed, 25 Mar 2009)
New Revision: 4328

Added:
   jbpm4/trunk/modules/deployment/
   jbpm4/trunk/modules/deployment/.classpath
   jbpm4/trunk/modules/deployment/.project
   jbpm4/trunk/modules/deployment/pom.xml
   jbpm4/trunk/modules/deployment/src/
   jbpm4/trunk/modules/deployment/src/main/
   jbpm4/trunk/modules/deployment/src/main/java/
   jbpm4/trunk/modules/deployment/src/main/java/org/
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/Deployment.java
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositoryService.java
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositorySession.java
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/cmd/
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/cmd/StartExecutionInLatestCmd.java
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/jpdl/
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/jpdl/JpdlDeployer.java
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeployCmd.java
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/Deployer.java
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeployerManager.java
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentImpl.java
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentProperty.java
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCache.java
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCacheImpl.java
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryServiceImpl.java
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositorySessionImpl.java
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployExecutionService.java
   jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployProcessService.java
   jbpm4/trunk/modules/deployment/src/test/
   jbpm4/trunk/modules/deployment/src/test/java/
   jbpm4/trunk/modules/deployment/src/test/java/org/
   jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/
   jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/
   jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/
   jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/JbpmTestCase.java
   jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/StartExecutionTest.java
   jbpm4/trunk/modules/deployment/src/test/resources/
   jbpm4/trunk/modules/deployment/src/test/resources/jbpm.cache.xml
   jbpm4/trunk/modules/deployment/src/test/resources/jbpm.cfg.xml
   jbpm4/trunk/modules/deployment/src/test/resources/jbpm.definition.hbm.xml
   jbpm4/trunk/modules/deployment/src/test/resources/jbpm.execution.hbm.xml
   jbpm4/trunk/modules/deployment/src/test/resources/jbpm.hibernate.cfg.xml
   jbpm4/trunk/modules/deployment/src/test/resources/jbpm.history.hbm.xml
   jbpm4/trunk/modules/deployment/src/test/resources/jbpm.identity.hbm.xml
   jbpm4/trunk/modules/deployment/src/test/resources/jbpm.jpdl.activities.xml
   jbpm4/trunk/modules/deployment/src/test/resources/jbpm.jpdl.hbm.xml
   jbpm4/trunk/modules/deployment/src/test/resources/jbpm.repository.hbm.xml
   jbpm4/trunk/modules/deployment/src/test/resources/jbpm.task.hbm.xml
   jbpm4/trunk/modules/deployment/src/test/resources/jbpm.task.lifecycle.xml
   jbpm4/trunk/modules/deployment/src/test/resources/jbpm.variable.types.xml
   jbpm4/trunk/modules/deployment/src/test/resources/jbpm.wire.bindings.xml
   jbpm4/trunk/modules/deployment/src/test/resources/logging.properties
   jbpm4/trunk/modules/deployment/target/
Removed:
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/Deployer.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployerManager.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/Deployment.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCache.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySession.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
Modified:
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/VariablesCmd.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java
Log:
revisiting deployment

Added: jbpm4/trunk/modules/deployment/.classpath
===================================================================
--- jbpm4/trunk/modules/deployment/.classpath	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/.classpath	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: jbpm4/trunk/modules/deployment/.project
===================================================================
--- jbpm4/trunk/modules/deployment/.project	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/.project	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>deployment</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Added: jbpm4/trunk/modules/deployment/pom.xml
===================================================================
--- jbpm4/trunk/modules/deployment/pom.xml	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/pom.xml	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ====================================================================== -->
+<!--                                                                        -->
+<!--  JBoss, the OpenSource J2EE webOS                                      -->
+<!--                                                                        -->
+<!--  Distributable under LGPL license.                                     -->
+<!--  See terms of license at http://www.gnu.org.                           -->
+<!--                                                                        -->
+<!-- ====================================================================== -->
+
+<!-- $Id$ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <name>jBPM 4 - PVM</name>
+  <groupId>org.jbpm.jbpm4</groupId>
+  <artifactId>jbpm-deployment</artifactId>
+  <packaging>jar</packaging>
+
+  <!-- Parent -->
+  <parent>
+    <groupId>org.jbpm.jbpm4</groupId>
+    <artifactId>jbpm</artifactId>
+    <version>4.0.0-SNAPSHOT</version>
+    <relativePath>../../pom.xml</relativePath>
+  </parent>
+
+  <!-- Dependencies -->
+  <dependencies>
+    <dependency>
+      <groupId>org.jbpm.jbpm4</groupId>
+      <artifactId>jbpm-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jbpm.jbpm4</groupId>
+      <artifactId>jbpm-test-base</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jbpm.jbpm4</groupId>
+      <artifactId>jbpm-jpdl</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+  </dependencies>
+
+  <!-- Plugins -->
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <showDeprecation>false</showDeprecation>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>**/*TestCase.java</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
\ No newline at end of file


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

Added: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/Deployment.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/Deployment.java	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/Deployment.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.api;
+
+import java.util.zip.ZipInputStream;
+
+import org.jbpm.pvm.internal.stream.StreamInput;
+
+/**
+ * @author Tom Baeyens
+ */
+public interface Deployment {
+
+  void setName(String name);
+  
+  Deployment addStreamInput(String name, StreamInput streamInput);
+  Deployment addZipInputStream(ZipInputStream zipInputStream);
+  
+  /** @return deploymentId */
+  long deploy();
+}


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

Added: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositoryService.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositoryService.java	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositoryService.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.api;
+
+import java.io.InputStream;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface RepositoryService {
+
+  public abstract Deployment createDeployment();
+
+  public abstract void deleteDeployment(long deploymentDbid);
+
+  public abstract InputStream getResource(String deploymentId, String resource);
+
+}
\ No newline at end of file


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

Added: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositorySession.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositorySession.java	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositorySession.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.api;
+
+import java.util.List;
+
+import org.jbpm.pvm.DeploymentImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface RepositorySession {
+
+  Object getObject(long deploymentDbid, String objectName);
+
+  long deploy(DeploymentImpl deployment);
+
+  List<String> findObjectNames(String propertyKey, String propertyValue);
+  List<String> findObjectPropertyValues(String objectName, String propertyKey);
+  Object findObjectByPropertyValue(String propertyKey, String propertyValue);
+}


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

Added: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/cmd/StartExecutionInLatestCmd.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/cmd/StartExecutionInLatestCmd.java	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/cmd/StartExecutionInLatestCmd.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,81 @@
+/*
+ * 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.cmd;
+
+import java.util.Map;
+
+import org.hibernate.Session;
+import org.jbpm.Execution;
+import org.jbpm.JbpmException;
+import org.jbpm.api.RepositorySession;
+import org.jbpm.client.ClientProcessDefinition;
+import org.jbpm.client.ClientProcessInstance;
+import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.cmd.VariablesCmd;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StartExecutionInLatestCmd extends VariablesCmd<Execution> {
+
+  private static final long serialVersionUID = 1L;
+
+  protected String processDefinitionKey;
+  protected String executionKey;
+
+  public StartExecutionInLatestCmd(String processDefinitionKey, Map<String, Object> variables, String executionKey) {
+    if (processDefinitionKey==null) {
+      throw new JbpmException("processDefinitionKey is null");
+    }
+    this.processDefinitionKey = processDefinitionKey;
+    this.variables = variables;
+    this.executionKey = executionKey;
+  }
+  
+  public Execution execute(Environment environment) throws Exception {
+    ClientProcessDefinition processDefinition = null;
+    
+    RepositorySession repositorySession = environment.get(RepositorySession.class);
+    processDefinition = (ClientProcessDefinition) repositorySession
+          .findObjectByPropertyValue("jpdl.key", processDefinitionKey);
+
+    if (processDefinition==null) {
+      throw new JbpmException("no process definition with key '"+processDefinitionKey+"'");
+    }
+    
+    ClientProcessInstance processInstance = processDefinition.createProcessInstance(executionKey);
+    processInstance.setVariables(variables);
+    processInstance.start();
+    
+    Session session = Environment.getFromCurrent(Session.class);
+    session.save(processInstance);
+    return processInstance;
+  }
+
+  public String getExecutionKey() {
+    return executionKey;
+  }
+  public void setExecutionKey(String executionKey) {
+    this.executionKey = executionKey;
+  }
+}


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

Added: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/jpdl/JpdlDeployer.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/jpdl/JpdlDeployer.java	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/jpdl/JpdlDeployer.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl;
+
+import java.io.InputStream;
+import java.util.List;
+
+import org.jbpm.api.RepositorySession;
+import org.jbpm.env.Environment;
+import org.jbpm.internal.log.Log;
+import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.pvm.Deployer;
+import org.jbpm.pvm.DeploymentImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.xml.Parse;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JpdlDeployer implements Deployer {
+  
+  private static Log log = Log.getLog(JpdlDeployer.class.getName());
+  
+  static JpdlParser jpdlParser = new JpdlParser();
+
+  public void deploy(DeploymentImpl deployment) {
+    
+    for (String resourceName: deployment.getResourceNames()) {
+      InputStream inputStream = deployment.getResourceAsStream(resourceName);
+      
+      Parse parse = jpdlParser.createParse();
+      parse.setProblems(deployment.getProblems());
+      parse.setInputStream(inputStream);
+      parse.execute();
+      
+      JpdlProcessDefinition processDefinition = 
+          (JpdlProcessDefinition) parse.getDocumentObject();
+
+      if ( (processDefinition!=null)
+           && (processDefinition.getName()!=null)
+         ) {
+        String processDefinitionName = processDefinition.getName();
+
+        processDefinition.setDeploymentDbid(deployment.getDbid());
+        checkKey(processDefinition, deployment);
+        checkId(processDefinition, deployment);
+
+        deployment.addObject(processDefinitionName, processDefinition);
+        deployment.addObjectProperty(processDefinitionName, "jpdl.key", processDefinition.getKey());
+        deployment.addObjectProperty(processDefinitionName, "jpdl.id", processDefinition.getId());
+      }
+    }
+  }
+  
+  protected void checkKey(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
+    String processDefinitionName = processDefinition.getName();
+    String processDefinitionKey = processDefinition.getKey();
+
+    // if no key was specified in the jpdl process file
+    if (processDefinitionKey==null) {
+      // derive the key from the name
+      // replace any non-word character with an underscore
+      processDefinitionKey = processDefinitionName.replaceAll("\\W", "_");
+      processDefinition.setKey(processDefinitionKey);
+    }
+    
+    RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
+    List<String> existingKeys = repositorySession.findObjectPropertyValues(processDefinitionName, "jpdl.key");
+    if ( (!existingKeys.isEmpty())
+         && existingKeys.get(0).equals(processDefinitionKey)
+       ) {
+      deployment.addProblem("invalid key '"+processDefinitionKey+"' in process "+processDefinition.getName()+".  Existing process has name '"+processDefinitionName+"' and key '"+processDefinitionKey+"'");
+    }
+
+    List<String> existingNames = repositorySession.findObjectNames("jpdl.key", processDefinitionKey);
+    if ( (!existingNames.isEmpty())
+            && existingNames.get(0).equals(processDefinitionName)
+       ) {
+      deployment.addProblem("invalid name '"+processDefinitionName+"' in process "+processDefinition.getName()+".  Existing process has name '"+processDefinitionName+"' and key '"+processDefinitionKey+"'");
+    }
+  }
+
+  protected void checkId(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
+    String id = processDefinition.getId();
+    if (id==null) {
+      id = processDefinition.getKey()+"-"+deployment.getDbid();
+      log.trace("created id '"+id+"' for "+processDefinition);
+      processDefinition.setId(id);
+    }
+    
+    RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
+    if (repositorySession.findObjectByPropertyValue("jpdl.id", id) != null) {
+      deployment.addProblem("process '" + id + "' already exists");
+    }
+  }
+}


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

Added: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeployCmd.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeployCmd.java	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeployCmd.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,61 @@
+/*
+ * 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;
+
+import org.jbpm.JbpmException;
+import org.jbpm.api.RepositorySession;
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.internal.log.Log;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeployCmd implements Command<Long> {
+
+  private static final long serialVersionUID = 1L;
+  
+  private static Log log = Log.getLog(DeployCmd.class.getName());
+  
+  DeploymentImpl deployment;
+  
+  public DeployCmd(DeploymentImpl deployment) {
+    this.deployment = deployment;
+  }
+
+  public Long execute(Environment environment) throws Exception {
+    RepositorySession repositorySession = environment.get(RepositorySession.class);
+    long deploymentDbid = repositorySession.deploy(deployment);
+    
+    if (deployment.hasProblems()) {
+      String problemsText = deployment.getProblemsText();
+      if (problemsText!=null) {
+        String errorMsg = "problems during deployment of "+deployment+": "+problemsText;
+        log.info(errorMsg);
+        throw new JbpmException(errorMsg);
+      }
+    }
+    
+    return deploymentDbid;
+  }
+}


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

Added: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/Deployer.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/Deployer.java	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/Deployer.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -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;
+
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface Deployer {
+
+  void deploy(DeploymentImpl deployment);
+
+}


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

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


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

Added: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentImpl.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentImpl.java	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentImpl.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,158 @@
+/*
+ * 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;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.ObjectStreamException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.jbpm.JbpmException;
+import org.jbpm.api.Deployment;
+import org.jbpm.cmd.CommandService;
+import org.jbpm.pvm.internal.lob.Lob;
+import org.jbpm.pvm.internal.stream.ByteArrayStreamInput;
+import org.jbpm.pvm.internal.stream.StreamInput;
+import org.jbpm.pvm.internal.util.IoUtil;
+import org.jbpm.pvm.internal.xml.ProblemList;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeploymentImpl extends ProblemList implements Deployment {
+  
+  protected long dbid;
+  protected String name;
+  protected long timestamp;
+  
+  protected Map<String, Lob> resources;
+
+  protected CommandService commandService;
+  
+  protected Map<String, Object> objects;
+  protected Set<DeploymentProperty> objectProperties;
+
+  public DeploymentImpl() {
+  }
+
+  public DeploymentImpl(CommandService commandService) {
+    this.commandService = commandService;
+  }
+  
+  public long deploy() {
+    return commandService.execute(new DeployCmd(this));
+  }
+  public void setName(String name) {
+    this.name = name;
+  }
+  
+  public void setTimestamp(long timestamp) {
+    this.timestamp = timestamp;
+  }
+
+  public Deployment addStreamInput(String name, StreamInput streamInput) {
+    if (resources==null) {
+      resources = new HashMap<String, Lob>();
+    }
+    byte[] bytes = IoUtil.readBytes(streamInput.openStream());
+    Lob lob = new Lob(bytes);
+    resources.put(name, lob);
+    return this;
+  }
+
+  public Deployment addZipInputStream(ZipInputStream zipInputStream) {
+    try {
+      ZipEntry zipEntry = zipInputStream.getNextEntry();
+      while(zipEntry!=null) {
+        String entryName = zipEntry.getName();
+        byte[] bytes = IoUtil.readBytes(zipInputStream);
+        if (bytes!=null) {
+          addStreamInput(entryName, new ByteArrayStreamInput(bytes));
+        }
+        zipEntry = zipInputStream.getNextEntry();
+      }
+    } catch (Exception e) {
+      throw new JbpmException("couldn't read zip archive", e);
+    }
+    return this;
+  }
+  
+  public Set<String> getResourceNames() {
+    if (resources==null) {
+      return Collections.EMPTY_SET;
+    }
+    return resources.keySet();
+  }
+  
+  public InputStream getResourceAsStream(String resourceName) {
+    if (resources!=null) {
+      Lob lob = resources.get(resourceName);
+      if (lob!=null) {
+        byte[] bytes = lob.extractBytes();
+        return new ByteArrayInputStream(bytes);
+      }
+    }
+    return null;
+  }
+
+  public void addObject(String objectName, Object object) {
+    if (objects==null) {
+      objects = new HashMap<String, Object>();
+    }
+    objects.put(objectName, object);
+  }
+
+  public void addObjectProperty(String objectName, String key, String value) {
+    if (objectProperties==null) {
+      objectProperties = new HashSet<DeploymentProperty>();
+    }
+    objectProperties.add(new DeploymentProperty(this, objectName, key, value));
+  }
+
+  protected Object writeReplace() throws ObjectStreamException {
+    commandService = null;
+    return this;
+  }
+
+  public long getDbid() {
+    return dbid;
+  }
+  public String getName() {
+    return name;
+  }
+  public long getTimestamp() {
+    return timestamp;
+  }
+  public Map<String, Object> getObjects() {
+    return objects;
+  }
+  public Set<DeploymentProperty> getObjectProperties() {
+    return objectProperties;
+  }
+}


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

Added: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentProperty.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentProperty.java	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentProperty.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,66 @@
+/*
+ * 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;
+
+import java.io.Serializable;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeploymentProperty implements Serializable {
+  
+  private static final long serialVersionUID = 1L;
+
+  long dbid;
+  protected DeploymentImpl deployment;
+  protected String objectName;
+  protected String key;
+  protected String value;
+  
+  public DeploymentProperty() {
+  }
+  
+  public DeploymentProperty(DeploymentImpl deployment, String objectName, String key, String value) {
+    this.deployment = deployment;
+    this.objectName = objectName;
+    this.key = key;
+    this.value = value;
+  }
+  
+  public String toString() {
+    return "{"+objectName+","+key+","+value+"}";
+  }
+
+  public String getObjectName() {
+    return objectName;
+  }
+  public String getKey() {
+    return key;
+  }
+  public String getValue() {
+    return value;
+  }
+  public DeploymentImpl getDeployment() {
+    return deployment;
+  }
+}


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

Added: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCache.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCache.java	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCache.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,34 @@
+/*
+ * 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;
+
+import java.util.Map;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface RepositoryCache {
+
+  void set(long deploymentdbid, Map<String, Object> deployedObjects);
+  Object get(long deploymentDbid, String objectName);
+}


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

Added: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCacheImpl.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCacheImpl.java	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCacheImpl.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+import java.util.Map;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class RepositoryCacheImpl implements RepositoryCache {
+
+  public Object get(long deploymentDbid, String objectName) {
+    return null;
+  }
+
+  public void set(long deploymentdbid, Map<String, Object> deployedObjects) {
+  }
+}


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

Added: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryServiceImpl.java	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryServiceImpl.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm;
+
+import java.io.InputStream;
+
+import org.jbpm.api.Deployment;
+import org.jbpm.api.RepositoryService;
+import org.jbpm.cmd.CommandService;
+
+/**
+ * @author Tom Baeyens
+ */
+public class RepositoryServiceImpl implements RepositoryService {
+  
+  CommandService commandService;
+  
+  public Deployment createDeployment() {
+    return new DeploymentImpl(commandService);
+  }
+  
+  public void deleteDeployment(long deploymentdbid) {
+  }
+  
+  public InputStream getResource(String deploymentId, String resource) {
+    return null;
+  }
+}


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

Added: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositorySessionImpl.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositorySessionImpl.java	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositorySessionImpl.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,123 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.Session;
+import org.jbpm.JbpmException;
+import org.jbpm.Problem;
+import org.jbpm.api.RepositorySession;
+import org.jbpm.internal.log.Log;
+
+/**
+ * @author Tom Baeyens
+ */
+public class RepositorySessionImpl implements RepositorySession {
+  
+  private static Log log = Log.getLog(RepositorySessionImpl.class.getName());
+  
+  Session session;
+  RepositoryCache repositoryCache;
+  DeployerManager deployerManager;
+
+  public long deploy(DeploymentImpl deployment) {
+    session.save(deployment);
+    
+    deployment.setTimestamp(System.currentTimeMillis());
+    deployment.setProblems(new ArrayList<Problem>());
+
+    deployerManager.deploy(deployment);
+
+    if (deployment.hasProblems()) {
+      for (Problem problem: deployment.getProblems()) {
+        Throwable cause = problem.getCause();
+        if (cause!=null) {
+          log.debug("deployment exception", cause);
+        }
+      }
+      throw new JbpmException("problems during deployment: "+deployment.getProblemsText());
+    } else {
+      
+      repositoryCache.set(deployment.getDbid(), deployment.getObjects());
+    }
+
+    return deployment.getDbid();
+  }
+
+  public Object getObject(long deploymentDbid, String objectName) {
+    Object object = repositoryCache.get(deploymentDbid, objectName);
+    if (object!=null) {
+      log.trace("repository cache hit");
+
+    } else {
+      log.trace("loading deployment "+deploymentDbid+" from db");
+      DeploymentImpl deployment = (DeploymentImpl) session.load(DeploymentImpl.class, deploymentDbid);
+      deploy(deployment);
+      
+      object = repositoryCache.get(deploymentDbid, objectName);
+      
+      if (object==null) {
+        throw new JbpmException("deployment "+deploymentDbid+" doesn't contain object "+objectName);
+      }
+    }
+    return object;
+  }
+
+  public Object findObjectByPropertyValue(String key, String value) {
+    DeploymentProperty deploymentProperty = (DeploymentProperty) session.createQuery(
+      "select deploymentProperty " +
+      "from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
+      "where deploymentProperty.key = '"+key+"' " +
+      "  and deploymentProperty.value = '"+value+"' " +
+      "order by deploymentProperty.deployment.timestamp desc "
+    ).uniqueResult();
+    
+    if (deploymentProperty!=null) {
+      long deploymentDbid = deploymentProperty.getDeployment().getDbid();
+      String objectName = deploymentProperty.getObjectName();
+      
+      return getObject(deploymentDbid, objectName);
+    }
+
+    return null;
+  }
+
+  public List<String> findObjectNames(String key, String value) {
+    return session.createQuery(
+      "select distinct deploymentProperty.objectName " +
+      "from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
+      "where deploymentProperty.key = '"+key+"' " +
+      "  and deploymentProperty.value = '"+value+"' "
+    ).list();
+  }
+
+  public List<String> findObjectPropertyValues(String objectName, String key) {
+    return session.createQuery(
+      "select distinct deploymentProperty.value " +
+      "from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
+      "where deploymentProperty.objectName = '"+objectName+"' " +
+      "  and deploymentProperty.key = '"+key+"' "
+    ).list();
+  }
+}


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

Added: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployExecutionService.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployExecutionService.java	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployExecutionService.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,37 @@
+/*
+ * 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.tmp;
+
+import org.jbpm.Execution;
+import org.jbpm.cmd.StartExecutionInLatestCmd;
+import org.jbpm.pvm.internal.svc.ExecutionServiceImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeployExecutionService extends ExecutionServiceImpl {
+
+  public Execution startProcessInstanceByKey(String processDefinitionKey) {
+    return commandService.execute(new StartExecutionInLatestCmd(processDefinitionKey, null, null));
+  }
+}


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

Added: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployProcessService.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployProcessService.java	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployProcessService.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,30 @@
+/*
+ * 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.tmp;
+
+import org.jbpm.pvm.internal.svc.ProcessServiceImpl;
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeployProcessService extends ProcessServiceImpl {
+}


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

Added: jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/JbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/JbpmTestCase.java	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/JbpmTestCase.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,246 @@
+/*
+ * 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.deploy.test;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import org.jbpm.Configuration;
+import org.jbpm.Execution;
+import org.jbpm.ExecutionService;
+import org.jbpm.HistoryService;
+import org.jbpm.IdentityService;
+import org.jbpm.ManagementService;
+import org.jbpm.ProcessEngine;
+import org.jbpm.ProcessService;
+import org.jbpm.TaskService;
+import org.jbpm.api.RepositoryService;
+import org.jbpm.cmd.CommandService;
+import org.jbpm.job.Job;
+import org.jbpm.pvm.internal.stream.StringStreamInput;
+import org.jbpm.task.Task;
+import org.jbpm.test.BaseJbpmTestCase;
+import org.jbpm.test.Db;
+
+/** base class for persistent jBPM tests.
+ * 
+ * This class exposes a lot of extra convenience methods for testing 
+ * process executions.
+ * 
+ * The ProcessEngine services will be initialized and available as 
+ * member fields.
+ * 
+ * This test assumes that each test will clean the DB itself and that 
+ * no data is in the DB tables when the test finishes.  
+ *  
+ * During tearDown, a check will be done if all the DB tables are 
+ * empty.  If not, that is logged with a F I X M E and the DB tables 
+ * are cleaned. 
+ * 
+ * Convenience methods {@link #deployJpdlXmlString(String)} and 
+ * {@link #deployJpdlResource(String)} will automatically keep track
+ * of the deployed process and delete it (and all the related executions)
+ * before the check is done.
+ * 
+ * Similarly, the {@link #saveAndRegisterTask(Task)} will delete 
+ * the task before the check is done in the tearDown.
+ * 
+ * @author Tom Baeyens
+ */
+public abstract class JbpmTestCase extends BaseJbpmTestCase {
+  
+  protected static ProcessEngine processEngine = null;
+  
+  protected static RepositoryService repositoryService;
+  protected static ProcessService processService;
+  protected static ExecutionService executionService;
+  protected static ManagementService managementService;
+  protected static TaskService taskService;
+  protected static HistoryService historyService;
+  protected static IdentityService identityService;
+
+  protected static CommandService commandService;
+
+  /** registered deployments.  registered deployments will be deleted automatically 
+   * in the tearDown. This is a convenience function as each test is expected to clean up the DB. */
+  protected List<Long> registeredDeployments;
+  /** registered tasks will be deleted automatically in the tearDown.
+   * This is a convenience function as each test is expected to clean up the DB. */
+  protected List<Long> registeredTaskIds;
+
+  protected void setUp() throws Exception {
+    super.setUp();
+    initialize();
+  }
+
+  protected synchronized void initialize() {
+    if (processEngine==null) {
+
+      String jbpmTestCfgType = System.getProperty("jbpm.test.cfg.type");
+      Configuration configuration = new Configuration(jbpmTestCfgType);
+
+      String jbpmTestCfgResource = System.getProperty("jbpm.test.cfg.resource");
+      if (jbpmTestCfgResource!=null) {
+        configuration.setResource(jbpmTestCfgResource);
+      }
+
+      processEngine = configuration.buildProcessEngine();
+
+      repositoryService = processEngine.get(RepositoryService.class);
+      processService = processEngine.getProcessService();
+      executionService = processEngine.getExecutionService();
+      historyService = processEngine.getHistoryService();
+      managementService = processEngine.getManagementService();
+      taskService = processEngine.getTaskService();
+      identityService = processEngine.getIdentityService();
+      commandService = processEngine.get(CommandService.class);
+    }
+  }
+
+  protected void tearDown() throws Exception {
+    if (registeredDeployments!=null) {
+      for (Long deploymentDbid : registeredDeployments) {
+        repositoryService.deleteDeployment(deploymentDbid);
+      }
+    }
+
+    if (registeredTaskIds != null) {
+      for (Long taskDbid : registeredTaskIds) {
+        taskService.cancelTask(taskDbid);
+      }
+    }
+
+    Db.verifyClean(processEngine);
+    
+    super.tearDown();
+  }
+
+  public void deployJpdlXmlString(String jpdlXmlString) {
+    long deploymentDbid = 
+      repositoryService.createDeployment()
+        .addStreamInput("xmlstring.jpdl.xml", new StringStreamInput(jpdlXmlString))
+        .deploy();
+    
+    registerDeployment(deploymentDbid);
+  }
+
+  protected void registerDeployment(long deploymentDbid) {
+    if (registeredDeployments==null) {
+      registeredDeployments = new ArrayList<Long>();
+    }
+    
+    registeredDeployments.add(deploymentDbid);
+  }
+
+  public long saveAndRegisterTask(Task task) {
+    long taskDbid = taskService.saveTask(task);
+    
+    if (registeredTaskIds == null) {
+      registeredTaskIds = new ArrayList<Long>();
+    }
+    registeredTaskIds.add(taskDbid);
+    
+    return taskDbid;
+  }
+
+  public HashSet<String> getActivityNames(String processInstanceId) {
+    HashSet<String> activityNames = new HashSet<String>();
+    
+    List<Execution> executions = executionService.findExecutions(processInstanceId);
+    for (Execution execution: executions) {
+      String activityName = execution.getActivityName();
+      if (activityName!=null) {
+        activityNames.add(activityName);
+      }
+    }
+    
+    return activityNames;
+  }
+
+  public Execution findExecution(String processInstanceId, String activityName) {
+    List<Execution> executions = executionService.findExecutions(processInstanceId);
+    for (Execution execution: executions) {
+      if (activityName.equals(execution.getActivityName())) {
+        return execution;
+      }
+    }
+    
+    return null;
+  }
+
+  public static Task getTask(List<Task> taskList, String taskName) {
+    for (Task task : taskList) {
+      if (taskName.equals(task.getName())) {
+        return task;
+      }
+    }
+    return null;
+  }
+  
+  public static void assertContainsTask(List<Task> taskList, String taskName) {
+    if (getTask(taskList, taskName)==null) {
+      fail("tasklist doesn't contain task '"+taskName+"': "+taskList);
+    }
+  }
+
+  public static Task getTask(List<Task> taskList, String taskName, String assignee) {
+    for (Task task : taskList) {
+      if (taskName.equals(task.getName())) {
+        if (assignee==null) {
+          if (task.getAssignee()==null) {
+            return task;
+          }
+        } else {
+          if (assignee.equals(task.getAssignee())) {
+            return task;
+          }
+        }
+      }
+    }
+    return null;
+  }
+  
+  public void executeAsyncMessage(Execution execution) {
+    List<Job> jobs = managementService
+      .createJobQuery()
+      .messages()
+      .processInstanceId(execution.getId())
+      .execute();
+    
+    if (jobs.isEmpty()) {
+      fail("no async message");
+    }
+    
+    if (jobs.size()>1) {
+      fail("more then one async message");
+    }
+    
+    managementService.executeJob(jobs.get(0).getDbid());
+  }
+
+  public static void assertContainsTask(List<Task> taskList, String taskName, String assignee) {
+    if (getTask(taskList, taskName, assignee)==null) {
+      fail("tasklist doesn't contain task '"+taskName+"' for assignee '"+assignee+"': "+taskList);
+    }
+  }
+}


Property changes on: jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/JbpmTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/StartExecutionTest.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/StartExecutionTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/StartExecutionTest.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.deploy.test;
+
+import org.jbpm.Execution;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StartExecutionTest extends JbpmTestCase {
+
+  public void testStartNewExecutionByKey() {
+    deployJpdlXmlString(
+      "<process name='InsuranceClaim' key='ICL'>" +
+      "  <start>" +
+      "    <transition to='a' />" +
+      "  </start>" +
+      "  <state name='a' />" +
+      "</process>"
+    );
+
+    Execution execution = executionService.startProcessInstanceByKey("ICL");
+
+    assertNotNull(execution);
+    assertEquals("a", execution.getActivityName());
+  }
+}


Property changes on: jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/StartExecutionTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.cache.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.cache.xml	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.cache.xml	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,39 @@
+<hibernate-cache>
+
+  <class-cache class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl" />
+	<class-cache class="org.jbpm.pvm.internal.model.ActivityImpl" />
+	<class-cache class="org.jbpm.pvm.internal.model.TransitionImpl" />
+	<class-cache class="org.jbpm.pvm.internal.model.EventImpl" />
+	<class-cache class="org.jbpm.pvm.internal.model.ExceptionHandlerImpl" />
+	<class-cache class="org.jbpm.pvm.internal.model.ObjectReference" />
+  <class-cache class="org.jbpm.pvm.internal.model.VariableDefinitionImpl" />
+  <class-cache class="org.jbpm.pvm.internal.model.TimerDefinitionImpl" />
+  <class-cache class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor" />
+
+	<collection-cache collection="org.jbpm.pvm.internal.model.ProcessDefinitionImpl.exceptionHandlers" />
+	<collection-cache collection="org.jbpm.pvm.internal.model.ProcessDefinitionImpl.events" />
+	<collection-cache collection="org.jbpm.pvm.internal.model.ProcessDefinitionImpl.activities" />
+	<collection-cache collection="org.jbpm.pvm.internal.model.ProcessDefinitionImpl.variableDefinitions" />
+	<collection-cache collection="org.jbpm.pvm.internal.model.ProcessDefinitionImpl.timerDefinitions" />
+  <collection-cache collection="org.jbpm.pvm.internal.model.ProcessDefinitionImpl.attachments" />
+
+	<collection-cache collection="org.jbpm.pvm.internal.model.ActivityImpl.exceptionHandlers" />
+	<collection-cache collection="org.jbpm.pvm.internal.model.ActivityImpl.events" />
+	<collection-cache collection="org.jbpm.pvm.internal.model.ActivityImpl.activities" />
+	<collection-cache collection="org.jbpm.pvm.internal.model.ActivityImpl.variableDefinitions" />
+	<collection-cache collection="org.jbpm.pvm.internal.model.ActivityImpl.timerDefinitions" />
+	<collection-cache collection="org.jbpm.pvm.internal.model.ActivityImpl.incomingTransitions" />
+	<collection-cache collection="org.jbpm.pvm.internal.model.ActivityImpl.outgoingTransitions" />
+
+	<collection-cache collection="org.jbpm.pvm.internal.model.TransitionImpl.exceptionHandlers" />
+	<collection-cache collection="org.jbpm.pvm.internal.model.TransitionImpl.events" />
+
+	<collection-cache collection="org.jbpm.pvm.internal.model.EventImpl.exceptionHandlers" />
+	<collection-cache collection="org.jbpm.pvm.internal.model.EventImpl.listenerReferences" />
+	  
+	<collection-cache collection="org.jbpm.pvm.internal.model.ExceptionHandlerImpl.eventListenerReferences" />
+
+  <collection-cache collection="org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor.argDescriptors" />
+  <collection-cache collection="org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor.operations" />
+	
+</hibernate-cache>


Property changes on: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.cache.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.cfg.xml	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.cfg.xml	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration xmlns="http://jbpm.org/xsd/cfg">
+
+  <process-engine-context>
+  
+    <object class="org.jbpm.pvm.RepositoryServiceImpl" auto-wire="true" />
+    <object class="org.jbpm.pvm.RepositoryCacheImpl" />
+
+    <object class="org.jbpm.tmp.DeployExecutionService" auto-wire="true" />
+
+    <process-service />
+    <history-service />
+    <management-service />
+    <task-service />
+    <identity-service />
+    
+    <command-service>
+      <retry-interceptor />
+      <environment-interceptor />
+      <standard-transaction-interceptor />
+    </command-service>
+    
+    <hibernate-configuration>
+      <cfg resource="jbpm.hibernate.cfg.xml" />     
+      <cache-configuration resource="jbpm.cache.xml" 
+                           usage="nonstrict-read-write" />
+    </hibernate-configuration>
+
+    <hibernate-session-factory />
+
+    <object class="org.jbpm.pvm.DeployerManager">
+      <field name="deployers">
+        <list>
+          <object class="org.jbpm.jpdl.JpdlDeployer" />
+        </list>
+      </field>
+    </object>
+    
+    <script-manager default-expression-language="juel"
+                    default-script-language="juel"
+                    read-contexts="execution, environment, process-engine"
+                    write-context="">
+        <script-language name="juel" factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
+    </script-manager>
+    
+    <authentication />
+
+    <job-executor auto-start="false" />
+
+    <id-generator />
+    <types resource="jbpm.variable.types.xml" />
+
+    <business-calendar>
+      <monday    hours="9:00-12:00 and 12:30-17:00"/>
+      <tuesday   hours="9:00-12:00 and 12:30-17:00"/>
+      <wednesday hours="9:00-12:00 and 12:30-17:00"/>
+      <thursday  hours="9:00-12:00 and 12:30-17:00"/>
+      <friday    hours="9:00-12:00 and 12:30-17:00"/>
+      <holiday period="01/07/2008 - 31/08/2008"/>
+    </business-calendar>
+  
+  </process-engine-context>
+
+  <transaction-context>
+    <transaction />
+
+    <object class="org.jbpm.pvm.RepositorySessionImpl" auto-wire="true" />
+    
+    <pvm-db-session />
+    <job-db-session />
+    <task-db-session />
+    <message-session />
+    <timer-session />
+    <history-session />
+    <hibernate-session />
+    <identity-session />
+  </transaction-context>
+
+</jbpm-configuration>


Property changes on: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.cfg.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.definition.hbm.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.definition.hbm.xml	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.definition.hbm.xml	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,646 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.jbpm.pvm.internal.model" default-access="field">
+
+  <!-- ### PROCESS DEFINITION ############################################# -->
+  <class name="ProcessDefinitionImpl" 
+         table="JBPM_PROCESS"
+         discriminator-value="pvm">
+    <!-- ProcessElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <discriminator><column name="CLASS_" /></discriminator>
+
+    <version name="dbversion" column="DBVERSION_" />
+    <many-to-one name="properties"
+                 class="WireProperties" 
+                 column="PROPS_" 
+                 foreign-key="FK_PROCDEF_PROPS"
+                 index="IDX_PROCDEF_PROPS"
+                 cascade="all" />
+    <list name="exceptionHandlers" cascade="all">
+      <key foreign-key="FK_EXHDLR_PROCESS">
+        <column name="PROCESS_" index="IDX_EXHDLR_PROCESS"/>
+      </key>
+      <index column="PROCESS_IDX_" />
+      <one-to-many class="ExceptionHandlerImpl"/>
+    </list>
+
+    <!-- ObservableElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+    <property name="name" column="NAME_" />
+    <property name="description" column="DESCR_" />
+    <map name="events" cascade="all-delete-orphan">
+      <key foreign-key="FK_EVENT_PROCESS">
+        <column name="PROCESS_" index="IDX_EVENT_PROCESS" />
+      </key>
+      <map-key type="string" column="NAME_" />
+      <one-to-many class="org.jbpm.pvm.internal.model.EventImpl"/>
+    </map>
+
+    <!-- CompositeElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+    <list name="activities" cascade="all" inverse="false">
+      <key foreign-key="FK_ACTS_PROCESS">
+        <column name="ACTSPROCESS_" index="IDX_ACTS_PROCESS"/>
+      </key>
+      <list-index column="ACTSPROCESS_IDX_" />
+      <one-to-many class="ActivityImpl" />
+    </list>
+    <property name="hasVariableDefinitions" column="HAS_VAR_DEF_" />
+    <list name="variableDefinitions" cascade="all">
+      <key foreign-key="FK_VARDEF_PROCESS">
+        <column name="PROCESS_" index="IDX_VARDEF_PROCESS"/>
+      </key>
+      <index column="PROCESS_IDX_" />
+      <one-to-many class="VariableDefinitionImpl" />
+    </list>
+    <property name="hasTimerDefinitions" column="HAS_TIMER_DEF_" />
+    <set name="timerDefinitions" cascade="all">
+      <key foreign-key="FK_TMRDEF_PROCESS">
+        <column name="PROCESS_" index="IDX_TMRDEF_PROCESS"/>
+      </key>
+      <one-to-many class="TimerDefinitionImpl" />
+    </set>
+
+    <!-- ProcessDefinitionImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+    <property name="key" column="KEY_" />
+    <property name="id" column="ID_" unique="true" />
+
+    <property name="packageName" column="PACKAGE_" />
+    <property name="version" column="VERSION_" />
+    <property name="deploymentTime" column="DEPLOYED_" />
+    <many-to-one name="initial" 
+                 column="INITIAL_"
+                 class="ActivityImpl"
+                 cascade="all" 
+                 foreign-key="FK_PROCDEF_INITIAL"
+                 index="IDX_PROCDEF_INIT"
+                 fetch="select" />
+
+    <map name="attachments" cascade="all-delete-orphan">
+      <key foreign-key="FK_LOB_PROCESS">
+        <column name="PROCESS_" index="IDX_LOB_PROCESS" />
+      </key>
+      <map-key type="string" column="NAME_" />
+      <one-to-many class="org.jbpm.pvm.internal.lob.Lob"/>
+    </map>
+  </class>
+
+  <!-- ### Activity ############################################################## -->
+  <class name="ActivityImpl" table="JBPM_ACTIVITY">
+    <!-- ProcessElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <version name="dbversion" column="DBVERSION_" />
+    <many-to-one name="processDefinition"
+                 class="ProcessDefinitionImpl" 
+                 column="PROCESS_" 
+                 foreign-key="FK_ACT_PROCESS"
+                 index="IDX_ACT_PROCESS" />
+    <many-to-one name="properties"
+                 class="WireProperties" 
+                 column="PROPS_" 
+                 foreign-key="FK_ACT_PROPS"
+                 index="IDX_ACT_PROPS"
+                 cascade="all" />
+    <list name="exceptionHandlers" cascade="all">
+      <key foreign-key="FK_EXHDLR_ACT">
+        <column name="ACT_" index="IDX_EXHDLR_ACT"/>
+      </key>
+      <index column="ACT_IDX_" />
+      <one-to-many class="ExceptionHandlerImpl" />
+    </list>
+
+    <!-- ObservableElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+    <property name="name" column="NAME_"/>
+    <property name="description" column="DESCR_"/>
+    <map name="events" cascade="all-delete-orphan">
+      <key foreign-key="FK_EVENT_ACT">
+        <column name="ACT_" index="IDX_EVENT_ACT" />
+      </key>
+      <map-key type="string" column="NAME_" />
+      <one-to-many class="org.jbpm.pvm.internal.model.EventImpl" />
+    </map>
+
+    <!-- CompositeElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+    <list name="activities" cascade="all" inverse="false">
+      <key column="PARENT_" foreign-key="none" />
+      <list-index column="PARENT_IDX_" />
+      <one-to-many class="ActivityImpl" />
+    </list>
+    <property name="hasVariableDefinitions" column="HAS_VAR_DEF_" />
+    <list name="variableDefinitions" cascade="all">
+      <key foreign-key="FK_VARDEF_ACT">
+        <column name="ACT_" index="IDX_VARDEF_ACT"/>
+      </key>
+      <index column="ACT_IDX_" />
+      <one-to-many class="VariableDefinitionImpl" />
+    </list>
+    <property name="hasTimerDefinitions" column="HAS_TIMER_DEF_" />
+    <set name="timerDefinitions" cascade="all">
+      <key foreign-key="FK_TMRDEF_ACT">
+        <column name="ACT_" index="IDX_TMRDEF_ACT"/>
+      </key>
+      <one-to-many class="TimerDefinitionImpl" />
+    </set>
+
+    <!-- ActivityImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+    <property name="type" column="TYPE_" />
+    <property name="isLocalScope" column="LOCAL_SCOPE_" />
+    <property name="isExecutionAsync" column="EXEC_ASYNC_" />
+    <property name="isSignalAsync" column="SIGNAL_ASYNC_" />
+    <property name="isPreviousNeeded" column="PREV_NEEDED_" />
+
+    <many-to-one name="parentActivity" 
+                 column="PARENT_"
+                 class="ActivityImpl"
+                 cascade="all"
+                 foreign-key="FK_ACT_PARENT" 
+                 index="IDX_ACT_PARENT" />
+
+    <many-to-one name="defaultTransition"
+                 column="DEFTRANS_" 
+                 class="TransitionImpl"
+                 fetch="select"
+                 foreign-key="FK_ACT_DEFTRANS" 
+                 index="IDX_ACT_DEFTRANS" />
+
+    <list name="incomingTransitions" inverse="false">
+      <key column="DESTINATION_" />
+      <index column="IN_IDX_" />
+      <one-to-many class="TransitionImpl" />
+    </list>
+
+    <list name="outgoingTransitions" inverse="false" cascade="all">
+      <key column="SOURCE_" />
+      <index column="OUT_IDX_" />
+      <one-to-many class="TransitionImpl" />
+    </list>
+
+    <component name="behaviourReference" class="ObjectReference">
+      <many-to-one name="descriptor"
+                   column="BEHAV_DESCR_" 
+                   cascade="all"
+                   class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
+                   foreign-key="FK_NODE_BEHAV_DESCR"
+                   index="IDX_NODE_BEHAV_DESCR" />
+      <any name="object" id-type="long" cascade="all">
+        <!--  TODO: Specify names for classes -->
+        <!--        <meta-value value="bpel::activity" class="org.jbpm.pvm.bpel.BpelActivity"/> -->
+        <column name="BEHAV_CLASS_" />
+        <column name="BEHAV_ID_" />
+      </any>
+    </component>
+  </class>
+
+  <!-- ### TRANSITION ##################################################### -->
+  <class name="TransitionImpl" table="JBPM_TRANSITION">
+    <!-- ProcessElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <version name="dbversion" column="DBVERSION_" />
+    <many-to-one name="processDefinition"
+                 class="ProcessDefinitionImpl" 
+                 column="PROCESS_" 
+                 foreign-key="FK_TRANS_PROCDEF"
+                 index="IDX_TRANS_PROCDEF" />
+    <many-to-one name="properties"
+                 class="WireProperties" 
+                 column="PROPS_" 
+                 foreign-key="FK_TRANS_PROPS"
+                 index="IDX_TRANS_PROPS"
+                 cascade="all" />
+    <list name="exceptionHandlers" cascade="all">
+      <key foreign-key="FK_EXHDLR_TRANS">
+        <column name="TRANSITION_" index="IDX_EXHDLR_TRANS" />
+      </key>
+      <index column="TRANSITION_IDX_" />
+      <one-to-many class="ExceptionHandlerImpl" />
+    </list>
+
+    <!-- ObservableElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+    <property name="name" column="NAME_" />
+    <property name="description" column="DESCR_" />
+    <map name="events" cascade="all-delete-orphan">
+      <key foreign-key="FK_EVENT_TRANS">
+        <column name="TRANSITION_" index="IDX_EVENT_TRANS" />
+      </key>
+      <map-key type="string" column="NAME_" />
+      <one-to-many class="org.jbpm.pvm.internal.model.EventImpl" />
+    </map>
+    
+    <!-- TransitionImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+    <many-to-one name="source"
+                 column="SRC_" 
+                 class="ActivityImpl" 
+                 fetch="select" 
+                 foreign-key="FK_TRANS_SRC" 
+                 index="IDX_TRANS_SRC" />
+
+    <many-to-one name="destination"
+                 column="DEST_" 
+                 class="ActivityImpl" 
+                 fetch="select"
+                 cascade="all"
+                 foreign-key="FK_TRANS_DST" 
+                 index="IDX_TRANS_DST" />
+
+    <many-to-one name="conditionDescriptor" 
+                 column="COND_DESCR_"
+                 class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
+                 cascade="all"
+                 foreign-key="FK_TRANS_COND"
+                 index="IDX_TRANS_COND" />
+                 
+    <!-- 
+    <many-to-one name="waitConditionDescriptor" 
+                 column="WAIT_DESCR_"
+                 class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
+                 cascade="all"
+                 foreign-key="FK_TRANS_WAIT_DESCR" 
+                 index="IDX_TRANS_WAIT_DESCR" />
+    -->
+    
+    <property name="isTakeAsync" column="TAKEASYNC_" />
+  </class>
+
+  <!-- ### EVENT ########################################################## -->
+  <class name="EventImpl" table="JBPM_EVENT">
+    <!-- ProcessElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <version name="dbversion" column="DBVERSION_" />
+    <many-to-one name="processDefinition"
+                 class="ProcessDefinitionImpl" 
+                 column="PROCESSDEF_" 
+                 foreign-key="FK_EVENT_PROCDEF" 
+                 index="IDX_EVENT_PROCDEF" />
+    <many-to-one name="properties"
+                 class="WireProperties" 
+                 column="PROPS_" 
+                 foreign-key="FK_EVENT_PROPS"
+                 index="IDX_EVENT_PROPS"
+                 cascade="all" />
+    <list name="exceptionHandlers" cascade="all">
+      <key foreign-key="FK_EXHDLR_EVENT">
+        <column name="EVENT_" index="IDX_EXHDLR_EVENT"/>
+      </key>
+      <index column="EVENT_IDX_" />
+      <one-to-many class="ExceptionHandlerImpl" />
+    </list>
+
+    <!-- EventImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+    <property name="name" column="NAME_" />
+    <list name="listenerReferences" table="JBPM_OBJECTREFERENCES" cascade="all-delete-orphan">
+      <key foreign-key="FK_OBJECTREF_EVENT">
+        <column name="EVENT_" index="IDX_OBJREF_EVENT"/>
+      </key>
+      <list-index column="EVENT_IDX_" />
+      <one-to-many class="EventListenerReference" />
+    </list>
+  </class>
+  
+  <!-- ### EXCEPTION HANDLER ############################################## -->
+  <class name="ExceptionHandlerImpl" table="JBPM_EXCEPTHNDLR">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <version name="dbversion" column="DBVERSION_" />
+    <property name="exceptionClassName" column="EXCEPT_CLASS_" />
+    <property name="isTransactional" column="TRANSACT_" />
+    <property name="isRethrowMasked" column="RETHROW_MASKED_"/>
+    <property name="transitionName" column="TRANSITIONNAME_" />
+    <property name="activityName" column="NODENAME_" />
+    <list name="eventListenerReferences" 
+          inverse="false"
+          cascade="all-delete-orphan"
+          table="JBPM_OBJECTREFERENCES">
+      <key foreign-key="FK_OBJREF_EXHNDLR" not-null="false">
+        <column name="EXHNDLR_" index="IDX_OBJREF_EXHNDLR" />
+      </key>
+      <list-index column="EXHNDLR_IDX_" />
+      <one-to-many class="ObjectReference" />
+    </list>
+  </class>
+  
+  <!-- ### OBJECT REFERENCE ############################################### -->
+  <class name="ObjectReference" discriminator-value="objref" table="JBPM_OBJECTREF">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <discriminator column="CLASS_" />
+    <version name="dbversion" column="DBVERSION_" />
+    <many-to-one name="descriptor"
+                 column="OBJ_DESCR_"
+                 class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
+                 cascade="all"
+                 foreign-key="FK_OBJREF_EVENT" 
+                 index="IDX_OBJREF_EVENT"/>
+    <any name="object" id-type="long" cascade="all">
+      <!--  TODO: Specify names for classes -->
+      <column name="OBJ_CLASS_" />
+      <column name="OBJ_ID_" />
+    </any>
+    <property name="expression" column="OBJ_EXPRESSION_"/>
+    <property name="expressionLanguage" column="OBJ_EXPRLANG_"/>
+    
+    <subclass name="EventListenerReference" discriminator-value="evtlis">
+      <property name="isPropagationEnabled" column="PROPAGATE_" />
+    </subclass>
+        
+  </class>
+
+  <!-- ### VARIABLE DEFINITION ############################################ -->
+  <class name="VariableDefinitionImpl" table="JBPM_VARIABLEDEF">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <version name="dbversion" column="DBVERSION_" />
+    <property name="name" column="NAME_"/>
+    <property name="typeName" column="TYPE_"/>
+    
+    <property name="inVariableName" column="INVAR_" />
+    <property name="inExpression" column="INEXPR_" />
+    <many-to-one name="inDescriptor" 
+                 column="INDESCR_"
+                 class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
+                 cascade="all"
+                 foreign-key="FK_VARDEF_INDES" 
+                 index="IDX_VARDEF_INDES"/>
+    <property name="outVariableName" column="OUTVAR_" />
+    <property name="outExpression" column="OUTEXPR_" />
+  </class>
+
+  <!-- ### TIMER DEFINITION ############################################### -->
+  <class name="TimerDefinitionImpl" table="JBPM_TIMERDEF">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <version name="dbversion" column="DBVERSION_" />
+    <property name="dueDateDescription" column="DUEDATEDESCR_"/>
+    <property name="repeat" column="REPEAT_"/>
+    <property name="isExclusive" column="ISEXCL_"/>
+    <property name="retries" column="RETRIES_"/>
+    <property name="eventName" column="EVENT_"/>
+    <property name="signalName" column="SIGNAL_"/>
+    <property name="dueDate" column="DUEDATE_" type="timestamp"/>
+  </class>
+  
+  <!-- ### DESCRIPTORS #################################################### -->
+  <class name="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor" table="JBPM_DESCRIPTOR" abstract="true"
+    discriminator-value="abstract">
+    <!--
+    byte     : ByteDescriptor 
+    string   : StringDescriptor
+    char     : CharacterDescriptor
+    class    : ClassDescriptor
+    double   : DoubleDescriptor
+    expr     : ExpressionDescriptor
+    float    : FloatDescriptor 
+    long     : LongDescriptor
+    int      : IntegerDescriptor
+    short    : ShortDescriptor
+    coll     : CollectionDescriptor 
+    map      : MapDescriptor
+    list     : ListDescriptor
+    set      : SetDescriptor
+    object   : ObjectDescriptor
+    ref      : ReferenceDescriptor
+    null     : NullDescriptor
+    true     : TrueDescriptor
+    false    : FalseDescriptor
+    provided : ProvidedObjectDescriptor
+    -->
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <discriminator column="CLASS_" />
+    <version name="dbversion" column="DBVERSION_" />
+
+    <property name="name" column="NAME_" />
+    <property name="init" column="INIT_" />
+
+    <subclass name="org.jbpm.pvm.internal.wire.descriptor.NullDescriptor" discriminator-value="null_" />
+    <subclass name="org.jbpm.pvm.internal.wire.descriptor.TrueDescriptor" discriminator-value="true" />
+    <subclass name="org.jbpm.pvm.internal.wire.descriptor.FalseDescriptor" discriminator-value="false" />
+
+    <subclass name="org.jbpm.pvm.internal.wire.descriptor.StringDescriptor" discriminator-value="string">
+      <property name="text" column="TEXT_" />
+    </subclass>
+
+    <subclass name="org.jbpm.pvm.internal.wire.descriptor.CharacterDescriptor" discriminator-value="char">
+      <property name="text" column="TEXT_" />
+    </subclass>
+    <subclass name="org.jbpm.pvm.internal.wire.descriptor.ClassDescriptor" discriminator-value="class">
+      <property name="text" column="TEXT_" />
+    </subclass>
+    <subclass name="org.jbpm.pvm.internal.wire.descriptor.ReferenceDescriptor" discriminator-value="ref">
+      <property name="text" column="TEXT_" />
+    </subclass>
+
+    <subclass name="org.jbpm.pvm.internal.wire.descriptor.DoubleDescriptor" discriminator-value="double">
+      <property name="doubleVal" column="DOUBLEVAL_" />
+    </subclass>
+    <subclass name="org.jbpm.pvm.internal.wire.descriptor.FloatDescriptor" discriminator-value="float">
+      <property name="doubleVal" column="DOUBLEVAL_" />
+    </subclass>
+
+    <subclass name="org.jbpm.pvm.internal.wire.descriptor.LongDescriptor" discriminator-value="long">
+      <property name="longVal" column="LONGVAL_" />
+    </subclass>
+    <subclass name="org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor" discriminator-value="int">
+      <property name="longVal" column="LONGVAL_" />
+    </subclass>
+    <subclass name="org.jbpm.pvm.internal.wire.descriptor.ShortDescriptor" discriminator-value="short">
+      <property name="longVal" column="LONGVAL_" />
+    </subclass>
+    <subclass name="org.jbpm.pvm.internal.wire.descriptor.ByteDescriptor" discriminator-value="byte">
+      <property name="longVal" column="LONGVAL_" />
+    </subclass>
+
+    <subclass name="org.jbpm.pvm.internal.wire.descriptor.CollectionDescriptor" discriminator-value="coll">
+      <property name="className" column="CLASSNAME_" />
+      <list name="valueDescriptors" cascade="all-delete-orphan">
+        <key foreign-key="FK_DESCR_VALDESCR">
+          <column name="VALUEDESCR_" index="IDX_DESCR_VALDESCR" />
+        </key>
+        <list-index column="VALUEDESCR_IDX_" />
+        <one-to-many class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor" />
+      </list>
+
+      <subclass name="org.jbpm.pvm.internal.wire.descriptor.MapDescriptor" discriminator-value="map">
+        <list name="keyDescriptors" cascade="all-delete-orphan">
+          <key column="KEYDESCR_" foreign-key="FK_DESCR_KEYDESCR" />
+          <list-index column="KEYDESCR_IDX_" />
+          <one-to-many class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor" />
+        </list>
+      </subclass>
+
+      <subclass name="org.jbpm.pvm.internal.wire.descriptor.ListDescriptor" discriminator-value="list" />
+      <subclass name="org.jbpm.pvm.internal.wire.descriptor.SetDescriptor" discriminator-value="set" />
+    </subclass>
+
+
+    <subclass name="org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor" discriminator-value="object">
+      <property name="className" column="TEXT_" />
+      <property name="methodName" column="METHOD_" />
+      <property name="isAutoWireEnabled" column="BOOLVAL_" />
+      <property name="factoryObjectName" column="FACTORYNAME_" />
+
+      <many-to-one name="factoryDescriptor" class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor" column="FACTORYDESCR_"
+        foreign-key="FK_DESCR_ARG_REF" index="IDX_DESCR_ARG_REF" cascade="all" />
+
+      <list name="argDescriptors" cascade="all-delete-orphan">
+        <key foreign-key="FK_OBJARG_DESCR">
+          <column name="OBJARG_DESCR_" index="IDX_OBJARG_DESCR" />
+        </key>
+        <list-index column="OBJARG_DESCR_IDX_" />
+        <one-to-many class="org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor" />
+      </list>
+
+      <list name="operations" cascade="all-delete-orphan">
+        <key foreign-key="FK_OBJOPER_DESCR">
+          <column name="OBJOPER_DESCR_" index="IDX_OBJOPER_DESCR" />
+        </key>
+        <list-index column="OBJOPER_DESCR_IDX_" />
+        <one-to-many class="org.jbpm.pvm.internal.wire.operation.AbstractOperation" />
+      </list>
+    </subclass>
+
+    <subclass name="org.jbpm.pvm.internal.wire.descriptor.ExpressionDescriptor" discriminator-value="expr">
+      <property name="expr" column="TEXT_" />
+      <property name="lang" column="METHOD_" />
+    </subclass>
+
+    <subclass name="org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor" discriminator-value="provided">
+      <any name="providedObject" id-type="long" cascade="all">
+        <column name="TEXT_" />
+        <column name="LONGVAL_" />
+      </any>
+      <property name="exposeType" column="BOOLVAL_" />
+    </subclass>
+
+    <subclass name="org.jbpm.pvm.internal.wire.descriptor.EnvDescriptor" discriminator-value="env">
+      <property name="objectName" column="TEXT_" />
+      <property name="typeName" column="CLASSNAME_" />
+    </subclass>
+
+  </class>
+
+  <!-- ### OPERATIONS ##################################################### -->
+  <class name="org.jbpm.pvm.internal.wire.operation.AbstractOperation" abstract="true"
+    table="JBPM_OPERATION" discriminator-value="oper">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <discriminator column="CLASS_" />
+    <version name="dbversion" column="DBVERSION_" />
+
+    <subclass name="org.jbpm.pvm.internal.wire.operation.FieldOperation"
+      discriminator-value="field">
+      <property name="fieldName" column="TEXT_" />
+      <many-to-one name="descriptor" column="DESCR_" cascade="all" 
+                   class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
+        foreign-key="FK_OPER_DESC" index="IDX_OPER_DESC" />
+    </subclass>
+
+    <subclass name="org.jbpm.pvm.internal.wire.operation.PropertyOperation"
+      discriminator-value="prop">
+      <property name="setterName" column="TEXT_" />
+      <many-to-one name="descriptor" column="DESCR_" cascade="all" 
+                   class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor" />
+    </subclass>
+
+    <subclass name="org.jbpm.pvm.internal.wire.operation.InvokeOperation"
+      discriminator-value="invoke">
+      <property name="methodName" column="TEXT_" />
+      <list name="argDescriptors" cascade="all-delete-orphan">
+        <key foreign-key="FK_ARGDSCR_OPER">
+          <column name="OPER_" index="IDX_ARGDSCR_OPER" />
+        </key>
+        <list-index column="OPER_IDX_" />
+        <one-to-many class="org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor" />
+      </list>
+    </subclass>
+  </class>
+
+  <!-- ### ARG DESCRIPTOR ################################################# -->
+  <class name="org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor" table="JBPM_ARGDESCRIPTOR">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <version name="dbversion" column="DBVERSION_" />
+    <property name="typeName" column="TYPENAME_" />
+    <many-to-one name="descriptor" column="DESCRIPTOR_" 
+                 class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
+      foreign-key="FK_ARGDESCR_DESCR" index="IDX_ARGDESCR_DESCR" cascade="all" />
+  </class>
+
+  <!-- ### PROPERTIES ##################################################### -->
+  <class name="org.jbpm.pvm.internal.model.WireProperties" table="JBPM_WIREPROPS">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <version name="dbversion" column="DBVERSION_" />
+    <component name="wireContext" class="org.jbpm.pvm.internal.wire.WireContext">
+      <component name="wireDefinition" class="org.jbpm.pvm.internal.wire.WireDefinition">
+        <map name="descriptors" cascade="all-delete-orphan" lazy="false">
+          <key foreign-key="FK_DESCR_PROPS">
+            <column name="PROPS_" index="IDX_DESCR_PROPS" />
+          </key>
+          <map-key type="string" column="NAME_" />
+          <one-to-many class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor" />
+        </map>
+      </component>
+    </component>
+  </class>
+  
+  
+  <!-- ### QUERIES ######################################################## -->
+  
+  <query name="findProcessDefinitionKeys">
+    <![CDATA[
+     select distinct process.key
+     from org.jbpm.pvm.internal.model.ProcessDefinitionImpl as process
+     order by process.key asc
+    ]]>
+  </query>
+
+  <query name="findProcessDefinitionsByKey">
+    <![CDATA[
+     select process
+     from org.jbpm.pvm.internal.model.ProcessDefinitionImpl as process
+     where process.key = :key
+     order by process.version desc    
+    ]]>
+  </query>
+
+  <query name="findProcessDefinitionById">
+    <![CDATA[
+     select process
+     from org.jbpm.pvm.internal.model.ProcessDefinitionImpl as process
+     where process.id = :id
+    ]]>
+  </query>
+  
+  <query name="findProcessDefinitionKeysByName">
+    <![CDATA[
+     select process.key
+     from org.jbpm.pvm.internal.model.ProcessDefinitionImpl as process
+     where process.name = :name
+    ]]>
+  </query>
+  
+  <query name="findProcessDefinitionNamesByKey">
+    <![CDATA[
+     select process.name
+     from org.jbpm.pvm.internal.model.ProcessDefinitionImpl as process
+     where process.key = :key
+    ]]>
+  </query>
+
+</hibernate-mapping>
\ No newline at end of file


Property changes on: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.definition.hbm.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.execution.hbm.xml	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.execution.hbm.xml	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,378 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.jbpm.pvm.internal.model" default-access="field">
+
+  <!-- ### TYPEDEFS ####################################################### -->
+  <typedef name="converter" class="org.jbpm.pvm.internal.hibernate.ConverterType">
+    <param name="org.jbpm.pvm.internal.type.converter.BooleanToStringConverter"    >bool-str</param>
+    <param name="org.jbpm.pvm.internal.type.converter.ByteToLongConverter"         >byte-long</param>
+    <param name="org.jbpm.pvm.internal.type.converter.CharacterToStringConverter"  >char-str</param>
+    <param name="org.jbpm.pvm.internal.type.converter.DateToLongConverter"         >date-long</param>
+    <param name="org.jbpm.pvm.internal.type.converter.DateToStringConverter"       >date-str</param>
+    <param name="org.jbpm.pvm.internal.type.converter.DoubleToStringConverter"     >double-str</param>
+    <param name="org.jbpm.pvm.internal.type.converter.FloatToDoubleConverter"      >float-double</param>
+    <param name="org.jbpm.pvm.internal.type.converter.FloatToStringConverter"      >float-str</param>
+    <param name="org.jbpm.pvm.internal.type.converter.IntegerToLongConverter"      >int-long</param>
+    <param name="org.jbpm.pvm.internal.type.converter.SerializableToBytesConverter">ser-bytes</param>
+    <param name="org.jbpm.pvm.internal.type.converter.ShortToLongConverter"        >short-long</param>
+  </typedef>
+
+  <!-- ### PROCESS DEFINITION ############################################# -->
+  <class name="ExecutionImpl" 
+         table="JBPM_EXECUTION"
+         discriminator-value="pvm">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <discriminator><column name="CLASS_" /></discriminator>
+    <version name="dbversion" column="DBVERSION_" />
+    
+    <many-to-one name="activity" 
+                 class="org.jbpm.pvm.internal.model.ActivityImpl" 
+                 column="ACT_"
+                 lazy="false"
+                 foreign-key="FK_EXEC_ACT"
+                 index="IDX_EXEC_ACT" />
+
+    <property name="hasVariables" column="HASVARS_" />
+    <map name="variables"
+         cascade="all-delete-orphan">
+      <key foreign-key="FK_VAR_EXECUTION">
+         <column name="EXECUTION_" index="IDX_VAR_EXECUTION"/>
+      </key>
+      <map-key type="string" column="KEY_" />
+      <one-to-many class="org.jbpm.pvm.internal.type.Variable" />
+    </map>
+    
+    <property name="hasTimers" column="HASTIMERS_" />
+    <set name="timers"
+         cascade="all-delete-orphan">
+      <key foreign-key="FK_TMR_EXECUTION">
+         <column name="EXECUTION_" />
+      </key>
+      <one-to-many class="org.jbpm.pvm.internal.job.TimerImpl" />
+    </set>
+
+    <property name="name" column="NAME_" />
+    <property name="key" column="KEY_" />
+    <property name="id" column="ID_" unique="true" />
+
+    <property name="state" column="STATE_" />
+
+    <property name="priority" column="PRIORITY_" />
+    <property name="historyActivityInstanceDbid" column="HISACTINST_" />
+
+    <many-to-one name="processDefinition"
+                 class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl" 
+                 column="PROCESS_"
+                 foreign-key="FK_EXEC_PROCESS" 
+                 index="IDX_EXEC_PROCESS" />
+
+    <many-to-one name="transition" column="TRANSITION_" class="TransitionImpl" />
+
+    <many-to-one name="transitionOrigin" 
+                 class="org.jbpm.pvm.internal.model.ActivityImpl" 
+                 column="TRANSORIG_"
+                 foreign-key="FK_EXEC_TRANSORIG"
+                 index="IDX_EXEC_TRANSORIG" />
+
+    <list name="executions" 
+          cascade="all-delete-orphan"
+          inverse="false">
+      <key column="PARENT_" foreign-key="FK_EXEC_PARENT" />
+      <list-index column="PARENT_IDX_" />
+      <one-to-many class="ExecutionImpl" />
+    </list>
+
+    <many-to-one name="parent"
+                 column="PARENT_"
+                 class="ExecutionImpl"
+                 foreign-key="FK_EXEC_PARENT"
+                 index="IDX_EXEC_PARENT" />
+
+    <many-to-one name="processInstance"
+                 class="ExecutionImpl" 
+                 column="INSTANCE_"
+                 foreign-key="FK_EXEC_INSTANCE"
+                 index="IDX_EXEC_INSTANCE" />
+
+    <many-to-one name="superProcessExecution"
+                 column="SUPEREXEC_"
+                 class="ExecutionImpl"
+                 foreign-key="FK_EXEC_SUPEREXEC"
+                 index="IDX_EXEC_SUPEREXEC" />
+                 
+  </class>
+
+  <!-- ### COMMENTS ####################################################### -->
+  <class name="CommentImpl" table="JBPM_COMMENT">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <discriminator column="CLASS_" />
+    <version name="dbversion" column="DBVERSION_" />
+
+    <property name="userId" column="USERID_" />
+    <property name="time" column="TIME_" />
+    <property name="message" column="MESSAGE_" />
+
+    <list name="comments" 
+          cascade="all-delete-orphan"
+          inverse="false">
+      <key column="PARENT_" foreign-key="none" />
+      <list-index column="PARENT_IDX_" />
+      <one-to-many class="CommentImpl" />
+    </list>
+  </class>
+  
+  <!-- ### VARIABLE ####################################################### -->
+  <class name="org.jbpm.pvm.internal.type.Variable" abstract="true" discriminator-value=" " table="JBPM_VARIABLE">
+    <!-- discriminator values:
+    date   : org.jbpm.pvm.internal.type.variable.DateVariable
+    double : org.jbpm.pvm.internal.type.variable.DoubleVariable
+    hibl   : org.jbpm.pvm.internal.type.variable.HibernateLongVariable
+    long   : org.jbpm.pvm.internal.type.variable.LongVariable
+    hibs   : org.jbpm.pvm.internal.type.variable.HibernateStringVariable
+    string : org.jbpm.pvm.internal.type.variable.StringVariable
+    null   : org.jbpm.pvm.internal.type.variable.NullVariable
+    blob   : org.jbpm.pvm.internal.type.variable.BlobVariable
+    clob   : org.jbpm.pvm.internal.type.variable.ClobVariable
+    -->
+  
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <discriminator column="CLASS_"/>
+    <version name="dbversion" column="DBVERSION_" />
+    
+    <property name="key" column="KEY_"/>
+    <property name="queryText" column="QUERYTEXT_" />
+    <property name="converter" type="converter" column="CONVERTER_" />
+    <many-to-one name="processInstance"
+                 column="PROCINST_" 
+                 class="org.jbpm.pvm.internal.model.ExecutionImpl"
+                 foreign-key="FK_VAR_PROCINST"
+                 index="IDX_VAR_PROCINST"/>
+  </class>
+
+  <subclass name="org.jbpm.pvm.internal.type.variable.DateVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="T">
+    <property name="date" column="DATE_VALUE_" type="timestamp"/>
+  </subclass>
+  
+  <subclass name="org.jbpm.pvm.internal.type.variable.DoubleVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="D">
+    <property name="d" column="DOUBLE_VALUE_" type="double"/>
+  </subclass>
+  
+  <subclass name="org.jbpm.pvm.internal.type.variable.HibernateLongVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="l">
+    <property name="hibernatable" column="LONG_VALUE_" type="long"/>
+  </subclass>
+  
+  <subclass name="org.jbpm.pvm.internal.type.variable.LongVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="L">
+    <property name="l" column="LONG_VALUE_" type="long"/>
+  </subclass>
+  
+  <subclass name="org.jbpm.pvm.internal.type.variable.HibernateStringVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="s">
+    <property name="hibernatable" column="STRING_VALUE_" type="string"/>
+  </subclass>
+  
+  <subclass name="org.jbpm.pvm.internal.type.variable.StringVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="S">
+    <property name="string" column="STRING_VALUE_" type="string"/>
+  </subclass>
+  
+  <subclass name="org.jbpm.pvm.internal.type.variable.NullVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="N">
+  </subclass>
+  
+  <subclass name="org.jbpm.pvm.internal.type.variable.BlobVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="B">
+    <many-to-one name="lob"
+                 column="LOB_" 
+                 cascade="all"
+                 class="org.jbpm.pvm.internal.lob.Lob"
+                 foreign-key="FK_VAR_LOB"
+                 index="IDX_VAR_LOB" />
+  </subclass>
+
+  <subclass name="org.jbpm.pvm.internal.type.variable.ClobVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="C">
+    <many-to-one name="lob"
+                 column="LOB_" 
+                 cascade="all"
+                 class="org.jbpm.pvm.internal.lob.Lob"
+                 foreign-key="none"/>
+  </subclass>
+  
+  <!-- ### LOB ############################################################ -->
+  <class name="org.jbpm.pvm.internal.lob.Lob" table="JBPM_LOB">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <version name="dbversion" column="DBVERSION_" />
+    <property name="blob" type="blob"><column name="BLOB_VALUE_" /></property>
+    <property name="bytes" type="binary" column="BINARY_VALUE_"/>
+    <property name="clob" type="clob" column="CLOB_VALUE_" />
+    <property name="text" type="text" column="TEXT_VALUE_"/>
+  </class>
+  
+    <class name="org.jbpm.pvm.internal.job.JobImpl" table="JBPM_JOB" discriminator-value="Job">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <discriminator column="CLASS_" />
+    <version name="dbversion" column="DBVERSION_" />
+
+    <property name="dueDate" column="DUEDATE_" type="timestamp" index="IDX_JOBDUEDATE"  />
+    <property name="isSuspended" column="ISSUSPENDED_" />
+    <property name="isExclusive" column="ISEXCLUSIVE_" />
+    <property name="lockOwner" column="LOCKOWNER_" />
+    <property name="lockExpirationTime" column="LOCKEXPTIME_" index="IDX_JOBLOCKEXP" />
+    <property name="info" column="INFO_" />
+    <property name="exception" column="EXCEPTION_" type="text" />
+    <property name="retries" column="RETRIES_" index="IDX_JOBRETRIES" />
+    
+    <many-to-one name="processInstance"   
+                 class="org.jbpm.pvm.internal.model.ExecutionImpl"   
+                 column="PROCESSINSTANCE_" 
+                 cascade="none"
+                 foreign-key="FK_JOB_PRINST"
+                 index="IDX_JOB_PRINST"/>
+    <many-to-one name="execution"
+                 class="org.jbpm.pvm.internal.model.ExecutionImpl"   
+                 column="EXECUTION_" 
+                 cascade="none"
+                 foreign-key="FK_JOB_EXE"
+                 index="IDX_JOB_EXE"/>
+    <many-to-one name="commandDescriptor"
+                 column="CMDDESCR_"
+                 class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor" 
+                 cascade="all"
+                 foreign-key="FK_JOB_CMDDESCR"
+                 index="IDX_JOB_CMDDESCR"/>
+
+    <subclass name="org.jbpm.pvm.internal.job.MessageImpl" discriminator-value="Msg">
+      <subclass name="org.jbpm.pvm.internal.model.op.ExecuteActivityMessage" discriminator-value="ExeActivityMsg" />
+      <subclass name="org.jbpm.pvm.internal.model.op.SignalMessage" discriminator-value="SignalMsg">
+        <property name="signalName" column="SIGNAL_" />
+        <many-to-one name="activity"   
+                     column="NODE_" 
+                     cascade="none"
+                     foreign-key="FK_JOB_NODE"/>
+      </subclass>
+      <subclass name="org.jbpm.pvm.internal.model.op.TakeTransitionMessage" discriminator-value="TakeTrMsg" />
+      <subclass name="org.jbpm.pvm.internal.model.op.ProceedToDestinationMessage" discriminator-value="ProceedDestMsg" />
+      <subclass name="org.jbpm.pvm.internal.job.CommandMessage" discriminator-value="CmdMsg" />
+    </subclass>
+    
+    <subclass name="org.jbpm.pvm.internal.job.TimerImpl" discriminator-value="Timer">
+      <property name="signalName" column="SIGNAL_" />
+      <property name="eventName" column="EVENT_" />
+      <property name="repeat" column="REPEAT_" />
+    </subclass>
+     
+  </class>
+
+  <!-- ### HibernatePvmDbSession QUERIES ################################## -->
+
+  <query name="findTimers">
+    <![CDATA[
+     select t
+     from org.jbpm.pvm.internal.job.TimerImpl as t
+     order by dueDate asc
+    ]]>
+  </query>
+
+  <query name="findMessages">
+    <![CDATA[
+     select m
+     from org.jbpm.pvm.internal.job.MessageImpl as m
+    ]]>
+  </query>
+
+  <query name="findJobsWithException">
+    <![CDATA[
+     select job
+     from org.jbpm.pvm.internal.job.JobImpl as job
+     where job.retries = 0 
+     order by dueDate asc
+    ]]>
+  </query>
+
+  <!-- ### HibernateJobDbSession QUERIES ################################## -->
+  <query name="findFirstAcquirableJob">
+    <![CDATA[
+     select job
+     from org.jbpm.pvm.internal.job.JobImpl as job
+     where ( ( (job.lockExpirationTime is null)
+               or (job.lockExpirationTime <= :now) 
+             )
+             and 
+             ( (job.dueDate is null)
+               or (job.dueDate <= :now) 
+             ) 
+             and 
+             ( job.retries > 0 ) 
+           )
+     order by job.dueDate asc
+    ]]>
+  </query>
+
+  <query name="findExclusiveJobs">
+    <![CDATA[
+     select job
+     from org.jbpm.pvm.internal.job.JobImpl as job
+     where job.lockOwner is null
+       and job.processInstance = :processInstance 
+       and job.isExclusive = true 
+       and job.retries > 0 
+       and ( (job.dueDate is null)
+             or (job.dueDate <= :now) 
+           )
+     order by job.dueDate asc
+    ]]>
+  </query>
+  
+  <query name="findFirstDueJob">
+    <![CDATA[
+     select job
+     from org.jbpm.pvm.internal.job.JobImpl as job
+     where job.lockOwner is null
+       and job.retries > 0 
+     order by job.dueDate asc
+    ]]>
+  </query>
+  
+  <!-- ### HibernatePvmDbSession QUERIES ############################################# -->
+  <query name="findExecutionById">
+    <![CDATA[
+     select execution
+     from org.jbpm.pvm.internal.model.ExecutionImpl as execution
+     where execution.id = :id
+    ]]>
+  </query>
+
+  <query name="findProcessInstanceById">
+    <![CDATA[
+     select processInstance
+     from org.jbpm.pvm.internal.model.ExecutionImpl as processInstance
+     where processInstance.id = :processInstanceId
+       and processInstance.parent is null
+    ]]>
+  </query>
+
+  <query name="findExecutionByKey">
+    <![CDATA[
+     select execution
+     from org.jbpm.pvm.internal.model.ExecutionImpl as execution
+     where execution.key = :executionKey
+       and execution.processDefinition.name = :processDefinitionName
+    ]]>
+  </query>
+  
+  <query name="findProcessInstanceIds">
+    <![CDATA[
+     select processInstance.id
+     from org.jbpm.pvm.internal.model.ExecutionImpl as processInstance
+     where processInstance.processDefinition.id = :processDefinitionId
+       and processInstance.parent is null
+    ]]>
+  </query>
+
+</hibernate-mapping>
\ No newline at end of file


Property changes on: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.execution.hbm.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.hibernate.cfg.xml	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.hibernate.cfg.xml	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!DOCTYPE hibernate-configuration PUBLIC
+          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+  <session-factory>
+      <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+      <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
+      <property name="hibernate.connection.url">jdbc:hsqldb:mem:.</property>
+      <property name="hibernate.connection.username">sa</property>
+      <property name="hibernate.connection.password"></property>
+      <property name="hibernate.hbm2ddl.auto">create-drop</property>
+      <property name="hibernate.format_sql">true</property>
+      <property name="hibernate.cache.use_second_level_cache">true</property>
+      <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
+      <mapping resource="jbpm.definition.hbm.xml" />
+      <mapping resource="jbpm.execution.hbm.xml" />
+      <mapping resource="jbpm.history.hbm.xml" />
+      <mapping resource="jbpm.task.hbm.xml" />
+      <mapping resource="jbpm.jpdl.hbm.xml" />
+      <mapping resource="jbpm.identity.hbm.xml" />
+      <mapping resource="jbpm.repository.hbm.xml" />
+  </session-factory>
+</hibernate-configuration>


Property changes on: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.hibernate.cfg.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.history.hbm.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.history.hbm.xml	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.history.hbm.xml	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.jbpm.pvm.internal.history.model" default-access="field">
+
+  <!-- ### HISTORY PROCESS INSTANCE ####################################### -->
+  <class name="HistoryProcessInstanceImpl" table="JBPM_HIST_PROCINST">
+    <id name="processInstanceId" column="ID_">
+      <generator class="assigned" />
+    </id>
+    <version name="dbversion" column="DBVERSION_" />
+
+    <property name="processDefinitionId" column="PROCDEFID_" />
+    <property name="key" column="KEY_" />
+    <property name="startTime" column="START_" type="timestamp" />
+    <property name="endTime" column="END_" type="timestamp" />
+    <property name="duration" column="DURATION_" />
+    <property name="state" column="STATE_" />
+    <property name="endActivityName" column="ENDACTIVITY_" />
+
+    <many-to-one name="processDefinition" 
+                 class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl" 
+                 column="PROCDEF_"
+                 foreign-key="FK_HISTPI_PROCDEF"
+                 index="IDX_HISTPI_PROCDEF" />
+                 
+    <set name="historyActivityInstances"
+         cascade="all">
+      <key>
+         <column name="HPI_" />
+      </key>
+      <one-to-many class="HistoryActivityInstanceImpl" />
+    </set>
+                 
+  </class>
+
+  <!-- ### HISTORY PROCESS INSTANCE ####################################### -->
+  <class name="HistoryActivityInstanceImpl" table="JBPM_HIST_ACTINST" discriminator-value="ACT">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <discriminator column="CLASS_" />
+    <version name="dbversion" column="DBVERSION_" />
+
+    <many-to-one name="historyProcessInstance" 
+                 class="HistoryProcessInstanceImpl" 
+                 column="HPI_"
+                 foreign-key="FK_HAI_HPI"
+                 index="IDX_HAI_HPI" />
+
+    <many-to-one name="activity" 
+                 class="org.jbpm.pvm.internal.model.ActivityImpl" 
+                 column="ACTIVITY_"
+                 foreign-key="FK_HISTAI_ACT"
+                 index="IDX_HISTAI_ACT" />
+
+    <property name="type" column="TYPE_" />
+    <property name="executionId" column="EXECUTION_" />
+    <property name="activityName" column="ACTIVITY_NAME_" />
+    <property name="startTime" column="START_" type="timestamp" />
+    <property name="endTime" column="END_" type="timestamp" />
+    <property name="duration" column="DURATION_" />
+    <property name="transitionName" column="TRANSITION_" />
+
+    <subclass name="HistoryAutomaticInstanceImpl" discriminator-value="AUT">
+      <subclass name="HistoryExclusiveInstanceImpl" discriminator-value="EXCL" />
+    </subclass>
+    
+    <subclass name="HistoryTaskInstanceImpl" discriminator-value="TASK">
+      <property name="assignee" column="ASSIGNEE_" />
+      <property name="state" column="STATE_" />
+    </subclass>
+  </class>
+
+</hibernate-mapping>
\ No newline at end of file


Property changes on: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.history.hbm.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.identity.hbm.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.identity.hbm.xml	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.identity.hbm.xml	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.jbpm.pvm.internal.identity.impl" default-access="field">
+
+  <!-- ### USER ########################################################### -->
+  <class name="UserImpl" table="JBPM_ID_USER">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <version name="dbversion" column="DBVERSION_" />
+    
+    <property name="id" column="ID_" />
+    <property name="password" column="PASSWORD_" />
+    <property name="givenName" column="GIVENNAME_" />
+    <property name="familyName" column="FAMILYNAME_" />
+  </class>
+  
+  <!-- ### MEMBERSHIP ##################################################### -->
+  <class name="MembershipImpl" table="JBPM_ID_MEMBERSHIP">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <version name="dbversion" column="DBVERSION_" />
+    
+    <many-to-one name="user"
+                 column="USER_" 
+                 class="UserImpl"
+                 foreign-key="FK_MEM_USER"
+                 index="IDX_MEM_USER"/>
+
+    <many-to-one name="group"
+                 column="GROUP_" 
+                 class="GroupImpl"
+                 foreign-key="FK_MEM_GROUP"
+                 index="IDX_MEM_GROUP"/>
+
+    <property name="role" column="NAME_" />
+  </class>
+  
+  <!-- ### GROUP ########################################################### -->
+  <class name="GroupImpl" table="JBPM_ID_GROUP">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <version name="dbversion" column="DBVERSION_" />
+    
+    <property name="id" column="ID_" />
+    <property name="name" column="NAME_" />
+    <property name="type" column="TYPE_" />
+
+    <many-to-one name="parent"
+                 column="PARENT_" 
+                 class="GroupImpl"
+                 foreign-key="FK_GROUP_PARENT"
+                 index="IDX_GROUP_PARENT"/>
+  </class>
+  
+</hibernate-mapping>
\ No newline at end of file


Property changes on: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.identity.hbm.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.jpdl.activities.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.jpdl.activities.xml	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.jpdl.activities.xml	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,17 @@
+<activities>
+  <schema resource="jpdl.xsd" />
+  <activity binding="org.jbpm.jpdl.internal.activity.StartBinding" />
+  <activity binding="org.jbpm.jpdl.internal.activity.StateBinding" />
+  <activity binding="org.jbpm.jpdl.internal.activity.ExclusiveBinding" />
+  <activity binding="org.jbpm.jpdl.internal.activity.EndBinding" />
+  <activity binding="org.jbpm.jpdl.internal.activity.EndCancelBinding" />
+  <activity binding="org.jbpm.jpdl.internal.activity.EndErrorBinding" />
+  <activity binding="org.jbpm.jpdl.internal.activity.ForkBinding" />
+  <activity binding="org.jbpm.jpdl.internal.activity.JoinBinding" />
+  <activity binding="org.jbpm.jpdl.internal.activity.HqlBinding" />
+  <activity binding="org.jbpm.jpdl.internal.activity.SqlBinding" />
+  <activity binding="org.jbpm.jpdl.internal.activity.JavaBinding" />
+  <activity binding="org.jbpm.jpdl.internal.activity.ScriptBinding" />
+  <activity binding="org.jbpm.jpdl.internal.activity.EsbBinding" />
+  <activity binding="org.jbpm.jpdl.internal.activity.TaskBinding" />
+</activities>


Property changes on: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.jpdl.activities.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.jpdl.hbm.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.jpdl.hbm.xml	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.jpdl.hbm.xml	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,122 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping default-access="field">
+
+  <subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition" 
+            extends="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
+            discriminator-value="jpdl">
+    <map name="swimlaneDefinitions"
+         cascade="all-delete-orphan">
+      <key foreign-key="FK_SWLDEF_PROCESS">
+         <column name="PROCESS_SWL_" index="IDX_SWLDEF_PROCESS"/>
+      </key>
+      <map-key type="string" column="NAME_" />
+      <one-to-many class="org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl" />
+    </map>
+    <map name="taskDefinitions"
+         cascade="all-delete-orphan">
+      <key foreign-key="FK_TSKDEF_PROCESS">
+         <column name="PROCESS_" index="IDX_TSKDEF_PROCESS"/>
+      </key>
+      <map-key type="string" column="NAME_" />
+      <one-to-many class="org.jbpm.pvm.internal.task.TaskDefinitionImpl" />
+    </map>
+  </subclass>
+
+  <subclass name="org.jbpm.jpdl.internal.model.JpdlExecution" 
+            extends="org.jbpm.pvm.internal.model.ExecutionImpl"
+            discriminator-value="jpdl">
+
+    <map name="swimlanes"
+         cascade="all-delete-orphan">
+      <key foreign-key="FK_SWIMLANE_EXEC">
+         <column name="EXECUTION_" index="IDX_SWIMLANE_EXEC"/>
+      </key>
+      <map-key type="string" column="NAME_" />
+      <one-to-many class="org.jbpm.pvm.internal.task.SwimlaneImpl" />
+    </map>
+  </subclass>
+
+  <class name="org.jbpm.jpdl.internal.activity.JpdlActivity" table="JBPM_JPDL_ACTIVITY"  abstract="true" discriminator-value="X">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <discriminator column="CLASS_" />
+    <subclass name="org.jbpm.jpdl.internal.activity.StartActivity" discriminator-value="start" />
+    <subclass name="org.jbpm.jpdl.internal.activity.ExclusiveConditionActivity" discriminator-value="excl-cond" />
+    <subclass name="org.jbpm.jpdl.internal.activity.ExclusiveExpressionActivity" discriminator-value="excl-expr">
+      <property name="expr" column="TEXT_" />
+      <property name="lang" column="TEXT2_" />
+    </subclass>
+    <subclass name="org.jbpm.jpdl.internal.activity.ExclusiveHandlerActivity" discriminator-value="excl-handler">
+      <property name="exclusiveHandlerName" column="TEXT_" />
+      <many-to-one name="exclusiveHandlerDescriptor"
+                   column="EXCLDESCR_" 
+                   cascade="all"
+                   class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
+                   foreign-key="FK_ACT_EXCLDESCR"
+                   index="IDX_ACT_EXCLDESCR" />
+    </subclass>
+    <subclass name="org.jbpm.jpdl.internal.activity.StateActivity" discriminator-value="state" />
+    <subclass name="org.jbpm.jpdl.internal.activity.EndActivity" discriminator-value="end">
+      <property name="endProcessInstance" column="ENDPI_" />
+      <property name="state" column="TEXT_" />
+    </subclass>
+    <subclass name="org.jbpm.jpdl.internal.activity.ForkActivity" discriminator-value="fork" />
+    <subclass name="org.jbpm.jpdl.internal.activity.JoinActivity" discriminator-value="join" />
+    <subclass name="org.jbpm.jpdl.internal.activity.HqlActivity" discriminator-value="hql">
+      <property name="query" column="TEXT_" />
+      <property name="resultVariableName" column="TEXT2_" />
+      <property name="isResultUnique" column="ISUNIQ_" />
+      <many-to-one name="parametersDescriptor"
+                   column="PARAMDESCR_" 
+                   cascade="all"
+                   class="org.jbpm.pvm.internal.wire.descriptor.ListDescriptor"
+                   foreign-key="FK_ACT_PARAMDESCR"
+                   index="IDX_ACT_PARAMDESCR" />
+      
+      <subclass name="org.jbpm.jpdl.internal.activity.SqlActivity" discriminator-value="sql" />
+    </subclass>
+    <subclass name="org.jbpm.jpdl.internal.activity.JavaActivity" discriminator-value="java">
+      <property name="methodName" column="TEXT_" />
+      <property name="variableName" column="TEXT2_" />
+      <many-to-one name="descriptor"
+                   column="JAVADESCR_" 
+                   cascade="all"
+                   class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
+                   foreign-key="FK_ACT_JAVADESCR"
+                   index="IDX_ACT_JAVADESCR" />
+      <many-to-one name="invokeOperation"
+                   column="INVOPER_" 
+                   cascade="all"
+                   class="org.jbpm.pvm.internal.wire.operation.InvokeOperation"
+                   foreign-key="FK_ACT_INVKOPER"
+                   index="IDX_ACT_INVKOPER" />
+    </subclass>
+    <subclass name="org.jbpm.jpdl.internal.activity.ScriptActivity" discriminator-value="script">
+      <property name="script" column="TEXT_" />
+      <property name="language" column="TEXT2_" />
+      <property name="variableName" column="TEXT3_" />
+    </subclass>
+    <subclass name="org.jbpm.jpdl.internal.activity.EsbActivity" discriminator-value="esb">
+      <property name="service" column="TEXT_" />
+      <property name="category" column="TEXT2_" />
+      <many-to-one name="partsListDescriptor"
+               column="PARTSDESCR_" 
+               cascade="all"
+               class="org.jbpm.pvm.internal.wire.descriptor.ListDescriptor"
+               foreign-key="FK_ACT_PARTSDESCR"
+               index="IDX_ACT_PARTSDESCR" />
+    </subclass>
+    <subclass name="org.jbpm.jpdl.internal.activity.TaskActivity" discriminator-value="task">
+      <many-to-one name="taskDefinition"
+               column="TASKDEF_" 
+               cascade="all"
+               class="org.jbpm.pvm.internal.task.TaskDefinitionImpl"
+               foreign-key="FK_ACT_TASKDEF"
+               index="IDX_ACT_TASKDEF" />
+    </subclass>
+  </class>
+
+</hibernate-mapping>
\ No newline at end of file


Property changes on: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.jpdl.hbm.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.repository.hbm.xml	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.repository.hbm.xml	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping default-access="field">
+
+  <!-- ### Deployment ##################################################### -->
+  <class name="org.jbpm.pvm.DeploymentImpl" 
+         table="JBPM_DEPLOYMENT">
+
+    <!-- ProcessElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+
+    <property name="timestamp" column="TIMESTAMP_" />
+
+    <map name="resources" cascade="all-delete-orphan">
+      <key foreign-key="FK_LOB_DEPLOYMENT">
+        <column name="DEPLOYMENT_" index="IDX_LOB_DEPLOYMENT" />
+      </key>
+      <map-key type="string" column="NAME_" />
+      <one-to-many class="org.jbpm.pvm.internal.lob.Lob"/>
+    </map>
+    
+    <set name="objectProperties" 
+         table="JBPM_DEPLOYPROPS" 
+         cascade="all">
+      <key column="DEPLOYMENT_" />
+      <one-to-many class="org.jbpm.pvm.DeploymentProperty" />
+    </set>
+
+  </class>
+
+  <class name="org.jbpm.pvm.DeploymentProperty" table="JBPM_DEPLOYPROP">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <many-to-one name="deployment" 
+                 class="org.jbpm.pvm.DeploymentImpl" 
+                 column="DEPLOYMENT_"
+                 foreign-key="FK_DEPLPROP_DEPL"
+                 index="IDX_DEPLPROP_DEPL" />
+    <property name="objectName" column="OBJNAME_" />
+    <property name="key" column="KEY_" />
+    <property name="value" column="VALUE_" />
+  </class> 
+
+</hibernate-mapping>
\ No newline at end of file


Property changes on: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.repository.hbm.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.task.hbm.xml	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.task.hbm.xml	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,199 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+      "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+          "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping auto-import="false" package="org.jbpm.pvm.internal.task" default-access="field">
+
+  <!-- ### ASSIGNABLE DEFINITIONS ######################################### -->
+  <class name="AssignableDefinitionImpl" 
+         table="JBPM_ASSIGNDEF"
+         discriminator-value="A" >
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <discriminator><column name="CLASS_" /></discriminator>
+    <version name="dbversion" column="DBVERSION_" />
+
+    <property name="name" column="NAME_"/>
+    <property name="description" column="DESCR_"/>
+    <property name="assigneeExpression" column="ASS_EXPR_"/>
+    <property name="assigneeExpressionLanguage" column="ASS_EXPR_LANG_"/>
+    <property name="candidateUsersExpression" column="CNDUSR_EXPR_"/>
+    <property name="candidateUsersExpressionLanguage" column="CNDUSR_EXPRLANG_"/>
+    <property name="candidateGroupsExpression" column="CNDGRP_EXPR_"/>
+    <property name="candidateGroupsExpressionLanguage" column="CNDGRP_EXPRLANG_"/>
+
+    <many-to-one name="assignmentHandlerDescriptor"
+                 column="ASSHNDLR_DESCR_" 
+                 cascade="all"
+                 class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
+                 foreign-key="FK_ASSHNDLR_DESCR"
+                 index="IDX_ASSHNDLR_DESCR" />
+
+    <subclass name="SwimlaneDefinitionImpl" discriminator-value="S">
+    </subclass>
+
+    <!-- ### TASK DEFINITION ################################################ -->
+    <subclass name="TaskDefinitionImpl" discriminator-value="T">
+  
+      <property name="priority" column="PRIORITY_"/>
+      <property name="dueDateDuration" column="DUEDATE_"/>
+      
+      <many-to-one name="taskHandlerDescriptor"
+                   column="TSKHNDLRDESCR_" 
+                   cascade="all"
+                   class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
+                   foreign-key="FK_TSKHNDLR_DESCR"
+                   index="IDX_TSKHNDLR_DESCR" />
+
+      <many-to-one name="swimlaneDefinition"
+                   column="SWIMLDEF_" 
+                   cascade="all"
+                   class="SwimlaneDefinitionImpl"
+                   foreign-key="FK_TSK_SWIMLDEF"
+                   index="IDX_TSK_SWIMLDEF" />
+  
+      <list name="subTaskDefinitions" cascade="all-delete-orphan">
+        <key column="TASKDEF_" />
+        <list-index column="TASKDEF_IDX_" />
+        <one-to-many class="TaskDefinitionImpl" />
+      </list>
+    </subclass>
+  </class>
+
+  <!-- ### TASK ########################################################### -->
+  <class name="TaskImpl" 
+         table="JBPM_TASK"
+         discriminator-value="T">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <discriminator type="char" column="CLASS_"/>
+    <version name="dbversion" column="DBVERSION_" />
+
+    <property name="id" column="ID_" unique="true" />
+    <property name="name" column="NAME_"/>
+    <property name="description" column="DESCR_"/>
+    <property name="assignee" column="ASSIGNEE_"/>
+    
+    <set name="participants" cascade="all-delete-orphan">
+      <key column="TASK_" />
+      <one-to-many class="ParticipantImpl" />
+    </set>
+    
+    <property name="priority" column="PRIORITY_"/>
+    <property name="create" column="CREATE_"/>
+    <property name="dueDate" column="DUEDATE_"/>
+    <property name="progress" column="PROGRESS_"/>
+    <property name="isSignalling" column="SIGNALLING_"/>
+    
+    <!-- 
+    <many-to-one name="variableMap"
+                 class="org.jbpm.pvm.impl.VariableMap" 
+                 column="VARMAP_" 
+                 foreign-key="FK_TASK_VARMAP"
+                 cascade="all" />
+    -->
+
+    <many-to-one name="superTask"
+                 class="TaskImpl" 
+                 column="SUPERTASK_" 
+                 foreign-key="FK_TASK_SUPERTASK" 
+                 index="IDX_TASK_SUPERTASK" />
+
+    <many-to-one name="execution"
+                 class="org.jbpm.pvm.internal.model.ExecutionImpl" 
+                 column="EXECUTION_" 
+                 foreign-key="none" />
+
+    <many-to-one name="processInstance"
+                 class="org.jbpm.pvm.internal.model.ExecutionImpl" 
+                 column="PROCINST_" 
+                 foreign-key="none" />
+
+    <many-to-one name="swimlane"
+                 class="SwimlaneImpl" 
+                 column="SWIMLANE_" 
+                 foreign-key="FK_TASK_SWIML" />
+
+      <many-to-one name="taskDefinition"
+               column="TASKDEF_" 
+               class="org.jbpm.pvm.internal.task.TaskDefinitionImpl"
+               foreign-key="FK_TSK_TASKDEF"
+               index="IDX_TSK_TASKDEF" />
+
+		<list name="comments" cascade="all-delete-orphan">
+			<key column="TASK_" />
+			<list-index column="TASK_IDX_" />
+			<one-to-many class="org.jbpm.pvm.internal.model.CommentImpl" />
+		</list>
+
+    <set name="subTasks" cascade="all-delete-orphan">
+      <key column="SUPERTASK_" />
+      <one-to-many class="TaskImpl" />
+    </set>
+    
+  </class>
+  
+  <!-- ### PARTICIPANT #################################################### -->
+  <class name="ParticipantImpl" table="JBPM_PARTICIPANT">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <version name="dbversion" column="DBVERSION_" />
+    
+    <property name="groupId" column="GROUPID_"/>
+    <property name="userId" column="USERID_"/>
+    <property name="participation" column="PARTICIPATION_" />
+
+    <many-to-one name="task"
+                 class="TaskImpl" 
+                 column="TASK_" 
+                 index="IDX_PART_TASK"
+                 foreign-key="FK_PART_TASK" />
+
+    <many-to-one name="swimlane"
+                 class="SwimlaneImpl" 
+                 column="SWIMLANE_" 
+                 foreign-key="FK_PART_SWIMLANE" />
+
+  </class>
+  
+  <!-- ### SWIMLANE ####################################################### -->
+  <class name="SwimlaneImpl" table="JBPM_SWIMLANE">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <version name="dbversion" column="DBVERSION_" />
+    
+    <property name="name" column="NAME_"/>
+    <property name="assignee" column="ASSIGNEE_"/>
+
+    <many-to-one name="swimlaneDefinition"
+                 class="SwimlaneDefinitionImpl" 
+                 column="SWIMLANEDEF_" 
+                 foreign-key="FK_SWIMLANE_DEF" />
+
+    <many-to-one name="execution"
+                 class="org.jbpm.pvm.internal.model.ExecutionImpl" 
+                 column="EXECUTION_" 
+                 foreign-key="none" />
+
+    <set name="participants" cascade="all-delete-orphan">
+      <key column="SWIMLANE_" />
+      <one-to-many class="ParticipantImpl" />
+    </set>
+    
+  </class>
+
+  
+  <!-- ### QUERIES ######################################################## -->
+
+  <query name="findTasks">
+    <![CDATA[
+     select task
+     from org.jbpm.pvm.internal.task.TaskImpl as task
+    ]]>
+  </query>
+
+</hibernate-mapping>


Property changes on: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.task.hbm.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.task.lifecycle.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.task.lifecycle.xml	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.task.lifecycle.xml	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,13 @@
+<task-lifecycle initial="open">
+  <state name="open">
+    <transition name="complete" to="completed" />
+    <transition name="suspend" to="suspended" />
+    <transition name="cancel" to="cancelled" />
+  </state>
+  <state name="suspended">
+    <transition name="resume" to="open" />
+    <transition name="cancel" to="cancelled" />
+  </state>
+  <state name="cancelled" />
+  <state name="completed" />
+</task-lifecycle>


Property changes on: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.task.lifecycle.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.variable.types.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.variable.types.xml	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.variable.types.xml	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,34 @@
+<types>
+
+  <!-- types stored in a native column -->
+  <type name="string" class="java.lang.String" variable-class="org.jbpm.pvm.internal.type.variable.StringVariable" />
+  <type name="long"   class="java.lang.Long" variable-class="org.jbpm.pvm.internal.type.variable.LongVariable" />
+  <type name="double" class="java.lang.Double" variable-class="org.jbpm.pvm.internal.type.variable.DoubleVariable" />
+
+  <!-- types converted to a string -->
+  <type name="date"    class="java.util.Date" converter="org.jbpm.pvm.internal.type.converter.DateToStringConverter" variable-class="org.jbpm.pvm.internal.type.variable.StringVariable" />
+  <type name="boolean" class="java.lang.Boolean" converter="org.jbpm.pvm.internal.type.converter.BooleanToStringConverter" variable-class="org.jbpm.pvm.internal.type.variable.StringVariable" />
+  <type name="char"    class="java.lang.Character" converter="org.jbpm.pvm.internal.type.converter.CharacterToStringConverter" variable-class="org.jbpm.pvm.internal.type.variable.StringVariable" />
+
+  <!-- types converted to a long -->
+  <type name="byte"    class="java.lang.Byte" converter="org.jbpm.pvm.internal.type.converter.ByteToLongConverter" variable-class="org.jbpm.pvm.internal.type.variable.LongVariable" />
+  <type name="short"   class="java.lang.Short" converter="org.jbpm.pvm.internal.type.converter.ShortToLongConverter" variable-class="org.jbpm.pvm.internal.type.variable.LongVariable" />
+  <type name="integer" class="java.lang.Integer" converter="org.jbpm.pvm.internal.type.converter.IntegerToLongConverter" variable-class="org.jbpm.pvm.internal.type.variable.LongVariable" />
+
+  <!-- types converted to a double -->
+  <type name="float" class="java.lang.Float" converter="org.jbpm.pvm.internal.type.converter.FloatToDoubleConverter" variable-class="org.jbpm.pvm.internal.type.variable.DoubleVariable" />
+
+  <!-- byte[] and char[] -->
+  <type name="byte[]" class="[B" variable-class="org.jbpm.pvm.internal.type.variable.BlobVariable" />
+  <type name="char[]" class="[C" variable-class="org.jbpm.pvm.internal.type.variable.ClobVariable" />
+
+  <type name="hibernate-long-id"   class="hibernate" id-type="long" variable-class="org.jbpm.pvm.internal.type.variable.HibernateLongVariable" />
+  <type name="hibernate-string-id" class="hibernate" id-type="string" variable-class="org.jbpm.pvm.internal.type.variable.HibernateStringVariable" />
+
+  <type name="serializable" class="serializable" converter="org.jbpm.pvm.internal.type.converter.SerializableToBytesConverter" variable-class="org.jbpm.pvm.internal.type.variable.BlobVariable" />
+
+  <!-- TODO: add ejb3 entity bean support -->
+  <!-- TODO: add JCR activity support -->
+  <!-- TODO: add collection support -->
+  
+</types>


Property changes on: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.variable.types.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.wire.bindings.xml	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.wire.bindings.xml	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,93 @@
+<wire-bindings>
+
+  <!-- ########################### -->
+  <!-- ### Descriptor bindings ### -->
+  <!-- ########################### -->
+  <!-- basic types -->
+  <binding class="org.jbpm.pvm.internal.wire.binding.TrueBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.FalseBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.CharBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.DoubleBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.FloatBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.IntBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.ShortBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.ByteBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.LongBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.StringBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.NullBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.ClassBinding" />
+  <!-- object and ref --> 
+  <binding class="org.jbpm.pvm.internal.wire.binding.ObjectBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.RefBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.JndiBinding" />
+  <!-- collections -->
+  <binding class="org.jbpm.pvm.internal.wire.binding.ListBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.SetBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.MapBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.PropertiesBinding" />
+  <!-- environment refs -->
+  <binding class="org.jbpm.pvm.internal.wire.binding.EnvironmentFactoryRefBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.EnvRefBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.EnvBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.ContextRefBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.TransactionRefBinding" />
+  <!-- various specials -->
+  <binding class="org.jbpm.pvm.internal.wire.binding.TransactionBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.JobExecutorBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.JobTestHelperBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.ScriptManagerBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.BusinessCalendarBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.IdGeneratorBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.AuthenticationBinding" />
+  <!-- hibernate bindings -->
+  <binding class="org.jbpm.pvm.internal.wire.binding.HibernateConfigurationBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.SeamHibernateSessionBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.HibernateSessionBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.HibernateSessionFactoryBinding" />
+  <!-- sessions -->
+  <binding class="org.jbpm.pvm.internal.wire.binding.MessageSessionBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.TimerSessionBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.HistorySessionBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionFactoryBinding" />
+  <!-- db sessions -->
+  <binding class="org.jbpm.pvm.internal.wire.binding.PvmDbSessionBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.JobDbSessionBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.TaskDbSessionBinding" />
+  
+  <!-- dynamic type mapping configuration  -->    
+  <binding class="org.jbpm.pvm.internal.wire.binding.TypesBinding" />
+  <!-- services  -->
+  <binding class="org.jbpm.pvm.internal.wire.binding.CommandServiceBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.ProcessServiceBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.ExecutionServiceBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.ManagementServiceBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.IdentityServiceBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.HistoryServiceBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.TaskServiceBinding" />
+  
+  <!-- deployers -->
+  <binding class="org.jbpm.pvm.internal.wire.binding.DeployerManagerBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.AssignFileTypesBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.CheckProcessBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.CheckProblemsBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.SaveBinding" />
+
+  <!-- interceptors -->
+  <binding class="org.jbpm.pvm.internal.wire.binding.EnvironmentInterceptorBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.AuthorizationInterceptorBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.RetryInterceptorBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.StandardTransactionInterceptorBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.SerializeInterceptorBinding" />
+
+  <!-- operation -->
+  <binding class="org.jbpm.pvm.internal.wire.binding.PropertyBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.FieldBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.InvokeBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.SubscribeBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.EnlistBinding" />
+
+  <!-- jpdl bindings -->
+  <binding class="org.jbpm.jpdl.internal.xml.ParseJpdlBinding" />
+
+</wire-bindings>


Property changes on: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.wire.bindings.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/trunk/modules/deployment/src/test/resources/logging.properties
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/logging.properties	                        (rev 0)
+++ jbpm4/trunk/modules/deployment/src/test/resources/logging.properties	2009-03-25 18:08:31 UTC (rev 4328)
@@ -0,0 +1,18 @@
+handlers= java.util.logging.ConsoleHandler
+redirect.commons.logging = enabled
+
+java.util.logging.ConsoleHandler.level = FINE
+java.util.logging.ConsoleHandler.formatter = org.jbpm.internal.log.LogFormatter
+
+org.jbpm.level=FINE
+# org.jbpm.pvm.internal.tx.level=FINE
+# org.jbpm.pvm.internal.wire.level=FINE
+# org.jbpm.pvm.internal.util.level=FINE
+
+org.hibernate.level=INFO
+org.hibernate.cfg.SettingsFactory.level=SEVERE
+org.hibernate.cfg.HbmBinder.level=SEVERE
+# org.hibernate.SQL.level=FINEST
+# org.hibernate.type.level=FINEST
+# org.hibernate.tool.hbm2ddl.SchemaExport.level=FINEST
+# org.hibernate.transaction.level=FINEST
\ No newline at end of file

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/VariablesCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/VariablesCmd.java	2009-03-25 12:56:01 UTC (rev 4327)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/VariablesCmd.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -36,7 +36,7 @@
 
   private static final long serialVersionUID = 1L;
 
-  Map<String, Object> variables;
+  protected Map<String, Object> variables;
 
   public void addVariable(String key, Object variable) {
     if (variables==null) {

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java	2009-03-25 12:56:01 UTC (rev 4327)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -66,6 +66,9 @@
   /** time this process was deployed */
   protected Date deploymentTime;
   
+  /** ref to the deployment */
+  protected long deploymentDbid;
+  
   /** the activity which is executed when the process starts */
   protected ActivityImpl initial;
   
@@ -203,4 +206,10 @@
   public void setId(String id) {
     this.id = id;
   }
+  public long getDeploymentDbid() {
+    return deploymentDbid;
+  }
+  public void setDeploymentDbid(long deploymentDbid) {
+    this.deploymentDbid = deploymentDbid;
+  }
 }

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java	2009-03-25 12:56:01 UTC (rev 4327)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -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.internal.repository;
-
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DeployCmd implements Command<Long> {
-
-  private static final long serialVersionUID = 1L;
-  
-  DeploymentImpl deployment;
-  
-  public DeployCmd(DeploymentImpl deployment) {
-    this.deployment = deployment;
-  }
-
-  public Long execute(Environment environment) throws Exception {
-    RepositorySession repositorySession = environment.get(RepositorySession.class);
-    return repositorySession.deploy(deployment);
-  }
-}

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/Deployer.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/Deployer.java	2009-03-25 12:56:01 UTC (rev 4327)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/Deployer.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -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.repository;
-
-
-/**
- * @author Tom Baeyens
- */
-public interface Deployer {
-
-  boolean matches(String fileName);
-  Object deployFile(String fileName, byte[] bytes);
-
-}

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployerManager.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployerManager.java	2009-03-25 12:56:01 UTC (rev 4327)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployerManager.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.repository;
-
-import java.util.List;
-
-import org.jbpm.pvm.internal.xml.ProblemList;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DeployerManager {
-  
-  List<Deployer> deployers;
-  
-  public Object deployFile(String fileName, byte[] bytes, ProblemList problemList) {
-    for (Deployer deployer: deployers) {
-      if (deployer.matches(fileName)) {
-        return deployer.deployFile(fileName, bytes);
-      }
-    }
-    return null;
-  }
-}

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/Deployment.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/Deployment.java	2009-03-25 12:56:01 UTC (rev 4327)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/Deployment.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.repository;
-
-import java.util.zip.ZipInputStream;
-
-import org.jbpm.pvm.internal.stream.StreamInput;
-
-/**
- * @author Tom Baeyens
- */
-public interface Deployment {
-
-  void setName(String name);
-  
-  Deployment addStreamInput(String name, StreamInput streamInput);
-  Deployment addZipInputStream(ZipInputStream zipInputStream);
-  
-  /** @return deploymentId */
-  long deploy();
-}

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java	2009-03-25 12:56:01 UTC (rev 4327)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -1,135 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.repository;
-
-import java.io.ObjectStreamException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import org.jbpm.JbpmException;
-import org.jbpm.cmd.CommandService;
-import org.jbpm.pvm.internal.lob.Lob;
-import org.jbpm.pvm.internal.stream.ByteArrayStreamInput;
-import org.jbpm.pvm.internal.stream.StreamInput;
-import org.jbpm.pvm.internal.util.IoUtil;
-import org.jbpm.pvm.internal.xml.ProblemList;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DeploymentImpl extends ProblemList implements Deployment {
-  
-  protected long dbid;
-  protected String name;
-  protected long timestamp;
-  
-  protected Map<String, Lob> storedFiles;
-  
-  protected Map<String, StreamInput> inputFiles;
-  protected CommandService commandService;
-
-  public DeploymentImpl(CommandService commandService) {
-    this.commandService = commandService;
-  }
-  
-  public long deploy() {
-    return commandService.execute(new DeployCmd(this));
-  }
-  public void setName(String name) {
-    this.name = name;
-  }
-  
-  public void setTimestamp(long timestamp) {
-    this.timestamp = timestamp;
-  }
-
-  public Deployment addStreamInput(String name, StreamInput streamInput) {
-    if (this.name==null) {
-      this.name = name;
-    }
-    if (inputFiles==null) {
-      inputFiles = new HashMap<String, StreamInput>();
-    }
-    inputFiles.put(name, streamInput);
-    return this;
-  }
-
-  public Deployment addZipInputStream(ZipInputStream zipInputStream) {
-    try {
-      ZipEntry zipEntry = zipInputStream.getNextEntry();
-      while(zipEntry!=null) {
-        String entryName = zipEntry.getName();
-        byte[] bytes = IoUtil.readBytes(zipInputStream);
-        if (bytes!=null) {
-          addStreamInput(entryName, new ByteArrayStreamInput(bytes));
-        }
-        zipEntry = zipInputStream.getNextEntry();
-      }
-    } catch (Exception e) {
-      throw new JbpmException("couldn't read zip archive", e);
-    }
-    return this;
-  }
-
-  protected Object writeReplace() throws ObjectStreamException {
-    if (inputFiles!=null) {
-      Map<String, StreamInput> replacedFiles = new HashMap<String, StreamInput>();
-      for (Map.Entry<String, StreamInput> entry: inputFiles.entrySet()) {
-        if (! (entry.getValue() instanceof ByteArrayStreamInput)) {
-          byte[] bytes = IoUtil.readBytes(entry.getValue().openStream());
-          replacedFiles.put(entry.getKey(), new ByteArrayStreamInput(bytes));
-        }
-      }
-      inputFiles = replacedFiles;
-    }
-    
-    commandService = null;
-
-    return this;
-  }
-
-  public long getDbid() {
-    return dbid;
-  }
-  public String getName() {
-    return name;
-  }
-  public long getTimestamp() {
-    return timestamp;
-  }
-
-  public Map<String, Lob> getStoredFiles() {
-    return storedFiles;
-  }
-  public void setStoredFiles(Map<String, Lob> storedFiles) {
-    this.storedFiles = storedFiles;
-  }
-  public Map<String, StreamInput> getInputFiles() {
-    return inputFiles;
-  }
-  public void setInputFiles(Map<String, StreamInput> inputFiles) {
-    this.inputFiles = inputFiles;
-  }
-}

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCache.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCache.java	2009-03-25 12:56:01 UTC (rev 4327)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCache.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.repository;
-
-import java.util.Map;
-
-
-/**
- * @author Tom Baeyens
- */
-public interface RepositoryCache {
-
-  void store(Map<String, Object> deployedObjects);
-
-}

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java	2009-03-25 12:56:01 UTC (rev 4327)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -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.internal.repository;
-
-import java.io.InputStream;
-
-import org.jbpm.cmd.CommandService;
-
-/**
- * @author Tom Baeyens
- */
-public class RepositoryServiceImpl {
-  
-  CommandService commandService;
-  
-  public Deployment createDeployment() {
-    return new DeploymentImpl(commandService);
-  }
-  
-  public void deleteDeployment(String deploymentId) {
-  }
-  
-  public InputStream getResource(String deploymentId, String resource) {
-    return null;
-  }
-}

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySession.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySession.java	2009-03-25 12:56:01 UTC (rev 4327)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySession.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.repository;
-
-import java.io.InputStream;
-
-
-/**
- * @author Tom Baeyens
- */
-public interface RepositorySession {
-
-  InputStream getResource(String deploymentId, String name);
-
-  Object getDeployedObject(String deploymentId, String name);
-
-  long deploy(DeploymentImpl deployment);
-}

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java	2009-03-25 12:56:01 UTC (rev 4327)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java	2009-03-25 18:08:31 UTC (rev 4328)
@@ -1,98 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.repository;
-
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.hibernate.Session;
-import org.jbpm.JbpmException;
-import org.jbpm.Problem;
-import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.lob.Lob;
-import org.jbpm.pvm.internal.stream.StreamInput;
-import org.jbpm.pvm.internal.util.IoUtil;
-
-
-/**
- * @author Tom Baeyens
- */
-public class RepositorySessionImpl implements RepositorySession {
-  
-  private static Log log = Log.getLog(RepositorySessionImpl.class.getName());
-  
-  Session session;
-  RepositoryCache repositoryCache;
-  DeployerManager deployerManager;
-
-  public long deploy(DeploymentImpl deployment) {
-    Map<String, Object> deployedObjects = new HashMap<String, Object>();
-
-    Map<String, StreamInput> inputFiles = deployment.getInputFiles();
-    if (inputFiles==null) {
-      deployment.addProblem("deployment is empty");
-
-    } else {
-      
-      Map<String, Lob> storedFiles = new HashMap<String, Lob>();
-      for (String fileName: inputFiles.keySet()) {
-        StreamInput streamInput = inputFiles.get(fileName);
-        byte[] bytes = IoUtil.readBytes(streamInput.openStream());
-        
-        Object deployedObject = deployerManager.deployFile(fileName, bytes, deployment);
-        if (deployedObject!=null) {
-          deployedObjects.put(fileName, deployedObject);
-        }
-
-        Lob lob = new Lob(bytes);
-        storedFiles.put(fileName, lob);
-      }
-      deployment.setStoredFiles(storedFiles);
-    }
-    
-    
-    if (deployment.hasProblems()) {
-      for (Problem problem: deployment.getProblems()) {
-        Throwable cause = problem.getCause();
-        if (cause!=null) {
-          log.debug("deployment exception", cause);
-        }
-      }
-      throw new JbpmException("problems during deployment: "+deployment.getProblemsText());
-    } else {
-      
-      repositoryCache.store(deployedObjects);
-      session.save(deployment);
-    }
-
-    return 0;
-  }
-
-  public Object getDeployedObject(String deploymentId, String name) {
-    return null;
-  }
-
-  public InputStream getResource(String deploymentId, String name) {
-    return null;
-  }
-}




More information about the jbpm-commits mailing list