org.apache.ode.bpel.engine
Class BrokeredUnreliableMyRoleMessageExchangeImpl

java.lang.Object
  extended by org.apache.ode.bpel.engine.UnreliableMyRoleMessageExchangeImpl
      extended by org.apache.ode.bpel.engine.BrokeredUnreliableMyRoleMessageExchangeImpl
All Implemented Interfaces:
MessageExchange, MyRoleMessageExchange

public class BrokeredUnreliableMyRoleMessageExchangeImpl
extends UnreliableMyRoleMessageExchangeImpl

An unreliable MEP that delegates messages to a list of subscribers


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.ode.bpel.iapi.MyRoleMessageExchange
MyRoleMessageExchange.CorrelationStatus
 
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  javax.xml.namespace.QName _callee
           
protected  java.lang.String _clientId
           
protected  MyRoleMessageExchange.CorrelationStatus _cstatus
           
protected  MessageExchange.FailureType _failureType
           
 
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
 
Constructor Summary
BrokeredUnreliableMyRoleMessageExchangeImpl(ODEProcess process, java.util.List<MyRoleMessageExchange> subscribers, java.lang.String mexId, MyRoleMessageExchange template)
          Creates a new BrokeredUnreliableMyRoleMessageExchangeImpl object.
 
Method Summary
protected  void assertTransaction()
           
protected  Message cloneMessage(Message message)
          Return a deep clone of the given message
 void complete()
          Complete the message, exchange: indicates that the client has receive the response (if any).
 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)
           
protected  MessageExchangeDAO doInvoke()
           
 boolean equals(java.lang.Object other)
           
 MessageExchange.AckType getAckType()
          Fool the engine into thinking I'm one-way, wherever possible
 java.lang.String getClientId()
          Get the previously associated client key for this exchange.
 MyRoleMessageExchange.CorrelationStatus getCorrelationStatus()
          Get the correlation state of the the invocation.
protected  MessageExchangeDAO getDAO()
          Get the DAO object.
 EndpointReference getEndpointReference()
          Use the EPR of one of the subscribers as my EPR
 MessageExchange.FailureType getFailureType()
          Get the type of failure.
 javax.xml.namespace.QName getFault()
          Get the fault type.
 java.lang.String getFaultExplanation()
           
 Message getFaultResponse()
          Get the fault resposne message.
 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).
 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?).
 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()
          Use the response from one of the subscribers as my response
 javax.xml.namespace.QName getServiceName()
          Get the name of the service targetted in this message exchange.
 MessageExchange.Status getStatus()
          Return the status of one of the subscribers
 long getTimeout()
          Get the time-out in ms.
 java.util.concurrent.Future<MessageExchange.Status> invokeAsync()
          Propagate the invoke asynchronous call to each subscriber
 MessageExchange.Status invokeBlocking()
          Propagate the invoke blocking call to each subscriber
 void invokeReliable()
          Invoke a reliable process: this method must be invoked in a transaction.
 MessageExchange.Status invokeTransacted()
          Invoke a transactional process: this method must be invoked in a transaction.
 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 release(boolean instanceSucceeded)
           
 void save(MessageExchangeDAO dao)
           
 void setEndpointReference(EndpointReference ref)
           
 void setProperty(java.lang.String key, java.lang.String value)
          Set a message exchange property.
 void setRequest(Message request)
          Propagate set request call to every subscriber
 void setTimeout(long timeout)
          Propagate set timeout call to every subscriber
 java.lang.String toString()
           
 
Methods inherited from class org.apache.ode.bpel.engine.UnreliableMyRoleMessageExchangeImpl
getInvocationStyle, onAsyncAck
 
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, getFault, getFaultExplanation, getFaultResponse, getMessageExchangeId, getMessageExchangePattern, getOperation, getOperationName, getPortType, getProperty, getPropertyNames, getRequest, getTimeout, isSafe, isTransactional, release, setProperty
 

Field Detail

_callee

protected final javax.xml.namespace.QName _callee

_cstatus

protected MyRoleMessageExchange.CorrelationStatus _cstatus

_clientId

protected java.lang.String _clientId

__msgs

protected static final Messages __msgs

_failureType

protected MessageExchange.FailureType _failureType
Constructor Detail

BrokeredUnreliableMyRoleMessageExchangeImpl

public BrokeredUnreliableMyRoleMessageExchangeImpl(ODEProcess process,
                                                   java.util.List<MyRoleMessageExchange> subscribers,
                                                   java.lang.String mexId,
                                                   MyRoleMessageExchange template)
Creates a new BrokeredUnreliableMyRoleMessageExchangeImpl object.

Parameters:
process -
subscribers -
mexId -
template -
Method Detail

invokeAsync

public java.util.concurrent.Future<MessageExchange.Status> invokeAsync()
Propagate the invoke asynchronous call to each subscriber

Specified by:
invokeAsync in interface MyRoleMessageExchange
Overrides:
invokeAsync in class UnreliableMyRoleMessageExchangeImpl
Returns:
type

invokeBlocking

public MessageExchange.Status invokeBlocking()
                                      throws BpelEngineException,
                                             java.util.concurrent.TimeoutException
Propagate the invoke blocking call to each subscriber

Specified by:
invokeBlocking in interface MyRoleMessageExchange
Overrides:
invokeBlocking in class UnreliableMyRoleMessageExchangeImpl
Returns:
type
Throws:
BpelEngineException - BpelEngineException
java.util.concurrent.TimeoutException - TimeoutException

getAckType

public MessageExchange.AckType getAckType()
Fool the engine into thinking I'm one-way, wherever possible

Specified by:
getAckType in interface MessageExchange
Returns:
type

getEndpointReference

public EndpointReference getEndpointReference()
                                       throws BpelEngineException
Use the EPR of one of the subscribers as my EPR

Specified by:
getEndpointReference in interface MessageExchange
Returns:
type
Throws:
BpelEngineException - BpelEngineException

getResponse

public Message getResponse()
Use the response from one of the subscribers as my response

Specified by:
getResponse in interface MessageExchange
Returns:
type

setRequest

public void setRequest(Message request)
Propagate set request call to every subscriber

Specified by:
setRequest in interface MyRoleMessageExchange
Parameters:
request - request

setTimeout

public void setTimeout(long timeout)
Propagate set timeout call to every subscriber

Specified by:
setTimeout in interface MessageExchange
Parameters:
timeout - timeout

getStatus

public MessageExchange.Status getStatus()
Return the status of one of the subscribers

Specified by:
getStatus in interface MessageExchange
Returns:
status

getCorrelationStatus

public MyRoleMessageExchange.CorrelationStatus getCorrelationStatus()
Description copied from interface: MyRoleMessageExchange
Get the correlation state of the the invocation. An invocation will either create a new process instance, match an existing instance, or be queued for consumption by an instance in the future (see CorrelationType for details).

Specified by:
getCorrelationStatus in interface MyRoleMessageExchange
Returns:
correlation state of the invocation

save

public void save(MessageExchangeDAO dao)

getFailureType

public MessageExchange.FailureType getFailureType()
Description copied from interface: MyRoleMessageExchange
Get the type of failure. Only usable if AckType is FAILURE.

Specified by:
getFailureType in interface MyRoleMessageExchange
Returns:

getClientId

public java.lang.String getClientId()
Description copied from interface: MyRoleMessageExchange
Get the previously associated client key for this exchange.

Specified by:
getClientId in interface MyRoleMessageExchange
Returns:

invokeReliable

public void invokeReliable()
Description copied from interface: MyRoleMessageExchange
Invoke a reliable process: this method must be invoked in a transaction. The invoking thread will not be blocked. When the response is available, it will be provided via the MessageExchangeContext#onReliableReply(MyRoleMessageExchange).

Specified by:
invokeReliable in interface MyRoleMessageExchange

invokeTransacted

public MessageExchange.Status invokeTransacted()
                                        throws BpelEngineException
Description copied from interface: MyRoleMessageExchange
Invoke a transactional process: this method must be invoked in a transaction. The invoking thread will be blocked for the duration of the call.

Specified by:
invokeTransacted in interface MyRoleMessageExchange
Returns:
the final status of the operation (provided that commit succeedes)
Throws:
BpelEngineException

getServiceName

public javax.xml.namespace.QName getServiceName()
Description copied from interface: MyRoleMessageExchange
Get the name of the service targetted in this message exchange.

Specified by:
getServiceName in interface MyRoleMessageExchange
Returns:
service name

toString

public java.lang.String toString()

complete

public void complete()
Description copied from interface: MyRoleMessageExchange
Complete the message, exchange: indicates that the client has receive the response (if any).

Specified by:
complete in interface MyRoleMessageExchange

release

public void release(boolean instanceSucceeded)
Specified by:
release in interface MyRoleMessageExchange

doInvoke

protected MessageExchangeDAO doInvoke()

cloneMessage

protected Message cloneMessage(Message message)
Return a deep clone of the given message

Parameters:
message -
Returns:

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

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

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)

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:

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: