org.apache.ode.bpel.engine
Class TransactedPartnerRoleMessageExchangeImpl

java.lang.Object
  extended by org.apache.ode.bpel.engine.TransactedPartnerRoleMessageExchangeImpl
All Implemented Interfaces:
MessageExchange, PartnerRoleMessageExchange

public class TransactedPartnerRoleMessageExchangeImpl
extends java.lang.Object


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.ode.bpel.iapi.MessageExchange
MessageExchange.AckType, MessageExchange.FailureType, MessageExchange.MessageExchangePattern, MessageExchange.Status
 
Field Summary
protected static Messages __msgs
           
protected  java.util.concurrent.locks.Lock _accessLock
           
protected  java.util.concurrent.locks.Condition _acked
           
protected  MessageExchange.FailureType _failureType
           
protected  java.lang.String _foreignKey
           
protected  EndpointReference _myRoleEPR
           
protected  PartnerRoleChannel _partnerRoleChannel
           
protected  java.lang.String _responseChannel
           
protected  org.apache.ode.bpel.engine.PartnerRoleMessageExchangeImpl.State _state
           
protected  java.util.concurrent.locks.Condition _stateChanged
           
 
Fields inherited from interface org.apache.ode.bpel.iapi.MessageExchange
PROPERTY_SEP_MYROLE_SESSIONID, PROPERTY_SEP_MYROLE_TRANSACTED, PROPERTY_SEP_PARTNERROLE_EPR, PROPERTY_SEP_PARTNERROLE_SESSIONID
 
Method Summary
protected  void assertTransaction()
           
protected  void asyncACK()
          Resume an instance.
protected  void checkReplyContextOk()
          The criteria for issuing a replyXXX call on TRANSACTED message exchanges is that the replyXXX must come while the engine is blocked in an MessageExchangeContext#invokePartnerBlocking(org.apache.ode.bpel.iapi.PartnerRoleMessageExchange).
 Message createMessage(javax.xml.namespace.QName msgType)
          Create a message associated with this exchange.
protected
<T> T
doInTX(org.apache.ode.bpel.engine.MessageExchangeImpl.InDbAction<T> action)
           
 boolean equals(java.lang.Object other)
           
 MessageExchange.AckType getAckType()
           
 javax.xml.namespace.QName getCaller()
          Get the identifier of the process that created this message exchange.
protected  MessageExchangeDAO getDAO()
          Get the DAO object.
 EndpointReference getEndpointReference()
          Get a reference to the end-point targeted by this message exchange.
 javax.xml.namespace.QName getFault()
          Get the fault type.
 java.lang.String getFaultExplanation()
           
 Message getFaultResponse()
          Get the fault resposne message.
 InvocationStyle getInvocationStyle()
          Get the invocation style for this message exchange.
 java.lang.String getMessageExchangeId()
          Get the message exchange identifier.
 MessageExchange.MessageExchangePattern getMessageExchangePattern()
          Return the type of message-exchange that resulted form this invocation (request only/request-respone).
 EndpointReference getMyRoleEndpointReference()
          Get the EndpointReference associated with the my-role of the partner link to which this message exchange belongs.
 javax.wsdl.Operation getOperation()
          Get the operation description for this message exchange.
 java.lang.String getOperationName()
          Get the name of the operation (WSDL 1.1) / message exchange (WSDL 1.2?).
 PartnerRoleChannel getPartnerRoleChannel()
          Get the communication channel.
 javax.wsdl.PortType getPortType()
          Get the port type description for this message exchange.
 java.lang.String getProperty(java.lang.String key)
          Get a message exchange property.
 java.util.Set<java.lang.String> getPropertyNames()
          Get a set containing the names of the defined properties.
 Message getRequest()
          Get the request message.
 Message getResponse()
          Get the response message.
 MessageExchange.Status getStatus()
          Get the message exchange status.
 long getTimeout()
          Get the time-out in ms.
 boolean isSafe()
          Report whether the operation is "safe" in the sense of the WSDL1.2 meaning of the term.
 boolean isTransactional()
          Indicates whether a transactions in associated with the message exchange.
 void release()
          Should be called by the external partner when it's done with the message exchange.
 void reply(Message response)
          Indicate that the partner has responded to the message exchange.
 void replyAsync(java.lang.String foreignKey)
          Indicate that the response to the request/response operation is not yet available and that the response will be delivered asynchronously.
 void replyOneWayOk()
          Indicate that the partner processed the one-way invocation successfully.
 void replyWithFailure(MessageExchange.FailureType type, java.lang.String description, org.w3c.dom.Element details)
          Indicate that the partner has failed to process the message exchange.
 void replyWithFault(javax.xml.namespace.QName faultType, Message outputFaultMessage)
          Indicate that the partner faulted in processing the message exchange.
 void setEndpointReference(EndpointReference ref)
           
 void setProperty(java.lang.String key, java.lang.String value)
          Set a message exchange property.
 void setTimeout(long timeout)
          Set the time-out in ms
 java.lang.String toString()
           
 boolean waitForAck(long timeout)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.ode.bpel.iapi.MessageExchange
createMessage, getAckType, getEndpointReference, getFault, getFaultExplanation, getFaultResponse, getMessageExchangeId, getMessageExchangePattern, getOperation, getOperationName, getPortType, getProperty, getPropertyNames, getRequest, getResponse, getStatus, getTimeout, isSafe, isTransactional, release, setProperty, setTimeout
 

Field Detail

_partnerRoleChannel

protected final PartnerRoleChannel _partnerRoleChannel

_myRoleEPR

protected EndpointReference _myRoleEPR

_responseChannel

protected java.lang.String _responseChannel

_foreignKey

protected volatile java.lang.String _foreignKey

_accessLock

protected java.util.concurrent.locks.Lock _accessLock

_stateChanged

protected java.util.concurrent.locks.Condition _stateChanged

_acked

protected java.util.concurrent.locks.Condition _acked

_state

protected org.apache.ode.bpel.engine.PartnerRoleMessageExchangeImpl.State _state

__msgs

protected static final Messages __msgs

_failureType

protected MessageExchange.FailureType _failureType
Method Detail

checkReplyContextOk

protected void checkReplyContextOk()
The criteria for issuing a replyXXX call on TRANSACTED message exchanges is that the replyXXX must come while the engine is blocked in an MessageExchangeContext#invokePartnerBlocking(org.apache.ode.bpel.iapi.PartnerRoleMessageExchange). method, AND the call must come from the engine thread.


getInvocationStyle

public InvocationStyle getInvocationStyle()
Description copied from interface: MessageExchange
Get the invocation style for this message exchange.

Specified by:
getInvocationStyle in interface MessageExchange
Returns:

asyncACK

protected void asyncACK()
Resume an instance. This happens if the response for the partner invocation were not "immediately" available, that is if the IL was not able to supply a response in the scope of the MessageExchangeContext.invokePartnerReliable(PartnerRoleMessageExchange) or MessageExchangeContext#invokePartnerAsynch(PartnerRoleMessageExchange). Note that this is actually the common case for ASYNC and RELIABLE invocations.


replyAsync

public void replyAsync(java.lang.String foreignKey)
Description copied from interface: PartnerRoleMessageExchange
Indicate that the response to the request/response operation is not yet available and that the response will be delivered asynchronously.

Specified by:
replyAsync in interface PartnerRoleMessageExchange
Parameters:
foreignKey - "foreign" key that is used to identify this message exchange.

replyOneWayOk

public void replyOneWayOk()
Description copied from interface: PartnerRoleMessageExchange
Indicate that the partner processed the one-way invocation successfully.

Specified by:
replyOneWayOk in interface PartnerRoleMessageExchange

replyWithFault

public void replyWithFault(javax.xml.namespace.QName faultType,
                           Message outputFaultMessage)
                    throws BpelEngineException
Description copied from interface: PartnerRoleMessageExchange
Indicate that the partner faulted in processing the message exchange.

Specified by:
replyWithFault in interface PartnerRoleMessageExchange
Parameters:
faultType - fault type
outputFaultMessage - the input message
Throws:
BpelEngineException

reply

public void reply(Message response)
           throws BpelEngineException
Description copied from interface: PartnerRoleMessageExchange
Indicate that the partner has responded to the message exchange.

Specified by:
reply in interface PartnerRoleMessageExchange
Parameters:
response - the response from the partner
Throws:
BpelEngineException

replyWithFailure

public void replyWithFailure(MessageExchange.FailureType type,
                             java.lang.String description,
                             org.w3c.dom.Element details)
                      throws BpelEngineException
Description copied from interface: PartnerRoleMessageExchange
Indicate that the partner has failed to process the message exchange.

Specified by:
replyWithFailure in interface PartnerRoleMessageExchange
Parameters:
type - type of failure
description - description of failure
Throws:
BpelEngineException

getCaller

public javax.xml.namespace.QName getCaller()
Description copied from interface: PartnerRoleMessageExchange
Get the identifier of the process that created this message exchange.

Specified by:
getCaller in interface PartnerRoleMessageExchange
Returns:

getPartnerRoleChannel

public PartnerRoleChannel getPartnerRoleChannel()
Description copied from interface: PartnerRoleMessageExchange
Get the communication channel.

Specified by:
getPartnerRoleChannel in interface PartnerRoleMessageExchange
Returns:
communication channel, an object created by the IL

getMyRoleEndpointReference

public EndpointReference getMyRoleEndpointReference()
Description copied from interface: PartnerRoleMessageExchange
Get the EndpointReference associated with the my-role of the partner link to which this message exchange belongs. This method is typically used to provide protocol-specific "callback" mechanisms.

Specified by:
getMyRoleEndpointReference in interface PartnerRoleMessageExchange
Returns:
endpoint reference associate with the corresponding my-role, or null if no my-role is defined

toString

public java.lang.String toString()

waitForAck

public boolean waitForAck(long timeout)
                   throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

isSafe

public boolean isSafe()
Description copied from interface: MessageExchange
Report whether the operation is "safe" in the sense of the WSDL1.2 meaning of the term. That is, is the operation side-effect free?

Specified by:
isSafe in interface MessageExchange
Returns:
true if the operation is safe, false otherwise.

getMessageExchangeId

public java.lang.String getMessageExchangeId()
                                      throws BpelEngineException
Description copied from interface: MessageExchange
Get the message exchange identifier. This identifier should be globally unique as the BPEL engine may keep identifiers for extended periods of time.

Specified by:
getMessageExchangeId in interface MessageExchange
Returns:
unique message exchange identifier
Throws:
BpelEngineException

getOperationName

public java.lang.String getOperationName()
                                  throws BpelEngineException
Description copied from interface: MessageExchange
Get the name of the operation (WSDL 1.1) / message exchange (WSDL 1.2?).

Specified by:
getOperationName in interface MessageExchange
Returns:
name of the operation (WSDL 1.1) /message exchange (WSDL 1.2?).
Throws:
BpelEngineException

getMessageExchangePattern

public MessageExchange.MessageExchangePattern getMessageExchangePattern()
Description copied from interface: MessageExchange
Return the type of message-exchange that resulted form this invocation (request only/request-respone). If a MessageExchange.MessageExchangePattern.REQUEST_RESPONSE message-exchange was created, then the caller should expect a response in the future.

Specified by:
getMessageExchangePattern in interface MessageExchange
Returns:
type of message exchange created by the invocation

isTransactional

public boolean isTransactional()
                        throws BpelEngineException
Description copied from interface: MessageExchange
Indicates whether a transactions in associated with the message exchange. If this is the case, then the object must be used from a context (i.e. thread) that is associated with the same transaction. The TRANSACTED and RELIABLE invocation styles will have this flag set to true. ASYNC and BLOCKING styles will always have this set to false.

Specified by:
isTransactional in interface MessageExchange
Returns:
true if there is a transaction associated with the object, false otherwise.
Throws:
BpelEngineException

getFault

public javax.xml.namespace.QName getFault()
Description copied from interface: MessageExchange
Get the fault type.

Specified by:
getFault in interface MessageExchange
Returns:
fault type, or null if not available/applicable.

getFaultResponse

public Message getFaultResponse()
Description copied from interface: MessageExchange
Get the fault resposne message.

Specified by:
getFaultResponse in interface MessageExchange
Returns:
fault response, or null if not available/applicable.

getFaultExplanation

public java.lang.String getFaultExplanation()
Specified by:
getFaultExplanation in interface MessageExchange

getStatus

public MessageExchange.Status getStatus()
Description copied from interface: MessageExchange
Get the message exchange status.

Specified by:
getStatus in interface MessageExchange
Returns:

getAckType

public MessageExchange.AckType getAckType()
Specified by:
getAckType in interface MessageExchange

getOperation

public javax.wsdl.Operation getOperation()
Description copied from interface: MessageExchange
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.

Specified by:
getOperation in interface MessageExchange
Returns:
WSDL operation description or null if not availble

getPortType

public javax.wsdl.PortType getPortType()
Description copied from interface: MessageExchange
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.

Specified by:
getPortType in interface MessageExchange
Returns:
WSDL port type description or null if not available.

getRequest

public Message getRequest()
Description copied from interface: MessageExchange
Get the request message.

Specified by:
getRequest in interface MessageExchange
Returns:
request message

getResponse

public Message getResponse()
Description copied from interface: MessageExchange
Get the response message.

Specified by:
getResponse in interface MessageExchange
Returns:
response message (or null if not avaiable)

createMessage

public Message createMessage(javax.xml.namespace.QName msgType)
Description copied from interface: MessageExchange
Create a message associated with this exchange.

Specified by:
createMessage in interface MessageExchange
Parameters:
msgType - message type
Returns:
a new Message

setEndpointReference

public void setEndpointReference(EndpointReference ref)

getEndpointReference

public EndpointReference getEndpointReference()
                                       throws BpelEngineException
Description copied from interface: MessageExchange
Get a reference to the end-point targeted by this message exchange.

Specified by:
getEndpointReference in interface MessageExchange
Returns:
end-point reference for this message exchange
Throws:
BpelEngineException

getProperty

public java.lang.String getProperty(java.lang.String key)
Description copied from interface: MessageExchange
Get a message exchange property.

Specified by:
getProperty in interface MessageExchange
Parameters:
key - property key
Returns:
property value

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
Description copied from interface: MessageExchange
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.

Specified by:
setProperty in interface MessageExchange
Parameters:
key - property key
value - property value

getPropertyNames

public java.util.Set<java.lang.String> getPropertyNames()
Description copied from interface: MessageExchange
Get a set containing the names of the defined properties.

Specified by:
getPropertyNames in interface MessageExchange
Returns:
set of property names.

getTimeout

public long getTimeout()
Description copied from interface: MessageExchange
Get the time-out in ms.

Specified by:
getTimeout in interface MessageExchange
Returns:

setTimeout

public void setTimeout(long timeout)
Description copied from interface: MessageExchange
Set the time-out in ms

Specified by:
setTimeout in interface MessageExchange

release

public void release()
Description copied from interface: MessageExchange
Should be called by the external partner when it's done with the message exchange. Ncessary for a better resource management and proper mex cleanup.

Specified by:
release in interface MessageExchange

assertTransaction

protected void assertTransaction()

doInTX

protected <T> T doInTX(org.apache.ode.bpel.engine.MessageExchangeImpl.InDbAction<T> action)

getDAO

protected MessageExchangeDAO getDAO()
Get the DAO object. Note, we can do this only when we are running in a transaction.

Returns: