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/05/21 17:41:07 UTC

svn commit: r947046 [2/12] - in /ode/trunk: ./ axis2/src/main/java/org/apache/ode/axis2/ bpel-dao/ bpel-dao/src/main/java/org/apache/ode/dao/ bpel-dao/src/main/java/org/apache/ode/dao/bpel/ bpel-dao/src/main/java/org/apache/ode/dao/store/ bpel-epr/ bpe...

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=947046&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 Fri May 21 15:40:59 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=947046&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 Fri May 21 15:40:59 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=947046&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 Fri May 21 15:40:59 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=947046&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 Fri May 21 15:40:59 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=947046&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 Fri May 21 15:40:59 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=947046&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 Fri May 21 15:40:59 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=947046&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 Fri May 21 15:40:59 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/bpel/package.html
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/package.html?rev=947046&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/package.html (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/package.html Fri May 21 15:40:59 2010
@@ -0,0 +1,35 @@
+<!--
+  ~ 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.
+  -->
+
+<html>
+	<head><title>DAO Package</title></head>
+  <body>
+    <p>Data-Access Object (DAO) interfaces used by the BPEL Service Provider 
+    to communicate with the data store; can be used to customize the 
+    BPEL persistence layer.
+    The BPEL DAO layer is used to maintain persistent state of each
+    active BPEL process instance. This includes the values of scope
+    variables, as well as instance &quot;state snapshots&quot; that
+    may need to be persisted due to the activation of receive, pick,
+    or invoke activity that cannot be immediately satisfied.  Like
+    the DAO of the framework (see {@link com.fs.jlo.sfwk.bapi.dao}), the
+    BPEL DAO is a &quot;dumb&quot; object-relational model supporting
+    transactional access.</p>
+  </body>
+</html>

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=947046&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 Fri May 21 15:40:59 2010
@@ -0,0 +1,40 @@
+/*
+ * 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();
+
+    void close();
+
+    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=947046&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 Fri May 21 15:40:59 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=947046&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 Fri May 21 15:40:59 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);
+    
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/store/ProcessConfDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/store/ProcessConfDAO.java?rev=947046&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/store/ProcessConfDAO.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/store/ProcessConfDAO.java Fri May 21 15:40:59 2010
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ode.dao.store;
+
+import org.apache.ode.bpel.iapi.ProcessState;
+
+import javax.xml.namespace.QName;
+import java.util.Collection;
+
+/**
+ * DAO interface for a process configuration. 
+ * @author mriou <mriou at apache dot org>
+ */
+public interface ProcessConfDAO {
+    
+    QName getPID();
+
+    QName getType();
+
+    long getVersion();
+
+    DeploymentUnitDAO getDeploymentUnit();
+    
+    ProcessState getState();
+
+    void setState(ProcessState state);
+
+    void setProperty(QName name, String content);
+
+    String getProperty(QName name);
+    
+    Collection<QName> getPropertyNames();
+    
+    void delete();
+}

Modified: ode/trunk/bpel-epr/pom.xml
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-epr/pom.xml?rev=947046&r1=947045&r2=947046&view=diff
==============================================================================
--- ode/trunk/bpel-epr/pom.xml (original)
+++ ode/trunk/bpel-epr/pom.xml Fri May 21 15:40:59 2010
@@ -45,32 +45,52 @@
       <artifactId>ode-bpel-api</artifactId>
     </dependency>
 
-    <dependency>
+   <dependency>
       <groupId>org.apache.derby</groupId>
       <artifactId>derby</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.h2database</groupId>
+      <artifactId>h2</artifactId>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.geronimo.specs</groupId>
       <artifactId>geronimo-jta_1.1_spec</artifactId>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.geronimo.components</groupId>
       <artifactId>geronimo-connector</artifactId>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.geronimo.components</groupId>
       <artifactId>geronimo-transaction</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.jencks</groupId>
-      <artifactId>jencks</artifactId>
-      <version>${jencks.version}</version>
-      <classifier>all</classifier>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>commons-beanutils</groupId>
       <artifactId>commons-beanutils</artifactId>
       <version>1.8.2</version>
     </dependency>
+    <dependency>
+      <groupId>org.jencks</groupId>
+      <artifactId>jencks</artifactId>
+      <version>${jencks.version}</version>
+      <classifier>all</classifier>
+      <scope>provided</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>geronimo</groupId>
+          <artifactId>geronimo-connector</artifactId>
+        </exclusion>
+        <exclusion>
+          <artifactId>geronimo-jta_1.0.1B_spec</artifactId>
+          <groupId>org.apache.geronimo.specs</groupId>
+        </exclusion>
+      </exclusions>
+     </dependency>
    </dependencies>
 </project>

Modified: ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java?rev=947046&r1=947045&r2=947046&view=diff
==============================================================================
--- ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java (original)
+++ ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java Fri May 21 15:40:59 2010
@@ -45,6 +45,10 @@ public class OdeConfigProperties {
     public static final String PROP_DB_EXTERNAL_DS = "db.ext.dataSource";
 
     public static final String PROP_DB_EMBEDDED_NAME = "db.emb.name";
+    
+    public static final String PROP_DB_EMBEDDED_TYPE = "db.emb.type";
+
+    public static final String PROP_DB_EMBEDDED_CREATE = "db.emb.create";
 
     public static final String PROP_DB_INTERNAL_URL = "db.int.jdbcurl";
 
@@ -97,6 +101,10 @@ public class OdeConfigProperties {
     public static final String PROP_PROCESS_INSTANCE_THROTTLED_MAXIMUM_COUNT = "process.instance.throttled.maximum.count";
     
     public static final String PROP_DAOCF = "dao.factory";
+
+    public static final String PROP_DAOCF_STORE = "dao.factory.store";
+
+    public static final String PROP_DAOCF_SCHEDULER = "dao.factory.scheduler";
     
     public static final String PROP_MIGRATION_TRANSACTION_TIMEOUT = "migration.transaction.timeout";
     
@@ -111,6 +119,12 @@ public class OdeConfigProperties {
     /** Default defaults for the database embedded name and dao connection factory class. */
     private static String __dbEmbName = "jpadb";
     private static String __daoCfClass = "org.apache.ode.dao.jpa.BPELDAOConnectionFactoryImpl";
+    
+    /** Default defaults for the database embedded name and dao connection factory class. */
+    public static String DEFAULT_DB_EMB_NAME = "ode-db";
+    public static String DEFAULT_DB_EMB_TYPE = "h2";
+    public static String DEFAULT_DAOCF_CLASS = "org.apache.ode.dao.jpa.openjpa.BpelDAOConnectionFactoryImpl";
+    public static String DEFAULT_DAOCF_STORE_CLASS = "org.apache.ode.dao.jpa.openjpa.ConfStoreDAOConnectionFactoryImpl";
 
     static {
         String odep = System.getProperty("ode.persistence");
@@ -135,6 +149,18 @@ public class OdeConfigProperties {
         /** Embedded database (Ode provides default embedded database with connection pool) */
         EMBEDDED
     }
+    
+    /**
+     * Possible database implementation.
+     */
+    public enum EmbeddedDbType {
+        
+        DERBY,
+        
+        H2,
+
+        HSQL
+    }
 
     public OdeConfigProperties(File cfgFile, String prefix) {
         _cfgFile = cfgFile;
@@ -188,15 +214,28 @@ public class OdeConfigProperties {
 
     }
 
+    public EmbeddedDbType getDbEmbeddedType() {
+        return EmbeddedDbType.valueOf(getProperty(OdeConfigProperties.PROP_DB_EMBEDDED_TYPE, DEFAULT_DB_EMB_TYPE).trim().toUpperCase());
+    }
+
+    public boolean isDbEmbeddedCreate() {
+        return Boolean.valueOf(getProperty(OdeConfigProperties.PROP_DB_EMBEDDED_CREATE, "true"));
+    }
+
     public DatabaseMode getDbMode() {
         return DatabaseMode.valueOf(getProperty(OdeConfigProperties.PROP_DB_MODE, DatabaseMode.EMBEDDED.toString()).trim()
                 .toUpperCase());
     }
 
     public String getDAOConnectionFactory() {
-        return getProperty(PROP_DAOCF, __daoCfClass);
+        return getProperty(PROP_DAOCF, DEFAULT_DAOCF_CLASS);
+    }
+
+    public String getDAOConfStoreConnectionFactory() {
+        return getProperty(PROP_DAOCF_STORE, DEFAULT_DAOCF_STORE_CLASS);
     }
 
+
     public String getDbDataSource() {
         return getProperty(OdeConfigProperties.PROP_DB_EXTERNAL_DS, "java:comp/env/jdbc/ode-ds");
     }

Modified: ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/dbutil/Database.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/dbutil/Database.java?rev=947046&r1=947045&r2=947046&view=diff
==============================================================================
--- ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/dbutil/Database.java (original)
+++ ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/dbutil/Database.java Fri May 21 15:40:59 2010
@@ -19,29 +19,18 @@
 package org.apache.ode.il.dbutil;
 
 import java.io.File;
-import java.sql.SQLException;
-import java.util.Properties;
 
 import javax.naming.InitialContext;
 import javax.sql.DataSource;
 import javax.transaction.TransactionManager;
 
-import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.derby.jdbc.EmbeddedDriver;
-import org.apache.geronimo.connector.outbound.GenericConnectionManager;
-import org.apache.geronimo.connector.outbound.connectionmanagerconfig.LocalTransactions;
-import org.apache.geronimo.connector.outbound.connectionmanagerconfig.PoolingSupport;
-import org.apache.geronimo.connector.outbound.connectionmanagerconfig.SinglePool;
-import org.apache.geronimo.connector.outbound.connectionmanagerconfig.TransactionSupport;
-import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTracker;
-import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator;
-import org.apache.geronimo.transaction.manager.RecoverableTransactionManager;
-import org.apache.ode.bpel.dao.BpelDAOConnectionFactoryJDBC;
+import org.apache.ode.dao.bpel.BpelDAOConnectionFactory;
+import org.apache.ode.dao.store.ConfStoreDAOConnectionFactory;
 import org.apache.ode.il.config.OdeConfigProperties;
 import org.apache.ode.utils.LoggingInterceptor;
-import org.tranql.connector.jdbc.JDBCDriverMCF;
+
 
 /**
  * Does the dirty work of setting up / obtaining a DataSource based on the configuration in the {@link OdeConfigProperties} object.
@@ -54,15 +43,11 @@ public class Database {
 
     private static final Messages __msgs = Messages.getMessages(Messages.class);
 
-    private static final int CONNECTION_MAX_WAIT_MILLIS = 30000;
-
-    private static final int CONNECTION_MAX_IDLE_MINUTES = 5;
-
     private OdeConfigProperties _odeConfig;
 
     private boolean _started;
 
-    private GenericConnectionManager _connectionManager;
+    private DatabaseConnectionManager _connectionManager;
 
     private TransactionManager _txm;
 
@@ -70,9 +55,9 @@ public class Database {
 
     private File _workRoot;
 
-    private boolean _needDerbyShutdown;
+    private boolean _needShutdown;
 
-    private String _derbyUrl;
+    private EmbeddedDatabase _embeddedDB;
 
     public Database(OdeConfigProperties props) {
         if (props == null)
@@ -93,7 +78,7 @@ public class Database {
         if (_started)
             return;
 
-        _needDerbyShutdown = false;
+        _needShutdown = false;
         _datasource = null;
         _connectionManager = null;
 
@@ -102,42 +87,35 @@ public class Database {
     }
 
     public synchronized void shutdown() {
-        if (!_started)
-            return;
+       if (!_started) {
+        return;
+      }
 
-        if (_connectionManager != null)
-            try {
-                __log.debug("Stopping connection manager");
-                _connectionManager.doStop();
-            } catch (Throwable t) {
-                __log.warn("Exception while stopping connection manager: " + t.getMessage());
-            } finally {
-                _connectionManager = null;
-            }
+      if (_connectionManager != null) {
+        try {
+          __log.debug("Stopping connection manager");
+          _connectionManager.shutdown();
+        } catch (Throwable t) {
+          __log.warn("Exception while stopping connection manager: " + t.getMessage());
+        } finally {
+          _connectionManager = null;
+        }
+      }
 
-        if (_needDerbyShutdown) {
-            __log.debug("shutting down derby.");
-            EmbeddedDriver driver = new EmbeddedDriver();
-            try {
-                driver.connect(_derbyUrl + ";shutdown=true", new Properties());
-            } catch (SQLException ex) {
-                // Shutdown will always return an exeption!
-                if (ex.getErrorCode() != 45000)
-                    __log.error("Error shutting down Derby: " + ex.getErrorCode(), ex);
+      if (_needShutdown) {
+        __log.debug("shutting down database.");
+       _embeddedDB.shutdown();
 
-            } catch (Throwable ex) {
-                __log.debug("Error shutting down Derby.", ex);
-            }
-        }
+      }
 
-        _needDerbyShutdown = false;
+        _needShutdown = false;
         _datasource = null;
         _started = false;
     }
 
     public DataSource getDataSource() {
-        //return __logSql.isDebugEnabled() ? new LoggingDataSourceWrapper(_datasource, __logSql) : _datasource;
-        return __logSql.isDebugEnabled() ? LoggingInterceptor.createLoggingDS(_datasource, __logSql) : _datasource;
+        DataSource ds =  __logSql.isDebugEnabled() ? LoggingInterceptor.createLoggingDS(_datasource, __logSql) : _datasource;
+        return ds;
     }
 
     private void initDataSource() throws DatabaseConfigException {
@@ -159,7 +137,7 @@ public class Database {
     private void initExternalDb() throws DatabaseConfigException {
         try {
             _datasource = (DataSource) lookupInJndi(_odeConfig.getDbDataSource());
-            __log.info(__msgs.msgOdeUsingExternalDb(_odeConfig.getDbDataSource()));
+            __log.debug(__msgs.msgOdeUsingExternalDb(_odeConfig.getDbDataSource()));
         } catch (Exception ex) {
             String msg = __msgs.msgOdeInitExternalDbFailed(_odeConfig.getDbDataSource());
             __log.error(msg, ex);
@@ -168,87 +146,34 @@ public class Database {
     }
 
     private void initInternalDb() throws DatabaseConfigException {
-        __log.info(__msgs.msgOdeUsingInternalDb(_odeConfig.getDbIntenralJdbcUrl(), _odeConfig.getDbInternalJdbcDriverClass()));
+        __log.debug(__msgs.msgOdeUsingInternalDb(_odeConfig.getDbIntenralJdbcUrl(), _odeConfig.getDbInternalJdbcDriverClass()));
         initInternalDb(_odeConfig.getDbIntenralJdbcUrl(), _odeConfig.getDbInternalJdbcDriverClass(),
                 _odeConfig.getDbInternalUserName(), _odeConfig.getDbInternalPassword());
+
     }
 
     private void initInternalDb(String url, String driverClass, String username,String password) throws DatabaseConfigException {
-
-        __log.debug("Creating connection pool for " + url + " with driver " + driverClass);
-        if (!(_txm instanceof RecoverableTransactionManager)) {
-            throw new RuntimeException("TransactionManager is not recoverable.");
-        }
-
-        TransactionSupport transactionSupport = LocalTransactions.INSTANCE;
-        ConnectionTracker connectionTracker = new ConnectionTrackingCoordinator();
-
-        PoolingSupport poolingSupport = new SinglePool(
-                _odeConfig.getPoolMaxSize(),
-                _odeConfig.getPoolMinSize(),
-                CONNECTION_MAX_WAIT_MILLIS,
-                CONNECTION_MAX_IDLE_MINUTES,
-                true, // match one
-                false, // match all
-                false); // select one assume match
-
-        _connectionManager = new GenericConnectionManager(
-                    transactionSupport,
-                    poolingSupport,
-                    null,
-                    connectionTracker,
-                    (RecoverableTransactionManager) _txm,
-                    getClass().getName(),
-                    getClass().getClassLoader());
-
-        
-        try {
-            javax.resource.spi.ManagedConnectionFactory mcf = null;
-            String mcfClass = _odeConfig.getDbInternalMCFClass();
-            if (mcfClass != null) {
-                Properties dbInternalMCFProps = _odeConfig.getDbInternalMCFProperties();
-                if (__log.isDebugEnabled()) {
-                    __log.debug("Using internal DB MCF " + mcfClass + " " + dbInternalMCFProps);
-                }
-                mcf = (javax.resource.spi.ManagedConnectionFactory) Class.forName(mcfClass).newInstance();
-                BeanUtils.copyProperties(mcf, dbInternalMCFProps);
-            } else {
-                if (__log.isDebugEnabled()) {
-                    __log.debug("Using internal DB JDBCDriverMCF");
-                }
-                JDBCDriverMCF mcf2 = new JDBCDriverMCF();
-                mcf = mcf2;
-                mcf2.setDriver(driverClass);
-                mcf2.setConnectionURL(url);
-                if (username != null) {
-                    mcf2.setUserName(username);
-                }
-                if (password != null) {
-                    mcf2.setPassword(password);
-                }
-            }
-            _connectionManager.doStart();
-            _datasource = (DataSource) mcf.createConnectionFactory(_connectionManager);
-        } catch (Exception ex) {
-            String errmsg = __msgs.msgOdeDbPoolStartupFailed(url);
-            __log.error(errmsg, ex);
-            throw new DatabaseConfigException(errmsg, ex);
-        }
+        _connectionManager = new DatabaseConnectionManager(_txm,_odeConfig);
+        _connectionManager.init(url, driverClass, username, password);
+        _datasource = _connectionManager.getDataSource();
     }
 
     /**
      * Initialize embedded (DERBY) database.
      */
-    private void initEmbeddedDb() throws DatabaseConfigException {
+   private void initEmbeddedDb() throws DatabaseConfigException {
 
-        String db = _odeConfig.getDbEmbeddedName();
-
-        String url = "jdbc:derby:" + _workRoot + "/" + db ;
-        __log.info("Using Embedded Derby: " + url);
-        _derbyUrl = url;
-        initInternalDb(url, org.apache.derby.jdbc.EmbeddedDriver.class.getName(),"sa",null);
-        _needDerbyShutdown = true;
-    }
+    switch (_odeConfig.getDbEmbeddedType()) {
+      case DERBY:
+        _embeddedDB = new DerbyDatabase();
+        break;
+      default:
+        _embeddedDB = new H2Database();
+    }
+    _embeddedDB.init(_workRoot,_odeConfig,_txm);
+    _datasource = _embeddedDB.getDataSource();
+    _needShutdown = true;
+  }
 
     @SuppressWarnings("unchecked")
     private <T> T lookupInJndi(String objName) throws Exception {
@@ -272,23 +197,40 @@ public class Database {
         }
     }
 
-    public BpelDAOConnectionFactoryJDBC createDaoCF() throws DatabaseConfigException  {
+    public BpelDAOConnectionFactory createDaoCF() throws DatabaseConfigException  {
         String pClassName = _odeConfig.getDAOConnectionFactory();
 
-        __log.info(__msgs.msgOdeUsingDAOImpl(pClassName));
+        __log.debug(__msgs.msgOdeUsingDAOImpl(pClassName));
+
+        BpelDAOConnectionFactory cf;
+        try {
+            cf = (BpelDAOConnectionFactory) Class.forName(pClassName).newInstance();
+        } catch (Exception ex) {
+            String errmsg = __msgs.msgDAOInstantiationFailed(pClassName);
+            __log.error(errmsg, ex);
+            throw new DatabaseConfigException(errmsg, ex);
+        }
+
+        cf.init(_odeConfig.getProperties(),_txm,getDataSource());
+        return cf;
+    }
+
+
+    public ConfStoreDAOConnectionFactory createDaoStoreCF() throws DatabaseConfigException  {
+        String pClassName = _odeConfig.getDAOConfStoreConnectionFactory();
+
+        __log.debug(__msgs.msgOdeUsingDAOImpl(pClassName));
 
-        BpelDAOConnectionFactoryJDBC cf;
+        ConfStoreDAOConnectionFactory cf;
         try {
-            cf = (BpelDAOConnectionFactoryJDBC) Class.forName(pClassName).newInstance();
+            cf = (ConfStoreDAOConnectionFactory) Class.forName(pClassName).newInstance();
         } catch (Exception ex) {
             String errmsg = __msgs.msgDAOInstantiationFailed(pClassName);
             __log.error(errmsg, ex);
             throw new DatabaseConfigException(errmsg, ex);
         }
 
-        cf.setDataSource(getDataSource());
-        cf.setTransactionManager(_txm);
-        cf.init(_odeConfig.getProperties());
+        cf.init(_odeConfig.getProperties(),_txm,getDataSource());
         return cf;
     }
 

Added: ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/dbutil/DatabaseConnectionManager.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/dbutil/DatabaseConnectionManager.java?rev=947046&view=auto
==============================================================================
--- ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/dbutil/DatabaseConnectionManager.java (added)
+++ ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/dbutil/DatabaseConnectionManager.java Fri May 21 15:40:59 2010
@@ -0,0 +1,117 @@
+/*
+ * 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.il.dbutil;
+
+
+import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.connector.outbound.GenericConnectionManager;
+import org.apache.geronimo.connector.outbound.connectionmanagerconfig.LocalTransactions;
+import org.apache.geronimo.connector.outbound.connectionmanagerconfig.PoolingSupport;
+import org.apache.geronimo.connector.outbound.connectionmanagerconfig.SinglePool;
+import org.apache.geronimo.connector.outbound.connectionmanagerconfig.TransactionSupport;
+import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTracker;
+import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator;
+import org.apache.geronimo.transaction.manager.RecoverableTransactionManager;
+import org.apache.ode.il.config.OdeConfigProperties;
+import org.apache.ode.il.txutil.TxManager;
+import org.tranql.connector.jdbc.JDBCDriverMCF;
+
+public class DatabaseConnectionManager {
+
+  private static final long serialVersionUID = 1L;
+  private static final Log __log = LogFactory.getLog(DatabaseConnectionManager.class);
+  private static final Messages __msgs = Messages.getMessages(Messages.class);
+  private static final int CONNECTION_MAX_WAIT_MILLIS = 30000;
+  private static final int CONNECTION_MAX_IDLE_MINUTES = 5;
+  private GenericConnectionManager _connectionManager;
+  private TransactionManager _txm = null;
+  private String _url = null;
+  private OdeConfigProperties _odeConfig = null;
+  private DataSource _dataSource = null;
+
+  public DatabaseConnectionManager(TransactionManager txm, OdeConfigProperties odeConfig) {
+    _txm = txm;
+    _odeConfig = odeConfig;
+  }
+
+  public void init(String url, String driverClass, String username, String password) throws DatabaseConfigException {
+    __log.debug("Creating connection pool for " + url + " with driver " + driverClass);
+
+    if (!(_txm instanceof RecoverableTransactionManager)) {
+      throw new RuntimeException("TransactionManager is not recoverable.");
+    }
+
+    _url = url;
+    TransactionSupport transactionSupport = LocalTransactions.INSTANCE;
+    ConnectionTracker connectionTracker = new ConnectionTrackingCoordinator();
+
+    PoolingSupport poolingSupport = new SinglePool(
+            _odeConfig.getPoolMaxSize(),
+            _odeConfig.getPoolMinSize(),
+            CONNECTION_MAX_WAIT_MILLIS,
+            CONNECTION_MAX_IDLE_MINUTES,
+            true, // match one
+            false, // match all
+            false); // select one assume match
+
+    _connectionManager = new GenericConnectionManager(
+            transactionSupport,
+            poolingSupport,
+            null,
+            connectionTracker,
+            (RecoverableTransactionManager) _txm,
+            getClass().getName(),
+            getClass().getClassLoader());
+
+    JDBCDriverMCF mcf = new JDBCDriverMCF();
+    try {
+      mcf.setDriver(driverClass);
+      mcf.setConnectionURL(url);
+      if (username != null) {
+        mcf.setUserName(username);
+      }
+      if (password != null) {
+        mcf.setPassword(password);
+      }
+      _connectionManager.doStart();
+      _dataSource = (DataSource) mcf.createConnectionFactory(_connectionManager);
+    } catch (Exception ex) {
+      String errmsg = __msgs.msgOdeDbPoolStartupFailed(url);
+      __log.error(errmsg, ex);
+      throw new DatabaseConfigException(errmsg, ex);
+    }
+  }
+
+  public void shutdown() throws DatabaseConfigException {
+    try {
+      _connectionManager.doStop();
+    } catch (Exception ex) {
+      String errmsg = __msgs.msgOdeDbPoolStartupFailed(_url);
+      __log.error(errmsg, ex);
+      throw new DatabaseConfigException(errmsg, ex);
+    }
+  }
+
+  public DataSource getDataSource() {
+    return _dataSource;
+  }
+}

Added: ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/dbutil/DerbyDatabase.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/dbutil/DerbyDatabase.java?rev=947046&view=auto
==============================================================================
--- ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/dbutil/DerbyDatabase.java (added)
+++ ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/dbutil/DerbyDatabase.java Fri May 21 15:40:59 2010
@@ -0,0 +1,104 @@
+/*
+ * 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.il.dbutil;
+
+import java.io.File;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.derby.impl.io.VFMemoryStorageFactory;
+import org.apache.derby.jdbc.EmbeddedDataSource;
+import org.apache.ode.il.config.OdeConfigProperties;
+
+public class DerbyDatabase implements EmbeddedDatabase {
+
+  private static final Log __log = LogFactory.getLog(DerbyDatabase.class);
+  private DatabaseConnectionManager _connectionManager;
+  private String _dbUrl = null;
+  private DataSource _dataSource = null;
+  private File _workRoot = null;
+  private String _dbName = null;
+
+  public void init(File workRoot, OdeConfigProperties props, TransactionManager txm) {
+    _workRoot = workRoot;
+    _dbName = props.getDbEmbeddedName();
+    if (_workRoot == null) {
+      _dbUrl = "jdbc:derby:memory:" + _dbName + ";create=true";
+      try {
+        DriverManager.getConnection(_dbUrl).close();
+      } catch (SQLException se) {
+        __log.error(se);
+      }
+      EmbeddedDataSource dds = new EmbeddedDataSource();
+      dds.setDatabaseName("memory:" + _dbName);
+      dds.setUser("sa");
+      dds.setCreateDatabase("true");
+      _dataSource = dds;
+    } else {
+      _dbUrl = "jdbc:derby:" + _workRoot + File.separator + _dbName;
+      if (props.isDbEmbeddedCreate()) {
+        _dbUrl += ";create=true";
+      }
+      String clazz = org.apache.derby.jdbc.EmbeddedDriver.class.getName();
+      _connectionManager = new DatabaseConnectionManager(txm, props);
+      try {
+        _connectionManager.init(_dbUrl, clazz, "sa", null);
+      } catch (DatabaseConfigException ex) {
+        __log.error("Unable to initialize connection pool", ex);
+      }
+      _dataSource = _connectionManager.getDataSource();
+      __log.debug("Using Embedded Database: " + _dbUrl);
+    }
+  }
+
+  public void shutdown() {
+    if (_connectionManager != null) {
+      try {
+        _connectionManager.shutdown();
+      } catch (DatabaseConfigException ex) {
+        __log.error("unable to shutdown connection pool", ex);
+      }
+    }
+    try {
+      DriverManager.getConnection(_dbUrl + ";shutdown=true").close();
+    } catch (SQLException ex) {
+      // Shutdown will always return an exeption!
+      if (ex.getErrorCode() != 45000) {
+        __log.error("Error shutting down Derby: " + ex.getErrorCode(), ex);
+      }
+    } catch (Throwable ex) {
+      __log.debug("Error shutting down Derby.", ex);
+    }
+    if (_workRoot == null) {
+      try {
+        //Don't worry about File IO, this is only virtual
+        VFMemoryStorageFactory.purgeDatabase(new File(_dbName).getCanonicalPath());
+      } catch (Exception e) {
+        __log.debug("Error shutting down Derby.", e);
+      }
+    }
+  }
+
+  public DataSource getDataSource() {
+    return _dataSource;
+  }
+}

Added: ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/dbutil/EmbeddedDatabase.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/dbutil/EmbeddedDatabase.java?rev=947046&view=auto
==============================================================================
--- ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/dbutil/EmbeddedDatabase.java (added)
+++ ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/dbutil/EmbeddedDatabase.java Fri May 21 15:40:59 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.il.dbutil;
+
+import java.io.File;
+import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
+import org.apache.ode.il.config.OdeConfigProperties;
+
+public interface EmbeddedDatabase  {
+
+  void init(File workRoot, OdeConfigProperties props, TransactionManager txm);
+
+  void shutdown();
+
+  DataSource getDataSource();
+}

Added: ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/dbutil/H2Database.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/dbutil/H2Database.java?rev=947046&view=auto
==============================================================================
--- ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/dbutil/H2Database.java (added)
+++ ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/dbutil/H2Database.java Fri May 21 15:40:59 2010
@@ -0,0 +1,81 @@
+/*
+ * 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.il.dbutil;
+
+import java.io.File;
+import java.sql.Connection;
+import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.il.config.OdeConfigProperties;
+import org.h2.jdbcx.JdbcDataSource;
+
+public class H2Database implements EmbeddedDatabase {
+
+  private static final Log __log = LogFactory.getLog(H2Database.class);
+  private DatabaseConnectionManager _connectionManager;
+  private String _dbUrl = null;
+  private DataSource _dataSource = null;
+
+  public void init(File workRoot, OdeConfigProperties props, TransactionManager txm) {
+    String db = props.getDbEmbeddedName();
+    if (workRoot == null) {
+      _dbUrl = "jdbc:h2:mem:" + db + ";DB_CLOSE_DELAY=-1";
+      JdbcDataSource hds = new JdbcDataSource();
+      hds.setURL(_dbUrl);
+      hds.setUser("sa");
+      _dataSource = hds;
+    } else {
+      _dbUrl = "jdbc:h2:" + workRoot + File.separator + db;
+      if (!props.isDbEmbeddedCreate()) {
+        _dbUrl += ";IFEXISTS=TRUE";
+      }
+      String clazz = org.h2.Driver.class.getName();
+      _connectionManager = new DatabaseConnectionManager(txm, props);
+      try {
+        _connectionManager.init(_dbUrl, clazz, "sa", null);
+      } catch (DatabaseConfigException ex) {
+        __log.error("Unable to initialize connection pool", ex);
+      }
+      _dataSource = _connectionManager.getDataSource();
+    }
+    __log.debug("Using Embedded Database: " + _dbUrl);
+  }
+
+  public void shutdown() {
+    if (_connectionManager != null) {
+      try {
+        _connectionManager.shutdown();
+      } catch (DatabaseConfigException ex) {
+        __log.error("unable to shutdown connection pool", ex);
+      }
+    }
+    try {
+      Connection conn = getDataSource().getConnection();
+      conn.createStatement().execute("SHUTDOWN");
+    } catch (Throwable ex) {
+      __log.debug("Error shutting down H2.", ex);
+    }
+  }
+
+  public DataSource getDataSource() {
+    return _dataSource;
+  }
+}

Added: ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/txutil/TransactionConfigException.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/txutil/TransactionConfigException.java?rev=947046&view=auto
==============================================================================
--- ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/txutil/TransactionConfigException.java (added)
+++ ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/txutil/TransactionConfigException.java Fri May 21 15:40:59 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.il.txutil;
+
+public class TransactionConfigException extends Exception {
+
+    private static final long serialVersionUID = 1L;
+
+    public TransactionConfigException(String msg, Exception ex) {
+        super(msg,ex);
+    }
+
+}

Added: ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/txutil/TxManager.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/txutil/TxManager.java?rev=947046&view=auto
==============================================================================
--- ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/txutil/TxManager.java (added)
+++ ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/txutil/TxManager.java Fri May 21 15:40:59 2010
@@ -0,0 +1,173 @@
+/*
+ * 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.il.txutil;
+
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.Synchronization;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import javax.transaction.xa.XAResource;
+
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.il.config.OdeConfigProperties;
+
+
+/**
+ * Does the dirty work of setting up / obtaining a TransactionManager based on the configuration in the {@link OdeConfigProperties} object.
+ *
+ */
+public class TxManager {
+    private static final Log __log = LogFactory.getLog(TxManager.class);
+
+    private OdeConfigProperties _odeConfig;
+    private boolean _debugTxn = false;
+
+
+    public TxManager(OdeConfigProperties props) {
+        if (props == null)
+            throw new NullPointerException("Must provide a configuration.");
+
+        _odeConfig = props;
+        _debugTxn=Boolean.valueOf(_odeConfig.getProperty("tx.debug","false"));
+    }
+
+
+    public TransactionManager createTransactionManager() throws TransactionConfigException  {
+        String txFactoryName = _odeConfig.getTxFactoryClass();
+        __log.debug("Initializing transaction manager using " + txFactoryName);
+        try {
+            Class txFactClass = Class.forName(txFactoryName);
+            Object txFact = txFactClass.newInstance();
+            TransactionManager txMgr = (TransactionManager) txFactClass.getMethod("getTransactionManager", (Class[]) null).invoke(txFact);
+            if (__log.isDebugEnabled() && _debugTxn)
+                txMgr = new DebugTxMgr(txMgr);
+            return txMgr;
+        } catch (Exception e) {
+            __log.fatal("Couldn't initialize a transaction manager with factory: " + txFactoryName, e);
+            throw new TransactionConfigException("Couldn't initialize a transaction manager with factory: " + txFactoryName, e);
+        }
+    }
+
+
+    // Transactional debugging stuff, to track down all these little annoying bugs.
+    public static class DebugTxMgr implements TransactionManager {
+        protected TransactionManager _tm;
+
+        public DebugTxMgr(TransactionManager tm) {        
+                _tm = tm;
+        }
+
+        public void begin() throws NotSupportedException, SystemException {
+            __log.debug("Txm begin");
+            _tm.begin();
+        }
+
+        public void commit() throws HeuristicMixedException, HeuristicRollbackException, IllegalStateException, RollbackException, SecurityException, SystemException {
+            __log.debug("Txm commit");
+            for (StackTraceElement traceElement : Thread.currentThread().getStackTrace()) {
+                __log.debug(traceElement.toString());
+            }
+            _tm.commit();
+        }
+
+        public int getStatus() throws SystemException {
+            __log.debug("Txm status");
+            return _tm.getStatus();
+        }
+
+        public Transaction getTransaction() throws SystemException {
+            Transaction tx = _tm.getTransaction();
+            __log.debug("Txm get tx " + tx);
+            return tx == null ? null : new DebugTx(tx);
+        }
+
+        public void resume(Transaction transaction) throws IllegalStateException, InvalidTransactionException, SystemException {
+            __log.debug("Txm resume");
+            _tm.resume(transaction);
+        }
+
+        public void rollback() throws IllegalStateException, SecurityException, SystemException {
+            __log.debug("Txm rollback");
+            _tm.rollback();
+        }
+
+        public void setRollbackOnly() throws IllegalStateException, SystemException {
+            __log.debug("Txm set rollback");
+            _tm.setRollbackOnly();
+        }
+
+        public void setTransactionTimeout(int i) throws SystemException {
+            __log.debug("Txm set tiemout " + i);
+            _tm.setTransactionTimeout(i);
+        }
+
+        public Transaction suspend() throws SystemException {
+            __log.debug("Txm suspend");
+            return _tm.suspend();
+        }
+    }
+
+    public static class DebugTx implements Transaction {
+        private Transaction _tx;
+
+        public DebugTx(Transaction tx) {
+            _tx = tx;
+        }
+
+        public void commit() throws HeuristicMixedException, HeuristicRollbackException, RollbackException, SecurityException, SystemException {
+            __log.debug("Tx commit");
+            _tx.commit();
+        }
+
+        public boolean delistResource(XAResource xaResource, int i) throws IllegalStateException, SystemException {
+            return _tx.delistResource(xaResource, i);
+        }
+
+        public boolean enlistResource(XAResource xaResource) throws IllegalStateException, RollbackException, SystemException {
+            return _tx.enlistResource(xaResource);
+        }
+
+        public int getStatus() throws SystemException {
+            return _tx.getStatus();
+        }
+
+        public void registerSynchronization(Synchronization synchronization) throws IllegalStateException, RollbackException, SystemException {
+            __log.debug("Synchronization registration on " + synchronization.getClass().getName());
+            _tx.registerSynchronization(synchronization);
+        }
+
+        public void rollback() throws IllegalStateException, SystemException {
+            __log.debug("Tx rollback");
+            _tx.rollback();
+        }
+
+        public void setRollbackOnly() throws IllegalStateException, SystemException {
+            __log.debug("Tx set rollback");
+            _tx.setRollbackOnly();
+        }
+    }
+
+}

Modified: ode/trunk/bpel-runtime/pom.xml
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/pom.xml?rev=947046&r1=947045&r2=947046&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/pom.xml (original)
+++ ode/trunk/bpel-runtime/pom.xml Fri May 21 15:40:59 2010
@@ -85,9 +85,9 @@
     </dependency>
     <dependency>
       <groupId>org.apache.ode</groupId>
-      <artifactId>ode-dao-hibernate</artifactId>
+      <artifactId>ode-dao-jpa-ojpa</artifactId>
       <scope>test</scope>
-    </dependency>
+    </dependency>   
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
@@ -99,8 +99,8 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>hsqldb</groupId>
-      <artifactId>hsqldb</artifactId>
+      <groupId>com.h2database</groupId>
+      <artifactId>h2</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -117,27 +117,6 @@
             <groupId>org.apache.ode</groupId>
             <artifactId>ode-agents</artifactId>
         </dependency>
-
-        <dependency>
-            <groupId>org.apache.ode</groupId>
-            <artifactId>ode-jacob</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
-            <artifactId>ode-jacob-ap</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
-            <artifactId>ode-utils</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
-            <artifactId>ode-bpel-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ode</groupId>
-            <artifactId>ode-bpel-dao</artifactId>
-        </dependency>
         <dependency>
           <groupId>commons-collections</groupId>
           <artifactId>commons-collections</artifactId>
@@ -202,15 +181,25 @@
         <dependency>
           <groupId>junit</groupId>
           <artifactId>junit</artifactId>
-	  <scope>test</scope>
+	  	  <scope>test</scope>
+        </dependency>
+ 		<dependency>
+          <groupId>org.apache.ode</groupId>
+          <artifactId>ode-dao-hibernate</artifactId>
+	  	  <scope>test</scope>
         </dependency>
-
        <dependency>
           <groupId>tranql</groupId>
           <artifactId>tranql-connector-derby-common</artifactId>
           <version>1.1</version>
           <scope>test</scope>
-       </dependency>       
+       </dependency>
+       
+       <dependency>
+          <groupId>org.apache.geronimo.components</groupId>
+          <artifactId>geronimo-transaction</artifactId>
+          <scope>test</scope>
+       </dependency>        
 
 
    </dependencies>
@@ -232,14 +221,22 @@
 		    </goals>
 		   </execution>
 	        </executions>
-		<dependencies>
-		   <dependency>
-		      <groupId>org.apache.ode</groupId>
-		      <artifactId>ode-jacob-ap</artifactId>
-		      <version>${project.version}</version>
-		   </dependency>
-		 </dependencies>
-            </plugin>
+			<dependencies>
+			   <dependency>
+			      <groupId>org.apache.ode</groupId>
+			      <artifactId>ode-jacob-ap</artifactId>
+			      <version>${project.version}</version>
+			   </dependency>
+			 </dependencies>
+         </plugin>
+      	<plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>**/ActivityRecoveryTest.java</exclude>
+          </excludes>
+        </configuration>
+    	</plugin>
         </plugins>
     </build>
 </project>

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelDatabase.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelDatabase.java?rev=947046&r1=947045&r2=947046&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelDatabase.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelDatabase.java Fri May 21 15:40:59 2010
@@ -22,9 +22,9 @@ package org.apache.ode.bpel.engine;
 
 import javax.xml.namespace.QName;
 
-import org.apache.ode.bpel.dao.BpelDAOConnection;
-import org.apache.ode.bpel.dao.BpelDAOConnectionFactory;
 import org.apache.ode.bpel.iapi.Scheduler;
+import org.apache.ode.dao.bpel.BpelDAOConnection;
+import org.apache.ode.dao.bpel.BpelDAOConnectionFactory;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java?rev=947046&r1=947045&r2=947046&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java Fri May 21 15:40:59 2010
@@ -34,9 +34,6 @@ import javax.xml.namespace.QName;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-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.evt.BpelEvent;
 import org.apache.ode.bpel.iapi.BpelEngine;
 import org.apache.ode.bpel.iapi.BpelEngineException;
@@ -63,6 +60,9 @@ import org.apache.ode.bpel.o.OConstants;
 import org.apache.ode.bpel.o.OPartnerLink;
 import org.apache.ode.bpel.o.OProcess;
 import org.apache.ode.bpel.runtime.InvalidProcessException;
+import org.apache.ode.dao.bpel.MessageExchangeDAO;
+import org.apache.ode.dao.bpel.ProcessDAO;
+import org.apache.ode.dao.bpel.ProcessInstanceDAO;
 import org.apache.ode.utils.DOMUtils;
 import org.apache.ode.utils.Namespaces;
 import org.apache.ode.utils.msg.MessageBundle;

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelManagementFacadeImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelManagementFacadeImpl.java?rev=947046&r1=947045&r2=947046&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelManagementFacadeImpl.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelManagementFacadeImpl.java Fri May 21 15:40:59 2010
@@ -22,13 +22,17 @@ import org.apache.ode.bpel.bdi.breaks.Ac
 import org.apache.ode.bpel.bdi.breaks.Breakpoint;
 import org.apache.ode.bpel.bdi.breaks.VariableModificationBreakpoint;
 import org.apache.ode.bpel.common.CorrelationKey;
-import org.apache.ode.bpel.dao.*;
 import org.apache.ode.bpel.iapi.BpelServer;
 import org.apache.ode.bpel.iapi.ProcessStore;
 import org.apache.ode.bpel.o.OProcess;
 import org.apache.ode.bpel.pmapi.*;
 import org.apache.ode.bpel.pmapi.TInstanceInfo.EventInfo;
 import org.apache.ode.bpel.runtime.breaks.ActivityBreakpointImpl;
+import org.apache.ode.dao.bpel.BpelDAOConnection;
+import org.apache.ode.dao.bpel.CorrelationSetDAO;
+import org.apache.ode.dao.bpel.ProcessInstanceDAO;
+import org.apache.ode.dao.bpel.ScopeDAO;
+import org.apache.ode.dao.bpel.XmlDataDAO;
 import org.apache.ode.utils.DOMUtils;
 import org.apache.ode.utils.uuid.UUIDGen;
 import org.w3c.dom.Node;

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java?rev=947046&r1=947045&r2=947046&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java Fri May 21 15:40:59 2010
@@ -38,10 +38,6 @@ import org.apache.commons.logging.LogFac
 import org.apache.ode.agents.memory.SizingAgent;
 import org.apache.ode.bpel.common.FaultException;
 import org.apache.ode.bpel.common.ProcessState;
-import org.apache.ode.bpel.dao.BpelDAOConnection;
-import org.apache.ode.bpel.dao.DeferredProcessInstanceCleanable;
-import org.apache.ode.bpel.dao.ProcessDAO;
-import org.apache.ode.bpel.dao.ProcessInstanceDAO;
 import org.apache.ode.bpel.engine.extvar.ExternalVariableConf;
 import org.apache.ode.bpel.engine.extvar.ExternalVariableManager;
 import org.apache.ode.bpel.evt.ProcessInstanceEvent;
@@ -71,6 +67,10 @@ import org.apache.ode.bpel.runtime.Inval
 import org.apache.ode.bpel.runtime.PROCESS;
 import org.apache.ode.bpel.runtime.PropertyAliasEvaluationContext;
 import org.apache.ode.bpel.runtime.channels.FaultData;
+import org.apache.ode.dao.bpel.BpelDAOConnection;
+import org.apache.ode.dao.bpel.DeferredProcessInstanceCleanable;
+import org.apache.ode.dao.bpel.ProcessDAO;
+import org.apache.ode.dao.bpel.ProcessInstanceDAO;
 import org.apache.ode.jacob.soup.ReplacementMap;
 import org.apache.ode.utils.ObjectPrinter;
 import org.apache.ode.utils.Properties;

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcessDatabase.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcessDatabase.java?rev=947046&r1=947045&r2=947046&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcessDatabase.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcessDatabase.java Fri May 21 15:40:59 2010
@@ -18,9 +18,9 @@
  */
 package org.apache.ode.bpel.engine;
 
-import org.apache.ode.bpel.dao.BpelDAOConnectionFactory;
-import org.apache.ode.bpel.dao.ProcessDAO;
 import org.apache.ode.bpel.iapi.Scheduler;
+import org.apache.ode.dao.bpel.BpelDAOConnectionFactory;
+import org.apache.ode.dao.bpel.ProcessDAO;
 
 import javax.xml.namespace.QName;
 

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java?rev=947046&r1=947045&r2=947046&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java Fri May 21 15:40:59 2010
@@ -39,17 +39,6 @@ import org.apache.ode.bpel.common.Correl
 import org.apache.ode.bpel.common.CorrelationKeySet;
 import org.apache.ode.bpel.common.FaultException;
 import org.apache.ode.bpel.common.ProcessState;
-import org.apache.ode.bpel.dao.CorrelationSetDAO;
-import org.apache.ode.bpel.dao.CorrelatorDAO;
-import org.apache.ode.bpel.dao.MessageDAO;
-import org.apache.ode.bpel.dao.MessageExchangeDAO;
-import org.apache.ode.bpel.dao.MessageRouteDAO;
-import org.apache.ode.bpel.dao.PartnerLinkDAO;
-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.ScopeStateEnum;
-import org.apache.ode.bpel.dao.XmlDataDAO;
 import org.apache.ode.bpel.evar.ExternalVariableModuleException;
 import org.apache.ode.bpel.evar.ExternalVariableModule.Value;
 import org.apache.ode.bpel.evt.CorrelationSetWriteEvent;
@@ -108,6 +97,17 @@ import org.apache.ode.utils.Namespaces;
 import org.apache.ode.utils.ObjectPrinter;
 import org.apache.ode.bpel.evar.ExternalVariableModuleException;
 import org.apache.ode.bpel.evar.ExternalVariableModule.Value;
+import org.apache.ode.dao.bpel.CorrelationSetDAO;
+import org.apache.ode.dao.bpel.CorrelatorDAO;
+import org.apache.ode.dao.bpel.MessageDAO;
+import org.apache.ode.dao.bpel.MessageExchangeDAO;
+import org.apache.ode.dao.bpel.MessageRouteDAO;
+import org.apache.ode.dao.bpel.PartnerLinkDAO;
+import org.apache.ode.dao.bpel.ProcessDAO;
+import org.apache.ode.dao.bpel.ProcessInstanceDAO;
+import org.apache.ode.dao.bpel.ScopeDAO;
+import org.apache.ode.dao.bpel.ScopeStateEnum;
+import org.apache.ode.dao.bpel.XmlDataDAO;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java?rev=947046&r1=947045&r2=947046&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java Fri May 21 15:40:59 2010
@@ -35,10 +35,6 @@ import javax.xml.namespace.QName;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.ode.bpel.dao.BpelDAOConnection;
-import org.apache.ode.bpel.dao.BpelDAOConnectionFactory;
-import org.apache.ode.bpel.dao.DeferredProcessInstanceCleanable;
-import org.apache.ode.bpel.dao.ProcessDAO;
 import org.apache.ode.bpel.engine.cron.CronScheduler;
 import org.apache.ode.bpel.engine.migration.MigrationHandler;
 import org.apache.ode.bpel.evar.ExternalVariableModule;
@@ -59,6 +55,10 @@ import org.apache.ode.bpel.iapi.Schedule
 import org.apache.ode.bpel.iapi.Scheduler.Synchronizer;
 import org.apache.ode.bpel.intercept.MessageExchangeInterceptor;
 import org.apache.ode.bpel.o.OProcess;
+import org.apache.ode.dao.bpel.BpelDAOConnection;
+import org.apache.ode.dao.bpel.BpelDAOConnectionFactory;
+import org.apache.ode.dao.bpel.DeferredProcessInstanceCleanable;
+import org.apache.ode.dao.bpel.ProcessDAO;
 import org.apache.ode.utils.msg.MessageBundle;
 import org.apache.ode.utils.stl.CollectionsX;
 import org.apache.ode.utils.stl.MemberOfFunction;

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BrokeredMyRoleMessageExchangeImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BrokeredMyRoleMessageExchangeImpl.java?rev=947046&r1=947045&r2=947046&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BrokeredMyRoleMessageExchangeImpl.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BrokeredMyRoleMessageExchangeImpl.java Fri May 21 15:40:59 2010
@@ -28,12 +28,12 @@ import java.util.concurrent.TimeoutExcep
 import javax.wsdl.Operation;
 import javax.wsdl.PortType;
 
-import org.apache.ode.bpel.dao.MessageExchangeDAO;
 import org.apache.ode.bpel.iapi.BpelEngineException;
 import org.apache.ode.bpel.iapi.EndpointReference;
 import org.apache.ode.bpel.iapi.Message;
 import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
 import org.apache.ode.bpel.iapi.ProcessState;
+import org.apache.ode.dao.bpel.MessageExchangeDAO;
 
 
 /**

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java?rev=947046&r1=947045&r2=947046&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java Fri May 21 15:40:59 2010
@@ -19,7 +19,6 @@
 
 package org.apache.ode.bpel.engine;
 
-import org.apache.ode.bpel.dao.BpelDAOConnectionFactory;
 import org.apache.ode.bpel.iapi.BindingContext;
 import org.apache.ode.bpel.iapi.BpelEventListener;
 import org.apache.ode.bpel.iapi.EndpointReferenceContext;
@@ -28,6 +27,7 @@ import org.apache.ode.bpel.iapi.Schedule
 import org.apache.ode.bpel.intercept.MessageExchangeInterceptor;
 import org.apache.ode.bpel.engine.cron.CronScheduler;
 import org.apache.ode.bpel.evar.ExternalVariableModule;
+import org.apache.ode.dao.bpel.BpelDAOConnectionFactory;
 
 import java.util.HashMap;
 import java.util.List;

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/DebuggerSupport.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/DebuggerSupport.java?rev=947046&r1=947045&r2=947046&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/DebuggerSupport.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/DebuggerSupport.java Fri May 21 15:40:59 2010
@@ -25,9 +25,6 @@ import org.apache.ode.bpel.iapi.Schedule
 import org.apache.ode.bpel.iapi.Scheduler.JobType;
 import org.apache.ode.bpel.bdi.breaks.Breakpoint;
 import org.apache.ode.bpel.common.ProcessState;
-import org.apache.ode.bpel.dao.BpelDAOConnection;
-import org.apache.ode.bpel.dao.ProcessDAO;
-import org.apache.ode.bpel.dao.ProcessInstanceDAO;
 import org.apache.ode.bpel.evt.ActivityExecStartEvent;
 import org.apache.ode.bpel.evt.BpelEvent;
 import org.apache.ode.bpel.evt.ProcessCompletionEvent;
@@ -41,6 +38,9 @@ import org.apache.ode.bpel.pmapi.Instanc
 import org.apache.ode.bpel.pmapi.ManagementException;
 import org.apache.ode.bpel.pmapi.ProcessingException;
 import org.apache.ode.bpel.runtime.breaks.BreakpointImpl;
+import org.apache.ode.dao.bpel.BpelDAOConnection;
+import org.apache.ode.dao.bpel.ProcessDAO;
+import org.apache.ode.dao.bpel.ProcessInstanceDAO;
 import org.apache.ode.utils.CollectionUtils;
 import org.apache.ode.utils.msg.MessageBundle;