You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by je...@apache.org on 2010/08/18 06:12:59 UTC

svn commit: r986561 [2/13] - in /ode/trunk: ./ axis2-war/ axis2-war/src/main/assembly/ axis2-war/src/test/java/org/apache/ode/axis2/ axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/ axis2-war/src/test/java/org/apache/ode/bpel/dao/ axis2-wa...

Modified: ode/trunk/axis2-war/src/test/resources/test-log4j.properties
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/test-log4j.properties?rev=986561&r1=986560&r2=986561&view=diff
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/test-log4j.properties (original)
+++ ode/trunk/axis2-war/src/test/resources/test-log4j.properties Wed Aug 18 04:12:49 2010
@@ -22,20 +22,22 @@
 # The logging properties used during tests..
 #
 #log4j.rootLogger=DEBUG, file
-log4j.rootLogger=INFO, file
+log4j.rootLogger=DEBUG, file
 
 log4j.appender.file=org.apache.log4j.FileAppender
 log4j.appender.file.File=target/test/test.log
 log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} | %-5p | %-10t | %-24.24c{1} | %-30.30C %4L | %m%n
+log4j.appender.file.layout.ConversionPattern=%d %-5p [%c] %m%n
 
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} | %-5p | %-10t | %-24.24c{1} | %-30.30C %4L | %m%n
+log4j.appender.stdout.layout.ConversionPattern=%d %-5p [%c] %m%n
 
 log4j.category.httpclient=INFO
 log4j.category.httpclient.Wire=INFO
-log4j.category.org.apache.ode=INFO
+log4j.category.org.apache.ode=DEBUG
+log4j.category.org.apache.ode.sql=INFO
 log4j.category.hibernate=INFO
 log4j.category.org.hibernate=INFO
 log4j.category.org.apache.axis2=INFO
+log4j.category.openjpa=INFO

Modified: ode/trunk/axis2-war/src/test/webapp/WEB-INF/conf.jpa-derby/ode-axis2.properties
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/webapp/WEB-INF/conf.jpa-derby/ode-axis2.properties?rev=986561&r1=986560&r2=986561&view=diff
==============================================================================
--- ode/trunk/axis2-war/src/test/webapp/WEB-INF/conf.jpa-derby/ode-axis2.properties (original)
+++ ode/trunk/axis2-war/src/test/webapp/WEB-INF/conf.jpa-derby/ode-axis2.properties Wed Aug 18 04:12:49 2010
@@ -15,4 +15,9 @@
 #    limitations under the License.
 #
 
-ode-axis2.dao.factory=org.apache.ode.axis2.instancecleanup.JpaDaoConnectionFactoryImpl
\ No newline at end of file
+ode-axis2.dao.factory=org.apache.ode.axis2.instancecleanup.JpaDaoConnectionFactoryImpl
+#ode-axis2.db.mode=INTERNAL
+#ode-axis2.db.int.jdbcurl=jdbc:h2:file:${basedir}/target/webapp/WEB-INF/jpadb/ode-ojpa-h2;DB_CLOSE_ON_EXIT=false;user=sa;TRACE_LEVEL_FILE=3
+#ode-axis2.db.int.driver=org.h2.Driver
+#ode-axis2.acquireTransactionLocks=true
+ode-axis2.db.emb.type=derby
\ No newline at end of file

Modified: ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java?rev=986561&r1=986560&r2=986561&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java Wed Aug 18 04:12:49 2010
@@ -58,7 +58,6 @@ import org.apache.ode.axis2.service.Depl
 import org.apache.ode.axis2.service.ManagementService;
 import org.apache.ode.axis2.util.ClusterUrlTransformer;
 import org.apache.ode.bpel.connector.BpelServerConnector;
-import org.apache.ode.bpel.dao.BpelDAOConnectionFactory;
 import org.apache.ode.bpel.engine.BpelServerImpl;
 import org.apache.ode.bpel.engine.CountLRUDehydrationPolicy;
 import org.apache.ode.bpel.engine.cron.CronScheduler;
@@ -73,6 +72,8 @@ import org.apache.ode.bpel.intercept.Mes
 import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl;
 import org.apache.ode.bpel.pmapi.InstanceManagement;
 import org.apache.ode.bpel.pmapi.ProcessManagement;
+import org.apache.ode.dao.bpel.BpelDAOConnectionFactory;
+import org.apache.ode.dao.store.ConfStoreDAOConnectionFactory;
 import org.apache.ode.il.dbutil.Database;
 import org.apache.ode.scheduler.simple.JdbcDelegate;
 import org.apache.ode.scheduler.simple.SimpleScheduler;
@@ -109,6 +110,8 @@ public class ODEServer {
     protected TransactionManager _txMgr;
 
     protected BpelDAOConnectionFactory _daoCF;
+    
+    protected ConfStoreDAOConnectionFactory _storeDaoCF;
 
     protected ExecutorService _executorService;
 
@@ -435,6 +438,7 @@ public class ODEServer {
         __log.info(__msgs.msgOdeUsingDAOImpl(_odeConfig.getDAOConnectionFactory()));
         try {
             _daoCF = _db.createDaoCF();
+            _storeDaoCF = _db.createDaoStoreCF();
         } catch (Exception ex) {
             String errmsg = __msgs.msgDAOInstantiationFailed(_odeConfig.getDAOConnectionFactory());
             __log.error(errmsg, ex);
@@ -454,7 +458,7 @@ public class ODEServer {
     }
 
     protected ProcessStoreImpl createProcessStore(EndpointReferenceContext eprContext, DataSource ds) {
-        return new ProcessStoreImpl(eprContext, ds, _odeConfig.getDAOConnectionFactory(), _odeConfig, false);
+        return new ProcessStoreImpl(eprContext,_txMgr,_storeDaoCF);
     }
 
     protected Scheduler createScheduler() {

Modified: ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/OdeGlobalConfig.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/OdeGlobalConfig.java?rev=986561&r1=986560&r2=986561&view=diff
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/OdeGlobalConfig.java (original)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/OdeGlobalConfig.java Wed Aug 18 04:12:49 2010
@@ -24,7 +24,7 @@ public class OdeGlobalConfig {
         return Boolean.parseBoolean(System.getProperty("org.apache.ode.queueInOutMessages", "true"));
     }
     public static boolean autoRetireProcess() {
-        return Boolean.parseBoolean(System.getProperty("org.apache.ode.autoRetireProcess", "false"));
+        return Boolean.parseBoolean(System.getProperty("org.apache.ode.autoRetireProcess", "true"));
     }
     public static boolean autoincrementVersion() {
         return Boolean.parseBoolean(System.getProperty("org.apache.ode.autoincrementVersion", "true"));

Modified: ode/trunk/bpel-dao/pom.xml
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/pom.xml?rev=986561&r1=986560&r2=986561&view=diff
==============================================================================
--- ode/trunk/bpel-dao/pom.xml (original)
+++ ode/trunk/bpel-dao/pom.xml Wed Aug 18 04:12:49 2010
@@ -36,5 +36,9 @@
       <groupId>org.apache.ode</groupId>
       <artifactId>ode-bpel-api</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-jta_1.1_spec</artifactId>
+    </dependency>  
    </dependencies>
 </project>

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/DAOConnection.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/DAOConnection.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/DAOConnection.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/DAOConnection.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,27 @@
+/*
+ * 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.dao;
+
+public interface DAOConnection {
+
+  void close();
+
+  boolean isClosed();
+
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/DAOConnectionFactory.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/DAOConnectionFactory.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/DAOConnectionFactory.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/DAOConnectionFactory.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,43 @@
+/*
+ * 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.dao;
+
+import java.util.Properties;
+import javax.transaction.TransactionManager;
+
+public interface DAOConnectionFactory<C extends DAOConnection> {
+
+  /**
+   *
+   * @return a connection object to a store.
+   */
+  public C getConnection();
+  
+  /**
+   * Initializes the connection factory with properties required to establish a
+   * connection.
+   *
+   * @param properties
+   */
+
+  <E> void init(Properties p, TransactionManager txm, E envCtx);
+
+  void shutdown();
+
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ActivityRecoveryDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ActivityRecoveryDAO.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ActivityRecoveryDAO.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ActivityRecoveryDAO.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,46 @@
+/*
+ * 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.dao.bpel;
+
+import java.util.Date;
+import org.w3c.dom.Element;
+
+/**
+ * Activity recovery object. Registered when activity enters recovery state.
+ */
+public interface ActivityRecoveryDAO {
+
+    long getActivityId();
+
+    String getChannel();
+
+    String getReason();
+
+    Element getDetails();
+
+    Date getDateTime();
+
+    String getActions();
+
+    String[] getActionsList();
+
+    int getRetries();
+
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/BpelDAOConnection.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/BpelDAOConnection.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/BpelDAOConnection.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/BpelDAOConnection.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,121 @@
+/*
+ * 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.dao.bpel;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+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 org.apache.ode.dao.DAOConnection;
+
+
+/**
+ * Represents the physical resource for connecting to the bpel state store.
+ */
+public interface BpelDAOConnection extends DAOConnection{
+    /**
+     * Return the DAO for a bpel process.
+     *
+     * @param processId name (identifier) of the process
+     *
+     * @return DAO
+     */
+    ProcessDAO getProcess(QName processId);
+
+
+    /**
+     * Retrieve a process instance from the database.
+     * @param iid instance identifier
+     * @return process instance
+     */
+    ProcessInstanceDAO getInstance(Long iid);
+
+    /**
+     * Retrieve a scope instance from the database.
+     * @param siidl scope instance identifier
+     * @return scope instance
+     */
+    ScopeDAO getScope(Long siidl);
+
+    /**
+     * Query instances in the database meeting the requested
+     * criteria.
+     * @param criteria
+     * @return Collection<ProcessInstanceDAO>
+     */
+    Collection<ProcessInstanceDAO> instanceQuery(InstanceFilter criteria);
+
+    Collection<ProcessInstanceDAO> instanceQuery(String expression);
+
+    int getNumInstances(QName processId);
+
+    /**
+     * Insert a BPEL event into the database.
+     * @param event a BPEL event
+     * @param process associated process (optional)
+     * @param instance associated instance (optional)
+     */
+    void insertBpelEvent(BpelEvent event, ProcessDAO process,
+            ProcessInstanceDAO instance);
+
+    /**
+     * Execute a query for the timeline for BPEL events matching the criteria.
+     * @param ifilter instance filter (optional)
+     * @param efilter event filter (optional)
+     * @return List of event timestamps of events matching the criteria
+     */
+    List<Date> bpelEventTimelineQuery(InstanceFilter ifilter, BpelEventFilter efilter);
+
+    /**
+     * Execute a query to retrieve the BPEL events matching the criteria.
+     * @param ifilter instance filter
+     * @param efilter event filter
+     * @return
+     */
+    List<BpelEvent> bpelEventQuery(InstanceFilter ifilter, BpelEventFilter efilter);
+
+    Map<Long, Collection<CorrelationSetDAO>> getCorrelationSets(Collection<ProcessInstanceDAO> instances);
+
+    Collection<CorrelationSetDAO> getActiveCorrelationSets();
+
+    ProcessDAO createTransientProcess(Long pidId);
+    ProcessDAO createProcess(QName pid, QName type, String guid, long version);
+
+    /**
+     * Create a message exchange.
+     * @param dir type of message exchange
+     * @return
+     */
+    MessageExchangeDAO createMessageExchange(char dir);
+
+    MessageExchangeDAO getMessageExchange(String mexid);
+
+    /**
+     * Returns an interface for process and instance management.
+     *
+     * @return a ProcessManagement DAO
+     */
+    ProcessManagementDAO getProcessManagement();
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/BpelDAOConnectionFactory.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/BpelDAOConnectionFactory.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/BpelDAOConnectionFactory.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/BpelDAOConnectionFactory.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,36 @@
+/*
+ * 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.dao.bpel;
+
+
+import org.apache.ode.dao.DAOConnectionFactory;
+
+public interface BpelDAOConnectionFactory extends DAOConnectionFactory<BpelDAOConnection>{
+
+  /**
+   * Create a JTA transaction-aware state store connection to an the state store.
+   * The state store must have previously been created in order for this method to
+   * be succesful.
+   *
+   * @return a {@link BpelDAOConnection} connection object to the state
+   *         store.
+   */
+  public BpelDAOConnection getConnection();
+
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/BpelDAOConnectionFactoryJDBC.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/BpelDAOConnectionFactoryJDBC.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/BpelDAOConnectionFactoryJDBC.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/BpelDAOConnectionFactoryJDBC.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,48 @@
+/*
+ * 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.dao.bpel;
+
+import javax.sql.DataSource;
+
+/**
+ * Extension of the {@link BpelDAOConnectionFactory} interface for DAOs that
+ * are based on J2EE/JDBC data sources.
+ *
+ * @author Maciej Szefler - m s z e f l e r @ g m a i l . c o m
+ */
+public interface BpelDAOConnectionFactoryJDBC extends BpelDAOConnectionFactory {
+
+    /**
+     * Set the managed data source (transactions tied to transaction manager).
+     * @param ds
+     */
+    public void setDataSource(DataSource ds);
+
+    /**
+     * Set the unmanaged data source.
+     * @param ds
+     */
+    public void setUnmanagedDataSource(DataSource ds);
+
+    /**
+     * Set the transaction manager.
+     * @param tm
+     */
+    public void setTransactionManager(Object tm);
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/CorrelationSetDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/CorrelationSetDAO.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/CorrelationSetDAO.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/CorrelationSetDAO.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,79 @@
+/*
+ * 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.dao.bpel;
+
+import org.apache.ode.bpel.common.CorrelationKey;
+
+import javax.xml.namespace.QName;
+import java.util.Map;
+
+/**
+ * <p>
+ * Data access object representing a BPEL correlation set.
+ * Correlation sets are late-bound constants that "belong"
+ * either to the process or to a scope.
+ * </p>
+ */
+public interface CorrelationSetDAO {
+
+  public Long getCorrelationSetId();
+
+  /**
+   * Get the name of the correlation set.
+   * @return name of the correlation set
+   */
+  public String getName();
+
+  /**
+   * Get the scope instance to which this correlation set belongs.
+   *
+   * @see {@link ScopeDAO}
+   * @return owning scope instance
+   */
+  public ScopeDAO getScope();
+
+  /**
+   * Sets the value of the correlation set.
+   * @param names qualified names of the correlation set properties
+   * @param values
+   */
+  public void setValue(QName[] names, CorrelationKey values);
+
+  /**
+   * Get the value of the correlation set.
+   *
+   * @return valu of correlation set
+   */
+  public CorrelationKey getValue();
+
+  /**
+   * Get correlation set properties with their values as a Map.
+   * @return Map with the property qualified name as key and value as Map value.
+   */
+  public Map<QName, String> getProperties();
+
+    /**
+     * @return the process this correlation is related to, gives a chance of optimization to the underlying impl
+     */
+    ProcessDAO getProcess();
+    /**
+     * @return the instance this correlation is related to, gives a chance of optimization to the underlying impl
+     */
+    ProcessInstanceDAO getInstance();
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/CorrelatorDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/CorrelatorDAO.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/CorrelatorDAO.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/CorrelatorDAO.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,118 @@
+/*
+ * 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.dao.bpel;
+
+import java.util.List;
+
+import org.apache.ode.bpel.common.CorrelationKey;
+import org.apache.ode.bpel.common.CorrelationKeySet;
+
+import java.util.Collection;
+
+/**
+ * <p>
+ * Data access object representing a <em>correlator</em>. A correlator
+ * does not have a simple explanation: it acts as match-maker connecting
+ * messages with <em>message consumers</em> (i.e. BPEL pick and receive
+ * operations) across time.  For each partnerLink "myRole" and operation
+ * there is one correlator.
+ * </p>
+ * <p>
+ * The correlator functions as a two-sided queue: when a message is
+ * received the correlator is used to dequeue a consumer based on the
+ * keys from the message. If no consumer matches the keys in the message,
+ * the message itself is enqueued along with its keys. Conversely, when
+ * a BPEL pick/receive operation is performed, the correlator is used
+ * to dequeue a message matching a given correlation key. If no message is
+ * found, the consumer (i.e. the pick/receive operation) is enqueued
+ * along with the target key.
+ * </p>
+ * <p>
+ * The end result is matching of messages to pick/receive operations,
+ * irrespective of whether the operation or the message arrives first.
+ * Make sense?
+ * </p>
+ */
+public interface CorrelatorDAO {
+
+  /**
+   * Get the correlator identifier.
+   * @return correlator identifier
+   */
+  String getCorrelatorId();
+
+    void setCorrelatorId(String newId);
+
+  /**
+   * Enqueue a message exchange to the queue with a set of correlation keys.
+   *
+   * @param mex message exchange
+   * @param correlationKeys pre-computed set of correlation keys for this message
+   */
+  void enqueueMessage(MessageExchangeDAO mex, CorrelationKeySet correlationKeySet);
+
+
+  /**
+   * Dequeue a message exchange matching a correlationKey constraint.
+   *
+   * @param correlationKey correlation correlationKey constraint
+   * @return opaque message-related data previously enqueued with the
+   *         given correlation correlationKey
+   */
+  MessageExchangeDAO dequeueMessage(CorrelationKeySet correlationKeySet);
+
+    /**
+     * @return all messages waiting on this correlator, use with care as it can potentially return a lot of values
+     */
+    Collection<CorrelatorMessageDAO> getAllMessages();
+
+  /**
+   * Find a route matching the given correlation key.
+   * @param correlationKey correlation key
+   * @return route matching the given correlation key
+   */
+  List<MessageRouteDAO> findRoute(CorrelationKeySet correlationKeySet);
+
+  /**
+   * Check if corresponding key set is free to register (see ODE-804)
+   * @param correlationKeySet
+   * @return true - available, false - not available
+   */
+  boolean checkRoute(CorrelationKeySet correlationKeySet);
+
+  /**
+   * Add a route from the given correlation key to the given process instance.
+   * @param routeGroupId identifier of the group of routes to which this route belongs
+   * @param target target process instance
+   * @param index relative order in which the route should be considered
+   * @param correlationKey correlation key to match
+   */
+  void addRoute(String routeGroupId, ProcessInstanceDAO target, int index, CorrelationKeySet correlationKeySet, String routePolicy);
+
+  /**
+   * Remove all routes with the given route-group identifier.
+   * @param routeGroupId
+   */
+  void removeRoutes(String routeGroupId, ProcessInstanceDAO target);
+
+    /**
+     * @return all routes registered on this correlator, use with care as it can potentially return a lot of values
+     */
+    Collection<MessageRouteDAO> getAllRoutes();
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/CorrelatorMessageDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/CorrelatorMessageDAO.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/CorrelatorMessageDAO.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/CorrelatorMessageDAO.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,29 @@
+/*
+ * 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.dao.bpel;
+
+import org.apache.ode.bpel.common.CorrelationKey;
+
+public interface CorrelatorMessageDAO {
+
+    CorrelationKey getCorrelationKey();
+
+    void setCorrelationKey(CorrelationKey ckey);
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/DeferredProcessInstanceCleanable.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/DeferredProcessInstanceCleanable.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/DeferredProcessInstanceCleanable.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/DeferredProcessInstanceCleanable.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,48 @@
+/*
+ * 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.dao.bpel;
+
+import java.io.Serializable;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Instances and associated data for a ProcessDAO implementation that implements this
+ * interface can be deleted in a deferred fashion.
+ *
+ * @author sean
+ *
+ */
+public interface DeferredProcessInstanceCleanable {
+    /**
+     * Returns the database id.
+     *
+     * @return database id
+     */
+    Long getPidId();
+    
+    /**
+     * Deletes instances and data for this process, the number of rows gets deletes is limited
+     * by the transaction size.
+     *
+     * @param transactionSize the number of rows to delete
+     * @return the number of rows actually deleted
+     */
+    int deleteInstances(int transactionSize);
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/FaultDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/FaultDAO.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/FaultDAO.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/FaultDAO.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,42 @@
+/*
+ * 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.dao.bpel;
+
+import org.w3c.dom.Element;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Fault data access object. Used to access information about a
+ * fault that affected a process execution (causing the failure of
+ * an instance for example).
+ */
+public interface FaultDAO {
+
+  QName getName();
+
+  Element getData();
+
+  String getExplanation();
+
+  int getLineNo();
+
+  int getActivityId();
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/FilteredInstanceDeletable.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/FilteredInstanceDeletable.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/FilteredInstanceDeletable.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/FilteredInstanceDeletable.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,42 @@
+/*
+ * 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.dao.bpel;
+
+import java.util.Set;
+
+import org.apache.ode.bpel.common.InstanceFilter;
+import org.apache.ode.bpel.iapi.ProcessConf.CLEANUP_CATEGORY;
+
+/**
+ * An implementation of this interface provides a way to delete runtime process instances
+ * through the InstanceFilter.
+ *
+ * @author sean
+ *
+ */
+public interface FilteredInstanceDeletable {
+    /**
+     * Deletes instance filter by the given instance filter and clean up categories.
+     *
+     * @param filter instance filter
+     * @param categories clean up categories
+     * @return returns the number of instances that are deleted
+     */
+    int deleteInstances(InstanceFilter filter, Set<CLEANUP_CATEGORY> categories);
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/MessageDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/MessageDAO.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/MessageDAO.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/MessageDAO.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,39 @@
+/*
+ * 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.dao.bpel;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+// TODO: Abstract out the data representation.
+public interface MessageDAO {
+
+  void setType(QName type);
+  QName getType();
+
+  void setData(Element value);
+  Element getData();
+
+  void setHeader(Element value);
+  Element getHeader();
+
+  MessageExchangeDAO getMessageExchange();
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/MessageExchangeDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/MessageExchangeDAO.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/MessageExchangeDAO.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/MessageExchangeDAO.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,257 @@
+/*
+ * 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.dao.bpel;
+
+import org.w3c.dom.Element;
+
+import javax.xml.namespace.QName;
+import java.util.Date;
+import java.util.Set;
+
+/**
+ * Data access object for a message exchange.
+ */
+public interface MessageExchangeDAO {
+
+    public static final char DIR_BPEL_INVOKES_PARTNERROLE = 'P';
+
+    public static final char DIR_PARTNER_INVOKES_MYROLE = 'M';
+
+    /**
+     * Instance id of the message exchange.
+     *
+     * @return message exchange id.
+     */
+    String getMessageExchangeId();
+
+    /**
+     * Get output message (could be fault message)
+     *
+     * @return output message DAO
+     */
+    MessageDAO getResponse();
+
+    /**
+     * Creation time of the message exchange
+     *
+     * @return create time
+     */
+    Date getCreateTime();
+
+    void setCreateTime(Date createTime);
+
+    /**
+     * Get the input message.
+     *
+     * @return input message DAO
+     */
+    MessageDAO getRequest();
+
+    /**
+     * Get the operation name of this message exchange.
+     *
+     * @return operation name.
+     */
+    String getOperation();
+
+    /**
+     * The qualified name of the WSDL port type.
+     *
+     * @return port type name
+     */
+    QName getPortType();
+
+    /**
+     * Set the port type.
+     *
+     * @param porttype
+     *          port type
+     */
+    void setPortType(QName porttype);
+
+    /**
+     * Set state of last message sent/received.
+     *
+     * @param status state to be set
+     */
+    void setStatus(String status);
+
+    /**
+     * Get state of last message sent/received.
+     *
+     * @return the state
+     */
+    String getStatus();
+
+    /**
+     * Create a new message associated with this message-exchange
+     *
+     * @param type
+     *          message type
+     * @return new {@link MessageDAO}
+     */
+    MessageDAO createMessage(QName type);
+
+    /**
+     * Creates an input message DAO.
+     */
+    void setRequest(MessageDAO msg);
+
+    /**
+     * Creates an output message DAO.
+     */
+    void setResponse(MessageDAO msg);
+
+    /**
+     * Get the model id for the partner link to which this message exchange
+     * relates.
+     *
+     * @return
+     */
+    int getPartnerLinkModelId();
+
+    /**
+     * Set the model id for the partner link to which this message exchange
+     * relates
+     *
+     * @param modelId
+     */
+    void setPartnerLinkModelId(int modelId);
+
+    /**
+     * Get the correlation identifier/client id
+     *
+     * @return correlation identifier
+     */
+    String getCorrelationId();
+
+    /**
+     * Set the correlation identifier/client id
+     *
+     * @param correlationId
+     *          identifier
+     */
+    void setCorrelationId(String correlationId);
+
+    void setPattern(String string);
+
+    void setOperation(String opname);
+
+    void setEPR(Element epr);
+
+    Element getEPR();
+
+    String getPattern();
+
+    /**
+     * Get the response channel.
+     *
+     * @return response channel.
+     */
+    String getChannel();
+
+    /**
+     * Set the response channel.
+     *
+     * @param string
+     *          response channel
+     */
+    void setChannel(String string);
+
+    boolean getPropagateTransactionFlag();
+
+    QName getFault();
+
+    void setFault(QName faultType);
+
+    public String getFaultExplanation();
+
+    public void setFaultExplanation(String explanation);
+
+    void setCorrelationStatus(String cstatus);
+
+    String getCorrelationStatus();
+
+    /**
+     * Get the process associate with this message exchange. The process should
+     * always be available for partnerRole message exchanges. However, for myRole
+     * message exchanges, it is possible that no process is associated with the
+     * message exchange (i.e. if the EPR routing fails).
+     *
+     * @return process associated with the message exchange
+     */
+    ProcessDAO getProcess();
+
+    void setProcess(ProcessDAO process);
+
+    void setInstance(ProcessInstanceDAO dao);
+
+    ProcessInstanceDAO getInstance();
+
+    /**
+     * Get the direction of the message exchange.
+     *
+     * @return
+     */
+    char getDirection();
+
+    /**
+     * Get the "callee"--the id of the process being invoked in a myRole
+     * exchange.
+     * @return
+     */
+    QName getCallee();
+
+    /**
+     * Set the "callee"--the id of the process being invoked in a myRole
+     * exchange.
+     * @param callee
+     */
+    void setCallee(QName callee);
+
+    String getProperty(String key);
+
+    void setProperty(String key, String value);
+
+    Set<String> getPropertyNames();
+
+    void setPartnerLink(PartnerLinkDAO plinkDAO);
+
+    PartnerLinkDAO getPartnerLink();
+
+    /**
+     * Gets the mex id for the message exchange that has been piped with
+     * this one in a process to process interaction.
+     * @return
+     */
+    String getPipedMessageExchangeId();
+    void setPipedMessageExchangeId(String mexId);
+
+    int getSubscriberCount();
+    void setSubscriberCount(int subscriberCount);
+
+    void release(boolean doClean);
+
+    /**
+     * Deletes messages that arrived before the route is setup
+     */
+    void releasePremieMessages();
+
+    boolean lockPremieMessages();
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/MessageRouteDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/MessageRouteDAO.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/MessageRouteDAO.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/MessageRouteDAO.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,57 @@
+/*
+ * 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.dao.bpel;
+
+import org.apache.ode.bpel.common.CorrelationKeySet;
+
+import org.apache.ode.bpel.common.CorrelationKey;
+
+/**
+ * Data access object representing a message consumer. A message consumer
+ * represents an unsatisfied BPEL <code>pick</code> or <code>receive</code>
+ * activity.
+ */
+public interface MessageRouteDAO  {
+
+    /**
+     * Get the BPEL process instance to which this consumer belongs.
+     *
+     * @return the process instance to which this consumer belongs
+     */
+    ProcessInstanceDAO getTargetInstance();
+
+    String getGroupId();
+
+    int getIndex();
+
+    String getRoute();
+
+    /**
+     * Returns a correlation key set for the message route
+     * @return
+     */
+    public CorrelationKeySet getCorrelationKeySet();
+
+    void setCorrelationKeySet(CorrelationKeySet keySet);
+
+    void setCorrelationKey(CorrelationKey key);
+
+    CorrelationKey getCorrelationKey();
+
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/NoRootContextException.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/NoRootContextException.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/NoRootContextException.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/NoRootContextException.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,27 @@
+/*
+ * 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.dao.bpel;
+
+/**
+ * Exception thrown when no root context.
+ */
+public class NoRootContextException extends Exception {
+    private static final long serialVersionUID = -5160169433065685209L;
+}
+

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/PartnerLinkDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/PartnerLinkDAO.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/PartnerLinkDAO.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/PartnerLinkDAO.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,72 @@
+/*
+ * 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.dao.bpel;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+/**
+ * Data access object representing the endpoint reference of a specific
+ * partner link role (typically the partnerRole). An EPR has an implicit
+ * value attributed by the engine (usually by using the WSDL service
+ * definition but anyway that's the communication layer business). An
+ * EndpointReferenceDAO only has its own value if the default has been
+ * overriden (by assignment).
+ */
+public interface PartnerLinkDAO {
+
+  /**
+   * Get the model id of the partner link.
+   * @return
+   */
+  public int getPartnerLinkModelId();
+
+  public String getMyRoleName();
+
+  public String getPartnerRoleName();
+
+  public String getPartnerLinkName();
+
+  /**
+   * Get the service name associated with this partner link.
+   * @return
+   */
+  public QName getMyRoleServiceName();
+
+  public void setMyRoleServiceName(QName svcName);
+
+  public Element getMyEPR();
+
+  public void setMyEPR(Element val);
+
+  public Element getPartnerEPR();
+
+  public void setPartnerEPR(Element val);
+
+public String getMySessionId();
+
+public String getPartnerSessionId();
+
+public void setPartnerSessionId(String session);
+
+public void setMySessionId(String sessionId);
+
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ProcessDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ProcessDAO.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ProcessDAO.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ProcessDAO.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,121 @@
+/*
+ * 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.dao.bpel;
+
+import org.apache.ode.bpel.common.CorrelationKey;
+
+import javax.xml.namespace.QName;
+
+import java.util.Collection;
+
+/**
+ * BPEL process data access objects. Contains references to active process instances ({@link ProcessInstanceDAO} and messages bound
+ * for instances yet to be created or not yet correlated..
+ */
+public interface ProcessDAO {
+    /**
+     * Get the unique process identifier.
+     *
+     * @return process identifier
+     */
+    QName getProcessId();
+
+    /**
+     * Get the BPEL process name.
+     *
+     * @return qualified BPEL process name.
+     */
+    QName getType();
+
+    /**
+     * Get the process version
+     *
+     * @return version
+     */
+    long getVersion();
+
+    /**
+     * Get a message correlator instance.
+     *
+     * @param correlatorId
+     *            correlator identifier
+     * @return correlator corresponding to the given identifier
+     */
+    CorrelatorDAO getCorrelator(String correlatorId);
+
+    /**
+     * Create a new process instance object.
+     *
+     * @param instantiatingCorrelator
+     *            instantiating {@link CorrelatorDAO}
+     * @return newly generated instance DAO
+     */
+    ProcessInstanceDAO createInstance(CorrelatorDAO instantiatingCorrelator);
+
+    /**
+     * Get a process instance (by identifier).
+     *
+     * @param iid
+     *            unique instance identifier.
+     * @return DAO corresponding to the process instance
+     */
+    ProcessInstanceDAO getInstance(Long iid);
+
+    /**
+     * Locates a process instance based on a correlation key.
+     *
+     * @param cckey
+     *            correlation key
+     * @return collection of {@link ProcessInstanceDAO} that match correlation key, ordered by date
+     */
+    Collection<ProcessInstanceDAO> findInstance(CorrelationKey cckey);
+
+    /**
+     * Remove the routes with the given Id for all the correlators in the process.
+     *
+     * @todo remove this method.
+     * @param routeId
+     */
+    void removeRoutes(String routeId, ProcessInstanceDAO target);
+
+    /**
+     * Callback indicating that a process instance has completed its duties.
+     *
+     * @param instance
+     *            the completed {@link ProcessInstanceDAO}
+     */
+    void instanceCompleted(ProcessInstanceDAO instance);
+
+    /**
+     * Deletes only the process and routes without instances. This also deletes any static data to
+     * the process: correlators.
+     */
+    void deleteProcessAndRoutes();
+
+    CorrelatorDAO addCorrelator(String correlator);
+
+    String getGuid();
+
+    int getNumInstances();
+
+    /**
+     * @return all instances that haven't completed, use with care as there could be a lot of them
+     */
+    Collection<ProcessInstanceDAO> getActiveInstances();
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ProcessInstanceDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ProcessInstanceDAO.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ProcessInstanceDAO.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ProcessInstanceDAO.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,266 @@
+/*
+ * 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.dao.bpel;
+
+import org.apache.ode.bpel.evt.ProcessInstanceEvent;
+import org.apache.ode.bpel.iapi.ProcessConf.CLEANUP_CATEGORY;
+import org.w3c.dom.Element;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * BPEL process instance data access object. This object serves as the root
+ * object for data related to a particular process instance; this state
+ * includes auditing events, scopes, pick/received waiters, and the
+ * serialized process instance image.
+ */
+public interface ProcessInstanceDAO {
+
+    /**
+     * Get the time when the process instance was created.
+     * @return time of instance creation
+     */
+    public Date getCreateTime();
+
+    /**
+     * Get the time when the process instance was last active (re-hydrated).
+     * @return time of activity
+     */
+    public Date getLastActiveTime();
+
+    /**
+     * Set last activity time for the process instance
+     * @param dt tiem of activity
+     */
+    void setLastActiveTime(Date dt);
+
+    /**
+     * The un-caught fault associated with the process. This will be
+     * <code>null</code> if no fault occurred or if all faults are caught and
+     * processed.
+     * @param fault the fault
+     */
+    void setFault(FaultDAO fault);
+
+    void setFault(QName faultName, String explanation, int faultLineNo, int activityId, Element faultMessage);
+
+    /**
+     * The un-caught fault associated with the process. This will be
+     * <code>null</code> if no fault occurred or if all faults are caught and
+     * processed.
+     *
+     * @return the fault
+     */
+    FaultDAO getFault();
+
+    /**
+     * Get the (opaque) instance execution state.
+     * @return opaque execution state
+     */
+    byte[] getExecutionState();
+
+    /**
+     * Set the (opaque) instance execution state.
+     * @param execState execuction state
+     */
+    void setExecutionState(byte[] execState);
+
+    /**
+     * Get the process.
+     *
+     * @return process reference.
+     */
+    ProcessDAO getProcess();
+
+    /**
+     * Get the root (global) scope for the process.
+     *
+     * @return the root scope
+     */
+    ScopeDAO getRootScope();
+
+    /**
+     * Set the state of the process instance; one of the <code>STATE_XXX</code>
+     * constants defined in ProcessState.
+     *
+     * This should automatically populate the previous state.
+     *
+     * @param state new state of the process instance
+     */
+    void setState(short state);
+
+    /**
+     * Get the state of the process instance; one of the <code>STATE_XXX</code>
+     * constants defined in ProcessState.
+     *
+     * @return state of process instance
+     */
+    short getState();
+
+    /**
+     * Returns the next to last state.
+     * @return
+     */
+    short getPreviousState();
+
+    /**
+     * Creates a new scope.
+     *
+     * @param parentScope parent scope of the new scope, or null if this is the
+     *        root scope.
+     * @param name scope name
+     *
+     * @return the newly created scope
+     */
+    ScopeDAO createScope(ScopeDAO parentScope, String name, int scopeModelId);
+
+    /**
+     * Get the instance identifier.
+     * @return the instance identifier
+     */
+    Long getInstanceId();
+
+    /**
+     * Returns a scope using its instance id.
+     * @param scopeInstanceId
+     * @return
+     */
+    ScopeDAO getScope(Long scopeInstanceId);
+
+    /**
+     * Returns all the scopes with the associated name.
+     * @param scopeName
+     * @return
+     */
+    Collection<ScopeDAO> getScopes(String scopeName);
+
+    /**
+     * Returns all the scopes belonging to this isntance.
+     * @param scopeName
+     * @return
+     */
+    Collection<ScopeDAO> getScopes();
+
+    /**
+     * Return the correlator which results in the instantiation of the process instance.
+     * @return
+     */
+    CorrelatorDAO getInstantiatingCorrelator();
+
+    /**
+     * Returns all variable instances matching the variable name for a specified scope.
+     */
+    XmlDataDAO[] getVariables(String variableName, int scopeModelId);
+
+    /**
+     * Get all the correlation sets for this process.
+     * @return {@link Set} of {@link CorrelationSetDAO} objects
+     */
+    Set<CorrelationSetDAO> getCorrelationSets();
+
+    /**
+     * Get a correlation set by its name from this process
+     * @param name
+     * @return a {@link CorrelationSetDAO} object
+     */
+    CorrelationSetDAO getCorrelationSet(String name);
+
+    /**
+     * A simple callback to allow the ProcessInstance to perform post-completion duties.
+     * The DAO's state indicates whether any fault has occured.
+     */
+    void finishCompletion();
+
+    /**
+     * Delete the process instance object from the database.
+     */
+    void delete(Set<CLEANUP_CATEGORY> cleanupCategories);
+
+    /**
+     * Delete the process instance object from the database.
+     * @param cleanupCategories the categories of entities to delete
+     * @param deleteMyRoleMex will clean up the my role mex if set to true
+     */
+    void delete(Set<CLEANUP_CATEGORY> cleanupCategories, boolean deleteMyRoleMex);
+
+    /**
+     * Insert a BPEL event to the database (associating with this process).
+     * @param event BPEL event
+     */
+    void insertBpelEvent(ProcessInstanceEvent event);
+
+    /**
+     * Get a triple containing the first
+     * @return
+     */
+    EventsFirstLastCountTuple getEventsFirstLastCount();
+
+    /**
+     * Get the next number from a monotonically increasing sequence.
+     * @return next number in seqeunce
+     */
+    public long genMonotonic();
+
+    public BpelDAOConnection getConnection();
+
+    /**
+     * Get number of activities in the failure state.
+     */
+    int getActivityFailureCount();
+
+    /**
+     * Get date/time of last activity failure.
+     */
+    Date getActivityFailureDateTime();
+
+    /**
+     * Returns all activity recovery objects for this process instance.
+     */
+    Collection<ActivityRecoveryDAO> getActivityRecoveries();
+
+    /**
+     * Create an activity recovery object for a given activity instance.
+     * Specify the reason and optional data associated with the failure.
+     * Date/time failure occurred, and the recovery channel and available
+     * recovery actions.
+     */
+    void createActivityRecovery(String channel, long activityId, String reason, Date dateTime, Element data, String[] actions, int retries);
+
+    /**
+     * Delete previously registered activity recovery.
+     */
+    void deleteActivityRecovery(String channel);
+
+    /**
+     * Transport object holding the date of the first and last instance event
+     * along with the number events.
+     */
+    public class EventsFirstLastCountTuple {
+        public Date first;
+        public Date last;
+        public int count;
+    }
+
+    Collection<String> getMessageExchangeIds();
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ProcessManagementDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ProcessManagementDAO.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ProcessManagementDAO.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ProcessManagementDAO.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,102 @@
+/*
+ * 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.dao.bpel;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This DAO handles any process and instance management related database
+ * operations. The idea is to separate out the operational side of database
+ * tasks from core engine.
+ *
+ * @author sean
+ *
+ */
+public interface ProcessManagementDAO {
+    public static class InstanceSummaryKey {
+        public final String pid;
+        public final String instanceStatus;
+
+        public InstanceSummaryKey(String pid, String instanceStatus) {
+            super();
+            this.pid = pid;
+            this.instanceStatus = instanceStatus;
+        }
+
+        @Override
+        public String toString() {
+            return "InstanceSummaryKey [instanceStatus=" + instanceStatus
+                    + ", pid=" + pid + "]";
+        }
+
+        @Override
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime
+                    * result
+                    + ((instanceStatus == null) ? 0 : instanceStatus.hashCode());
+            result = prime * result + ((pid == null) ? 0 : pid.hashCode());
+            return result;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj)
+                return true;
+            if (obj == null)
+                return false;
+            if (getClass() != obj.getClass())
+                return false;
+            InstanceSummaryKey other = (InstanceSummaryKey) obj;
+            if (instanceStatus == null) {
+                if (other.instanceStatus != null)
+                    return false;
+            } else if (!instanceStatus.equals(other.instanceStatus))
+                return false;
+            if (pid == null) {
+                if (other.pid != null)
+                    return false;
+            } else if (!pid.equals(other.pid))
+                return false;
+            return true;
+        }
+
+    }
+
+    public static class FailedSummaryValue {
+        public final Long count;
+        public final Date lastFailed;
+        public FailedSummaryValue(Long count, Date lastFailed) {
+            super();
+            this.count = count;
+            this.lastFailed = lastFailed;
+        }
+    }
+
+    public Map<InstanceSummaryKey, Long> countInstancesSummary(Set<String> pids);
+
+    public Map<String, FailedSummaryValue> findFailedCountAndLastFailedDateForProcessIds(Set<String> pids);
+}
\ No newline at end of file

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/QueryReturnedEmptyResultException.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/QueryReturnedEmptyResultException.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/QueryReturnedEmptyResultException.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/QueryReturnedEmptyResultException.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,27 @@
+/*
+ * 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.dao.bpel;
+
+/**
+ * Thrown when a query returns empty results.
+ */
+public class QueryReturnedEmptyResultException extends Exception {
+    private static final long serialVersionUID = -6775955398350301761L;
+}
+

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/QueryReturnedMultipleResultsException.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/QueryReturnedMultipleResultsException.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/QueryReturnedMultipleResultsException.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/QueryReturnedMultipleResultsException.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,33 @@
+/*
+ * 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.dao.bpel;
+
+/**
+ * Thrown when a query returns multiple results.
+ *
+ * <p>
+ * Created on Mar 9, 2004 at 1:51:09 PM.
+ * </p>
+ *
+ * @author Maciej Szefler <a href="mailto:mbs@fivesight.com">mbs</a>
+ */
+public class QueryReturnedMultipleResultsException extends Exception {
+    private static final long serialVersionUID = 3652252549449534331L;
+}
+

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/RoleEnum.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/RoleEnum.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/RoleEnum.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/RoleEnum.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,88 @@
+/*
+ * 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.dao.bpel;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Partner-link role enumeration; one of {@link #MY_ROLE} or {@link
+ * #PARTNER_ROLE}.
+ */
+public class RoleEnum {
+
+  /** My Role */
+  public static final RoleEnum MY_ROLE = new RoleEnum("MY_ROLE");
+
+  /** Partner Role */
+  public static final RoleEnum PARTNER_ROLE = new RoleEnum("PARTNER_ROLE");
+
+  private static final List<RoleEnum> ENUMS = new ArrayList<RoleEnum>();
+  private short _id;
+  private transient String _name;
+
+  private RoleEnum(String name) {
+    _id = (short)ENUMS.size();
+    _name = name;
+    ENUMS.add(this);
+  }
+
+  /**
+   * @see Object#equals(java.lang.Object)
+   */
+  public boolean equals(Object o) {
+    return ((RoleEnum)o)._id == _id;
+  }
+
+  /**
+   * DOCUMENTME
+   *
+   * @param code
+   *          DOCUMENTME
+   *
+   * @return DOCUMENTME
+   */
+  public static RoleEnum fromCode(short code) {
+    return ENUMS.get(code);
+  }
+
+  /**
+   * @see Object#hashCode()
+   */
+  public int hashCode() {
+    return _id;
+  }
+
+  /**
+   * DOCUMENTME
+   *
+   * @return DOCUMENTME
+   */
+  public short toCode() {
+    return _id;
+  }
+
+  /**
+   * @see Object#toString()
+   */
+  public String toString() {
+    return "RoleEnum." + _name;
+  }
+
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ScopeDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ScopeDAO.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ScopeDAO.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ScopeDAO.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,133 @@
+/*
+ * 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.dao.bpel;
+
+import org.apache.ode.bpel.evt.BpelEvent;
+
+import java.util.Collection;
+import java.util.List;
+
+
+/**
+ * Data access objec representing a BPEL scope instance.
+ * Objects of this class manage a collection of correlation
+ * sets and XML data variables.
+ */
+public interface ScopeDAO  {
+
+    /**
+     * Get the unique identifier for this scope instance.
+     * @return scope instance id
+     */
+    Long getScopeInstanceId();
+
+    /**
+     * Get the scope model id from the object
+     * @return scope model id
+     */
+    int getModelId();
+
+
+    /**
+     * Get scope name (from the definition / or auto-generated).
+     * NOTE: the scope names are not necessarily unique.
+     * @return scope name
+     */
+    String getName();
+
+    /**
+     * Get a correlation set by name.
+     * @param corrSetName correlation set name
+     * @return correlation set instance
+     */
+    CorrelationSetDAO getCorrelationSet(String corrSetName);
+
+    /**
+     * Gets all correlation sets for this scope
+     * @return correlation set instances
+     */
+    Collection<CorrelationSetDAO> getCorrelationSets();
+
+    /**
+     * Get the parent scope.
+     * @return parent scope
+     */
+    ScopeDAO getParentScope();
+
+    Collection<ScopeDAO> getChildScopes();
+
+    /**
+     * Get the process instance to which this scope belongs.
+     * @return owner {@link ProcessInstanceDAO}
+     */
+    ProcessInstanceDAO getProcessInstance();
+
+    /**
+     * Set current state of the scope.
+     * @param state new scope state
+     */
+    void setState(ScopeStateEnum state);
+
+    /**
+     * Get current state of the scope.
+     * @return current scope state
+     */
+    ScopeStateEnum getState();
+
+    /**
+     * Get a variable by name.
+     * @param varName variable name
+     * @return {@link XmlDataDAO} object representing the requested variable
+     */
+    XmlDataDAO getVariable(String varName);
+
+    /**
+     * Get a colleciton of all the variables belonging to this scope.
+     * @return collection of variables
+     */
+    Collection<XmlDataDAO> getVariables();
+
+    /**
+     * Get an ordered list of events associated with this scope.
+     * @return collection of bpel events.
+     */
+    List<BpelEvent> listEvents();
+
+    /**
+     * Create a storage space for partner link values for the scope.
+     * @param plinkModelId partner link model id
+     * @param pLinkName partner link name
+     * @return {@link PartnerLinkDAO} object representing the created endpoint reference
+     */
+    PartnerLinkDAO createPartnerLink(int plinkModelId, String pLinkName, String myRole, String partnerRole);
+
+    /**
+     * Get the parnter link storage object associated with this scope instance
+     * and the provided partner link model id.
+     * @param plinkModelId partner link model id
+     * @return {@link PartnerLinkDAO} object representing the requested endpoint reference
+     */
+    PartnerLinkDAO getPartnerLink(int plinkModelId);
+
+    /**
+     * Get all partner link storage object associated with this scope instance.
+     * @return List of {@link PartnerLinkDAO} objects
+     */
+    Collection<PartnerLinkDAO> getPartnerLinks();
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ScopeStateEnum.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ScopeStateEnum.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ScopeStateEnum.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ScopeStateEnum.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,23 @@
+/*
+ * 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.dao.bpel;
+
+public enum ScopeStateEnum {
+    NEW, ACTIVE, FAULT, COMPLETED
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/XmlDataDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/XmlDataDAO.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/XmlDataDAO.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/XmlDataDAO.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,86 @@
+/*
+ * 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.dao.bpel;
+
+import org.w3c.dom.Node;
+
+
+/**
+ * Data access object representing a piece of XML data. This is object is used
+ * to model BPEL variables.
+ */
+public interface XmlDataDAO {
+
+  /**
+   * Get the name of the variable.
+   * @return variable name
+   */
+  public String getName();
+
+
+  /**
+   * Checks if the dao has been assigned any data.
+   *
+   * @return <code>true</code> is assignment has NOT occured.
+   */
+  public boolean isNull();
+
+
+  /**
+   * Retreive the variable data.
+   *
+   * @return the variable data
+   */
+  public Node get();
+
+  /**
+   * Remove the object from the data store.
+   */
+  public void remove();
+
+  /**
+   * Set the data value of a variable.
+   *
+   * @param val value
+   */
+  public void set(Node val);
+
+  /**
+   * Return the value of a property.  Properties are useful
+   * for extracting simple type data which can be used for querying
+   * and identifying process instances.
+   * @param propertyName
+   * @return value of property or <b>null</b> if not set.
+   */
+  public String getProperty(String propertyName);
+
+  /**
+   * Sets the value of a property
+   * @param pname
+   * @param pvalue
+   */
+  public void setProperty(String pname, String pvalue);
+
+  /**
+   * Gets the scope associated with this xml data.
+   * @return scope
+   */
+  public ScopeDAO getScopeDAO();
+
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/store/ConfStoreDAOConnection.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/store/ConfStoreDAOConnection.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/store/ConfStoreDAOConnection.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/store/ConfStoreDAOConnection.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,39 @@
+/*
+ * 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.dao.store;
+
+
+import java.util.Collection;
+
+import org.apache.ode.dao.DAOConnection;
+
+/**
+ */
+public interface ConfStoreDAOConnection extends DAOConnection{
+	
+    DeploymentUnitDAO createDeploymentUnit(String name);
+
+    DeploymentUnitDAO getDeploymentUnit(String name);
+
+    Collection<DeploymentUnitDAO> getDeploymentUnits();
+
+    long getNextVersion();
+
+    void setVersion(long version);
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/store/ConfStoreDAOConnectionFactory.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/store/ConfStoreDAOConnectionFactory.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/store/ConfStoreDAOConnectionFactory.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/store/ConfStoreDAOConnectionFactory.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,30 @@
+/*
+ * 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.dao.store;
+
+import org.apache.ode.dao.DAOConnectionFactory;
+
+/**
+ * Connection factory for DB store.
+ * @author mszefler
+  */
+public interface ConfStoreDAOConnectionFactory extends DAOConnectionFactory<ConfStoreDAOConnection> {
+	
+    ConfStoreDAOConnection getConnection();
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/store/DeploymentUnitDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/store/DeploymentUnitDAO.java?rev=986561&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/store/DeploymentUnitDAO.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/store/DeploymentUnitDAO.java Wed Aug 18 04:12:49 2010
@@ -0,0 +1,77 @@
+/*
+ * 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.dao.store;
+
+import javax.xml.namespace.QName;
+import java.util.Collection;
+import java.util.Date;
+
+/**
+ * DAO interface for a "deployment unit", a collection of processes deployed as a single
+ * unit.
+ *
+ * @author mszefler
+ *
+ */
+public interface DeploymentUnitDAO {
+
+    /**
+     * Get the name of the deployment unit.
+     * @return du name
+     */
+    String getName();
+
+    /**
+     * Get the deployment unit directory path.
+     * @return deployment unit directory path
+     */
+    String getDeploymentUnitDir();
+
+
+    void setDeploymentUnitDir(String dir);
+
+    /**
+     * Get the collection of processes that are deployed as part of this deployment unit.
+     * @return
+     */
+    Collection<? extends ProcessConfDAO> getProcesses();
+
+    /**
+     * Get the date/time the DU was deployed.
+     * @return
+     */
+    Date getDeployDate();
+
+    /**
+     * Get the userid of the user doing the deploying.
+     * @return
+     */
+    String getDeployer();
+
+
+    /**
+     * Delete this deployment unit (deletes all the children).
+     */
+    void delete();
+
+    ProcessConfDAO createProcess(QName pid, QName type, long version);
+
+    ProcessConfDAO getProcess(QName pid);
+
+}