Modified: incubator/ode/trunk/dao-hibernate/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/dao-hibernate/pom.xml?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/dao-hibernate/pom.xml (original)
+++ incubator/ode/trunk/dao-hibernate/pom.xml Tue Jan 16 14:36:14 2007
@@ -57,6 +57,12 @@
             <groupId>commons-logging</groupId>
             <artifactId>commons-logging</artifactId>
         </dependency>
+        <dependency>
+            <groupId>dom4j</groupId>
+            <artifactId>dom4j</artifactId>
+            <version>1.6.1</version>
+            <scope>compile</scope>
+        </dependency>
 
         <dependency>
             <groupId>jotm</groupId>

Modified: 
incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/BpelDAOConnectionImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/BpelDAOConnectionImpl.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- 
incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/BpelDAOConnectionImpl.java
 (original)
+++ 
incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/BpelDAOConnectionImpl.java
 Tue Jan 16 14:36:14 2007
@@ -22,26 +22,16 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.ode.bpel.common.BpelEventFilter;
 import org.apache.ode.bpel.common.InstanceFilter;
-import org.apache.ode.bpel.dao.BpelDAOConnection;
-import org.apache.ode.bpel.dao.MessageExchangeDAO;
-import org.apache.ode.bpel.dao.ProcessDAO;
-import org.apache.ode.bpel.dao.ProcessInstanceDAO;
-import org.apache.ode.bpel.dao.ScopeDAO;
+import org.apache.ode.bpel.dao.*;
 import org.apache.ode.bpel.evt.BpelEvent;
 import org.apache.ode.bpel.evt.ScopeEvent;
 import org.apache.ode.daohib.SessionManager;
-import org.apache.ode.daohib.bpel.hobj.HBpelEvent;
-import org.apache.ode.daohib.bpel.hobj.HLargeData;
-import org.apache.ode.daohib.bpel.hobj.HMessageExchange;
-import org.apache.ode.daohib.bpel.hobj.HProcess;
-import org.apache.ode.daohib.bpel.hobj.HProcessInstance;
-import org.apache.ode.daohib.bpel.hobj.HScope;
+import org.apache.ode.daohib.bpel.hobj.*;
 import org.apache.ode.daohib.bpel.ql.HibernateInstancesQueryCompiler;
 import org.apache.ode.ql.eval.skel.CommandEvaluator;
 import org.apache.ode.ql.tree.Builder;
 import org.apache.ode.ql.tree.BuilderFactory;
 import org.apache.ode.ql.tree.nodes.Query;
-import org.apache.ode.utils.ISO8601DateParser;
 import org.apache.ode.utils.SerializableUtils;
 import org.apache.ode.utils.stl.CollectionsX;
 import org.apache.ode.utils.stl.UnaryFunctionEx;
@@ -49,23 +39,14 @@
 import org.hibernate.FetchMode;
 import org.hibernate.HibernateException;
 import org.hibernate.Session;
-import org.hibernate.criterion.Example;
 import org.hibernate.criterion.Expression;
 import org.hibernate.criterion.Projections;
-import org.hibernate.criterion.Property;
-import org.hibernate.criterion.Restrictions;
 
 import javax.xml.namespace.QName;
 import java.io.ByteArrayOutputStream;
 import java.io.ObjectOutputStream;
 import java.sql.Timestamp;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
 
 /**
  * Hibernate-based [EMAIL PROTECTED] BpelDAOConnection} implementation.
@@ -95,13 +76,14 @@
         return mex == null ? null : new MessageExchangeDaoImpl(_sm, mex);
     }
 
-    public ProcessDAO createProcess(QName pid, QName type, String guid) {
+    public ProcessDAO createProcess(QName pid, QName type, String guid, int 
version) {
         HProcess process = new HProcess();
         process.setProcessId(pid.toString());
         process.setTypeName(type.getLocalPart());
         process.setTypeNamespace(type.getNamespaceURI());
         process.setDeployDate(new Date());
         process.setGuid(guid);
+        process.setVersion(version);
         _session.save(process);
         return new ProcessDaoImpl(_sm, process);
     }

Modified: 
incubator/ode/trunk/dao-jpa-ojpa-derby/src/main/descriptors/persistence.derby.xml
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa-ojpa-derby/src/main/descriptors/persistence.derby.xml?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- 
incubator/ode/trunk/dao-jpa-ojpa-derby/src/main/descriptors/persistence.derby.xml
 (original)
+++ 
incubator/ode/trunk/dao-jpa-ojpa-derby/src/main/descriptors/persistence.derby.xml
 Tue Jan 16 14:36:14 2007
@@ -19,6 +19,7 @@
         <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>
 
         <properties>
             <!-- Properties for an embedded Derby connection -->

Modified: incubator/ode/trunk/dao-jpa/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/pom.xml?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/dao-jpa/pom.xml (original)
+++ incubator/ode/trunk/dao-jpa/pom.xml Tue Jan 16 14:36:14 2007
@@ -18,31 +18,32 @@
   ~ under the License.
   -->
 <project>
-  <groupId>org.apache.ode</groupId>
-  <artifactId>ode-dao-jpa</artifactId>
-  <name>ODE :: JPA DAO Impl</name>
-  <description>A JPA Implementation of the ODE DAO</description>
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
     <groupId>org.apache.ode</groupId>
-    <artifactId>ode</artifactId>
+    <artifactId>ode-dao-jpa</artifactId>
+    <name>ODE :: JPA DAO Impl</name>
+    <description>A JPA Implementation of the ODE DAO</description>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.ode</groupId>
+        <artifactId>ode</artifactId>
+        <version>2.0-SNAPSHOT</version>
+    </parent>
     <version>2.0-SNAPSHOT</version>
-  </parent>
-  <version>2.0-SNAPSHOT</version>
-  
-  
-  <dependencies>
-   <dependency>
-      <groupId>org.apache.ode</groupId>
-      <artifactId>ode-bpel-dao</artifactId>
-    </dependency>
-    <dependency>
-       <groupId>javax.persistence</groupId>
-       <artifactId>persistence-api</artifactId>
-      <version>1.0</version>
-    </dependency>
 
-  </dependencies>
- 
- 
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.ode</groupId>
+            <artifactId>ode-bpel-dao</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>javax.persistence</groupId>
+            <artifactId>persistence-api</artifactId>
+            <version>1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.openjpa</groupId>
+            <artifactId>openjpa-all</artifactId>
+        </dependency>
+    </dependencies>
+
 </project>

Modified: 
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/BPELDAOConnectionImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/BPELDAOConnectionImpl.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- 
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/BPELDAOConnectionImpl.java
 (original)
+++ 
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/BPELDAOConnectionImpl.java
 Tue Jan 16 14:36:14 2007
@@ -88,8 +88,8 @@
         return ret;
     }
 
-    public ProcessDAO createProcess(QName pid, QName type, String guid) {
-        ProcessDAOImpl ret = new ProcessDAOImpl(pid,type,guid,this);
+    public ProcessDAO createProcess(QName pid, QName type, String guid, int 
version) {
+        ProcessDAOImpl ret = new ProcessDAOImpl(pid,type,guid,this,version);
 
         _processes.add(ret);
         return ret;
@@ -125,10 +125,9 @@
     }
 
     public ProcessDAO getProcess(QName processId) {
-        for ( ProcessDAOImpl p : _processes){
-            if ( p.getProcessId().equals(processId)) return p;
-        }
-        return null;
+        List daos = _em.createQuery("select p from ProcessDAOImpl 
p").getResultList();
+        if (daos.size() > 0) return (ProcessDAO) daos.get(0);
+        else return null;
     }
 
     public ScopeDAO getScope(Long siidl) {
@@ -169,7 +168,7 @@
         return new ArrayList<ProcessDAO>(_processes);
     }
 
-    EntityManager getEntityManager() {
+    public EntityManager getEntityManager() {
         return _em;
     }
 

Modified: 
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- 
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java
 (original)
+++ 
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java
 Tue Jan 16 14:36:14 2007
@@ -19,97 +19,89 @@
 
 package org.apache.ode.dao.jpa;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import javax.persistence.Basic;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.OneToMany;
-import javax.persistence.Table;
-import javax.persistence.Version;
-
 import org.apache.ode.bpel.common.CorrelationKey;
 import org.apache.ode.bpel.dao.CorrelatorDAO;
 import org.apache.ode.bpel.dao.MessageExchangeDAO;
 import org.apache.ode.bpel.dao.MessageRouteDAO;
 import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+import org.apache.openjpa.persistence.jdbc.ElementJoinColumn;
+
+import javax.persistence.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
 
 @Entity
 @Table(name="ODE_CORRELATOR")
 public class CorrelatorDAOImpl implements CorrelatorDAO {
-       
-       @Id @Column(name="CORRELATOR_ID") 
-       @GeneratedValue(strategy=GenerationType.AUTO)
-       private Long _correlatorId;
-       @Basic @Column(name="CORRELATOR_KEY") private String _correlatorKey;
-       @OneToMany(fetch=FetchType.LAZY,cascade={CascadeType.ALL})
-       private Collection<MessageRouteDAOImpl> _routes = new 
ArrayList<MessageRouteDAOImpl>();
-       @OneToMany(fetch=FetchType.LAZY,cascade={CascadeType.ALL})
-       private Collection<MessageExchangeDAOImpl> _exchanges = new 
ArrayList<MessageExchangeDAOImpl>();
-       
-       @Version @Column(name="VERSION") private long _version;
-       
-       public CorrelatorDAOImpl(){}
-       public CorrelatorDAOImpl(String correlatorKey) {
-               _correlatorKey = correlatorKey;
-       }
-
-       public void addRoute(String routeGroupId, ProcessInstanceDAO target,
-                       int index, CorrelationKey correlationKey) {
-               MessageRouteDAOImpl mr = new 
MessageRouteDAOImpl(correlationKey,routeGroupId,index,(ProcessInstanceDAOImpl)target);
-               
-               _routes.add(mr);
-       }
-
-       public MessageExchangeDAO dequeueMessage(CorrelationKey correlationKey) 
{
-               for (Iterator itr=_exchanges.iterator(); itr.hasNext();){
-                       MessageExchangeDAOImpl mex = 
(MessageExchangeDAOImpl)itr.next();
-                       if (mex.getCorrelationKeys().contains(correlationKey)) {
-                               itr.remove();
-                               return mex;
-                       }
-               }
-               return null;
-       }
-
-       public void enqueueMessage(MessageExchangeDAO mex,
-                       CorrelationKey[] correlationKeys) {
-               for (CorrelationKey key : correlationKeys ) {
-                       ((MessageExchangeDAOImpl)mex).addCorrelationKey(key);
-               }
-               _exchanges.add((MessageExchangeDAOImpl)mex);
-
-       }
-
-       public MessageRouteDAO findRoute(CorrelationKey correlationKey) {
-               for (MessageRouteDAOImpl mr : _routes ) {
-                       if ( mr.getCorrelationKey().equals(correlationKey)) 
return mr;
-               }
-               return null;
-       }
-
-       public String getCorrelatorId() {
-               return _correlatorKey;
-       }
-
-       public void removeRoutes(String routeGroupId, ProcessInstanceDAO 
target) {
-               // remove route across all correlators of the process
-               ((ProcessInstanceDAOImpl)target).removeRoutes(routeGroupId);
-       }
-       
-       void removeLocalRoutes(String routeGroupId, ProcessInstanceDAO target) {
-               for (Iterator itr=_routes.iterator(); itr.hasNext(); ) {
-                       MessageRouteDAOImpl mr = 
(MessageRouteDAOImpl)itr.next();
-                       if ( mr.getGroupId().equals(routeGroupId) &&
-                                       mr.getTargetInstance().equals(target))
-                               itr.remove();
-               }               
-       }
+
+    @Id @Column(name="CORRELATOR_ID")
+    @GeneratedValue(strategy=GenerationType.AUTO)
+    private Long _correlatorId;
+    @Basic @Column(name="CORRELATOR_KEY") private String _correlatorKey;
+    @OneToMany(fetch=FetchType.LAZY,cascade={CascadeType.ALL})
+    @ElementJoinColumn(name="CORR_ID", referencedColumnName="ROUTE_ID")
+    private Collection<MessageRouteDAOImpl> _routes = new 
ArrayList<MessageRouteDAOImpl>();
+    @OneToMany(fetch=FetchType.LAZY,cascade={CascadeType.ALL})
+    @ElementJoinColumn(name="CORR_ID", referencedColumnName="MEX_ID")
+    private Collection<MessageExchangeDAOImpl> _exchanges = new 
ArrayList<MessageExchangeDAOImpl>();
+
+    @Version @Column(name="VERSION") private long _version;
+
+    public CorrelatorDAOImpl(){}
+    public CorrelatorDAOImpl(String correlatorKey) {
+        _correlatorKey = correlatorKey;
+    }
+
+    public void addRoute(String routeGroupId, ProcessInstanceDAO target,
+                         int index, CorrelationKey correlationKey) {
+        MessageRouteDAOImpl mr = new 
MessageRouteDAOImpl(correlationKey,routeGroupId,index,(ProcessInstanceDAOImpl)target);
+
+        _routes.add(mr);
+    }
+
+    public MessageExchangeDAO dequeueMessage(CorrelationKey correlationKey) {
+        for (Iterator itr=_exchanges.iterator(); itr.hasNext();){
+            MessageExchangeDAOImpl mex = (MessageExchangeDAOImpl)itr.next();
+            if (mex.getCorrelationKeys().contains(correlationKey)) {
+                itr.remove();
+                return mex;
+            }
+        }
+        return null;
+    }
+
+    public void enqueueMessage(MessageExchangeDAO mex,
+                               CorrelationKey[] correlationKeys) {
+        for (CorrelationKey key : correlationKeys ) {
+            ((MessageExchangeDAOImpl)mex).addCorrelationKey(key);
+        }
+        _exchanges.add((MessageExchangeDAOImpl)mex);
+
+    }
+
+    public MessageRouteDAO findRoute(CorrelationKey correlationKey) {
+        for (MessageRouteDAOImpl mr : _routes ) {
+            if ( mr.getCorrelationKey().equals(correlationKey)) return mr;
+        }
+        return null;
+    }
+
+    public String getCorrelatorId() {
+        return _correlatorKey;
+    }
+
+    public void removeRoutes(String routeGroupId, ProcessInstanceDAO target) {
+        // remove route across all correlators of the process
+        ((ProcessInstanceDAOImpl)target).removeRoutes(routeGroupId);
+    }
+
+    void removeLocalRoutes(String routeGroupId, ProcessInstanceDAO target) {
+        for (Iterator itr=_routes.iterator(); itr.hasNext(); ) {
+            MessageRouteDAOImpl mr = (MessageRouteDAOImpl)itr.next();
+            if ( mr.getGroupId().equals(routeGroupId) &&
+                    mr.getTargetInstance().equals(target))
+                itr.remove();
+        }
+    }
 }

Modified: 
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessDAOImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessDAOImpl.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- 
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessDAOImpl.java
 (original)
+++ 
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessDAOImpl.java
 Tue Jan 16 14:36:14 2007
@@ -19,141 +19,124 @@
 
 package org.apache.ode.dao.jpa;
 
-import java.util.ArrayList;
-import java.util.Collection;
+import org.apache.ode.bpel.common.CorrelationKey;
+import org.apache.ode.bpel.dao.*;
+import org.apache.openjpa.persistence.jdbc.ElementJoinColumn;
 
-import javax.persistence.Basic;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EntityManager;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceUnit;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-import javax.persistence.Version;
+import javax.persistence.*;
 import javax.xml.namespace.QName;
-
-import org.apache.ode.bpel.common.CorrelationKey;
-import org.apache.ode.bpel.dao.CorrelatorDAO;
-import org.apache.ode.bpel.dao.ProcessDAO;
-import org.apache.ode.bpel.dao.ProcessInstanceDAO;
-import org.apache.ode.bpel.dao.ScopeDAO;
-import org.apache.ode.bpel.dao.CorrelationSetDAO;
+import java.util.ArrayList;
+import java.util.Collection;
 
 @Entity
 @Table(name="ODE_PROCESS")
 public class ProcessDAOImpl implements ProcessDAO {
-       
-       @Id @Column(name="PROCESS_ID") 
-       @GeneratedValue(strategy=GenerationType.AUTO)
-       private Long _id;
-       @Basic @Column(name="NUMBER_OF_INSTANCES") private int _numInstances;
-       @Basic @Column(name="PROCESS_KEY") private QName _processKey;
-       @Basic @Column(name="PROCESS_TYPE") private QName _processType;
-       @Basic @Column(name="GUID") private String _guid;
-       @Version @Column(name="VERSION") private int _version;
-       
-       
@OneToMany(targetEntity=ProcessInstanceDAOImpl.class,mappedBy="_process",fetch=FetchType.LAZY,cascade={CascadeType.ALL})
-       private Collection<ProcessInstanceDAO> _instances = new 
ArrayList<ProcessInstanceDAO>();
-       @OneToMany(fetch=FetchType.LAZY,cascade={CascadeType.ALL})
-       private Collection<CorrelatorDAOImpl> _correlators = new 
ArrayList<CorrelatorDAOImpl>();
-       @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST})
-       @Column(name="CONNECTION_ID")
-       private BPELDAOConnectionImpl _connection;
-       
-       public ProcessDAOImpl() {}
-       public ProcessDAOImpl(QName key, QName type, String guid, 
BPELDAOConnectionImpl connection) {
-               _processKey = key;
-               _processType = type;
-               _connection = connection;
-               _guid = guid;
-       }
-       
-       public void addCorrelator(String correlator) {
-               CorrelatorDAOImpl corr = new CorrelatorDAOImpl(correlator);
-               
-               _correlators.add(corr);
-       }
-
-       public ProcessInstanceDAO createInstance(
-                       CorrelatorDAO instantiatingCorrelator) {
-               ProcessInstanceDAOImpl inst = new 
ProcessInstanceDAOImpl((CorrelatorDAOImpl)instantiatingCorrelator, 
this,_connection);
-               _connection.getEntityManager().persist(inst);
-               _instances.add(inst);
-               _numInstances++;
-               
-               return inst;
-       }
-
-       public void delete() {
-               _connection.removeProcess(this);
-       }
-
-       public Collection<ProcessInstanceDAO> findInstance(CorrelationKey 
cckey) {
-               Collection<ProcessInstanceDAO> ret = new 
ArrayList<ProcessInstanceDAO>();
-               
-               for (ProcessInstanceDAO pi : _instances) {
-                       scope_block:for (ScopeDAO s : pi.getScopes()) {
-                               for (CorrelationSetDAO c : 
s.getCorrelationSets()) {
-                                       if (c.getValue().equals(cckey)) 
ret.add(pi);
-                                       break scope_block; 
-                               }
-                       }
-               }
-               return ret;
-       }
-
-       public CorrelatorDAO getCorrelator(String correlatorId) {
-               for ( CorrelatorDAO c : _correlators ) {
-                       if ( c.getCorrelatorId().equals(correlatorId) ) return 
c;
-               }
-               return null;
-       }
-
-       public ProcessInstanceDAO getInstance(Long iid) {
-               for (ProcessInstanceDAO pi : _instances) {
-                       if ( pi.getInstanceId().equals(iid) ) return pi;
-               }
-               return null;
-       }
-
-       public int getNumInstances() {
-               return _numInstances;
-       }
-
-       public QName getProcessId() {
-               return _processKey;
-       }
-
-       public QName getType() {
-               return _processType;
-       }
-
-       public int getVersion() {
-               return _version;
-       }
-
-       public void instanceCompleted(ProcessInstanceDAO instance) {
-               // TODO Auto-generated method stub
-               String tmp = "complete";
-               
-       }
 
-       public void removeRoutes(String routeId, ProcessInstanceDAO target) {
+    @Id @Column(name="PROCESS_ID")
+    @GeneratedValue(strategy=GenerationType.AUTO)
+    private Long _id;
+    @Basic @Column(name="NUMBER_OF_INSTANCES") private int _numInstances;
+    @Basic @Column(name="PROCESS_KEY") private QName _processKey;
+    @Basic @Column(name="PROCESS_TYPE") private QName _processType;
+    @Basic @Column(name="GUID") private String _guid;
+    @Version @Column(name="VERSION") private int _version;
+
+    
@OneToMany(targetEntity=ProcessInstanceDAOImpl.class,mappedBy="_process",fetch=FetchType.LAZY,cascade={CascadeType.ALL})
+    private Collection<ProcessInstanceDAO> _instances = new 
ArrayList<ProcessInstanceDAO>();
+    @OneToMany(fetch=FetchType.LAZY,cascade={CascadeType.ALL})
+    @ElementJoinColumn(name="PROC_ID", referencedColumnName="CORR_ID")
+    private Collection<CorrelatorDAOImpl> _correlators = new 
ArrayList<CorrelatorDAOImpl>();
+    @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST})
+    @Column(name="CONNECTION_ID")
+    private BPELDAOConnectionImpl _connection;
+
+    public ProcessDAOImpl() {}
+    public ProcessDAOImpl(QName key, QName type, String guid, 
BPELDAOConnectionImpl connection, int version) {
+        _processKey = key;
+        _processType = type;
+        _connection = connection;
+        _guid = guid;
+        _version = version;
+    }
+
+    public void addCorrelator(String correlator) {
+        CorrelatorDAOImpl corr = new CorrelatorDAOImpl(correlator);
+
+        _correlators.add(corr);
+    }
+
+    public ProcessInstanceDAO createInstance(
+            CorrelatorDAO instantiatingCorrelator) {
+        ProcessInstanceDAOImpl inst = new 
ProcessInstanceDAOImpl((CorrelatorDAOImpl)instantiatingCorrelator, 
this,_connection);
+        _connection.getEntityManager().persist(inst);
+        _instances.add(inst);
+        _numInstances++;
+
+        return inst;
+    }
+
+    public void delete() {
+        _connection.removeProcess(this);
+    }
+
+    public Collection<ProcessInstanceDAO> findInstance(CorrelationKey cckey) {
+        Collection<ProcessInstanceDAO> ret = new 
ArrayList<ProcessInstanceDAO>();
+
+        for (ProcessInstanceDAO pi : _instances) {
+            scope_block:for (ScopeDAO s : pi.getScopes()) {
+                for (CorrelationSetDAO c : s.getCorrelationSets()) {
+                    if (c.getValue().equals(cckey)) ret.add(pi);
+                    break scope_block;
+                }
+            }
+        }
+        return ret;
+    }
+
+    public CorrelatorDAO getCorrelator(String correlatorId) {
+        for ( CorrelatorDAO c : _correlators ) {
+            if ( c.getCorrelatorId().equals(correlatorId) ) return c;
+        }
+        return null;
+    }
+
+    public ProcessInstanceDAO getInstance(Long iid) {
+        for (ProcessInstanceDAO pi : _instances) {
+            if ( pi.getInstanceId().equals(iid) ) return pi;
+        }
+        return null;
+    }
+
+    public int getNumInstances() {
+        return _numInstances;
+    }
+
+    public QName getProcessId() {
+        return _processKey;
+    }
+
+    public QName getType() {
+        return _processType;
+    }
+
+    public int getVersion() {
+        return _version;
+    }
+
+    public void instanceCompleted(ProcessInstanceDAO instance) {
+        // TODO Auto-generated method stub
+        String tmp = "complete";
+
+    }
+
+    public void removeRoutes(String routeId, ProcessInstanceDAO target) {
         for (CorrelatorDAO c : _correlators) {
             ((CorrelatorDAOImpl)c).removeLocalRoutes(routeId, target);
         }
 
-       }
-       public String getGuid() {
-               return _guid;
-       }
+    }
+    public String getGuid() {
+        return _guid;
+    }
 
 }

Modified: 
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessInstanceDAOImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessInstanceDAOImpl.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- 
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessInstanceDAOImpl.java
 (original)
+++ 
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessInstanceDAOImpl.java
 Tue Jan 16 14:36:14 2007
@@ -22,6 +22,7 @@
 import org.apache.ode.bpel.common.ProcessState;
 import org.apache.ode.bpel.dao.*;
 import org.apache.ode.bpel.evt.ProcessInstanceEvent;
+import org.apache.openjpa.persistence.jdbc.ElementJoinColumn;
 import org.w3c.dom.Element;
 
 import javax.persistence.*;
@@ -49,7 +50,8 @@
        
@OneToMany(targetEntity=ScopeDAOImpl.class,mappedBy="_processInstance",fetch=FetchType.LAZY,cascade={CascadeType.ALL})
        private Collection<ScopeDAO> _scopes = new ArrayList<ScopeDAO>();
        
@OneToMany(targetEntity=ActivityRecoveryDAOImpl.class,fetch=FetchType.LAZY,cascade={CascadeType.ALL})
-       private Collection<ActivityRecoveryDAO> _recoveries = new 
ArrayList<ActivityRecoveryDAO>();
+    @ElementJoinColumn(name="INST_ID", referencedColumnName="REC_ID")
+    private Collection<ActivityRecoveryDAO> _recoveries = new 
ArrayList<ActivityRecoveryDAO>();
        @OneToOne(fetch=FetchType.LAZY,cascade={CascadeType.ALL})
        @Column(name="FAULT_ID")
        private FaultDAOImpl _fault;

Modified: 
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ScopeDAOImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ScopeDAOImpl.java?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- 
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ScopeDAOImpl.java
 (original)
+++ 
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ScopeDAOImpl.java
 Tue Jan 16 14:36:14 2007
@@ -22,6 +22,7 @@
 import org.apache.ode.bpel.common.BpelEventFilter;
 import org.apache.ode.bpel.dao.*;
 import org.apache.ode.bpel.evt.BpelEvent;
+import org.apache.openjpa.persistence.jdbc.ElementJoinColumn;
 
 import javax.persistence.*;
 import java.util.ArrayList;
@@ -49,7 +50,8 @@
        
@OneToMany(targetEntity=CorrelationSetDAOImpl.class,mappedBy="_scope",fetch=FetchType.LAZY,cascade={CascadeType.ALL})
        private Collection<CorrelationSetDAO> _correlationSets = new 
ArrayList<CorrelationSetDAO>();
        
@OneToMany(targetEntity=PartnerLinkDAOImpl.class,fetch=FetchType.LAZY,cascade={CascadeType.ALL})
-       private Collection<PartnerLinkDAO> _partnerLinks = new 
ArrayList<PartnerLinkDAO>();
+    @ElementJoinColumn(name="SCOPE_ID", referencedColumnName="PLINK_ID")
+    private Collection<PartnerLinkDAO> _partnerLinks = new 
ArrayList<PartnerLinkDAO>();
        
@OneToMany(targetEntity=XmlDataDAOImpl.class,mappedBy="_scope",fetch=FetchType.LAZY,cascade={CascadeType.ALL})
        private Collection<XmlDataDAO> _variables = new ArrayList<XmlDataDAO>();
        

Modified: incubator/ode/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/pom.xml?view=diff&rev=496884&r1=496883&r2=496884
==============================================================================
--- incubator/ode/trunk/pom.xml (original)
+++ incubator/ode/trunk/pom.xml Tue Jan 16 14:36:14 2007
@@ -274,7 +274,6 @@
                <updatePolicy>never</updatePolicy>
             </snapshots>
         </repository>
-        <!-- Repository is down;
                 <repository>
                     <id>apache-incubator</id>
                     <name>Apache Incubator Repository</name>
@@ -284,7 +283,6 @@
                        <updatePolicy>never</updatePolicy>
                     </snapshots>
                 </repository>
-        -->
         <repository>
             <id>central</id>
             <name>Maven Repository Switchboard</name>
@@ -343,21 +341,26 @@
             <name>Maven Repository Switchboard</name>
             <url>http://repo1.maven.org/maven2</url>
         </pluginRepository>
-        <!--pluginRepository>
+        <pluginRepository>
             <id>codehaus</id>
             <name>Maven Central Plugins Development Repository</name>
             <url>http://snapshots.maven.codehaus.org/maven2</url>
-        </pluginRepository-->
+        </pluginRepository>
         <pluginRepository>
             <id>ibiblio</id>
             <name>ibiblio</name>
             <url>http://www.ibiblio.org/maven2</url>
         </pluginRepository>
-        <!--pluginRepository>
+        <pluginRepository>
             <id>apache-incubator</id>
             <name>Apache Incubator Repository</name>
             <url>http://people.apache.org/repo/m2-incubating-repository</url>
-        </pluginRepository-->
+        </pluginRepository>
+        <pluginRepository>
+            <id>apache-snapshots</id>
+            <name>Apache Snapshot Repository</name>
+            <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+        </pluginRepository>
     </pluginRepositories>
 
 


Reply via email to