Author: mriou
Date: Mon Sep 11 17:01:22 2006
New Revision: 442391

URL: http://svn.apache.org/viewvc?view=rev&rev=442391
Log:
Faulting message exchanges when the process is faulted (instead of failing 
them). The fault is reported to the caller.

Modified:
    incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java
    
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/explang/EvaluationException.java
    
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/MessageExchange.java
    
incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/MessageExchangeDAO.java
    
incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java
    
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
    
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/MessageExchangeImpl.java
    
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/MessageExchangeDAOImpl.java
    
incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/MessageExchangeDaoImpl.java
    
incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HMessageExchange.java

Modified: 
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java?view=diff&rev=442391&r1=442390&r2=442391
==============================================================================
--- 
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java 
(original)
+++ 
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java 
Mon Sep 11 17:01:22 2006
@@ -232,7 +232,8 @@
     private void onResponse(MyRoleMessageExchange mex, MessageContext 
msgContext) throws AxisFault {
         switch (mex.getStatus()) {
             case FAULT:
-                throw new AxisFault(null, mex.getFault(), null, null, 
OMUtils.toOM(mex.getFaultResponse().getMessage()));
+                throw new AxisFault(mex.getResponse().getType(), 
mex.getFaultExplanation(), null, null,
+                        mex.getFaultResponse().getMessage() == null ? null : 
OMUtils.toOM(mex.getFaultResponse().getMessage()));
             case ASYNC:
             case RESPONSE:
                 Element response = 
SOAPUtils.wrap(mex.getResponse().getMessage(), _wsdlDef, _serviceName, mex
@@ -243,7 +244,6 @@
                 writeHeader(msgContext, mex);
                 break;
             case FAILURE:
-                // TODO: get failure codes out of the message.
                 throw new AxisFault("Message exchange failure!");
             default:
                 __log.warn("Received ODE message exchange in unexpected state: 
" + mex.getStatus());

Modified: 
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/explang/EvaluationException.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/explang/EvaluationException.java?view=diff&rev=442391&r1=442390&r2=442391
==============================================================================
--- 
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/explang/EvaluationException.java
 (original)
+++ 
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/explang/EvaluationException.java
 Mon Sep 11 17:01:22 2006
@@ -23,7 +23,7 @@
  */
 public class EvaluationException extends Exception {
 
-  public EvaluationException(String message, Exception e) {
+  public EvaluationException(String message, Throwable e) {
     super(message, e);
   }
 

Modified: 
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/MessageExchange.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/MessageExchange.java?view=diff&rev=442391&r1=442390&r2=442391
==============================================================================
--- 
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/MessageExchange.java
 (original)
+++ 
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/MessageExchange.java
 Mon Sep 11 17:01:22 2006
@@ -18,11 +18,10 @@
  */
 package org.apache.ode.bpel.iapi;
 
-import java.util.Set;
-
 import javax.wsdl.Operation;
 import javax.wsdl.PortType;
 import javax.xml.namespace.QName;
+import java.util.Set;
 
 /**
  * A representation of a communication (message-exchange) between the BPEL 
@@ -32,198 +31,200 @@
  */
 public interface MessageExchange {
 
-  /**
-   * Enumeration of message exchange patterns.
-   */
-  public enum MessageExchangePattern {
-    REQUEST_ONLY,
-    REQUEST_RESPONSE, 
-    UNKNOWN
-  }
-
-  /**
-   * Enumeration of the possible states for the message exchange.
-   */
-  public enum Status {
-    /** New message exchange, has not been "invoked" */
-    NEW,
-    
-    /** The request is being sent to the "server" */
-    REQUEST,
-    
-    /** Waiting for an asynchronous response from the "server" */
-    ASYNC,
-    
-    /** The one way request has been sent to the server. */
-    ONE_WAY,
-    
-    /** Processing the response received from the "server". */
-    RESPONSE,
-    
-    /** Processing the fault received from the "server". */
-    FAULT,
-    
-    /** Processing a failure. */
-    FAILURE,
-    
-    /** Message exchange completed succesfully. */
-    COMPLETED_OK,
-    
-    /** Message exchange completed with a fault. */
-    COMPLETED_FAULT,
-    
-    /** Message exchange completed with a failure. */
-    COMPLETED_FAILURE,
-  }
-  
-  /**
-   * Enumeration of the types of failures. 
-   */
-  public enum FailureType {
-    /** Requested endpoint is invalid. */
-    INVALID_ENDPOINT,
-    
-    /** Requested endpoint is unknown/unavailable. */
-    UNKNOWN_ENDPOINT,
-    
-    /** Requested operation is unknown/unimplemented. */
-    UNKNOWN_OPERATION,
-    
-    /** Network / IPC errror. */
-    COMMUNICATION_ERROR,
-    
-    /** Request message was of an invalid/unrecognized format. */ 
-    FORMAT_ERROR,
-    
-    /** An internal failure: no response was provided. */
-    NO_RESPONSE,
-    
-    /** Message exchange processing was aborted. */
-    ABORTED,
-    
-    /** Other failure. */
-    OTHER
-  }
-  
-  /**
-   * Get the message exchange identifier. This identifier should be globally 
-   * unique as the BPEL engine may keep identifiers for extended periods of
-   * time.
-   * @return unique message exchange identifier
-   */
-  String getMessageExchangeId()
-    throws BpelEngineException;
- 
-  /**
-   * Get the name of the operation (WSDL 1.1) / message exchange (WSDL 1.2?).
-   *
-   * @return name of the operation (WSDL 1.1) /message exchange (WSDL 1.2?).
-   */
-  String getOperationName()
-    throws BpelEngineException;
-  
-
-  /**
-   * Get a reference to the end-point targeted by this message exchange.
-   * @return end-point reference for this message exchange
-   */
-  EndpointReference getEndpointReference()
-    throws BpelEngineException;
-
-
-  
-  /**
-   * Return the type of message-exchange that resulted form this invocation 
-   * (request only/request-respone). If a 
-   * [EMAIL PROTECTED] MessageExchangePattern#REQUEST_RESPONSE} 
message-exchange was 
-   * created, then the caller should expect a response in the future. 
-   * @return type of message exchange created by the invocation
-   */
-  MessageExchangePattern getMessageExchangePattern();
-  
-  /**
-   * Create a message associated with this exchange.
-   * @param msgType message type
-   * @return a new [EMAIL PROTECTED] Message}
-   */
-  Message createMessage(QName msgType);
-
-  boolean isTransactionPropagated()
-    throws BpelEngineException;
-  
-  /**
-   * Get the message exchange status.
-   * @return
-   */
-  Status getStatus();
-  
-  /**
-   * Get the request message.
-   * @return request message
-   */
-  Message getRequest();
-  
-  /**
-   * Get the response message.
-   * @return response message (or null if not avaiable)
-   */
-  Message getResponse();
-  
-  /**
-   * Get the fault type.
-   * @return fault type, or <code>null</code> if not available/applicable.
-   */
-  String getFault();
-  
-  /**
-   * Get the fault resposne message.
-   * @return fault response, or <code>null</code> if not available/applicable.
-   */
-  Message getFaultResponse();
-  
-  /**
-   * Get the operation description for this message exchange.
-   * It is possible that the description cannot be resolved, for example if 
-   * the EPR is unknown or if the operation does not exist. 
-   * TODO: How to get rid of the WSDL4j dependency? 
-   * @return WSDL operation description or <code>null</code> if not availble
-   */ 
-  Operation getOperation();
-  
-  /**
-   * Get the port type description for this message exchange. 
-   * It is possible that the description cannot be resolved, for example if 
-   * the EPR is unknown or if the operation does not exist. 
-   * TODO: How to get rid of the WSDL4j dependency? 
-   * @return WSDL port type description or <code>null</code> if not available.
-   */
-  PortType getPortType();
-  
-  /**
-   * Set a message exchange property. Message exchange properties are not 
-   * interpreted by the engine--they exist to enable the integration layer
-   * to persist information about the exchange.
-   * @param key property key
-   * @param value property value
-   */
-  void setProperty(String key, String value);
-  
-  /**
-   * Get a message exchange property.
-   * @param key property key
-   * @return property value
-   */
-  String getProperty(String key);
-  
-
-  /**
-   * Get a set containing the names of the defined properties.
-   * @return set of property names.
-   */
-  public Set<String> getPropertyNames();
-
-  
-  public static final String PROPERTY_SEP_MYROLE_SESSIONID = 
"org.apache.ode.bpel.myRoleSessionId";
-  public static final String PROPERTY_SEP_PARTNERROLE_SESSIONID = 
"org.apache.ode.bpel.partnerRoleSessionId";
-  public static final String PROPERTY_SEP_PARTNERROLE_EPR = 
"org.apache.ode.bpel.partnerRoleEPR";
- }
+    /**
+     * Enumeration of message exchange patterns.
+     */
+    public enum MessageExchangePattern {
+        REQUEST_ONLY,
+        REQUEST_RESPONSE,
+        UNKNOWN
+    }
+
+    /**
+     * Enumeration of the possible states for the message exchange.
+     */
+    public enum Status {
+        /** New message exchange, has not been "invoked" */
+        NEW,
+
+        /** The request is being sent to the "server" */
+        REQUEST,
+
+        /** Waiting for an asynchronous response from the "server" */
+        ASYNC,
+
+        /** The one way request has been sent to the server. */
+        ONE_WAY,
+
+        /** Processing the response received from the "server". */
+        RESPONSE,
+
+        /** Processing the fault received from the "server". */
+        FAULT,
+
+        /** Processing a failure. */
+        FAILURE,
+
+        /** Message exchange completed succesfully. */
+        COMPLETED_OK,
+
+        /** Message exchange completed with a fault. */
+        COMPLETED_FAULT,
+
+        /** Message exchange completed with a failure. */
+        COMPLETED_FAILURE,
+    }
+
+    /**
+     * Enumeration of the types of failures.
+     */
+    public enum FailureType {
+        /** Requested endpoint is invalid. */
+        INVALID_ENDPOINT,
+
+        /** Requested endpoint is unknown/unavailable. */
+        UNKNOWN_ENDPOINT,
+
+        /** Requested operation is unknown/unimplemented. */
+        UNKNOWN_OPERATION,
+
+        /** Network / IPC errror. */
+        COMMUNICATION_ERROR,
+
+        /** Request message was of an invalid/unrecognized format. */
+        FORMAT_ERROR,
+
+        /** An internal failure: no response was provided. */
+        NO_RESPONSE,
+
+        /** Message exchange processing was aborted. */
+        ABORTED,
+
+        /** Other failure. */
+        OTHER
+    }
+
+    /**
+     * Get the message exchange identifier. This identifier should be globally
+     * unique as the BPEL engine may keep identifiers for extended periods of
+     * time.
+     * @return unique message exchange identifier
+     */
+    String getMessageExchangeId()
+            throws BpelEngineException;
+
+    /**
+     * Get the name of the operation (WSDL 1.1) / message exchange (WSDL 1.2?).
+     *
+     * @return name of the operation (WSDL 1.1) /message exchange (WSDL 1.2?).
+     */
+    String getOperationName()
+            throws BpelEngineException;
+
+
+    /**
+     * Get a reference to the end-point targeted by this message exchange.
+     * @return end-point reference for this message exchange
+     */
+    EndpointReference getEndpointReference()
+            throws BpelEngineException;
+
+
+
+    /**
+     * Return the type of message-exchange that resulted form this invocation
+     * (request only/request-respone). If a
+     * [EMAIL PROTECTED] MessageExchangePattern#REQUEST_RESPONSE} 
message-exchange was
+     * created, then the caller should expect a response in the future.
+     * @return type of message exchange created by the invocation
+     */
+    MessageExchangePattern getMessageExchangePattern();
+
+    /**
+     * Create a message associated with this exchange.
+     * @param msgType message type
+     * @return a new [EMAIL PROTECTED] Message}
+     */
+    Message createMessage(QName msgType);
+
+    boolean isTransactionPropagated()
+            throws BpelEngineException;
+
+    /**
+     * Get the message exchange status.
+     * @return
+     */
+    Status getStatus();
+
+    /**
+     * Get the request message.
+     * @return request message
+     */
+    Message getRequest();
+
+    /**
+     * Get the response message.
+     * @return response message (or null if not avaiable)
+     */
+    Message getResponse();
+
+    /**
+     * Get the fault type.
+     * @return fault type, or <code>null</code> if not available/applicable.
+     */
+    String getFault();
+
+    String getFaultExplanation();
+
+    /**
+     * Get the fault resposne message.
+     * @return fault response, or <code>null</code> if not 
available/applicable.
+     */
+    Message getFaultResponse();
+
+    /**
+     * Get the operation description for this message exchange.
+     * It is possible that the description cannot be resolved, for example if
+     * the EPR is unknown or if the operation does not exist.
+     * TODO: How to get rid of the WSDL4j dependency?
+     * @return WSDL operation description or <code>null</code> if not availble
+     */
+    Operation getOperation();
+
+    /**
+     * Get the port type description for this message exchange.
+     * It is possible that the description cannot be resolved, for example if
+     * the EPR is unknown or if the operation does not exist.
+     * TODO: How to get rid of the WSDL4j dependency?
+     * @return WSDL port type description or <code>null</code> if not 
available.
+     */
+    PortType getPortType();
+
+    /**
+     * Set a message exchange property. Message exchange properties are not
+     * interpreted by the engine--they exist to enable the integration layer
+     * to persist information about the exchange.
+     * @param key property key
+     * @param value property value
+     */
+    void setProperty(String key, String value);
+
+    /**
+     * Get a message exchange property.
+     * @param key property key
+     * @return property value
+     */
+    String getProperty(String key);
+
+
+    /**
+     * Get a set containing the names of the defined properties.
+     * @return set of property names.
+     */
+    public Set<String> getPropertyNames();
+
+
+    public static final String PROPERTY_SEP_MYROLE_SESSIONID = 
"org.apache.ode.bpel.myRoleSessionId";
+    public static final String PROPERTY_SEP_PARTNERROLE_SESSIONID = 
"org.apache.ode.bpel.partnerRoleSessionId";
+    public static final String PROPERTY_SEP_PARTNERROLE_EPR = 
"org.apache.ode.bpel.partnerRoleEPR";
+}

Modified: 
incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/MessageExchangeDAO.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/MessageExchangeDAO.java?view=diff&rev=442391&r1=442390&r2=442391
==============================================================================
--- 
incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/MessageExchangeDAO.java
 (original)
+++ 
incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/MessageExchangeDAO.java
 Mon Sep 11 17:01:22 2006
@@ -18,217 +18,220 @@
  */
 package org.apache.ode.bpel.dao;
 
-import java.util.Date;
-import java.util.Set;
+import org.w3c.dom.Element;
 
 import javax.xml.namespace.QName;
-
-import org.w3c.dom.Element;
+import java.util.Date;
+import java.util.Set;
 
 /**
  * Data access object for a message exchange.
  */
 public interface MessageExchangeDAO {
 
-  public static final char DIR_BPEL_INVOKES_PARTNERROLE = 'P';
+    public static final char DIR_BPEL_INVOKES_PARTNERROLE = 'P';
 
-  public static final char DIR_PARTNER_INVOKES_MYROLE = 'M';
+    public static final char DIR_PARTNER_INVOKES_MYROLE = 'M';
 
-  /**
-   * Instance id of the message exchange.
-   * 
-   * @return message exchange id.
-   */
-  String getMessageExchangeId();
-
-  /**
-   * Get output message (could be fault message)
-   * 
-   * @return output message DAO
-   */
-  MessageDAO getResponse();
-
-  /**
-   * Creation time of the message exchange
-   * 
-   * @return create time
-   */
-  Date getCreateTime();
-
-  /**
-   * 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 string
-   *          state to be set
-   */
-  void setStatus(String status);
-
-  /**
-   * Get state of last message sent/received.
-   * 
-   * @return the state
-   */
-  String getStatus();
-
-  /**
-   * Create a new message associated with this message-exchange
-   * 
-   * @param type
-   *          message type
-   * @return new [EMAIL PROTECTED] MessageDAO}
-   */
-  MessageDAO createMessage(QName type);
-
-  /**
-   * Creates an input message DAO.
-   */
-  void setRequest(MessageDAO msg);
-
-  /**
-   * Creates an output message DAO.
-   */
-  void setResponse(MessageDAO msg);
-
-  /**
-   * Get the model id for the partner link to which this message exchange
-   * relates.
-   * 
-   * @return
-   */
-  int getPartnerLinkModelId();
-
-  /**
-   * Set the model id for the partner link to which this message exchange
-   * relates
-   * 
-   * @param modelId
-   */
-  void setPartnerLinkModelId(int modelId);
-
-  /**
-   * Get the correlation identifier/client id
-   * 
-   * @return correlation identifier
-   */
-  String getCorrelationId();
-
-  /**
-   * Set the correlation identifier/client id
-   * 
-   * @param correlationId
-   *          identifier
-   */
-  void setCorrelationId(String correlationId);
-
-  void setPattern(String string);
-
-  void setOperation(String opname);
-
-  void setEPR(Element epr);
-
-  Element getEPR();
-
-  String getPattern();
-
-  /**
-   * Get the response channel.
-   * 
-   * @return response channel.
-   */
-  String getChannel();
-
-  /**
-   * Set the response channel.
-   * 
-   * @param string
-   *          response channel
-   */
-  void setChannel(String string);
-
-  boolean getPropagateTransactionFlag();
-
-  String getFault();
-
-  void setFault(String faultType);
-
-  void setCorrelationStatus(String cstatus);
-
-  String getCorrelationStatus();
-
-  /**
-   * Get the process associate with this message exchange. The process should
-   * always be available for partnerRole message exchanges. However, for myRole
-   * message exchanges, it is possible that no process is associated with the
-   * message exchange (i.e. if the EPR routing fails).
-   * 
-   * @return process associated with the message exchange
-   */
-  ProcessDAO getProcess();
-
-  void setProcess(ProcessDAO process);
-
-  void setInstance(ProcessInstanceDAO dao);
-
-  ProcessInstanceDAO getInstance();
-
-  /**
-   * Get the direction of the message exchange.
-   * 
-   * @return
-   */
-  char getDirection();
-
-  /**
-   * Get the "callee"--the id of the process being invoked in a myRole
-   * exchange.
-   * @return
-   */
-  QName getCallee();
-
-  /**
-   * Set the "callee"--the id of the process being invoked in a myRole 
-   * exchange.
-   * @param callee
-   */
-  void setCallee(QName callee);
-
-  String getProperty(String key);
+    /**
+     * Instance id of the message exchange.
+     *
+     * @return message exchange id.
+     */
+    String getMessageExchangeId();
+
+    /**
+     * Get output message (could be fault message)
+     *
+     * @return output message DAO
+     */
+    MessageDAO getResponse();
+
+    /**
+     * Creation time of the message exchange
+     *
+     * @return create time
+     */
+    Date getCreateTime();
+
+    /**
+     * 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 string
+     *          state to be set
+     */
+    void setStatus(String status);
+
+    /**
+     * Get state of last message sent/received.
+     *
+     * @return the state
+     */
+    String getStatus();
+
+    /**
+     * Create a new message associated with this message-exchange
+     *
+     * @param type
+     *          message type
+     * @return new [EMAIL PROTECTED] MessageDAO}
+     */
+    MessageDAO createMessage(QName type);
+
+    /**
+     * Creates an input message DAO.
+     */
+    void setRequest(MessageDAO msg);
+
+    /**
+     * Creates an output message DAO.
+     */
+    void setResponse(MessageDAO msg);
+
+    /**
+     * Get the model id for the partner link to which this message exchange
+     * relates.
+     *
+     * @return
+     */
+    int getPartnerLinkModelId();
+
+    /**
+     * Set the model id for the partner link to which this message exchange
+     * relates
+     *
+     * @param modelId
+     */
+    void setPartnerLinkModelId(int modelId);
+
+    /**
+     * Get the correlation identifier/client id
+     *
+     * @return correlation identifier
+     */
+    String getCorrelationId();
+
+    /**
+     * Set the correlation identifier/client id
+     *
+     * @param correlationId
+     *          identifier
+     */
+    void setCorrelationId(String correlationId);
+
+    void setPattern(String string);
+
+    void setOperation(String opname);
+
+    void setEPR(Element epr);
+
+    Element getEPR();
+
+    String getPattern();
+
+    /**
+     * Get the response channel.
+     *
+     * @return response channel.
+     */
+    String getChannel();
+
+    /**
+     * Set the response channel.
+     *
+     * @param string
+     *          response channel
+     */
+    void setChannel(String string);
+
+    boolean getPropagateTransactionFlag();
+
+    String getFault();
+
+    void setFault(String faultType);
+
+    public String getFaultExplanation();
+
+    public void setFaultExplanation(String explanation);
+
+    void setCorrelationStatus(String cstatus);
+
+    String getCorrelationStatus();
+
+    /**
+     * Get the process associate with this message exchange. The process should
+     * always be available for partnerRole message exchanges. However, for 
myRole
+     * message exchanges, it is possible that no process is associated with the
+     * message exchange (i.e. if the EPR routing fails).
+     *
+     * @return process associated with the message exchange
+     */
+    ProcessDAO getProcess();
+
+    void setProcess(ProcessDAO process);
+
+    void setInstance(ProcessInstanceDAO dao);
+
+    ProcessInstanceDAO getInstance();
+
+    /**
+     * Get the direction of the message exchange.
+     *
+     * @return
+     */
+    char getDirection();
+
+    /**
+     * Get the "callee"--the id of the process being invoked in a myRole
+     * exchange.
+     * @return
+     */
+    QName getCallee();
+
+    /**
+     * Set the "callee"--the id of the process being invoked in a myRole
+     * exchange.
+     * @param callee
+     */
+    void setCallee(QName callee);
+
+    String getProperty(String key);
 
-  void setProperty(String key, String value);
+    void setProperty(String key, String value);
 
-  Set<String> getPropertyNames();
+    Set<String> getPropertyNames();
 
-  void setPartnerLink(PartnerLinkDAO plinkDAO);
+    void setPartnerLink(PartnerLinkDAO plinkDAO);
 
-  PartnerLinkDAO getPartnerLink();
+    PartnerLinkDAO getPartnerLink();
 
 }

Modified: 
incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java?view=diff&rev=442391&r1=442390&r2=442391
==============================================================================
--- 
incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java
 (original)
+++ 
incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java
 Mon Sep 11 17:01:22 2006
@@ -177,8 +177,8 @@
                         + " - type=" + evalResult.getClass().getName());
             return evalResult;
         } catch (XPathExpressionException e) {
-            e.printStackTrace();
-            throw new EvaluationException("Error while executing an XPath 
expression." ,e);
+            Throwable cause = e.getCause() != null ? e.getCause() : e;
+            throw new EvaluationException("Error while executing an XPath 
expression: " + cause.toString(), cause);
         } catch (WrappedResolverException wre) {
             wre.printStackTrace();
             throw (FaultException)wre.getCause();

Modified: 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java?view=diff&rev=442391&r1=442390&r2=442391
==============================================================================
--- 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
 (original)
+++ 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
 Mon Sep 11 17:01:22 2006
@@ -41,6 +41,7 @@
 import org.apache.ode.bpel.iapi.BpelEngineException;
 import org.apache.ode.bpel.iapi.ContextException;
 import org.apache.ode.bpel.iapi.EndpointReference;
+import org.apache.ode.bpel.iapi.Message;
 import org.apache.ode.bpel.iapi.MessageExchange;
 import org.apache.ode.bpel.iapi.MessageExchange.FailureType;
 import org.apache.ode.bpel.iapi.MessageExchange.MessageExchangePattern;
@@ -195,7 +196,7 @@
         sendEvent(new ProcessCompletionEvent(faultData.getFaultName()));
         _dao.finishCompletion();
 
-        failOutstandingMessageExchanges();
+        faultOutstandingMessageExchanges(faultData);
     }
 
     /**
@@ -1051,6 +1052,25 @@
                     mex.setFailure(FailureType.OTHER, "No response.", null);
                     
_bpelProcess._engine._contexts.mexContext.onAsyncReply(mex);
             }
+        }
+    }
+
+    private void faultOutstandingMessageExchanges(FaultData faultData) {
+        String[] mexRefs = _outstandingRequests.releaseAll();
+        for (String mexId : mexRefs) {
+            MessageExchangeDAO mexDao = _dao.getConnection()
+                    .getMessageExchange(mexId);
+            MyRoleMessageExchangeImpl mex = new MyRoleMessageExchangeImpl(
+                    _bpelProcess._engine, mexDao);
+            _bpelProcess.initMyRoleMex(mex);
+
+            Message message = mex.createMessage(faultData.getFaultName());
+            if (faultData.getFaultMessage() != null) 
message.setMessage(faultData.getFaultMessage());
+            mex.setResponse(message);
+
+            mex.setFault(faultData.getFaultName().toString(), message);
+            mex.setFaultExplanation(faultData.getExplanation());
+            _bpelProcess._engine._contexts.mexContext.onAsyncReply(mex);
         }
     }
 

Modified: 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/MessageExchangeImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/MessageExchangeImpl.java?view=diff&rev=442391&r1=442390&r2=442391
==============================================================================
--- 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/MessageExchangeImpl.java
 (original)
+++ 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/MessageExchangeImpl.java
 Mon Sep 11 17:01:22 2006
@@ -19,8 +19,6 @@
 
 package org.apache.ode.bpel.engine;
 
-import java.util.Set;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ode.bpel.dao.MessageDAO;
@@ -36,215 +34,220 @@
 import javax.wsdl.Operation;
 import javax.wsdl.PortType;
 import javax.xml.namespace.QName;
+import java.util.Set;
 
 abstract class MessageExchangeImpl implements MessageExchange {
-  
-  private static final Log __log = 
LogFactory.getLog(MessageExchangeImpl.class);
-  protected static final Messages __msgs = 
MessageBundle.getMessages(Messages.class);
-
-  /** Process-Instance identifier.*/
-  protected Long _iid;
-  
-  protected OProcess _oprocess;
-  protected PortType _portType;
-  protected Operation _operation;
-
-  protected final BpelEngineImpl _engine;
-
-  protected EndpointReference _epr;
-
-  protected final MessageExchangeDAO _dao;
-  
-  /**
-   * Constructor: requires the minimal information for a message exchange.
-   * @param pattern
-   * @param opname
-   * @param epr
-   */
-  MessageExchangeImpl(BpelEngineImpl engine,
-      MessageExchangeDAO dao,
-      MessageExchangePattern pattern, 
-      String opname, 
-      EndpointReference epr) {
-    _engine = engine;
-    _dao = dao;
-    _epr = epr;
-
-    getDAO().setPattern(pattern.toString());
-    getDAO().setOperation(opname);
-    if (epr != null)
-      getDAO().setEPR(epr.toXML().getDocumentElement());
-  }
-  
-  public MessageExchangeImpl(BpelEngineImpl engine,
-      MessageExchangeDAO dao) {
-    _engine = engine;
-    _dao = dao;
-  }
-  
- 
-  public String getMessageExchangeId() throws BpelEngineException {
-    return getDAO().getMessageExchangeId();
-  }
-
-  public String getOperationName() throws BpelEngineException {
-    return getDAO().getOperation();
-  }
-
-  public MessageExchangePattern getMessageExchangePattern() {
-    return MessageExchangePattern.valueOf(getDAO().getPattern());
-  }
-
-  public boolean isTransactionPropagated() throws BpelEngineException {
-    return getDAO().getPropagateTransactionFlag();
-  }
-
-  public boolean isFault() {
-    // TODO
-    return false;
-  }
-
-  public boolean isDone() {
-    // TODO
-    return false;
-  }
-
-  public Message getResponse() {
-    return new MessageImpl(getDAO().getResponse());
-  }
-
-  public String getFault() {
-    return getDAO().getFault();
-  }
-
-  public Message getFaultResponse() {
-    return getResponse();
-  }
-
-
-  public MessageExchangePattern getPattern() {
-    return MessageExchangePattern.valueOf(getDAO().getPattern());
-  }
-  
-  public Status getStatus() {
-    return Status.valueOf(getDAO().getStatus());
-  }
-  
-  public Message getRequest() {
-    return new MessageImpl(getDAO().getRequest());
-  }
-
-  public Operation getOperation() {
-    return _operation;
-  }
-
-  public PortType getPortType() {
-    return _portType;
-  }
-
-  /**
-   * Associate message exchange with a process. 
-   * @param oprocess
-   */
-  void setProcess(OProcess oprocess) {
-    if (__log.isTraceEnabled())
-      __log.trace("Mex[" + getMessageExchangeId() + 
"].setProcess("+oprocess+")");
-    _oprocess = oprocess;
-  }
-
-
-  /**
-   * Update the pattern of this message exchange. 
-   * @param pattern
-   */
-  void setPattern(MessageExchangePattern pattern) {
-    if (__log.isTraceEnabled())
-      __log.trace("Mex[" + getMessageExchangeId() + 
"].setPattern("+pattern+")");
-    getDAO().setPattern(pattern.toString());
-  }
-  
-
-  void setPortOp(PortType portType, Operation operation) {
-    if (__log.isTraceEnabled())
-      __log.trace("Mex[" + getMessageExchangeId()  + 
"].setPortOp("+portType+","+operation+")");
-    _portType = portType;
-    _operation = operation;
-  }
-
-  protected MessageExchangeDAO getDAO() {
-    return _dao;
-  }
-
-  void setFault(String faultType, Message outputFaultMessage) throws 
BpelEngineException {
-    if (getStatus() != Status.REQUEST)
-      throw new IllegalStateException("Not in REQUEST state!");
-    
-    setStatus(Status.FAULT);
-    getDAO().setFault(faultType);
-    getDAO().setResponse(((MessageImpl)outputFaultMessage)._dao);
-  }
-
-  void setResponse(Message outputMessage) throws BpelEngineException {
-    if (getStatus() != Status.REQUEST && getStatus()!=Status.ASYNC)
-      throw new IllegalStateException("Not in REQUEST state!");
-   
-    setStatus(Status.RESPONSE);
-    getDAO().setFault(null);
-    getDAO().setResponse(((MessageImpl)outputMessage)._dao);
-  }
 
-  void setFailure(FailureType type, String description, Element details) 
throws BpelEngineException {
-    setStatus(Status.FAILURE);
+    private static final Log __log = 
LogFactory.getLog(MessageExchangeImpl.class);
+    protected static final Messages __msgs = 
MessageBundle.getMessages(Messages.class);
+
+    /** Process-Instance identifier.*/
+    protected Long _iid;
+
+    protected OProcess _oprocess;
+    protected PortType _portType;
+    protected Operation _operation;
+
+    protected final BpelEngineImpl _engine;
+
+    protected EndpointReference _epr;
+
+    protected final MessageExchangeDAO _dao;
+
+    /**
+     * Constructor: requires the minimal information for a message exchange.
+     * @param pattern
+     * @param opname
+     * @param epr
+     */
+    MessageExchangeImpl(BpelEngineImpl engine,
+                        MessageExchangeDAO dao,
+                        MessageExchangePattern pattern,
+                        String opname,
+                        EndpointReference epr) {
+        _engine = engine;
+        _dao = dao;
+        _epr = epr;
+
+        getDAO().setPattern(pattern.toString());
+        getDAO().setOperation(opname);
+        if (epr != null)
+            getDAO().setEPR(epr.toXML().getDocumentElement());
+    }
+
+    public MessageExchangeImpl(BpelEngineImpl engine,
+                               MessageExchangeDAO dao) {
+        _engine = engine;
+        _dao = dao;
+    }
+
+
+    public String getMessageExchangeId() throws BpelEngineException {
+        return getDAO().getMessageExchangeId();
+    }
+
+    public String getOperationName() throws BpelEngineException {
+        return getDAO().getOperation();
+    }
+
+    public MessageExchangePattern getMessageExchangePattern() {
+        return MessageExchangePattern.valueOf(getDAO().getPattern());
+    }
+
+    public boolean isTransactionPropagated() throws BpelEngineException {
+        return getDAO().getPropagateTransactionFlag();
+    }
+
+    public boolean isFault() {
+        // TODO
+        return false;
+    }
+
+    public boolean isDone() {
+        // TODO
+        return false;
+    }
+
+    public Message getResponse() {
+        return new MessageImpl(getDAO().getResponse());
+    }
+
+    public String getFault() {
+        return getDAO().getFault();
+    }
+
+    public Message getFaultResponse() {
+        return getResponse();
+    }
+
+    public String getFaultExplanation() {
+        return getDAO().getFaultExplanation();
+    }
+
+    public MessageExchangePattern getPattern() {
+        return MessageExchangePattern.valueOf(getDAO().getPattern());
+    }
+
+    public Status getStatus() {
+        return Status.valueOf(getDAO().getStatus());
+    }
+
+    public Message getRequest() {
+        return new MessageImpl(getDAO().getRequest());
+    }
+
+    public Operation getOperation() {
+        return _operation;
+    }
+
+    public PortType getPortType() {
+        return _portType;
+    }
+
+    /**
+     * Associate message exchange with a process.
+     * @param oprocess
+     */
+    void setProcess(OProcess oprocess) {
+        if (__log.isTraceEnabled())
+            __log.trace("Mex[" + getMessageExchangeId() + 
"].setProcess("+oprocess+")");
+        _oprocess = oprocess;
+    }
+
+
+    /**
+     * Update the pattern of this message exchange.
+     * @param pattern
+     */
+    void setPattern(MessageExchangePattern pattern) {
+        if (__log.isTraceEnabled())
+            __log.trace("Mex[" + getMessageExchangeId() + 
"].setPattern("+pattern+")");
+        getDAO().setPattern(pattern.toString());
+    }
+
+
+    void setPortOp(PortType portType, Operation operation) {
+        if (__log.isTraceEnabled())
+            __log.trace("Mex[" + getMessageExchangeId()  + 
"].setPortOp("+portType+","+operation+")");
+        _portType = portType;
+        _operation = operation;
+    }
+
+    protected MessageExchangeDAO getDAO() {
+        return _dao;
+    }
+
+    void setFault(String faultType, Message outputFaultMessage) throws 
BpelEngineException {
+        setStatus(Status.FAULT);
+        getDAO().setFault(faultType);
+        getDAO().setResponse(((MessageImpl)outputFaultMessage)._dao);
+    }
+
+    void setFaultExplanation(String explanation) {
+        getDAO().setFaultExplanation(explanation);
+    }
+
+    void setResponse(Message outputMessage) throws BpelEngineException {
+        if (getStatus() != Status.REQUEST && getStatus()!=Status.ASYNC)
+            throw new IllegalStateException("Not in REQUEST state!");
+
+        setStatus(Status.RESPONSE);
+        getDAO().setFault(null);
+        getDAO().setResponse(((MessageImpl)outputMessage)._dao);
+    }
+
+    void setFailure(FailureType type, String description, Element details) 
throws BpelEngineException {
+        setStatus(Status.FAILURE);
 //    getDAO().setFailureMessage(description);
 //    getDAO().setFailureDetails(details);
-  }
+    }
+
+    void setStatus(Status status) {
+        getDAO().setStatus(status.toString());
+    }
+
+    public Message createMessage(javax.xml.namespace.QName msgType) {
+        MessageDAO mdao = getDAO().createMessage(msgType);
+        return new MessageImpl(mdao);
+    }
+
+    public void setEndpointReference(EndpointReference ref) {
+        _epr = ref;
+        if (ref != null)
+            getDAO().setEPR(ref.toXML().getDocumentElement());
+    }
+
+    public EndpointReference getEndpointReference() throws BpelEngineException 
{
+        if (_epr != null) return _epr;
+        if (getDAO().getEPR() == null)
+            return null;
+
+        return _epr = 
_engine._contexts.eprContext.resolveEndpointReference(getDAO().getEPR());
+    }
+
+
+    QName getServiceName() {
+        return getDAO().getCallee();
+    }
+
+    public String getProperty(String key) {
+        String val = getDAO().getProperty(key);
+        if (__log.isDebugEnabled())
+            __log.debug("GET MEX property " + key + " = " + val);
+        return val;
+    }
+
+    public void setProperty(String key, String value) {
+        getDAO().setProperty(key,value);
+        if (__log.isDebugEnabled())
+            __log.debug("SET MEX property " + key + " = " + value);
+    }
+
+    public Set<String> getPropertyNames() {
+        return getDAO().getPropertyNames();
+    }
+    public String toString() {
+        return "MEX["+getDAO().getMessageExchangeId() +"]";
+    }
 
-  void setStatus(Status status) {
-    getDAO().setStatus(status.toString());
-  }
-
-  public Message createMessage(javax.xml.namespace.QName msgType) {
-    MessageDAO mdao = getDAO().createMessage(msgType);
-    return new MessageImpl(mdao);
-  }
-
-  public void setEndpointReference(EndpointReference ref) {
-    _epr = ref;
-    if (ref != null)
-      getDAO().setEPR(ref.toXML().getDocumentElement());
-  }
-
-  public EndpointReference getEndpointReference() throws BpelEngineException {
-    if (_epr != null) return _epr;
-    if (getDAO().getEPR() == null)
-      return null;
-
-    return _epr = 
_engine._contexts.eprContext.resolveEndpointReference(getDAO().getEPR());
-  }
-
- 
-  QName getServiceName() {
-    return getDAO().getCallee();
-  }
-
-  public String getProperty(String key) {
-      String val = getDAO().getProperty(key);
-      if (__log.isDebugEnabled())
-          __log.debug("GET MEX property " + key + " = " + val);
-      return val;
-  }
-
-  public void setProperty(String key, String value) {
-    getDAO().setProperty(key,value);
-    if (__log.isDebugEnabled())
-        __log.debug("SET MEX property " + key + " = " + value);
-  }
-  
-  public Set<String> getPropertyNames() {
-      return getDAO().getPropertyNames();
-  }
-  public String toString() {
-      return "MEX["+getDAO().getMessageExchangeId() +"]"; 
-  }
-  
 }

Modified: 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/MessageExchangeDAOImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/MessageExchangeDAOImpl.java?view=diff&rev=442391&r1=442390&r2=442391
==============================================================================
--- 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/MessageExchangeDAOImpl.java
 (original)
+++ 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/MessageExchangeDAOImpl.java
 Mon Sep 11 17:01:22 2006
@@ -1,15 +1,5 @@
 package org.apache.ode.bpel.memdao;
 
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Properties;
-import java.util.Set;
-import java.util.Map.Entry;
-
-import javax.xml.namespace.QName;
-
 import org.apache.ode.bpel.dao.MessageDAO;
 import org.apache.ode.bpel.dao.MessageExchangeDAO;
 import org.apache.ode.bpel.dao.PartnerLinkDAO;
@@ -17,6 +7,13 @@
 import org.apache.ode.bpel.dao.ProcessInstanceDAO;
 import org.w3c.dom.Element;
 
+import javax.xml.namespace.QName;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.Set;
+
 public class MessageExchangeDAOImpl implements MessageExchangeDAO {
 
        private String messageExchangeId;
@@ -34,7 +31,8 @@
        private String channel;
        private boolean propagateTransactionFlag;
        private String fault;
-       private String correlationStatus;
+    private String faultExplanation;
+    private String correlationStatus;
        private ProcessDAO process;
        private ProcessInstanceDAO instance;
        private char direction;
@@ -169,12 +167,20 @@
 
        public void setFault(String faultType) {
                this.fault = faultType;
-
        }
 
-       public void setCorrelationStatus(String cstatus) {
-               this.correlationStatus = cstatus;
+    public String getFaultExplanation() {
+        return faultExplanation;
+    }
+
+    public void setFaultExplanation(String explanation) {
+        this.faultExplanation = explanation;
+    }
+
 
+
+    public void setCorrelationStatus(String cstatus) {
+               this.correlationStatus = cstatus;
        }
 
        public String getCorrelationStatus() {

Modified: 
incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/MessageExchangeDaoImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/MessageExchangeDaoImpl.java?view=diff&rev=442391&r1=442390&r2=442391
==============================================================================
--- 
incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/MessageExchangeDaoImpl.java
 (original)
+++ 
incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/MessageExchangeDaoImpl.java
 Mon Sep 11 17:01:22 2006
@@ -19,14 +19,6 @@
 
 package org.apache.ode.daohib.bpel;
 
-import java.util.Collections;
-import java.util.Date;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
-import org.w3c.dom.Element;
-
 import org.apache.ode.bpel.dao.MessageDAO;
 import org.apache.ode.bpel.dao.MessageExchangeDAO;
 import org.apache.ode.bpel.dao.PartnerLinkDAO;
@@ -39,6 +31,12 @@
 import org.apache.ode.daohib.bpel.hobj.HProcessInstance;
 import org.apache.ode.daohib.hobj.HLargeData;
 import org.apache.ode.utils.DOMUtils;
+import org.w3c.dom.Element;
+
+import javax.xml.namespace.QName;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Set;
 
 public class MessageExchangeDaoImpl extends HibernateDao implements 
MessageExchangeDAO {
 
@@ -210,6 +208,15 @@
 
     public void setFault(String faultType) {
         _hself.setFault(faultType);
+        update();
+    }
+
+    public String getFaultExplanation() {
+        return _hself.getFaultExplanation();
+    }
+
+    public void setFaultExplanation(String explanation) {
+        _hself.setFaultExplanation(explanation);
         update();
     }
 

Modified: 
incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HMessageExchange.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HMessageExchange.java?view=diff&rev=442391&r1=442390&r2=442391
==============================================================================
--- 
incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HMessageExchange.java
 (original)
+++ 
incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HMessageExchange.java
 Mon Sep 11 17:01:22 2006
@@ -68,6 +68,8 @@
 
     private String _faultType;
 
+    private String _faultExplanation;
+
     private String _callee;
 
     private Map<String, String> _properties = new HashMap<String, String>();
@@ -269,6 +271,18 @@
     public void setFault(String faultType) {
         _faultType = faultType;
 
+    }
+
+    /**
+     * @hibernate.property column="FAULT_EXPL"
+     * @return
+     */
+    public String getFaultExplanation() {
+        return _faultExplanation;
+    }
+
+    public void setFaultExplanation(String faultExplanation) {
+        _faultExplanation = faultExplanation;
     }
 
     /**


Reply via email to