You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mr...@apache.org on 2007/01/16 23:36:16 UTC

svn commit: r496884 [1/2] - in /incubator/ode/trunk: ./ axis2/src/main/java/org/apache/ode/axis2/ axis2/src/main/java/org/apache/ode/axis2/service/ bpel-api/src/main/java/org/apache/ode/bpel/iapi/ bpel-dao/src/main/java/org/apache/ode/bpel/dao/ bpel-ru...

Author: mriou
Date: Tue Jan 16 14:36:14 2007
New Revision: 496884

URL: http://svn.apache.org/viewvc?view=rev&rev=496884
Log:
ODE-26 Implemented simple process versioning in the store.

Added:
    incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/VersionTrackerDAOImpl.java
    incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/jpa/VersionTrackerDAOImpl.java
    incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/VersionedRedeployTest.java
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-1/
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-1/HelloWorld2.bpel
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-1/HelloWorld2.wsdl
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-1/deploy.xml
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-1/test.properties
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/HelloWorld2.bpel
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/HelloWorld2.cbp
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/HelloWorld2.wsdl
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/deploy.xml
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/test.properties
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-3/
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-3/HelloWorld2.bpel
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-3/HelloWorld2.wsdl
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-3/deploy.xml
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-3/test.properties
Modified:
    incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ExternalService.java
    incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/service/DeploymentWebService.java
    incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java
    incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/BpelDAOConnection.java
    incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java
    incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/BpelDAOConnectionImpl.java
    incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/ProcessDaoImpl.java
    incubator/ode/trunk/bpel-store/pom.xml
    incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ConfStoreConnection.java
    incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDAO.java
    incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java
    incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java
    incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
    incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/ConfStoreConnectionHib.java
    incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/DbConfStoreConnectionFactory.java
    incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/DeploymentUnitDaoImpl.java
    incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/jpa/ConfStoreConnectionJpa.java
    incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/jpa/DbConfStoreConnectionFactory.java
    incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/jpa/DeploymentUnitDaoImpl.java
    incubator/ode/trunk/bpel-store/src/main/resources/META-INF/persistence.xml
    incubator/ode/trunk/bpel-store/src/test/java/org/apache/ode/store/hib/DaoTest.java
    incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTest.java
    incubator/ode/trunk/dao-hibernate/pom.xml
    incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/BpelDAOConnectionImpl.java
    incubator/ode/trunk/dao-jpa-ojpa-derby/src/main/descriptors/persistence.derby.xml
    incubator/ode/trunk/dao-jpa/pom.xml
    incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/BPELDAOConnectionImpl.java
    incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java
    incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessDAOImpl.java
    incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessInstanceDAOImpl.java
    incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ScopeDAOImpl.java
    incubator/ode/trunk/pom.xml

Modified: incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ExternalService.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ExternalService.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ExternalService.java (original)
+++ incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ExternalService.java Tue Jan 16 14:36:14 2007
@@ -19,12 +19,6 @@
 
 package org.apache.ode.axis2;
 
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-
-import javax.wsdl.Definition;
-import javax.xml.namespace.QName;
-
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
@@ -39,15 +33,16 @@
 import org.apache.ode.bpel.epr.EndpointFactory;
 import org.apache.ode.bpel.epr.MutableEndpoint;
 import org.apache.ode.bpel.epr.WSAEndpoint;
-import org.apache.ode.bpel.iapi.Message;
-import org.apache.ode.bpel.iapi.MessageExchange;
-import org.apache.ode.bpel.iapi.PartnerRoleChannel;
-import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange;
-import org.apache.ode.bpel.iapi.Scheduler;
+import org.apache.ode.bpel.iapi.*;
 import org.apache.ode.bpel.iapi.MessageExchange.FailureType;
 import org.apache.ode.utils.DOMUtils;
 import org.w3c.dom.Element;
 
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+
 /**
  * Acts as a service not provided by ODE. Used mainly for invocation as a way to
  * maintain the WSDL decription of used services.
@@ -107,8 +102,8 @@
             serviceClient.setOverrideOptions(mexOptions);
 
             if (isTwoWay) {
-                // Defer the invoke until the transaction commits. 
-                
+                // Defer the invoke until the transaction commits.
+
                 _sched.registerSynchronizer(new Scheduler.Synchronizer() {
 
                     public void afterCompletion(boolean success) {
@@ -136,10 +131,10 @@
 
                     public void beforeCompletion() {                
                     }
-                    
+
                 });
                 odeMex.replyAsync();
-              
+
             } else /** one-way case **/ {
                 serviceClient.fireAndForget(payload);
                 odeMex.replyOneWayOk();

Modified: incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/service/DeploymentWebService.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/service/DeploymentWebService.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/service/DeploymentWebService.java (original)
+++ incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/service/DeploymentWebService.java Tue Jan 16 14:36:14 2007
@@ -19,24 +19,6 @@
 
 package org.apache.ode.axis2.service;
 
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Collection;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import javax.activation.DataHandler;
-import javax.wsdl.Definition;
-import javax.wsdl.WSDLException;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.namespace.QName;
-
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMText;
@@ -58,6 +40,18 @@
 import org.apache.ode.bpel.iapi.ProcessStore;
 import org.apache.ode.utils.fs.FileUtils;
 
+import javax.activation.DataHandler;
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+import java.io.*;
+import java.util.Collection;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
 /**
  * Axis wrapper for process deployment.
  */
@@ -119,12 +113,7 @@
                         // it to hold on for a while.
                         _poller.hold();
 
-                        // Cleaning up if something existed previously
-                        File dest = new File(_deployPath, namePart.getText());
-                        Collection<QName> undeployed = _store.undeploy(dest);
-                        for (QName pqname : undeployed) {
-                            _server.unregister(pqname);
-                        }
+                        File dest = buildUnusedDir(_deployPath, namePart.getText());
 
                         // If the previous deployment failed, there will still be something but
                         // undeploy won't do anything
@@ -141,7 +130,7 @@
 
                         Collection<QName> deployed = _store.deploy(dest);
 
-                        File deployedMarker = new File(_deployPath, namePart.getText() + ".deployed");
+                        File deployedMarker = new File(_deployPath, dest.getName() + ".deployed");
                         deployedMarker.createNewFile();
 
                         // Telling the poller what we deployed so that it doesn't try to deploy it again
@@ -215,6 +204,12 @@
             }
             if (unknown) throw new AxisFault("Unknown operation: '"
                     + messageContext.getAxisOperation().getName() + "'");
+        }
+
+        private File buildUnusedDir(File deployPath, String dirName) {
+            int v = 1;
+            while (new File(deployPath, dirName + "-" + v).exists()) v++;
+            return new File(deployPath, dirName + "-" + v);
         }
 
         private void unzip(File dest, DataHandler dataHandler) throws AxisFault {

Modified: incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java (original)
+++ incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java Tue Jan 16 14:36:14 2007
@@ -50,6 +50,12 @@
     QName getType();
 
     /**
+     * Get the process version.
+     * @return version
+     */
+    int getVersion();
+
+    /**
      * Is this a <em>transient</em> process? Transient processes are not persisted in the store.
      * @return <code>true</code> if this is a transient process.
      */

Modified: incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/BpelDAOConnection.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/BpelDAOConnection.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/BpelDAOConnection.java (original)
+++ incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/BpelDAOConnection.java Tue Jan 16 14:36:14 2007
@@ -18,16 +18,15 @@
  */
 package org.apache.ode.bpel.dao;
 
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
 import org.apache.ode.bpel.common.BpelEventFilter;
 import org.apache.ode.bpel.common.InstanceFilter;
 import org.apache.ode.bpel.evt.BpelEvent;
 
+import javax.xml.namespace.QName;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
 
 /**
  * Represents the physical resource for connecting to the bpel state store.
@@ -94,7 +93,7 @@
   
   Collection<ProcessInstanceDAO> instanceQuery(String expression);
 
-  ProcessDAO createProcess(QName pid, QName type, String guid);
+  ProcessDAO createProcess(QName pid, QName type, String guid, int version);
 
 
   /**

Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java Tue Jan 16 14:36:14 2007
@@ -59,7 +59,7 @@
  */
 public class BpelServerImpl implements BpelServer {
 
-    private static final Log __log = LogFactory.getLog(BpelServer.class);
+    private static final Log __log = LogFactory.getLog(BpelServerImpl.class);
 
     private static final Messages __msgs = MessageBundle.getMessages(Messages.class);
 
@@ -294,7 +294,7 @@
             }
 
             // Create the processDAO if necessary.
-            createProcessDAO(conf.getProcessId(), compiledProcess);
+            createProcessDAO(conf.getProcessId(), conf.getVersion(), compiledProcess);
 
             BpelProcess process = new BpelProcess(conf, compiledProcess, null, elangRegistry);
 
@@ -338,9 +338,8 @@
      * 
      * @param pid
      * @param oprocess
-     * @return
      */
-    private void createProcessDAO(final QName pid, final OProcess oprocess) {
+    private void createProcessDAO(final QName pid, final int version, final OProcess oprocess) {
         __log.debug("Creating process DAO for " + pid + " (guid=" + oprocess.guid + ")");
         try {
             boolean create = _db.exec(new BpelDatabase.Callable<Boolean>() {
@@ -365,10 +364,9 @@
                     }
 
                     // GUIDS dont match, delete and create new
-                    // TODO: Versioning will need to handle this differently.
                     String errmsg = "ProcessDAO GUID " + old.getGuid() + " does not match " + oprocess.guid
                             + "; replacing.";
-                    __log.warn(errmsg);
+                    __log.debug(errmsg);
                     old.delete();
 
                     return true;
@@ -400,7 +398,7 @@
                             }
                         }
 
-                        ProcessDAO newDao = conn.createProcess(pid, oprocess.getQName(), oprocess.guid);
+                        ProcessDAO newDao = conn.createProcess(pid, oprocess.getQName(), oprocess.guid, version);
                         for (String correlator : oprocess.getCorrelators()) {
                             newDao.addCorrelator(correlator);
                         }

Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/BpelDAOConnectionImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/BpelDAOConnectionImpl.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/BpelDAOConnectionImpl.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/BpelDAOConnectionImpl.java Tue Jan 16 14:36:14 2007
@@ -42,8 +42,8 @@
         return _store.get(processId);
     }
 
-    public ProcessDAO createProcess(QName pid, QName type, String guid) {
-        ProcessDaoImpl process = new ProcessDaoImpl(this,_store,pid,type, guid);
+    public ProcessDAO createProcess(QName pid, QName type, String guid, int version) {
+        ProcessDaoImpl process = new ProcessDaoImpl(this,_store,pid,type, guid,version);
         _store.put(pid,process);
         return process;
     }

Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/ProcessDaoImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/ProcessDaoImpl.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/ProcessDaoImpl.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/ProcessDaoImpl.java Tue Jan 16 14:36:14 2007
@@ -11,12 +11,8 @@
 import org.apache.ode.bpel.dao.*;
 
 import javax.xml.namespace.QName;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.Date;
 
 /**
  * A very simple, in-memory implementation of the {@link ProcessDAO} interface.
@@ -26,6 +22,7 @@
 
     private QName _processId;
     private QName _type;
+    private int _version;
     final Map<String, CorrelatorDaoImpl> _correlators = new ConcurrentHashMap<String, CorrelatorDaoImpl>();
     protected final Map<Long, ProcessInstanceDAO> _instances = new ConcurrentHashMap<Long, ProcessInstanceDAO>();
     protected final Map<Integer, PartnerLinkDAO> _plinks = new ConcurrentHashMap<Integer, PartnerLinkDAO>();
@@ -34,9 +31,8 @@
 
     private String _guid;
 
-    public ProcessDaoImpl(BpelDAOConnectionImpl conn,
-                          Map<QName, ProcessDaoImpl> store,
-                          QName processId, QName type, String guid) {
+    public ProcessDaoImpl(BpelDAOConnectionImpl conn, Map<QName, ProcessDaoImpl> store,
+                          QName processId, QName type, String guid, int version) {
         if (__log.isDebugEnabled()) {
             __log.debug("Creating ProcessDao object for process \"" + processId + "\".");
         }
@@ -46,6 +42,7 @@
         _store = store;
         _processId = processId;
         _type = type;
+        _version = version;
     }
 
     public QName getProcessId() {
@@ -101,7 +98,6 @@
     }
 
     public void instanceCompleted(ProcessInstanceDAO instance) {
-        _instances.remove(instance.getInstanceId());
     }
 
     public void delete() {
@@ -109,7 +105,7 @@
     }
 
     public int getVersion() {
-        return 0;
+        return _version;
     }
 
     public String getDeployer() {

Modified: incubator/ode/trunk/bpel-store/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-store/pom.xml?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/bpel-store/pom.xml (original)
+++ incubator/ode/trunk/bpel-store/pom.xml Tue Jan 16 14:36:14 2007
@@ -64,6 +64,29 @@
             <artifactId>persistence-api</artifactId>
             <version>1.0</version>
         </dependency>
+
+        <!-- Enhancer dependencies, necessary for now as Maven doesn't set maven.plugin.classpath for reactor builds -->
+        <dependency>
+            <groupId>org.apache.openjpa</groupId>
+            <artifactId>openjpa-all</artifactId>
+            <version>0.9.7-incubating-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-dbcp</groupId>
+            <artifactId>commons-dbcp</artifactId>
+            <version>1.2.1</version>
+        </dependency>
+        <dependency>
+            <groupId>xerces</groupId>
+            <artifactId>xercesImpl</artifactId>
+            <version>2.0.2</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections</artifactId>
+            <version>3.1</version>
+        </dependency>
     </dependencies>
     <build>
         <plugins>
@@ -92,28 +115,6 @@
                 <artifactId>maven-antrun-plugin</artifactId>
                 <version>1.1</version>
 
-                <dependencies>
-                    <dependency>
-                        <groupId>org.apache.openjpa</groupId>
-                        <artifactId>openjpa-all</artifactId>
-                        <version>0.9.6-incubating-SNAPSHOT</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>commons-dbcp</groupId>
-                        <artifactId>commons-dbcp</artifactId>
-                        <version>1.2.1</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>xerces</groupId>
-                        <artifactId>xercesImpl</artifactId>
-                        <version>2.0.2</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>commons-collections</groupId>
-                        <artifactId>commons-collections</artifactId>
-                        <version>3.1</version>
-                    </dependency>
-                </dependencies>
                 <executions>
                     <execution>
                         <phase>compile</phase>
@@ -127,7 +128,7 @@
                                     <arg line="-d ${basedir}/target/classes"/>
                                     <classpath>
                                         <path refid="maven.compile.classpath"/>
-                                        <path refid="maven.plugin.classpath"/>
+                                        <!--<path refid="maven.plugin.classpath"/>-->
                                     </classpath>
                                 </java>
                             </tasks>

Modified: incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ConfStoreConnection.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ConfStoreConnection.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ConfStoreConnection.java (original)
+++ incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ConfStoreConnection.java Tue Jan 16 14:36:14 2007
@@ -1,6 +1,7 @@
 package org.apache.ode.store;
 
 
+import javax.xml.namespace.QName;
 import java.util.Collection;
 
 /**
@@ -18,7 +19,8 @@
 
     void close();
 
-    
+    int getNextVersion(QName processName);
 
+    void setVersion(QName processName, int version);
     
 }

Modified: incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDAO.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDAO.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDAO.java (original)
+++ incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDAO.java Tue Jan 16 14:36:14 2007
@@ -1,10 +1,9 @@
 package org.apache.ode.store;
 
+import javax.xml.namespace.QName;
 import java.util.Collection;
 import java.util.Date;
 
-import javax.xml.namespace.QName;
-
 /**
  * DAO interface for a "deployment unit", a collection of processes deployed as a single
  * unit.
@@ -52,7 +51,7 @@
      */
     void delete();
 
-    ProcessConfDAO createProcess(QName pid, QName type);
+    ProcessConfDAO createProcess(QName pid, QName type, int version);
 
     ProcessConfDAO getProcess(QName pid);
     

Modified: incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java (original)
+++ incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java Tue Jan 16 14:36:14 2007
@@ -43,6 +43,8 @@
     private volatile DeployDocument _dd;
     private volatile DocumentRegistry _docRegistry;
 
+    private int _version = -1;
+
     private static final FileFilter _wsdlFilter = new FileFilter() {
         public boolean accept(File path) {
             return path.getName().endsWith(".wsdl");
@@ -104,11 +106,9 @@
         _processes = processes;
 
         HashMap<QName, Process> processInfo = new HashMap<QName, TDeployment.Process>();
-
         for (TDeployment.Process p : getDeploymentDescriptor().getDeploy().getProcessList()) {
             processInfo.put(p.getName(), p);
         }
-
         _processInfo = processInfo;
 
     }
@@ -223,11 +223,11 @@
         return "{DeploymentUnit " + _name + "}";
     }
 
-    public TDeployment.Process getProcessDeployInfo(QName pid) {
+    public TDeployment.Process getProcessDeployInfo(QName type) {
         if (_processInfo == null) {
         }
 
-        return _processInfo.get(pid);
+        return _processInfo.get(type);
     }
 
     public List<File> allFiles() {
@@ -288,6 +288,14 @@
             }
         }
         return null;
+    }
+
+    public int getVersion() {
+        return _version;
+    }
+
+    public void setVersion(int version) {
+        _version = version;
     }
 
 }

Modified: incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java (original)
+++ incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java Tue Jan 16 14:36:14 2007
@@ -29,43 +29,35 @@
  */
 class ProcessConfImpl implements ProcessConf {
     private static final Log __log = LogFactory.getLog(ProcessConfImpl.class);
-
     private static final Messages __msgs = MessageBundle.getMessages(Messages.class);
 
     private final Date _deployDate;
-
     private final Map<QName, Node> _props;
-
     private final HashMap<String, Endpoint> _partnerRoleInitialValues = new HashMap<String, Endpoint>();;
-
     private final HashMap<String, Endpoint> _myRoleEndpoints = new HashMap<String, Endpoint>();
-
     private final Map<String, Set<BpelEvent.TYPE>> _events = new HashMap<String, Set<BpelEvent.TYPE>>();
-
     private final ArrayList<String> _mexi = new ArrayList<String>();
-
-    final ProcessState _state;
-
+    ProcessState _state;
     final TDeployment.Process _pinfo;
-
     final DeploymentUnitDir _du;
-
-
-    ProcessConfImpl(DeploymentUnitDir du, 
-            TDeployment.Process pinfo, 
-            Date deployDate, 
-            Map<QName, Node> props,
-            ProcessState pstate) {
+    private int _version = 0;
+    private QName _pid;
+    private QName _type;
+
+    ProcessConfImpl(QName pid, QName type, int version, DeploymentUnitDir du, TDeployment.Process pinfo, Date deployDate,
+                    Map<QName, Node> props, ProcessState pstate) {
+        _pid = pid;
+        _version = version;
         _du = du;
         _pinfo = pinfo;
         _deployDate = deployDate;
         _props = Collections.unmodifiableMap(props);
         _state = pstate;
+        _type = type;
 
         initLinks();
         initMexInterceptors();
         initEventList();
-
     }
 
     private void initMexInterceptors() {
@@ -120,11 +112,11 @@
     }
 
     public QName getProcessId() {
-        return _pinfo.getName();
+        return _pid;
     }
 
     public QName getType() {
-        return _pinfo.getType() == null ? getProcessId() : _pinfo.getType();
+        return _pinfo.getType() == null ? _type : _pinfo.getType();
     }
 
     public String getPackage() {
@@ -135,6 +127,10 @@
         return _props;
     }
 
+    public int getVersion() {
+        return _version;
+    }
+
     public InputStream getCBPInputStream() {
         CBPInfo cbpInfo = _du.getCBPInfo(getType());
         if (cbpInfo == null)
@@ -271,6 +267,10 @@
                 _events.put(tScopeEvents.getName(), evtSet);
             }
         }
+    }
+
+    void setState(ProcessState state) {
+        _state = state;
     }
 
 }

Modified: incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java (original)
+++ incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java Tue Jan 16 14:36:14 2007
@@ -87,22 +87,22 @@
     public ProcessStoreImpl(DataSource ds) {
         this(ds, false);
     }
-    
+
     public ProcessStoreImpl(DataSource ds, boolean auto) {
         String persistenceType = System.getProperty("ode.persistence");
         if (ds != null) {
             if ("hibernate".equalsIgnoreCase(persistenceType))
                 _cf = new org.apache.ode.store.hib.DbConfStoreConnectionFactory(ds, false);
             else
-                _cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(ds);
+                _cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(ds, false);
         } else {
             // If the datasource is not provided, then we create a HSQL-based in-memory
             // database. Makes testing a bit simpler.
             DataSource hsqlds = createInternalDS(_guid);
             if ("hibernate".equalsIgnoreCase(persistenceType))
-                _cf = new org.apache.ode.store.hib.DbConfStoreConnectionFactory(hsqlds, false);
+                _cf = new org.apache.ode.store.hib.DbConfStoreConnectionFactory(hsqlds, true);
             else
-                _cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(hsqlds);
+                _cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(hsqlds, true);
             _inMemDs = hsqlds;
         }
 
@@ -116,7 +116,7 @@
         }
     }
 
-    
+
     @Override
     protected void finalize() throws Throwable {
         // force a shutdown so that HSQL cleans up its mess.
@@ -139,18 +139,32 @@
         // Create the DU and compile/scan it before acquiring lock.
         final DeploymentUnitDir du = new DeploymentUnitDir(deploymentUnitDirectory);
         try {
+            System.out.println("CALLING COMPILATION");
             du.compile();
         } catch (CompilationException ce) {
             String errmsg = __msgs.msgDeployFailCompileErrors();
             __log.error(errmsg,ce);
             throw new ContextException(errmsg,ce);
         }
-        
+
         du.scan();
-        DeployDocument dd = du.getDeploymentDescriptor();
+        final DeployDocument dd = du.getDeploymentDescriptor();
         final ArrayList<ProcessConfImpl> processes = new ArrayList<ProcessConfImpl>();
         Collection<QName> deployed;
 
+        // Process and DU are all versioned at the highest process version number
+        // which becomes the DU version (subversion style).
+        int version = exec(new Callable<Integer>() {
+            public Integer call(ConfStoreConnection conn) {
+                int v = 0;
+                for (TDeployment.Process processDD : dd.getDeploy().getProcessList()) {
+                    int procVersion = conn.getNextVersion(processDD.getName());
+                    if (procVersion > v) v = procVersion;
+                }
+                return v;
+            }
+        });
+
         _rw.writeLock().lock();
 
         try {
@@ -160,8 +174,18 @@
                 throw new ContextException(errmsg);
             }
 
+            du.setVersion(version);
+
             for (TDeployment.Process processDD : dd.getDeploy().getProcessList()) {
-                if (_processes.containsKey(processDD.getName())) {
+                QName pid = toPid(processDD.getName(), version);
+                // Retires older version
+                try {
+                    if (version > 1) setState(toPid(processDD.getName(), version - 1), ProcessState.RETIRED);
+                } catch (ContextException ce) {
+                    __log.debug("No previous version to retire on deployment of version " + version);
+                }
+
+                if (_processes.containsKey(pid)) {
                     String errmsg = __msgs.msgDeployFailDuplicatePID(processDD.getName(), du.getName());
                     __log.error(errmsg);
                     throw new ContextException(errmsg);
@@ -177,14 +201,13 @@
                 }
 
                 // final OProcess oprocess = loadCBP(cbpInfo.cbp);
-                ProcessConfImpl pconf = new ProcessConfImpl(du, processDD, deployDate, calcInitialProperties(processDD),
-                        calcInitialState(processDD));
+                ProcessConfImpl pconf = new ProcessConfImpl(pid, processDD.getName(), version, du, processDD,
+                        deployDate, calcInitialProperties(processDD), calcInitialState(processDD));
                 processes.add(pconf);
-
             }
 
             _deploymentUnits.put(du.getName(),du);
-            
+
             for (ProcessConfImpl process : processes) {
                 __log.info(__msgs.msgProcessDeployed(du.getDeployDir(), process.getProcessId()));
                 _processes.put(process.getProcessId(), process);
@@ -211,7 +234,7 @@
                 try {
                     if (_deployDir == null)
                         dudao.setDeploymentUnitDir(deploymentUnitDirectory.getCanonicalPath());
-                    else 
+                    else
                         dudao.setDeploymentUnitDir(deploymentUnitDirectory.getName());
                 } catch (IOException e1) {
                     String errmsg = "Error getting canonical path for " + du.getName()
@@ -224,21 +247,20 @@
                 // Going trough each process declared in the dd
                 for (ProcessConfImpl pc : processes) {
                     try {
-                        ProcessConfDAO newDao = dudao.createProcess(pc.getProcessId(), pc.getType());
+                        ProcessConfDAO newDao = dudao.createProcess(pc.getProcessId(), pc.getType(), pc.getVersion());
                         newDao.setState(pc.getState());
                         for (Map.Entry<QName, Node> prop : pc.getProperties().entrySet()) {
                             newDao.setProperty(prop.getKey(), DOMUtils.domToString(prop.getValue()));
                         }
                         deployed.add(pc.getProcessId());
+                        conn.setVersion(pc.getType(), pc.getVersion());
                     } catch (Throwable e) {
                         String errmsg = "Error persisting deployment record for " + pc.getProcessId()
                                 + "; process will not be available after restart!";
                         __log.error(errmsg, e);
                     }
                 }
-
                 return deployed;
-
             }
 
         });
@@ -254,28 +276,25 @@
     }
 
     public Collection<QName> undeploy(final File dir) {
-
         try {
             exec(new Callable<Collection<QName>>() {
-
                 public Collection<QName> call(ConfStoreConnection conn) {
                     DeploymentUnitDAO dudao = conn.getDeploymentUnit(dir.getName());
                     if (dudao != null)
                         dudao.delete();
                     return null;
                 }
-
             });
         } catch (Exception ex) {
             __log.error("Error synchronizing with data store; " + dir.getName() + " may be reappear after restart!");
         }
-    
+
         Collection<QName> undeployed = Collections.emptyList();
         _rw.writeLock().lock();
         try {
             DeploymentUnitDir du = _deploymentUnits.remove(dir.getName());
             if (du != null) {
-                undeployed = du.getProcessNames();
+                undeployed = toPids(du.getProcessNames(), du.getVersion());
                 _processes.keySet().removeAll(undeployed);
             }
         } finally {
@@ -350,6 +369,7 @@
 
                 ProcessState old = dao.getState();
                 dao.setState(state);
+                pconf.setState(state);
                 return old;
             }
         });
@@ -401,7 +421,7 @@
 
     /**
      * Load all the deployment units out of the store. Called on start-up.
-     * 
+     *
      */
     public void loadAll() {
         final ArrayList<ProcessConfImpl> loaded = new ArrayList<ProcessConfImpl>();
@@ -417,7 +437,7 @@
                 return null;
             }
         });
-        
+
         for (ProcessConfImpl p : loaded)
             fireStateChange(p.getProcessId(), p.getState());
 
@@ -488,7 +508,7 @@
     }
 
     /**
-     * Create a property mapping based on the initial values in the deployment 
+     * Create a property mapping based on the initial values in the deployment
      * descriptor.
      * @param dd
      * @return
@@ -512,7 +532,7 @@
     }
 
     /**
-     * Figure out the initial process state from the state in the deployment descriptor. 
+     * Figure out the initial process state from the state in the deployment descriptor.
      * @param dd deployment descriptor
      * @return
      */
@@ -549,9 +569,9 @@
         _rw.writeLock().lock();
         try {
             _deploymentUnits.put(dud.getName(),dud);
-            
+
             for (ProcessConfDAO p : dudao.getProcesses()) {
-                TDeployment.Process pinfo = dud.getProcessDeployInfo(p.getPID());
+                TDeployment.Process pinfo = dud.getProcessDeployInfo(p.getType());
                 if (pinfo == null) {
                     __log.warn("Cannot load " + p.getPID() + "; cannot find descriptor.");
                     continue;
@@ -560,7 +580,8 @@
                 Map<QName, Node> props = calcInitialProperties(pinfo);
                 // TODO: update the props based on the values in the DB.
 
-                ProcessConfImpl pconf = new ProcessConfImpl(dud, pinfo, dudao.getDeployDate(), props, p.getState());
+                ProcessConfImpl pconf = new ProcessConfImpl(p.getPID(), p.getType(), p.getVersion(), dud,
+                        pinfo, dudao.getDeployDate(), props, p.getState());
 
                 _processes.put(pconf.getProcessId(), pconf);
                 loaded.add(pconf);
@@ -607,7 +628,7 @@
 
         abstract V call(ConfStoreConnection conn);
     }
-    
+
     public void setDeployDir(File depDir) {
         _deployDir = depDir;
     }
@@ -626,6 +647,18 @@
         } catch (SQLException e) {
             __log.error("Error shutting down.", e);
         }
+    }
+
+    private Collection<QName> toPids(Collection<QName> processTypes, int version) {
+        ArrayList<QName> result = new ArrayList<QName>();
+        for (QName pqName : processTypes) {
+            result.add(toPid(pqName, version));
+        }
+        return result;
+    }
+
+    private QName toPid(QName processType, int version) {
+        return new QName(processType.getNamespaceURI(), processType.getLocalPart() + "-" + version);
     }
 
 }

Modified: incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/ConfStoreConnectionHib.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/ConfStoreConnectionHib.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/ConfStoreConnectionHib.java (original)
+++ incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/ConfStoreConnectionHib.java Tue Jan 16 14:36:14 2007
@@ -60,6 +60,24 @@
         }
     }
 
+    public int getNextVersion(QName processName) {
+        VersionTrackerDAOImpl vt = (VersionTrackerDAOImpl)
+                _session.get(VersionTrackerDAOImpl.class,processName.toString());
+        if (vt == null) return 1;
+        else return vt.getVersion() + 1;
+    }
+
+    public void setVersion(QName processName, int version) {
+        VersionTrackerDAOImpl vt = (VersionTrackerDAOImpl)
+                _session.get(VersionTrackerDAOImpl.class,processName.toString());
+        if (vt == null) {
+            vt = new VersionTrackerDAOImpl();
+            vt.setNamespace(processName.toString());
+        }
+        vt.setVersion(version);
+        _session.save(vt);
+    }
+
     @SuppressWarnings("unchecked")
     public Collection<DeploymentUnitDAO> getDeploymentUnits() {
         Criteria c = _session.createCriteria(DeploymentUnitDaoImpl.class);
@@ -80,7 +98,6 @@
 
     public void rollback() {
         _tx.rollback();
-        
     }
 
 }

Modified: incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/DbConfStoreConnectionFactory.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/DbConfStoreConnectionFactory.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/DbConfStoreConnectionFactory.java (original)
+++ incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/DbConfStoreConnectionFactory.java Tue Jan 16 14:36:14 2007
@@ -126,7 +126,8 @@
     }
 
     static Configuration getDefaultConfiguration() throws MappingException {
-        return new Configuration().addClass(ProcessConfDaoImpl.class).addClass(DeploymentUnitDaoImpl.class);
+        return new Configuration().addClass(ProcessConfDaoImpl.class).addClass(DeploymentUnitDaoImpl.class)
+                .addClass(VersionTrackerDAOImpl.class);
     }
 
     public static class DataSourceConnectionProvider implements ConnectionProvider {

Modified: incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/DeploymentUnitDaoImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/DeploymentUnitDaoImpl.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/DeploymentUnitDaoImpl.java (original)
+++ incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/DeploymentUnitDaoImpl.java Tue Jan 16 14:36:14 2007
@@ -1,18 +1,16 @@
 package org.apache.ode.store.hib;
 
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
 import org.apache.ode.bpel.iapi.ProcessState;
 import org.apache.ode.store.DeploymentUnitDAO;
 import org.apache.ode.store.ProcessConfDAO;
 import org.apache.ode.utils.stl.CollectionsX;
 import org.apache.ode.utils.stl.MemberOfFunction;
 
+import javax.xml.namespace.QName;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+
 /**
  * @author mriou <mriou at apache dot org>
  * @hibernate.class table="STORE_DU"
@@ -104,12 +102,13 @@
         super.delete();
     }
     
-    public ProcessConfDAO createProcess(QName pid, QName type) {
+    public ProcessConfDAO createProcess(QName pid, QName type, int version) {
         ProcessConfDaoImpl p = new ProcessConfDaoImpl();
         p.setPID(pid);
         p.setType(type);
         p.setDeploymentUnit(this);
         p.setState(ProcessState.ACTIVE);
+        p.setVersion(version);
         getSession().save(p);
         _processes.add(p);
         return p;

Added: incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/VersionTrackerDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/VersionTrackerDAOImpl.java?view=auto&rev=496884
==============================================================================
--- incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/VersionTrackerDAOImpl.java (added)
+++ incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/VersionTrackerDAOImpl.java Tue Jan 16 14:36:14 2007
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ode.store.hib;
+
+/**
+ * @author Matthieu Riou <mriou at apache dot org>
+ * @hibernate.class table="STORE_VERSIONS"
+ */
+public class VersionTrackerDAOImpl extends HibObj {
+
+    private String _namespace;
+    private int _version;
+
+    /**
+     * @hibernate.id generator-class="assigned"
+     * @hibernate.property column="NS"
+     */
+    public String getNamespace() {
+        return _namespace;
+    }
+
+    public void setNamespace(String namespace) {
+        _namespace = namespace;
+    }
+
+    /**
+     * @hibernate.property column="VERSION"
+     */
+    public int getVersion() {
+        return _version;
+    }
+
+    public void setVersion(int version) {
+        _version = version;
+    }
+}

Modified: incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/jpa/ConfStoreConnectionJpa.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/jpa/ConfStoreConnectionJpa.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/jpa/ConfStoreConnectionJpa.java (original)
+++ incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/jpa/ConfStoreConnectionJpa.java Tue Jan 16 14:36:14 2007
@@ -23,6 +23,7 @@
 import org.apache.ode.store.DeploymentUnitDAO;
 
 import javax.persistence.EntityManager;
+import javax.xml.namespace.QName;
 import java.util.Collection;
 import java.util.Date;
 
@@ -69,5 +70,21 @@
 
     public void rollback() {
         _em.getTransaction().rollback();
+    }
+
+    public int getNextVersion(QName processName) {
+        VersionTrackerDAOImpl vt = _em.find(VersionTrackerDAOImpl.class,processName.toString());
+        if (vt == null) return 1;
+        else return vt.getVersion() + 1;
+    }
+
+    public void setVersion(QName processName, int version) {
+        VersionTrackerDAOImpl vt = _em.find(VersionTrackerDAOImpl.class,processName.toString());
+        if (vt == null) {
+            vt = new VersionTrackerDAOImpl();
+            vt.setNamespace(processName.toString());
+        }
+        vt.setVersion(version);
+        _em.persist(vt);
     }
 }

Modified: incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/jpa/DbConfStoreConnectionFactory.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/jpa/DbConfStoreConnectionFactory.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/jpa/DbConfStoreConnectionFactory.java (original)
+++ incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/jpa/DbConfStoreConnectionFactory.java Tue Jan 16 14:36:14 2007
@@ -35,13 +35,14 @@
     private DataSource _ds;
     private EntityManagerFactory _emf;
 
-    public DbConfStoreConnectionFactory(DataSource ds) {
+    public DbConfStoreConnectionFactory(DataSource ds, boolean auto) {
         _ds = ds;
         HashMap propMap = new HashMap();
         propMap.put("javax.persistence.nonJtaDataSource", ds);
-        //propMap.put("openjpa.Log", "DefaultLevel=TRACE");
-        propMap.put("openjpa.Log", "log4j");
+        propMap.put("openjpa.Log", "DefaultLevel=TRACE");
+//        propMap.put("openjpa.Log", "log4j");
         propMap.put("openjpa.jdbc.DBDictionary", "org.apache.openjpa.jdbc.sql.DerbyDictionary");
+        if (auto) propMap.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=false)");
 //        propMap.put("openjpa.MetaDataFactory",
 //                "Types=org.apache.ode.store.jpa.ProcessConfDaoImpl;" +
 //                        "org.apache.ode.store.jpa.ProcessConfPropertyDaoImpl;" +

Modified: incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/jpa/DeploymentUnitDaoImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/jpa/DeploymentUnitDaoImpl.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/jpa/DeploymentUnitDaoImpl.java (original)
+++ incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/jpa/DeploymentUnitDaoImpl.java Tue Jan 16 14:36:14 2007
@@ -114,12 +114,13 @@
         super.delete();
     }
 
-    public ProcessConfDAO createProcess(QName pid, QName type) {
+    public ProcessConfDAO createProcess(QName pid, QName type, int version) {
         ProcessConfDaoImpl p = new ProcessConfDaoImpl();
         p.setPID(pid);
         p.setType(type);
         p.setDeploymentUnit(this);
         p.setState(ProcessState.ACTIVE);
+        p.setVersion(version);
         getEM().persist(p);
         _processes.add(p);
         getEM().persist(this);

Added: incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/jpa/VersionTrackerDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/jpa/VersionTrackerDAOImpl.java?view=auto&rev=496884
==============================================================================
--- incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/jpa/VersionTrackerDAOImpl.java (added)
+++ incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/jpa/VersionTrackerDAOImpl.java Tue Jan 16 14:36:14 2007
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ode.store.jpa;
+
+import javax.persistence.*;
+
+/**
+ * @author Matthieu Riou <mriou at apache dot org>
+ */
+@Entity
+@Table(name="STORE_VERSIONS")
+public class VersionTrackerDAOImpl {
+
+    @Id @Column(name="NS")
+    private String _namespace;
+    @Basic @Column(name="VERSION")
+    private int _version;
+
+    public String getNamespace() {
+        return _namespace;
+    }
+
+    public void setNamespace(String namespace) {
+        _namespace = namespace;
+    }
+
+    public int getVersion() {
+        return _version;
+    }
+
+    public void setVersion(int version) {
+        _version = version;
+    }
+}

Modified: incubator/ode/trunk/bpel-store/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-store/src/main/resources/META-INF/persistence.xml?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/bpel-store/src/main/resources/META-INF/persistence.xml (original)
+++ incubator/ode/trunk/bpel-store/src/main/resources/META-INF/persistence.xml Tue Jan 16 14:36:14 2007
@@ -30,5 +30,6 @@
         <class>org.apache.ode.store.jpa.ProcessConfDaoImpl</class>
         <class>org.apache.ode.store.jpa.ProcessConfPropertyDaoImpl</class>
         <class>org.apache.ode.store.jpa.DeploymentUnitDaoImpl</class>
+        <class>org.apache.ode.store.jpa.VersionTrackerDAOImpl</class>
     </persistence-unit>
 </persistence>

Modified: incubator/ode/trunk/bpel-store/src/test/java/org/apache/ode/store/hib/DaoTest.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-store/src/test/java/org/apache/ode/store/hib/DaoTest.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/bpel-store/src/test/java/org/apache/ode/store/hib/DaoTest.java (original)
+++ incubator/ode/trunk/bpel-store/src/test/java/org/apache/ode/store/hib/DaoTest.java Tue Jan 16 14:36:14 2007
@@ -117,7 +117,7 @@
         conn.begin();
         try {
             DeploymentUnitDAO du = conn.createDeploymentUnit("foo1");
-            ProcessConfDAO p = du.createProcess(foobar,foobar);
+            ProcessConfDAO p = du.createProcess(foobar,foobar,1);
             assertEquals(foobar,p.getPID());
             assertEquals(foobar,p.getType());
             assertNotNull(p.getDeploymentUnit());
@@ -151,7 +151,7 @@
         conn.begin();
         try {
             DeploymentUnitDAO du = conn.createDeploymentUnit("foo1");
-            ProcessConfDAO p = du.createProcess(foobar,foobar);
+            ProcessConfDAO p = du.createProcess(foobar,foobar,1);
             p.setProperty(foobar,"baz");
         } finally {
             conn.commit();

Modified: incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTest.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTest.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTest.java (original)
+++ incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTest.java Tue Jan 16 14:36:14 2007
@@ -18,41 +18,36 @@
  */
 package org.apache.ode.test;
 
-import java.io.File;
-import java.util.Collection;
-import java.util.Properties;
-import java.util.regex.Pattern;
-
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-import javax.xml.namespace.QName;
-
 import junit.framework.TestCase;
-
+import org.apache.ode.bpel.dao.BpelDAOConnectionFactory;
 import org.apache.ode.bpel.engine.BpelServerImpl;
-import org.apache.ode.bpel.iapi.ContextException;
-import org.apache.ode.bpel.iapi.Message;
-import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
-import org.apache.ode.bpel.iapi.ProcessStore;
-import org.apache.ode.bpel.iapi.ProcessStoreEvent;
-import org.apache.ode.bpel.iapi.ProcessStoreListener;
+import org.apache.ode.bpel.iapi.*;
 import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl;
 import org.apache.ode.store.ProcessStoreImpl;
 import org.apache.ode.test.scheduler.TestScheduler;
 import org.apache.ode.utils.DOMUtils;
 import org.w3c.dom.Element;
 
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.xml.namespace.QName;
+import java.io.File;
+import java.util.Collection;
+import java.util.Properties;
+import java.util.regex.Pattern;
+
 public abstract class BPELTest extends TestCase {
 
-	private BpelServerImpl server;
-    private ProcessStore store;
-	private MessageExchangeContextImpl mexContext;
-	private EntityManager em;
-	private EntityManagerFactory emf;
-    private TestScheduler scheduler;
+	protected BpelServerImpl server;
+    protected ProcessStore store;
+	protected MessageExchangeContextImpl mexContext;
+	protected EntityManager em;
+	protected EntityManagerFactory emf;
+    protected TestScheduler scheduler;
+    protected BpelDAOConnectionFactory _cf;
 
-	@Override
+    @Override
 	protected void setUp() throws Exception {
 		server = new BpelServerImpl();
 		mexContext = new MessageExchangeContextImpl();
@@ -62,7 +57,8 @@
 			emf = Persistence.createEntityManagerFactory("ode-unit-test-embedded");
 			em = emf.createEntityManager();
 			String pr = Persistence.PERSISTENCE_PROVIDER;
-			server.setDaoConnectionFactory(new org.apache.ode.dao.jpa.ojpa.BPELDAOConnectionFactoryImpl(em));
+            _cf = new org.apache.ode.dao.jpa.ojpa.BPELDAOConnectionFactoryImpl();
+            server.setDaoConnectionFactory(_cf);
             scheduler = new TestScheduler() {
                 @Override
                 public void begin() {
@@ -83,7 +79,8 @@
                 
             };
 		} else {
-			server.setDaoConnectionFactory(new BpelDAOConnectionFactoryImpl());
+            _cf = new BpelDAOConnectionFactoryImpl();
+            server.setDaoConnectionFactory(_cf);
             scheduler = new TestScheduler();
 		}
         server.setInMemDaoConnectionFactory(new BpelDAOConnectionFactoryImpl());
@@ -95,7 +92,8 @@
             public void onProcessStoreEvent(ProcessStoreEvent event) {
                 // bounce the process
                 server.unregister(event.pid);
-                server.register(store.getProcessConfiguration(event.pid));
+                if (event.type != ProcessStoreEvent.Type.UNDEPLOYED)
+                    server.register(store.getProcessConfiguration(event.pid));
             }
         });
         server.init();
@@ -156,8 +154,9 @@
 			Properties testProps = new Properties();
 			testProps.load(testPropsFile.toURL().openStream());
 			String responsePattern = testProps.getProperty("response1");
+            bpelE.printStackTrace();
 			testResponsePattern(bpelE.getMessage(), responsePattern);
-			return;
+            return;
 		} catch ( Exception e ) {
 			e.printStackTrace();
 			fail();

Added: incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/VersionedRedeployTest.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/VersionedRedeployTest.java?view=auto&rev=496884
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/VersionedRedeployTest.java (added)
+++ incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/VersionedRedeployTest.java Tue Jan 16 14:36:14 2007
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ode.test;
+
+import org.apache.ode.bpel.iapi.ProcessConf;
+import org.apache.ode.bpel.iapi.ProcessState;
+
+import javax.xml.namespace.QName;
+import java.io.File;
+
+/**
+ * @author Matthieu Riou <mriou at apache dot org>
+ */
+public class VersionedRedeployTest extends BPELTest {
+
+    QName qName1 = new QName("http://ode/bpel/unit-test", "HelloWorld2-1");
+    QName qName2 = new QName("http://ode/bpel/unit-test", "HelloWorld2-2");
+    QName qName3 = new QName("http://ode/bpel/unit-test", "HelloWorld2-3");
+
+    public void testRetireOld() throws Throwable {
+        go("target/test-classes/bpel/2.0/TestVersionedRedeploy/HelloWorld-1");
+        ProcessConf conf = store.getProcessConfiguration(qName1);
+        assertEquals(ProcessState.ACTIVE, conf.getState());
+
+        go("target/test-classes/bpel/2.0/TestVersionedRedeploy/HelloWorld-2");
+        // Now 1 should be retired and 2 active
+        conf = store.getProcessConfiguration(qName1);
+        assertEquals(ProcessState.RETIRED, conf.getState());
+        conf = store.getProcessConfiguration(qName2);
+        assertEquals(ProcessState.ACTIVE, conf.getState());
+
+        go("target/test-classes/bpel/2.0/TestVersionedRedeploy/HelloWorld-3");
+        // 1 and 2 should be retired and 3 active
+        conf = store.getProcessConfiguration(qName1);
+        assertEquals(ProcessState.RETIRED, conf.getState());
+        conf = store.getProcessConfiguration(qName2);
+        assertEquals(ProcessState.RETIRED, conf.getState());
+        conf = store.getProcessConfiguration(qName3);
+        assertEquals(ProcessState.ACTIVE, conf.getState());
+    }
+
+    public void testInstancePersistence() throws Throwable {
+        // Checking for each step that all instances still exist and that each process got one execution
+        // so no instance has been created after a process has been retired.
+        go("target/test-classes/bpel/2.0/TestVersionedRedeploy/HelloWorld-1");
+        assertEquals(1, _cf.getConnection().getProcess(qName1).getNumInstances());
+        go("target/test-classes/bpel/2.0/TestVersionedRedeploy/HelloWorld-2");
+        assertEquals(1, _cf.getConnection().getProcess(qName1).getNumInstances());
+        assertEquals(1, _cf.getConnection().getProcess(qName2).getNumInstances());
+        go("target/test-classes/bpel/2.0/TestVersionedRedeploy/HelloWorld-3");
+        assertEquals(1, _cf.getConnection().getProcess(qName1).getNumInstances());
+        assertEquals(1, _cf.getConnection().getProcess(qName2).getNumInstances());
+        assertEquals(1, _cf.getConnection().getProcess(qName3).getNumInstances());
+    }
+
+    public void testVersionedUndeployDeploy() throws Throwable {
+        go("target/test-classes/bpel/2.0/TestVersionedRedeploy/HelloWorld-1");
+        store.undeploy(new File("target/test-classes/bpel/2.0/TestVersionedRedeploy/HelloWorld-1"));
+        go("target/test-classes/bpel/2.0/TestVersionedRedeploy/HelloWorld-1");
+        // We should have a brand new version 1 with no version 2
+        assertEquals(1, _cf.getConnection().getProcess(qName2).getNumInstances());
+        assertNull(store.getProcessConfiguration(qName1));
+        assertNull(store.getProcessConfiguration(qName3));
+    }
+
+}

Added: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-1/HelloWorld2.bpel
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-1/HelloWorld2.bpel?view=auto&rev=496884
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-1/HelloWorld2.bpel (added)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-1/HelloWorld2.bpel Tue Jan 16 14:36:14 2007
@@ -0,0 +1,68 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<process name="HelloWorld2"
+    targetNamespace="http://ode/bpel/unit-test" 
+    xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+    xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+    xmlns:tns="http://ode/bpel/unit-test"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:test="http://ode/bpel/unit-test.wsdl">
+
+  <import location="HelloWorld2.wsdl"
+     namespace="http://ode/bpel/unit-test.wsdl"
+     importType="http://schemas.xmlsoap.org/wsdl/" />
+
+   <partnerLinks>
+      <partnerLink name="helloPartnerLink" 
+         partnerLinkType="test:HelloPartnerLinkType" 
+         myRole="me" />
+   </partnerLinks>
+    
+   <variables>
+     <variable name="myVar" messageType="test:HelloMessage"/>
+     <variable name="tmpVar" type="xsd:string"/>
+   </variables>
+        
+   <sequence>   
+       <receive 
+          name="start"
+          partnerLink="helloPartnerLink"
+          portType="test:HelloPortType"
+          operation="hello"
+          variable="myVar"
+          createInstance="yes"/>
+
+      <assign name="assign1">
+         <copy>
+            <from variable="myVar" part="TestPart"/>
+            <to variable="tmpVar"/>
+         </copy>
+         <copy>
+             <from>concat($tmpVar,' World')"</from>
+             <to variable="myVar" part="TestPart"/>
+         </copy>
+      </assign>
+       <reply name="end"  
+              partnerLink="helloPartnerLink"
+              portType="test:HelloPortType" 
+              operation="hello"
+              variable="myVar"/>
+   </sequence>
+</process>

Added: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-1/HelloWorld2.wsdl
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-1/HelloWorld2.wsdl?view=auto&rev=496884
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-1/HelloWorld2.wsdl (added)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-1/HelloWorld2.wsdl Tue Jan 16 14:36:14 2007
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="utf-8" ?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<wsdl:definitions
+    targetNamespace="http://ode/bpel/unit-test.wsdl"
+    xmlns="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:tns="http://ode/bpel/unit-test.wsdl"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+    xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+    xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+    
+    <wsdl:message name="HelloMessage">
+        <wsdl:part name="TestPart" type="xsd:string"/>
+    </wsdl:message>
+    
+    <wsdl:portType name="HelloPortType">
+        <wsdl:operation name="hello">
+            <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+            <wsdl:output message="tns:HelloMessage" name="TestOut"/>
+        </wsdl:operation>    
+    </wsdl:portType>
+    
+     <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="hello">
+            <soap:operation soapAction="" style="rpc"/>
+            <wsdl:input>
+                <soap:body
+                    namespace="http://ode/bpel/unit-test.wsdl"
+                    use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body
+                    namespace="http://ode/bpel/unit-test.wsdl" 
+                    use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:service name="HelloService">
+		<wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+     		<soap:address location="http://localhost:8080/ode/processes/helloWorld"/>
+		</wsdl:port>
+    </wsdl:service>
+    
+   <plnk:partnerLinkType name="HelloPartnerLinkType">
+       <plnk:role name="me" portType="tns:HelloPortType"/>
+       <plnk:role name="you" portType="tns:HelloPortType"/>
+   </plnk:partnerLinkType>
+</wsdl:definitions>
+

Added: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-1/deploy.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-1/deploy.xml?view=auto&rev=496884
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-1/deploy.xml (added)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-1/deploy.xml Tue Jan 16 14:36:14 2007
@@ -0,0 +1,12 @@
+<deploy xmlns="http://ode.fivesight.com/schemas/2006/06/27/dd" 
+	xmlns:pns="http://ode/bpel/unit-test" 
+	xmlns:wns="http://ode/bpel/unit-test.wsdl">
+
+
+	<process name="pns:HelloWorld2">
+		<active>true</active>
+		<provide partnerLink="helloPartnerLink">
+			<service name="wns:HelloService" port="HelloPort"/>
+		</provide>
+	</process>
+</deploy>

Added: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-1/test.properties
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-1/test.properties?view=auto&rev=496884
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-1/test.properties (added)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-1/test.properties Tue Jan 16 14:36:14 2007
@@ -0,0 +1,6 @@
+namespace=http://ode/bpel/unit-test.wsdl
+service=HelloService
+operation=hello
+request1=<message><TestPart>Hello</TestPart></message>
+response1=.*Hello World.*
+

Added: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/HelloWorld2.bpel
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/HelloWorld2.bpel?view=auto&rev=496884
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/HelloWorld2.bpel (added)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/HelloWorld2.bpel Tue Jan 16 14:36:14 2007
@@ -0,0 +1,49 @@
+<process name="HelloWorld2"
+    targetNamespace="http://ode/bpel/unit-test" 
+    xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+    xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+    xmlns:tns="http://ode/bpel/unit-test"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:test="http://ode/bpel/unit-test.wsdl">
+
+  <import location="HelloWorld2.wsdl"
+     namespace="http://ode/bpel/unit-test.wsdl"
+     importType="http://schemas.xmlsoap.org/wsdl/" />
+
+   <partnerLinks>
+      <partnerLink name="helloPartnerLink" 
+         partnerLinkType="test:HelloPartnerLinkType" 
+         myRole="me" />
+   </partnerLinks>
+    
+   <variables>
+     <variable name="myVar" messageType="test:HelloMessage"/>
+     <variable name="tmpVar" type="xsd:string"/>
+   </variables>
+        
+   <sequence>   
+       <receive 
+          name="start"
+          partnerLink="helloPartnerLink"
+          portType="test:HelloPortType"
+          operation="hello"
+          variable="myVar"
+          createInstance="yes"/>
+
+      <assign name="assign1">
+         <copy>
+            <from variable="myVar" part="TestPart"/>
+            <to variable="tmpVar"/>
+         </copy>
+         <copy>
+             <from>concat($tmpVar,' World')"</from>
+             <to variable="myVar" part="TestPart"/>
+         </copy>
+      </assign>
+       <reply name="end"  
+              partnerLink="helloPartnerLink"
+              portType="test:HelloPortType" 
+              operation="hello"
+              variable="myVar"/>
+   </sequence>
+</process>

Added: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/HelloWorld2.cbp
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/HelloWorld2.cbp?view=auto&rev=496884
==============================================================================
Binary files /tmp/tmpIWtFqf and /tmp/tmpoY-cdx differ

Added: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/HelloWorld2.wsdl
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/HelloWorld2.wsdl?view=auto&rev=496884
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/HelloWorld2.wsdl (added)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/HelloWorld2.wsdl Tue Jan 16 14:36:14 2007
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="utf-8" ?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<wsdl:definitions
+    targetNamespace="http://ode/bpel/unit-test.wsdl"
+    xmlns="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:tns="http://ode/bpel/unit-test.wsdl"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+    xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+    xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+    
+    <wsdl:message name="HelloMessage">
+        <wsdl:part name="TestPart" type="xsd:string"/>
+    </wsdl:message>
+    
+    <wsdl:portType name="HelloPortType">
+        <wsdl:operation name="hello">
+            <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+            <wsdl:output message="tns:HelloMessage" name="TestOut"/>
+        </wsdl:operation>    
+    </wsdl:portType>
+    
+     <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="hello">
+            <soap:operation soapAction="" style="rpc"/>
+            <wsdl:input>
+                <soap:body
+                    namespace="http://ode/bpel/unit-test.wsdl"
+                    use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body
+                    namespace="http://ode/bpel/unit-test.wsdl" 
+                    use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:service name="HelloService">
+		<wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+     		<soap:address location="http://localhost:8080/ode/processes/helloWorld"/>
+		</wsdl:port>
+    </wsdl:service>
+    
+   <plnk:partnerLinkType name="HelloPartnerLinkType">
+       <plnk:role name="me" portType="tns:HelloPortType"/>
+       <plnk:role name="you" portType="tns:HelloPortType"/>
+   </plnk:partnerLinkType>
+</wsdl:definitions>
+

Added: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/deploy.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/deploy.xml?view=auto&rev=496884
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/deploy.xml (added)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/deploy.xml Tue Jan 16 14:36:14 2007
@@ -0,0 +1,12 @@
+<deploy xmlns="http://ode.fivesight.com/schemas/2006/06/27/dd" 
+	xmlns:pns="http://ode/bpel/unit-test" 
+	xmlns:wns="http://ode/bpel/unit-test.wsdl">
+
+
+	<process name="pns:HelloWorld2">
+		<active>true</active>
+		<provide partnerLink="helloPartnerLink">
+			<service name="wns:HelloService" port="HelloPort"/>
+		</provide>
+	</process>
+</deploy>

Added: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/test.properties
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/test.properties?view=auto&rev=496884
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/test.properties (added)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-2/test.properties Tue Jan 16 14:36:14 2007
@@ -0,0 +1,6 @@
+namespace=http://ode/bpel/unit-test.wsdl
+service=HelloService
+operation=hello
+request1=<message><TestPart>Hello</TestPart></message>
+response1=.*Hello World.*
+

Added: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-3/HelloWorld2.bpel
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-3/HelloWorld2.bpel?view=auto&rev=496884
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-3/HelloWorld2.bpel (added)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-3/HelloWorld2.bpel Tue Jan 16 14:36:14 2007
@@ -0,0 +1,49 @@
+<process name="HelloWorld2"
+    targetNamespace="http://ode/bpel/unit-test" 
+    xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+    xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+    xmlns:tns="http://ode/bpel/unit-test"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:test="http://ode/bpel/unit-test.wsdl">
+
+  <import location="HelloWorld2.wsdl"
+     namespace="http://ode/bpel/unit-test.wsdl"
+     importType="http://schemas.xmlsoap.org/wsdl/" />
+
+   <partnerLinks>
+      <partnerLink name="helloPartnerLink" 
+         partnerLinkType="test:HelloPartnerLinkType" 
+         myRole="me" />
+   </partnerLinks>
+    
+   <variables>
+     <variable name="myVar" messageType="test:HelloMessage"/>
+     <variable name="tmpVar" type="xsd:string"/>
+   </variables>
+        
+   <sequence>   
+       <receive 
+          name="start"
+          partnerLink="helloPartnerLink"
+          portType="test:HelloPortType"
+          operation="hello"
+          variable="myVar"
+          createInstance="yes"/>
+
+      <assign name="assign1">
+         <copy>
+            <from variable="myVar" part="TestPart"/>
+            <to variable="tmpVar"/>
+         </copy>
+         <copy>
+             <from>concat($tmpVar,' World')"</from>
+             <to variable="myVar" part="TestPart"/>
+         </copy>
+      </assign>
+       <reply name="end"  
+              partnerLink="helloPartnerLink"
+              portType="test:HelloPortType" 
+              operation="hello"
+              variable="myVar"/>
+   </sequence>
+</process>

Added: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-3/HelloWorld2.wsdl
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-3/HelloWorld2.wsdl?view=auto&rev=496884
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-3/HelloWorld2.wsdl (added)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-3/HelloWorld2.wsdl Tue Jan 16 14:36:14 2007
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="utf-8" ?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<wsdl:definitions
+    targetNamespace="http://ode/bpel/unit-test.wsdl"
+    xmlns="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:tns="http://ode/bpel/unit-test.wsdl"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+    xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+    xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+    
+    <wsdl:message name="HelloMessage">
+        <wsdl:part name="TestPart" type="xsd:string"/>
+    </wsdl:message>
+    
+    <wsdl:portType name="HelloPortType">
+        <wsdl:operation name="hello">
+            <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+            <wsdl:output message="tns:HelloMessage" name="TestOut"/>
+        </wsdl:operation>    
+    </wsdl:portType>
+    
+     <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="hello">
+            <soap:operation soapAction="" style="rpc"/>
+            <wsdl:input>
+                <soap:body
+                    namespace="http://ode/bpel/unit-test.wsdl"
+                    use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body
+                    namespace="http://ode/bpel/unit-test.wsdl" 
+                    use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:service name="HelloService">
+		<wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+     		<soap:address location="http://localhost:8080/ode/processes/helloWorld"/>
+		</wsdl:port>
+    </wsdl:service>
+    
+   <plnk:partnerLinkType name="HelloPartnerLinkType">
+       <plnk:role name="me" portType="tns:HelloPortType"/>
+       <plnk:role name="you" portType="tns:HelloPortType"/>
+   </plnk:partnerLinkType>
+</wsdl:definitions>
+

Added: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-3/deploy.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-3/deploy.xml?view=auto&rev=496884
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-3/deploy.xml (added)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-3/deploy.xml Tue Jan 16 14:36:14 2007
@@ -0,0 +1,12 @@
+<deploy xmlns="http://ode.fivesight.com/schemas/2006/06/27/dd" 
+	xmlns:pns="http://ode/bpel/unit-test" 
+	xmlns:wns="http://ode/bpel/unit-test.wsdl">
+
+
+	<process name="pns:HelloWorld2">
+		<active>true</active>
+		<provide partnerLink="helloPartnerLink">
+			<service name="wns:HelloService" port="HelloPort"/>
+		</provide>
+	</process>
+</deploy>

Added: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-3/test.properties
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-3/test.properties?view=auto&rev=496884
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-3/test.properties (added)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestVersionedRedeploy/HelloWorld-3/test.properties Tue Jan 16 14:36:14 2007
@@ -0,0 +1,6 @@
+namespace=http://ode/bpel/unit-test.wsdl
+service=HelloService
+operation=hello
+request1=<message><TestPart>Hello</TestPart></message>
+response1=.*Hello World.*
+