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/02 19:03:00 UTC

svn commit: r940263 [3/16] - in /ode/trunk: ./ axis2-war/ axis2-war/src/main/assembly/ axis2-war/src/main/webapp/WEB-INF/conf.hib-derby/ axis2-war/src/main/webapp/WEB-INF/conf.jpa-derby/ axis2-war/src/main/webapp/WEB-INF/conf/ axis2-war/src/test/java/o...

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=940263&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 Sun May  2 17:02:51 2010
@@ -0,0 +1,94 @@
+/*
+ * 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;
+
+/**
+ * <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();
+
+  /**
+   * 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, CorrelationKey[] correlationKeys);
+
+
+  /**
+   * 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(CorrelationKey correlationKey);
+
+  /**
+   * Find a route matching the given correlation key.
+   * @param correlationKey correlation key
+   * @return route matching the given correlation key
+   */
+  MessageRouteDAO findRoute(CorrelationKey correlationKey);
+
+  /**
+   * 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, CorrelationKey correlationKey);
+
+  /**
+   * Remove all routes with the given route-group identifier.
+   * @param routeGroupId
+   */
+  void removeRoutes(String routeGroupId, ProcessInstanceDAO target);
+}

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=940263&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 Sun May  2 17:02:51 2010
@@ -0,0 +1,31 @@
+package org.apache.ode.dao.bpel;
+
+import java.io.Serializable;
+
+/**
+ * Instances and associated data for a ProcessDAO implementation that implements this 
+ * interface can be deleted in a deferred fashion.
+ * The framework guarantees that the deleteInstances() call is repeatedly called
+ * until the call returns a number smaller than the given transaction size, even
+ * when the system restarts at some time.
+ * 
+ * @author sean
+ *
+ */
+public interface DeferredProcessInstanceCleanable {
+    /**
+     * Returns the database id.
+     * 
+     * @return database id
+     */
+    Serializable getId();
+    
+    /**
+     * 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=940263&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 Sun May  2 17:02:51 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=940263&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 Sun May  2 17:02:51 2010
@@ -0,0 +1,24 @@
+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=940263&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 Sun May  2 17:02:51 2010
@@ -0,0 +1,52 @@
+/*
+ * 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;
+
+/**
+ * Representation of a message (i.e. request/response) in the database.
+ * 
+ * @author Maciej Szefler <mszefler at gmail dot com>
+ * 
+ */
+public interface MessageDAO {
+
+    /** Set the message type (i.e. the <wsdl:message> type). */
+    void setType(QName type);
+
+    /** Get the message type (i.e. the <wsdl:message> type). */
+    QName getType();
+
+    /** Set the message data (content). */
+    void setData(Element value);
+
+    /** Get the message data (content). */
+    Element getData();
+
+    /** Set the message header (content). */
+    void setHeader(Element value);
+    
+    /** Get the message header (content). */
+    Element getHeader();
+ 
+}

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=940263&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 Sun May  2 17:02:51 2010
@@ -0,0 +1,293 @@
+/*
+ * 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 java.util.Set;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.ode.bpel.iapi.InvocationStyle;
+import org.apache.ode.bpel.iapi.Resource;
+import org.apache.ode.bpel.iapi.MessageExchange.AckType;
+import org.apache.ode.bpel.iapi.MessageExchange.FailureType;
+import org.apache.ode.bpel.iapi.MessageExchange.MessageExchangePattern;
+import org.apache.ode.bpel.iapi.MessageExchange.Status;
+import org.w3c.dom.Element;
+
+/**
+ * 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 the invocation style. 
+     * @return
+     */
+    InvocationStyle getInvocationStyle();
+    
+    /**
+     * Set the invocation style. 
+     * @param invocationStyle
+     */
+    void setInvocationStyle(InvocationStyle invocationStyle);
+    
+    
+    /**
+     * Get output message (could be fault message)
+     *
+     * @return output message DAO
+     */
+    MessageDAO getResponse();
+
+    /**
+     * Creation time of the message exchange
+     *
+     * @return create time
+     */
+    Date getCreateTime();
+
+    /**
+     * 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(Status status);
+
+    /**
+     * Get state of last message sent/received.
+     *
+     * @return the state
+     */
+    Status 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 the partner's identifier for this message exchange. Generally, the partner will have a different 
+     * identifier for each exchange. This key is used in sistuations when the partner needs to find the mex, 
+     * but only has their own identifier. 
+     *
+     * @return correlation identifier
+     */
+    String getPartnersKey();
+
+    /**
+     * Set the correlation identifier/client id
+     *
+     * @param correlationId
+     *          identifier
+     */
+    void setPartnersKey(String correlationId);
+
+    void setPattern(MessageExchangePattern pattern);
+
+    void setOperation(String opname);
+
+    void setEPR(Element epr);
+
+    Element getEPR();
+
+    String getResource();
+
+    void setResource(String resourceStr);
+
+    MessageExchangePattern getPattern();
+
+    /**
+     * Get the response channel.
+     *
+     * @return response channel.
+     */
+    String getChannel();
+
+    /**
+     * Set the response channel.
+     *
+     * @param string
+     *          response channel
+     */
+    void setChannel(String string);
+
+    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 service being invoked in a myRole
+     * exchange.
+     * @return
+     */
+    QName getCallee();
+
+    /**
+     * Set the "callee"--the id of the service 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();
+
+    Map<String,String> getProperties();
+
+    void setPartnerLink(PartnerLinkDAO plinkDAO);
+
+    PartnerLinkDAO getPartnerLink();
+
+    /**
+     * Gets the message exchange that has been piped with this one in a process to process interaction.
+     *  
+     * @return other side of the message pipe 
+     */
+    String getPipedMessageExchangeId();
+    
+    void setPipedMessageExchangeId(String pipedMexId);
+    
+    void release(boolean doClean);
+
+    void setFailureType(FailureType failureType);
+
+    FailureType getFailureType();
+
+    long getTimeout();
+
+    void setTimeout(long timeout);
+
+    void setAckType(AckType ackType);
+    
+    AckType getAckType();
+
+    QName getPipedPID();
+    
+    void setPipedPID(QName pipedPid);
+
+    boolean isInstantiatingResource();
+
+    void setInstantiatingResource(boolean inst);
+ }

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=940263&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 Sun May  2 17:02:51 2010
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+/**
+ * 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();
+}

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=940263&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 Sun May  2 17:02:51 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=940263&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 Sun May  2 17:02:51 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.dao.bpel;
+
+import java.util.Collection;
+
+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);
+
+    /**
+     * Get all context storage objects declared in this partner link instance.
+     */
+    public Collection<ContextValueDAO> getContextValues();
+    public void setContextValue(String namespace, String key, String value);
+    public void removeContextValue(String namespace, String key);
+
+}

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=940263&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 Sun May  2 17:02:51 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 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);
+    Collection<ProcessInstanceDAO> findInstance(CorrelationKey cckey, boolean wait);
+
+    /**
+     * 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);
+
+    /**
+     * Remove the process from the database (along with any instance, variable data, etc...).
+     * A ProcessDAO implementation that implements the DeferredProcessInstanceCleanable can opt to removed only
+     * the process and its routes on this call. The framework will call the deleteInstances() on 
+     * the DeferredProcessInstanceCleanable interface in another thread later.
+     */
+    void deleteProcessAndRoutes();
+
+    CorrelatorDAO addCorrelator(String correlator);
+
+    String getGuid();
+
+    int getNumInstances();
+}

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=940263&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 Sun May  2 17:02:51 2010
@@ -0,0 +1,288 @@
+/*
+ * 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.
+     */
+    Collection<ScopeDAO> getScopes();
+
+    /**
+     * Return the correlator which results in the instantiation of the process instance.
+     * 
+     * @return
+     */
+    CorrelatorDAO getInstantiatingCorrelator();
+
+    /**
+     * Returns the URL this instance has been instantiated under.
+     * @return
+     */
+    String getInstantiatingUrl();
+    
+    void setInstantiatingUrl(String url);
+
+    /**
+     * 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.
+     */
+    boolean delete(Set<CLEANUP_CATEGORY> cleanupCategories);
+
+    /**
+     * 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);
+
+
+    void createResourceRoute(String url, String method, String pickResponseChannel, int selectorIdx);
+
+    /**
+     * Delete previously registered activity recovery.
+     */
+    void deleteActivityRecovery(String channel);
+
+    public int getExecutionStateCounter();
+
+    public void setExecutionStateCounter(int stateCounter);
+
+    Set<String> getAllResourceRoutes();
+
+    /**
+     * 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;
+    }
+
+}

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=940263&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 Sun May  2 17:02:51 2010
@@ -0,0 +1,31 @@
+package org.apache.ode.dao.bpel;
+
+import java.util.Collection;
+
+/**
+ * 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 {
+	/**
+	 * Finds process instances that have failures on a given process id, and, returns the number of failed instances
+	 * and the last failed date in an object array.
+	 * 
+	 * @param conn BpelDAOConnection
+	 * @param status the status string, e.g. "active"
+	 * @param processId the string representation of the QName of the process
+	 * @return an array containing the number of failed instances and the last failed date
+	 */
+	public Object[] findFailedCountAndLastFailedDateForProcessId(BpelDAOConnection conn, String status, String processId);
+	
+	/**
+	 * Prefetches the counts of activity failures for the given instances and sets the values to the _activityFailureCount
+	 * member variable of the ProcesInstanceDAOImpl.
+	 * 
+	 * @param instances a collection of process instances
+	 */
+	public void prefetchActivityFailureCounts(Collection<ProcessInstanceDAO> instances);
+}
\ 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=940263&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 Sun May  2 17:02:51 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=940263&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 Sun May  2 17:02:51 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/ResourceRouteDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ResourceRouteDAO.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ResourceRouteDAO.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/bpel/ResourceRouteDAO.java Sun May  2 17:02:51 2010
@@ -0,0 +1,22 @@
+package org.apache.ode.dao.bpel;
+
+public interface ResourceRouteDAO {
+    public String getUrl();
+
+    public void setUrl(String url);
+
+    public String getMethod();
+
+    public void setMethod(String method);
+
+    public String getPickResponseChannel();
+
+    public void setPickResponseChannel(String pickResponseChannel);
+
+    public int getSelectorIdx();
+
+    public void setSelectorIdx(int selectorIdx);
+
+    public ProcessInstanceDAO getInstance();
+
+}

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=940263&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 Sun May  2 17:02:51 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=940263&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 Sun May  2 17:02:51 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=940263&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 Sun May  2 17:02:51 2010
@@ -0,0 +1,56 @@
+/*
+ * 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 class ScopeStateEnum {
+  /** DOCUMENTME */
+  public static final ScopeStateEnum ACTIVE = new ScopeStateEnum("ACTIVE");
+
+  /** DOCUMENTME */
+  public static final ScopeStateEnum FAULTED = new ScopeStateEnum("FAULTED");
+
+  /** DOCUMENTME */
+  public static final ScopeStateEnum FAULTHANDLER = new ScopeStateEnum("FAULTHANDLER");
+
+  /** DOCUMENTME */
+  public static final ScopeStateEnum COMPLETED = new ScopeStateEnum("COMPLETED");
+
+  /** DOCUMENTME */
+  public static final ScopeStateEnum COMPENSATING = new ScopeStateEnum("COMPENSATING");
+
+  /** DOCUMENTME */
+  public static final ScopeStateEnum COMPENSATED = new ScopeStateEnum("COMPENSATED");
+  private final String myName; // for debug only
+
+  public ScopeStateEnum(String name) {
+    myName = name;
+  }
+
+  public boolean equals(Object o) {
+    return ((ScopeStateEnum)o).myName.equals(myName);
+  }
+
+  public int hashCode() {
+    return myName.hashCode();
+  }
+
+  public String toString() {
+    return myName;
+  }
+}

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=940263&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 Sun May  2 17:02:51 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=940263&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 Sun May  2 17:02:51 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/scheduler/JobDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/scheduler/JobDAO.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/scheduler/JobDAO.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/scheduler/JobDAO.java Sun May  2 17:02:51 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.scheduler;
+
+
+import org.apache.ode.bpel.iapi.Scheduler.JobDetails;
+
+/**
+ * Like a task, but a little bit better.
+ *
+ * @author Maciej Szefler ( m s z e f l e r @ g m a i l . c o m )
+ */
+public interface JobDAO {
+  
+
+    String getJobId();
+    boolean isTransacted();
+    JobDetails getDetails();
+    boolean isPersisted();
+    long getScheduledDate();
+
+  
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/scheduler/SchedulerDAOConnection.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/scheduler/SchedulerDAOConnection.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/scheduler/SchedulerDAOConnection.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/scheduler/SchedulerDAOConnection.java Sun May  2 17:02:51 2010
@@ -0,0 +1,99 @@
+/*
+ * 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.scheduler;
+
+import java.util.List;
+import org.apache.ode.bpel.iapi.Scheduler.JobDetails;
+import org.apache.ode.dao.DAOConnection;
+
+/**
+ */
+public interface SchedulerDAOConnection extends DAOConnection {
+
+    JobDAO createJob(boolean transacted, JobDetails jobDetails, boolean persisted, long scheduledDate);
+
+    /**
+     * Save the job in the database.
+     * @param job the job
+     * @param nodeId node assigned to the job (or null if no node has been asssigned)
+     * @param loaded whether the job has been loaded into memory (i.e. in preperation for execution)
+     * @throws DatabaseException in case of error
+     */
+    boolean insertJob(JobDAO job, String nodeId, boolean loaded) ;
+
+    /**
+     * Delete a job from the database.
+     * @param jobid job identifier
+     * @param nodeId node identifier
+     * @throws DatabaseException in case of error
+     */
+    boolean deleteJob(String jobid, String nodeId);
+
+    /**
+     * Return a list of unique nodes identifiers found in the database. This is used
+     * to initialize the list of known nodes when a new node starts up.
+     * @return list of unique node identfiers found in the databaseuniqu
+     */
+    List<String> getNodeIds();
+
+    /**
+     * "Dequeue" jobs from the database that are ready for immediate execution; this basically
+     * is a select/delete operation with constraints on the nodeId and scheduled time.
+     *
+     * @param nodeId node identifier of the jobs
+     * @param maxtime only jobs with scheduled time earlier than this will be dequeued
+     * @param maxjobs maximum number of jobs to deqeue
+     * @return list of jobs that met the criteria and were deleted from the database
+     * @throws DatabaseException in case of error
+     */
+    List<JobDAO> dequeueImmediate(String nodeId, long maxtime, int maxjobs) ;
+
+    /**
+     * Assign a particular node identifier to a fraction of jobs in the database that do not have one,
+     * and are up for execution within a certain time. Only a fraction of the jobs found are assigned
+     * the node identifier. This fraction is determined by the "y" parameter, while membership in the
+     * group (of jobs that get the nodeId) is determined by the "x" parameter. Essentially the logic is:
+     * <code>
+     *  UPDATE jobs AS job
+     *  	WHERE job.scheduledTime before :maxtime
+     *  		  AND job.nodeId is null
+     *  		  AND job.scheduledTime MOD :y == :x
+     *      SET job.nodeId = :nodeId
+     * </code>
+     *
+     * @param nodeId node identifier to assign to jobs
+     * @param x the result of the mod-division
+     * @param y the dividend of the mod-division
+     * @param maxtime only jobs with scheduled time earlier than this will be updated
+     * @return number of jobs updated
+     * @throws DatabaseException in case of error
+     */
+    int updateAssignToNode(String nodeId, int x, int y, long maxtime);
+
+    /**
+     * Reassign jobs from one node to another.
+     *
+     * @param oldnode node assigning from
+     * @param newnode new node asssigning to
+     * @return number of rows changed
+     * @throws DatabaseException
+     */
+    int updateReassign(String oldnode, String newnode);
+    
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/scheduler/SchedulerDAOConnectionFactory.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/scheduler/SchedulerDAOConnectionFactory.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/scheduler/SchedulerDAOConnectionFactory.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/scheduler/SchedulerDAOConnectionFactory.java Sun May  2 17:02:51 2010
@@ -0,0 +1,31 @@
+/*
+ * 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.scheduler;
+
+import org.apache.ode.dao.DAOConnectionFactory;
+
+/**
+ * Connection factory for DB store. 
+ * @author mszefler
+  */
+public interface SchedulerDAOConnectionFactory extends DAOConnectionFactory<SchedulerDAOConnection> {
+
+    SchedulerDAOConnection getConnection() ;
+
+}

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/scheduler/Task.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/scheduler/Task.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/scheduler/Task.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/dao/scheduler/Task.java Sun May  2 17:02:51 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.
+ */
+
+package org.apache.ode.dao.scheduler;
+
+/**
+ * The thing that we schedule.
+ * 
+ * @author Maciej Szefler ( m s z e f l e r @ g m a i l . c o m )
+ *
+ */
+class Task {
+    /** Scheduled date/time. */
+    public long schedDate;
+
+    Task(long schedDate) {
+        this.schedDate = schedDate;
+    }
+}

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=940263&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 Sun May  2 17:02:51 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=940263&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 Sun May  2 17:02:51 2010
@@ -0,0 +1,31 @@
+/*
+ * 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=940263&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 Sun May  2 17:02:51 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=940263&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 Sun May  2 17:02:51 2010
@@ -0,0 +1,52 @@
+/*
+ * 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.store.DeploymentUnitDAO;
+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-schemas/pom.xml
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-schemas/pom.xml?rev=940263&r1=940262&r2=940263&view=diff
==============================================================================
--- ode/trunk/bpel-schemas/pom.xml (original)
+++ ode/trunk/bpel-schemas/pom.xml Sun May  2 17:02:51 2010
@@ -66,6 +66,25 @@
 		   </execution>
 	        </executions>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                        <configuration>
+                            <classifier>xsd</classifier>
+                            <classesDirectory>src/main/xsd</classesDirectory>
+                            <includes>
+                                <include>*.xsd</include>
+                            </includes>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 

Modified: ode/trunk/bpel-store/pom.xml
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-store/pom.xml?rev=940263&r1=940262&r2=940263&view=diff
==============================================================================
--- ode/trunk/bpel-store/pom.xml (original)
+++ ode/trunk/bpel-store/pom.xml Sun May  2 17:02:51 2010
@@ -19,11 +19,11 @@
   -->
 
 <project>
-    <groupId>org.apache.ode</groupId>
-    <artifactId>ode-bpel-store</artifactId>
-    <name>ODE :: Process Store</name>
-    <packaging>jar</packaging>
-    <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.ode</groupId>
+  <artifactId>ode-bpel-store</artifactId>
+  <name>ODE :: Process Store</name>
+  <packaging>jar</packaging>
+  <modelVersion>4.0.0</modelVersion>
 
   <parent>
     <groupId>org.apache.ode</groupId>
@@ -34,11 +34,7 @@
   <dependencies>
     <dependency>
       <groupId>org.apache.ode</groupId>
-      <artifactId>ode-bpel-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.ode</groupId>
-      <artifactId>ode-runtimes</artifactId>
+      <artifactId>ode-bpel-schemas</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.ode</groupId>
@@ -46,22 +42,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.ode</groupId>
-      <artifactId>ode-bpel-dao</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.ode</groupId>
-      <artifactId>ode-bpel-schemas</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.ode</groupId>
       <artifactId>ode-il-common</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.ode</groupId>
-      <artifactId>ode-dao-hibernate</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.ode</groupId>
       <artifactId>ode-utils</artifactId>
     </dependency>
     <dependency>
@@ -69,150 +53,92 @@
       <artifactId>commons-logging</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.hibernate</groupId>
-      <artifactId>hibernate-core</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>javax.persistence</groupId>
-      <artifactId>persistence-api</artifactId>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.specs</groupId>
-        <artifactId>geronimo-stax-api_1.0_spec</artifactId>
-    </dependency>
-    <dependency>
-        <groupId>hsqldb</groupId>
-        <artifactId>hsqldb</artifactId>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.xmlbeans</groupId>
-        <artifactId>xmlbeans</artifactId>
-    </dependency>
-    <dependency>
-        <groupId>xerces</groupId>
-        <artifactId>xercesImpl</artifactId>
-    </dependency>
-    <dependency>
-        <groupId>wsdl4j</groupId>
-        <artifactId>wsdl4j</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>commons-collections</groupId>
-      <artifactId>commons-collections</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>commons-lang</groupId>
-      <artifactId>commons-lang</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.specs</groupId>
-        <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
-        <scope>test</scope>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.specs</groupId>
-        <artifactId>geronimo-jta_1.1_spec</artifactId>
-        <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>log4j</groupId>
-      <artifactId>log4j</artifactId>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>jaxen</groupId>
-      <artifactId>jaxen</artifactId>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>dom4j</groupId>
-      <artifactId>dom4j</artifactId>
+      <groupId>com.h2database</groupId>
+      <artifactId>h2</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>xalan</groupId>
-      <artifactId>xalan</artifactId>
+      <groupId>org.apache.geronimo.components</groupId>
+      <artifactId>geronimo-transaction</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
+      <groupId>org.apache.ode</groupId>
+      <artifactId>ode-dao-jpa-ojpa</artifactId>
       <scope>test</scope>
     </dependency>
+    <!-- for the integration tests - seems to work with the openjpa enhanced enities -->
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
+      <groupId>org.apache.ode</groupId>
+      <artifactId>ode-dao-jpa-hibernate</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.apache.openjpa</groupId>
-      <artifactId>openjpa</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>net.sourceforge.serp</groupId>
-      <artifactId>serp</artifactId>
+      <groupId>org.apache.ode</groupId>
+      <artifactId>ode-dao-hibernate</artifactId>
       <scope>test</scope>
     </dependency>
-   </dependencies>
+  </dependencies>
 
-   <build>
-     <plugins>
+  <build>
+    <plugins>
       <plugin>
-        <artifactId>maven-antrun-plugin</artifactId>
+        <artifactId>maven-surefire-plugin</artifactId>
         <executions>
           <execution>
-            <id>openjpa-enhancer</id>
-            <phase>process-classes</phase>
+            <id>hibernate-jpa</id>
+            <phase>integration-test</phase>
             <goals>
-              <goal>run</goal>
+              <goal>test</goal>
             </goals>
             <configuration>
-              <tasks>
-                <property name="maven.runtime.classpath" refid="maven.test.classpath"/>
-                <path id="classpath">
-		   <pathelement path="${maven.runtime.classpath}"/>
-		</path>
-		<taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask" classpathref="classpath"/>
-                <openjpac>
-		    <fileset dir="${basedir}/src/main">
-		      <include name="**/*.java" />
-		    </fileset>
-		    <classpath>
-		     <pathelement location="${basedir}/target/classes"/>
-		     <pathelement path="${maven.runtime.classpath}"/>
-		    </classpath>
-		 </openjpac>
-              </tasks>
+              <reportsDirectory>${project.build.directory}/surefire-reports/hibernate-jpa</reportsDirectory>
+              <systemProperties>
+                <property>
+                  <name>dao.factory.store</name>
+                  <value>org.apache.ode.dao.jpa.hibernate.ConfStoreDAOConnectionFactoryImpl</value>
+                </property>
+              </systemProperties>
+              <includes>
+                <include>**/DaoTest.java</include>
+                <include>**/ProcessStoreTest.java</include>
+              </includes>
+            </configuration>
+          </execution>
+          <execution>
+            <id>hibernate</id>
+            <phase>integration-test</phase>
+            <goals>
+              <goal>test</goal>
+            </goals>
+            <configuration>
+              <reportsDirectory>${project.build.directory}/surefire-reports/hibernate</reportsDirectory>
+              <systemProperties>
+                <property>
+                  <name>dao.factory.store</name>
+                  <value>org.apache.ode.dao.hib.store.ConfStoreDAOConnectionFactoryImpl</value>
+                </property>
+              </systemProperties>
+              <includes>
+                <include>**/DaoTest.java</include>
+                <include>**/ProcessStoreTest.java</include>
+              </includes>
             </configuration>
           </execution>
         </executions>
       </plugin>
+    </plugins>
+  </build>
 
-       <plugin>
-         <groupId>org.codehaus.mojo</groupId>
-         <artifactId>xdoclet-maven-plugin</artifactId>
-         <executions>
-           <execution>
-             <phase>generate-sources</phase>
-             <goals>
-               <goal>xdoclet</goal>
-             </goals>
-	     
-             <configuration>
-               <tasks>
-                 <hibernatedoclet excludedTags="@version,@author,@todo" verbose="true"
-                   destdir="${project.build.outputDirectory}" force="true">
-                   <hibernate version="3.0"/>
-                   <fileset dir="${project.build.sourceDirectory}" includes="org/apache/ode/store/hib/*.java"/>
-                 </hibernatedoclet>
-               </tasks>
-             </configuration>
-           </execution>
-         </executions>
-       </plugin>
-     </plugins>
-   </build>
 </project>
+

Modified: ode/trunk/bpel-store/src/main/java/org/apache/ode/store/Messages.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/Messages.java?rev=940263&r1=940262&r2=940263&view=diff
==============================================================================
--- ode/trunk/bpel-store/src/main/java/org/apache/ode/store/Messages.java (original)
+++ ode/trunk/bpel-store/src/main/java/org/apache/ode/store/Messages.java Sun May  2 17:02:51 2010
@@ -191,10 +191,6 @@ public class Messages extends MessageBun
       return format("Error reading Hibernate properties file \"{0}\".", hibernatePropFile);
     }
 
-    public String msgOdeInitHibernateDialectDetectFailed() {
-      return format("Error detecting database dialect; Hibernate DAO could not be started.");
-    }
-
     public String msgDeployFailDuplicateDU(String name) {
         return format("Deploy failed; Deployment Unit \"{0}\" already deployed!", name);
     }