org.apache.ode.bpel.engine
Class BpelRuntimeContextImpl

java.lang.Object
  extended by org.apache.ode.bpel.engine.BpelRuntimeContextImpl
All Implemented Interfaces:
BpelRuntimeContext

public class BpelRuntimeContextImpl
extends java.lang.Object
implements BpelRuntimeContext


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.ode.bpel.runtime.BpelRuntimeContext
BpelRuntimeContext.ValueReferencePair
 
Field Summary
protected  ExecutionQueueImpl _soup
          JACOB ExecutionQueue (state)
protected  JacobVPU _vpu
          JACOB VPU
 
Constructor Summary
BpelRuntimeContextImpl(BpelProcess bpelProcess, ProcessInstanceDAO dao, PROCESS PROCESS, org.apache.ode.bpel.engine.MyRoleMessageExchangeImpl instantiatingMessageExchange)
           
 
Method Summary
 void cancel(TimerResponseChannel timerResponseChannel)
          Cancel a timer, or pick.
 void cancelOutstandingRequests(java.lang.String channelId)
           
 void completedFault(FaultData faultData)
          Should be invoked by process template, signalling process completion with fault.
 void completedOk()
          Should be invoked by process template, signalling process completion with no faults.
 org.w3c.dom.Node convertEndpointReference(org.w3c.dom.Element sourceNode, org.w3c.dom.Node targetNode)
           
protected  PartnerRoleMessageExchangeImpl createPartnerRoleMessageExchangeImpl(MessageExchangeDAO mexDao, PartnerLinkInstance partnerLink, javax.wsdl.Operation operation, EndpointReference partnerEpr, EndpointReference myRoleEndpoint)
           
 java.lang.Long createScopeInstance(java.lang.Long parentScopeId, OScope scope)
          Create a scope instance object.
 java.lang.String fetchEndpointSessionId(PartnerLinkInstance pLink, boolean isMyEPR)
           
 org.w3c.dom.Element fetchMyRoleEndpointReferenceData(PartnerLinkInstance pLink)
          Fetches the my-role endpoint reference data.
 java.lang.String fetchMySessionId(PartnerLinkInstance pLink)
          Fetch the session-identifier for the partner link from the database.
 org.w3c.dom.Element fetchPartnerRoleEndpointReferenceData(PartnerLinkInstance pLink)
           
 java.lang.String fetchPartnersSessionId(PartnerLinkInstance pLink)
          Fetches the partner's session id associated with the partner link instance.
 long genId()
          Generate a unique (and monotonic) ID in the context of this instance.
 java.net.URI getBaseResourceURI()
          Retrieves the base URI that this BPEL Process instance is running relative to.
protected  BpelProcess getBpelProcess()
           
 ExpressionLanguageRuntimeRegistry getExpLangRuntime()
           
 org.w3c.dom.Element getMyRequest(java.lang.String mexId)
           
 javax.xml.namespace.QName getPartnerFault(java.lang.String mexId)
           
 java.lang.String getPartnerFaultExplanation(java.lang.String mexId)
           
 org.w3c.dom.Element getPartnerResponse(java.lang.String mexId)
           
 javax.xml.namespace.QName getPartnerResponseType(java.lang.String mexId)
           
 java.lang.Long getPid()
           
 org.w3c.dom.Node getProcessProperty(javax.xml.namespace.QName propertyName)
          Retrieves the property value that has been defined for this BPEL Process type.
 javax.xml.namespace.QName getProcessQName()
           
 org.w3c.dom.Element getSourceEPR(java.lang.String mexId)
           
 java.lang.String getSourceSessionId(java.lang.String mexId)
           
 void initializeCorrelation(CorrelationSetInstance cset, VariableInstance variable)
          Common functionality to initialize a correlation set based on data available in a variable.
 void initializePartnerLinks(java.lang.Long parentScopeId, java.util.Collection<OPartnerLink> partnerLinks)
          Initializes endpoint references for partner links inside a scope.
 void initializePartnersSessionId(PartnerLinkInstance pLink, java.lang.String session)
          Initialize the partner's session id for this partner link instance.
 java.lang.String invoke(int aid, PartnerLinkInstance partnerLink, javax.wsdl.Operation operation, org.w3c.dom.Element outgoingMessage, InvokeResponseChannel channel)
          Called back when the process executes an invokation.
 boolean isCorrelationInitialized(CorrelationSetInstance correlationSet)
           
 boolean isPartnerRoleEndpointInitialized(PartnerLinkInstance pLink)
          Determine if the partner role of an endpoint has been initialized (either explicitly throug assginment or via the deployment descriptor)
 boolean isVariableInitialized(VariableInstance var)
          Checks for variable initialization, i.e.
 void matcherEvent(java.lang.String correlatorId, CorrelationKeySet ckeySet)
          Attempt to match message exchanges on a correlator.
 CorrelationKey readCorrelation(CorrelationSetInstance cset)
           
 org.w3c.dom.Node readExtVar(OScope.Variable variable, org.w3c.dom.Node reference)
          Read an external variable.
 java.lang.String readProperty(VariableInstance variable, OProcess.OProperty property)
          Evaluate a property alias query expression against a variable, returning the normalized String representation of the property value.
 org.w3c.dom.Node readVariable(java.lang.Long scopeInstanceId, java.lang.String varname, boolean forWriting)
           
 void recoverActivity(java.lang.String channel, long activityId, java.lang.String action, FaultData fault)
           
 void registerActivityForRecovery(ActivityRecoveryChannel channel, long activityId, java.lang.String reason, java.util.Date dateTime, org.w3c.dom.Element details, java.lang.String[] actions, int retries)
           
 void registerTimer(TimerResponseChannel timerChannel, java.util.Date timeToFire)
          Registers a timer for future notification.
 void releasePartnerMex(java.lang.String mexId, boolean instanceSucceeded)
           
 void reply(PartnerLinkInstance plinkInstnace, java.lang.String opName, java.lang.String mexId, org.w3c.dom.Element msg, javax.xml.namespace.QName fault)
          Send a reply to an open message-exchange.
 void select(PickResponseChannel pickResponseChannel, java.util.Date timeout, boolean createInstance, Selector[] selectors)
          Non-deterministic selection on incoming message-exchanges.
 void sendEvent(ProcessInstanceEvent event)
          Sends the bpel event.
 void terminate()
          Terminates the process / sets state flag to terminate and ceases all processing on the VPU.
 void unregisterActivityForRecovery(ActivityRecoveryChannel channel)
           
 void writeCorrelation(CorrelationSetInstance cset, CorrelationKey correlation)
           
 void writeEndpointReference(PartnerLinkInstance variable, org.w3c.dom.Element data)
          Writes a partner EPR.
 BpelRuntimeContext.ValueReferencePair writeExtVar(OScope.Variable variable, org.w3c.dom.Node reference, org.w3c.dom.Node value)
          Write an external variable.
 org.w3c.dom.Node writeVariable(VariableInstance variable, org.w3c.dom.Node changes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_vpu

protected JacobVPU _vpu
JACOB VPU


_soup

protected ExecutionQueueImpl _soup
JACOB ExecutionQueue (state)

Constructor Detail

BpelRuntimeContextImpl

public BpelRuntimeContextImpl(BpelProcess bpelProcess,
                              ProcessInstanceDAO dao,
                              PROCESS PROCESS,
                              org.apache.ode.bpel.engine.MyRoleMessageExchangeImpl instantiatingMessageExchange)
Method Detail

getPid

public java.lang.Long getPid()
Specified by:
getPid in interface BpelRuntimeContext

genId

public long genId()
Description copied from interface: BpelRuntimeContext
Generate a unique (and monotonic) ID in the context of this instance.

Specified by:
genId in interface BpelRuntimeContext
Returns:

isCorrelationInitialized

public boolean isCorrelationInitialized(CorrelationSetInstance correlationSet)
Specified by:
isCorrelationInitialized in interface BpelRuntimeContext
See Also:
BpelRuntimeContext.isCorrelationInitialized(org.apache.ode.bpel.runtime.CorrelationSetInstance)

isVariableInitialized

public boolean isVariableInitialized(VariableInstance var)
Description copied from interface: BpelRuntimeContext
Checks for variable initialization, i.e. has had a 'write'

Specified by:
isVariableInitialized in interface BpelRuntimeContext
Parameters:
var - variable
Returns:
true if initialized
See Also:
BpelRuntimeContext.isVariableInitialized(org.apache.ode.bpel.runtime.VariableInstance)

isPartnerRoleEndpointInitialized

public boolean isPartnerRoleEndpointInitialized(PartnerLinkInstance pLink)
Description copied from interface: BpelRuntimeContext
Determine if the partner role of an endpoint has been initialized (either explicitly throug assginment or via the deployment descriptor)

Specified by:
isPartnerRoleEndpointInitialized in interface BpelRuntimeContext
Parameters:
pLink - partner link
Returns:

completedFault

public void completedFault(FaultData faultData)
Description copied from interface: BpelRuntimeContext
Should be invoked by process template, signalling process completion with fault.

Specified by:
completedFault in interface BpelRuntimeContext
See Also:
BpelRuntimeContext.completedFault(org.apache.ode.bpel.runtime.channels.FaultData)

completedOk

public void completedOk()
Description copied from interface: BpelRuntimeContext
Should be invoked by process template, signalling process completion with no faults.

Specified by:
completedOk in interface BpelRuntimeContext
See Also:
BpelRuntimeContext.completedOk()

createScopeInstance

public java.lang.Long createScopeInstance(java.lang.Long parentScopeId,
                                          OScope scope)
Description copied from interface: BpelRuntimeContext
Create a scope instance object.

Specified by:
createScopeInstance in interface BpelRuntimeContext
Parameters:
parentScopeId - _id of parent scope (null if root scope)
scope - the type of scope, i.e. the name of the scope
Returns:
scope instance identifier
See Also:
BpelRuntimeContext.createScopeInstance(Long, org.apache.ode.bpel.o.OScope)

initializePartnerLinks

public void initializePartnerLinks(java.lang.Long parentScopeId,
                                   java.util.Collection<OPartnerLink> partnerLinks)
Description copied from interface: BpelRuntimeContext
Initializes endpoint references for partner links inside a scope.

Specified by:
initializePartnerLinks in interface BpelRuntimeContext

select

public void select(PickResponseChannel pickResponseChannel,
                   java.util.Date timeout,
                   boolean createInstance,
                   Selector[] selectors)
            throws FaultException
Description copied from interface: BpelRuntimeContext
Non-deterministic selection on incoming message-exchanges.

Specified by:
select in interface BpelRuntimeContext
Throws:
FaultException

readCorrelation

public CorrelationKey readCorrelation(CorrelationSetInstance cset)
Specified by:
readCorrelation in interface BpelRuntimeContext
See Also:
BpelRuntimeContext.readCorrelation(org.apache.ode.bpel.runtime.CorrelationSetInstance)

fetchPartnerRoleEndpointReferenceData

public org.w3c.dom.Element fetchPartnerRoleEndpointReferenceData(PartnerLinkInstance pLink)
                                                          throws FaultException
Specified by:
fetchPartnerRoleEndpointReferenceData in interface BpelRuntimeContext
Throws:
FaultException

fetchMyRoleEndpointReferenceData

public org.w3c.dom.Element fetchMyRoleEndpointReferenceData(PartnerLinkInstance pLink)
Description copied from interface: BpelRuntimeContext
Fetches the my-role endpoint reference data.

Specified by:
fetchMyRoleEndpointReferenceData in interface BpelRuntimeContext
Returns:

readProperty

public java.lang.String readProperty(VariableInstance variable,
                                     OProcess.OProperty property)
                              throws FaultException
Evaluate a property alias query expression against a variable, returning the normalized String representation of the property value.

Specified by:
readProperty in interface BpelRuntimeContext
Parameters:
variable - variable to read
property - property to read
Returns:
value of property for variable, in String form
Throws:
FaultException - in case of selection or other fault

writeEndpointReference

public void writeEndpointReference(PartnerLinkInstance variable,
                                   org.w3c.dom.Element data)
                            throws FaultException
Description copied from interface: BpelRuntimeContext
Writes a partner EPR.

Specified by:
writeEndpointReference in interface BpelRuntimeContext
Throws:
FaultException

fetchEndpointSessionId

public java.lang.String fetchEndpointSessionId(PartnerLinkInstance pLink,
                                               boolean isMyEPR)
                                        throws FaultException
Throws:
FaultException

convertEndpointReference

public org.w3c.dom.Node convertEndpointReference(org.w3c.dom.Element sourceNode,
                                                 org.w3c.dom.Node targetNode)
Specified by:
convertEndpointReference in interface BpelRuntimeContext

readVariable

public org.w3c.dom.Node readVariable(java.lang.Long scopeInstanceId,
                                     java.lang.String varname,
                                     boolean forWriting)
                              throws FaultException
Specified by:
readVariable in interface BpelRuntimeContext
Returns:
Throws:
FaultException

writeVariable

public org.w3c.dom.Node writeVariable(VariableInstance variable,
                                      org.w3c.dom.Node changes)
Specified by:
writeVariable in interface BpelRuntimeContext

cancelOutstandingRequests

public void cancelOutstandingRequests(java.lang.String channelId)
Specified by:
cancelOutstandingRequests in interface BpelRuntimeContext

reply

public void reply(PartnerLinkInstance plinkInstnace,
                  java.lang.String opName,
                  java.lang.String mexId,
                  org.w3c.dom.Element msg,
                  javax.xml.namespace.QName fault)
           throws FaultException
Description copied from interface: BpelRuntimeContext
Send a reply to an open message-exchange.

Specified by:
reply in interface BpelRuntimeContext
msg - response message
fault - fault name, if this is a fault reply, otherwise null
Throws:
FaultException

writeCorrelation

public void writeCorrelation(CorrelationSetInstance cset,
                             CorrelationKey correlation)
Specified by:
writeCorrelation in interface BpelRuntimeContext
See Also:
BpelRuntimeContext.writeCorrelation(org.apache.ode.bpel.runtime.CorrelationSetInstance, org.apache.ode.bpel.common.CorrelationKey)

initializeCorrelation

public void initializeCorrelation(CorrelationSetInstance cset,
                                  VariableInstance variable)
                           throws FaultException
Common functionality to initialize a correlation set based on data available in a variable.

Parameters:
cset - the correlation set instance
variable - variable instance
Throws:
java.lang.IllegalStateException - DOCUMENTME
FaultException

getExpLangRuntime

public ExpressionLanguageRuntimeRegistry getExpLangRuntime()
Specified by:
getExpLangRuntime in interface BpelRuntimeContext

terminate

public void terminate()
Description copied from interface: BpelRuntimeContext
Terminates the process / sets state flag to terminate and ceases all processing on the VPU.

Specified by:
terminate in interface BpelRuntimeContext
See Also:
BpelRuntimeContext.terminate()

registerTimer

public void registerTimer(TimerResponseChannel timerChannel,
                          java.util.Date timeToFire)
Description copied from interface: BpelRuntimeContext
Registers a timer for future notification.

Specified by:
registerTimer in interface BpelRuntimeContext
Parameters:
timerChannel - channel for timer notification
timeToFire - future time to fire timer notification

invoke

public java.lang.String invoke(int aid,
                               PartnerLinkInstance partnerLink,
                               javax.wsdl.Operation operation,
                               org.w3c.dom.Element outgoingMessage,
                               InvokeResponseChannel channel)
                        throws FaultException
Called back when the process executes an invokation.

Specified by:
invoke in interface BpelRuntimeContext
Parameters:
activityId - The activity id in the process definition (id of OInvoke)
partnerLinkInstance - The partner link variable instance
operation - The wsdl operation.
outboundMsg - The message sent outside as a DOM
invokeResponseChannel - Object called back when the response is received.
Returns:
The instance id of the message exchange.
Throws:
FaultException - When the response is a fault or when the invoke could not be executed in which case it is one of the bpel standard fault.

createPartnerRoleMessageExchangeImpl

protected PartnerRoleMessageExchangeImpl createPartnerRoleMessageExchangeImpl(MessageExchangeDAO mexDao,
                                                                              PartnerLinkInstance partnerLink,
                                                                              javax.wsdl.Operation operation,
                                                                              EndpointReference partnerEpr,
                                                                              EndpointReference myRoleEndpoint)

getBpelProcess

protected BpelProcess getBpelProcess()

cancel

public void cancel(TimerResponseChannel timerResponseChannel)
Description copied from interface: BpelRuntimeContext
Cancel a timer, or pick.

Specified by:
cancel in interface BpelRuntimeContext

sendEvent

public void sendEvent(ProcessInstanceEvent event)
Description copied from interface: BpelRuntimeContext
Sends the bpel event.

Specified by:
sendEvent in interface BpelRuntimeContext
See Also:
BpelRuntimeContext.sendEvent(org.apache.ode.bpel.evt.ProcessInstanceEvent)

getPartnerResponse

public org.w3c.dom.Element getPartnerResponse(java.lang.String mexId)
Specified by:
getPartnerResponse in interface BpelRuntimeContext

getMyRequest

public org.w3c.dom.Element getMyRequest(java.lang.String mexId)
Specified by:
getMyRequest in interface BpelRuntimeContext

getPartnerFault

public javax.xml.namespace.QName getPartnerFault(java.lang.String mexId)
Specified by:
getPartnerFault in interface BpelRuntimeContext

getPartnerResponseType

public javax.xml.namespace.QName getPartnerResponseType(java.lang.String mexId)
Specified by:
getPartnerResponseType in interface BpelRuntimeContext

getPartnerFaultExplanation

public java.lang.String getPartnerFaultExplanation(java.lang.String mexId)
Specified by:
getPartnerFaultExplanation in interface BpelRuntimeContext

releasePartnerMex

public void releasePartnerMex(java.lang.String mexId,
                              boolean instanceSucceeded)
Specified by:
releasePartnerMex in interface BpelRuntimeContext

getSourceEPR

public org.w3c.dom.Element getSourceEPR(java.lang.String mexId)
Specified by:
getSourceEPR in interface BpelRuntimeContext

getSourceSessionId

public java.lang.String getSourceSessionId(java.lang.String mexId)
Specified by:
getSourceSessionId in interface BpelRuntimeContext

registerActivityForRecovery

public void registerActivityForRecovery(ActivityRecoveryChannel channel,
                                        long activityId,
                                        java.lang.String reason,
                                        java.util.Date dateTime,
                                        org.w3c.dom.Element details,
                                        java.lang.String[] actions,
                                        int retries)
Specified by:
registerActivityForRecovery in interface BpelRuntimeContext

unregisterActivityForRecovery

public void unregisterActivityForRecovery(ActivityRecoveryChannel channel)
Specified by:
unregisterActivityForRecovery in interface BpelRuntimeContext

recoverActivity

public void recoverActivity(java.lang.String channel,
                            long activityId,
                            java.lang.String action,
                            FaultData fault)
Specified by:
recoverActivity in interface BpelRuntimeContext

fetchMySessionId

public java.lang.String fetchMySessionId(PartnerLinkInstance pLink)
Fetch the session-identifier for the partner link from the database.

Specified by:
fetchMySessionId in interface BpelRuntimeContext
Parameters:
pLink - partner link

fetchPartnersSessionId

public java.lang.String fetchPartnersSessionId(PartnerLinkInstance pLink)
Description copied from interface: BpelRuntimeContext
Fetches the partner's session id associated with the partner link instance.

Specified by:
fetchPartnersSessionId in interface BpelRuntimeContext
Parameters:
pLink - partner link

initializePartnersSessionId

public void initializePartnersSessionId(PartnerLinkInstance pLink,
                                        java.lang.String session)
Description copied from interface: BpelRuntimeContext
Initialize the partner's session id for this partner link instance.

Specified by:
initializePartnersSessionId in interface BpelRuntimeContext
Parameters:
pLink - partner link
session - session identifier

matcherEvent

public void matcherEvent(java.lang.String correlatorId,
                         CorrelationKeySet ckeySet)
Attempt to match message exchanges on a correlator.


readExtVar

public org.w3c.dom.Node readExtVar(OScope.Variable variable,
                                   org.w3c.dom.Node reference)
                            throws ExternalVariableModuleException
Description copied from interface: BpelRuntimeContext
Read an external variable.

Specified by:
readExtVar in interface BpelRuntimeContext
Throws:
ExternalVariableModuleException

writeExtVar

public BpelRuntimeContext.ValueReferencePair writeExtVar(OScope.Variable variable,
                                                         org.w3c.dom.Node reference,
                                                         org.w3c.dom.Node value)
                                                  throws ExternalVariableModuleException
Description copied from interface: BpelRuntimeContext
Write an external variable.

Specified by:
writeExtVar in interface BpelRuntimeContext
Throws:
ExternalVariableModuleException

getBaseResourceURI

public java.net.URI getBaseResourceURI()
Description copied from interface: BpelRuntimeContext
Retrieves the base URI that this BPEL Process instance is running relative to.

Specified by:
getBaseResourceURI in interface BpelRuntimeContext
Returns:
URI - the URI representing the absolute physical file path location that this process is defined within.

getProcessProperty

public org.w3c.dom.Node getProcessProperty(javax.xml.namespace.QName propertyName)
Description copied from interface: BpelRuntimeContext
Retrieves the property value that has been defined for this BPEL Process type.

Specified by:
getProcessProperty in interface BpelRuntimeContext
Returns:
propertyValue - the value corresponding to the process property name.

getProcessQName

public javax.xml.namespace.QName getProcessQName()
Specified by:
getProcessQName in interface BpelRuntimeContext