org.apache.ode.bpel.rtrep.v2
Class RuntimeInstanceImpl

java.lang.Object
  extended by org.apache.ode.bpel.rtrep.v2.RuntimeInstanceImpl
All Implemented Interfaces:
OdeRTInstance, OdeInternalInstance

public class RuntimeInstanceImpl
extends java.lang.Object
implements OdeInternalInstance, OdeRTInstance

Implementation of OdeInternalInstance for the "modern" runtime. This class also serves as a repository for kitchen sink type methods that the activities all use. A lot of these methods are simply deferals to similar methods on OdeRTInstanceContext; however here these methods use representation-specific classes (e.g. OPartnerLink) while the {@link OdeRTInstanceContext} methods use only the general (non-representation specific) interfaces (e.g. {@link PartnerLink}.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.ode.bpel.rapi.OdeRTInstance
OdeRTInstance.InvokeResponseType
 
Field Summary
protected  ExecutionQueueImpl _soup
          JACOB ExecutionQueue (state)
protected  JacobVPU _vpu
          JACOB VPU
 
Constructor Summary
RuntimeInstanceImpl(RuntimeImpl runtime, ExecutionQueueImpl soup)
           
 
Method Summary
 void cancel(PickResponseChannel responseChannel)
          Proxy to BpelRuntimeContext# .
 void cancelOutstandingRequests(java.lang.String channelId)
           
 void commitChanges(VariableInstance var, org.apache.ode.bpel.rtrep.v2.ScopeFrame scopeFrame, org.w3c.dom.Node value)
           
 void completedFault(FaultData faultData)
           
 void completedOk()
           
 org.w3c.dom.Node convertEndpointReference(org.w3c.dom.Element epr, org.w3c.dom.Node lvaluePtr)
          Proxy to VariableContext.convertEndpointReference(Element, Node).
 ExtensionOperation createExtensionActivityImplementation(javax.xml.namespace.QName name)
           
 java.lang.Long createScopeInstance(java.lang.Long scopeInstanceId, OScope scopedef)
          Proxy to VariableContext.createScopeInstance(Long, String, int).
 java.lang.Long createScopeInstance(java.lang.Long parentScopeId, java.lang.String name, int modelId)
           
 boolean execute()
           
 org.w3c.dom.Node fetchMyRoleEndpointReferenceData(PartnerLinkInstance link)
          Proxy to VariableContext.fetchMyRoleEndpointReferenceData(PartnerLink).
 java.lang.String fetchMySessionId(PartnerLinkInstance linkInstance)
          Proxy to BpelRuntimeContext# .
 org.w3c.dom.Node fetchPartnerRoleEndpointReferenceData(PartnerLinkInstance link)
           
 org.w3c.dom.Node fetchVariableData(VariableInstance variable, org.apache.ode.bpel.rtrep.v2.ScopeFrame scopeFrame, boolean forWriting)
           
 org.w3c.dom.Node fetchVariableData(VariableInstance var, org.apache.ode.bpel.rtrep.v2.ScopeFrame scopeFrame, OMessageVarType.Part part, boolean forWriting)
           
 void forceFlush()
          Proxy to ProcessControlContext.forceFlush().
 void forceRollback()
          Proxy to ProcessControlContext.forceRollback().
 long genId()
          Proxy to OdeRTInstanceContext.genId().
 java.net.URI getBaseResourceURI()
           
 ExpressionLanguageRuntimeRegistry getExpLangRuntime()
           
 org.w3c.dom.Element getMyRequest(java.lang.String mexId)
          Proxy to BpelRuntimeContext# .
 org.w3c.dom.Node getPartData(org.w3c.dom.Element message, OMessageVarType.Part part)
           
 javax.xml.namespace.QName getPartnerFault(java.lang.String mexId)
          Proxy to IOContext.getPartnerFault(String).
 java.lang.String getPartnerFaultExplanation(java.lang.String mexId)
          Proxy to IOContext.getPartnerFaultExplanation(String).
 org.w3c.dom.Element getPartnerResponse(java.lang.String mexId)
          Proxy to IOContext.getPartnerResponse(String).
 javax.xml.namespace.QName getPartnerResponseType(java.lang.String mexId)
          Proxy to IOContext.getPartnerResponseType(String).
 java.lang.Long getPid()
          Proxy to ProcessControlContext# .
 ProcessModel getProcessModel()
           
 org.w3c.dom.Node getProcessProperty(javax.xml.namespace.QName propertyName)
          Retrieves the property value that has been defined for this BPEL Process type.
 int getRetryDelay()
           
 org.w3c.dom.Node getSourceEPR(java.lang.String mexId)
           
 java.lang.String getSourceSessionId(java.lang.String mexId)
          Proxy to IOContext.getSourceSessionId(String).
 void initializePartnerLinks(java.lang.Long parentScopeId, java.util.Collection<OPartnerLink> partnerLinks)
           
 void initializePartnersSessionId(PartnerLinkInstance instance, java.lang.String partnersSessionId)
          Proxy to BpelRuntimeContext# .
 org.w3c.dom.Node initializeVariable(VariableInstance var, org.apache.ode.bpel.rtrep.v2.ScopeFrame scopeFrame, org.w3c.dom.Node val)
          Proxy to VariableContext.initializeVariable(Variable, Node) then write properties.
 java.lang.String invoke(java.lang.String invokeId, PartnerLinkInstance instance, javax.wsdl.Operation operation, org.w3c.dom.Element outboundMsg, java.lang.Object object)
           
 boolean isCorrelationInitialized(CorrelationSetInstance correlationSet)
           
 boolean isFirstTry()
           
 boolean isPartnerRoleEndpointInitialized(PartnerLinkInstance pLink)
           
 boolean isRetryable()
           
 boolean isVariableInitialized(VariableInstance var)
           
 void onCreateInstance(java.lang.String messageExchangeId)
          Called when the engine creates an instance (i.e.
 void onInvokeResponse(java.lang.String invokeId, OdeRTInstance.InvokeResponseType irt, java.lang.String mexid)
          Called when an invoke received a response.
 void onSelectEvent(java.lang.String selectId, java.lang.String messageExchangeId, int selectorIdx)
          Called when the engine detects a matching selector (i.e.
 void onTimerEvent(java.lang.String timerId)
          Called when the engine determines that a registered timer is ready to fire.
 CorrelationKey readCorrelation(CorrelationSetInstance cset)
           
 java.lang.String readProperty(VariableInstance variable, OProcess.OProperty property)
          Proxy to VariableContext.readVariableProperty(Variable, QName).
 void recoverActivity(java.lang.String channel, long activityId, java.lang.String action, FaultInfo fault)
           
 void registerActivityForRecovery(ActivityRecoveryChannel recoveryChannel, long id, java.lang.String reason, java.util.Date dateTime, org.w3c.dom.Element details, java.lang.String[] actions, int retryCount)
          Proxy to RecoveryContext.registerActivityForRecovery(String, long, String, Date, Element, String[], int).
 void registerTimer(TimerResponseChannel timerChannel, java.util.Date future)
          Proxy to IOContext.registerTimer(String, Date) .
 void releasePartnerMex(java.lang.String mexId, boolean instanceSucceeded)
          Proxy to IOContext#releasePartnerMex(String) .
 void reply(PartnerLinkInstance plink, java.lang.String opName, java.lang.String bpelmex, org.w3c.dom.Element element, javax.xml.namespace.QName fault)
          Proxy to IOContext#reply(PartnerLink, String, String, Element, QName) .
 java.lang.Object saveState(java.io.OutputStream bos)
          Save the execution state into the given output stream, and return a cached representation of the state.
 void select(PickResponseChannel pickResponseChannel, java.util.Date timeout, boolean createInstance, Selector[] selectors)
           
 void sendEvent(ProcessInstanceStartedEvent evt)
          Proxy to OdeRTInstanceContext.sendEvent(org.apache.ode.bpel.evt.ProcessInstanceEvent).
 void sendEvent(ScopeEvent event)
          Proxy to OdeRTInstanceContext.sendEvent(org.apache.ode.bpel.evt.ProcessInstanceEvent).
 void setAtomicScope(boolean atomicScope)
           
 void setContext(OdeRTInstanceContext ctx)
          Set the execution context.
 void setRetriedOnce()
           
 void setRetriesDone()
           
 void terminate()
          Proxy to ProcessControlContext.terminate().
 void unregisterActivityForRecovery(ActivityRecoveryChannel recoveryChannel)
           
 void writeCorrelation(CorrelationSetInstance cset, CorrelationKey ckeyVal)
           
 void writeEndpointReference(PartnerLinkInstance plval, org.w3c.dom.Element element)
          Proxy to BpelRuntimeContext# .
 
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

RuntimeInstanceImpl

public RuntimeInstanceImpl(RuntimeImpl runtime,
                           ExecutionQueueImpl soup)
Method Detail

getProcessModel

public ProcessModel getProcessModel()

isCorrelationInitialized

public boolean isCorrelationInitialized(CorrelationSetInstance correlationSet)
Specified by:
isCorrelationInitialized in interface OdeInternalInstance

isVariableInitialized

public boolean isVariableInitialized(VariableInstance var)
Specified by:
isVariableInitialized in interface OdeInternalInstance

isPartnerRoleEndpointInitialized

public boolean isPartnerRoleEndpointInitialized(PartnerLinkInstance pLink)
Specified by:
isPartnerRoleEndpointInitialized in interface OdeInternalInstance

completedFault

public void completedFault(FaultData faultData)
Specified by:
completedFault in interface OdeInternalInstance

completedOk

public void completedOk()
Specified by:
completedOk in interface OdeInternalInstance

createScopeInstance

public java.lang.Long createScopeInstance(java.lang.Long parentScopeId,
                                          java.lang.String name,
                                          int modelId)

initializePartnerLinks

public void initializePartnerLinks(java.lang.Long parentScopeId,
                                   java.util.Collection<OPartnerLink> partnerLinks)
Specified by:
initializePartnerLinks in interface OdeInternalInstance

cancelOutstandingRequests

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

select

public void select(PickResponseChannel pickResponseChannel,
                   java.util.Date timeout,
                   boolean createInstance,
                   Selector[] selectors)
            throws FaultException
Specified by:
select in interface OdeInternalInstance
Throws:
FaultException

readCorrelation

public CorrelationKey readCorrelation(CorrelationSetInstance cset)
Specified by:
readCorrelation in interface OdeInternalInstance

fetchVariableData

public org.w3c.dom.Node fetchVariableData(VariableInstance variable,
                                          org.apache.ode.bpel.rtrep.v2.ScopeFrame scopeFrame,
                                          boolean forWriting)
                                   throws FaultException
Specified by:
fetchVariableData in interface OdeInternalInstance
Throws:
FaultException

fetchVariableData

public org.w3c.dom.Node fetchVariableData(VariableInstance var,
                                          org.apache.ode.bpel.rtrep.v2.ScopeFrame scopeFrame,
                                          OMessageVarType.Part part,
                                          boolean forWriting)
                                   throws FaultException
Specified by:
fetchVariableData in interface OdeInternalInstance
Throws:
FaultException

writeCorrelation

public void writeCorrelation(CorrelationSetInstance cset,
                             CorrelationKey ckeyVal)
                      throws FaultException
Specified by:
writeCorrelation in interface OdeInternalInstance
Throws:
FaultException

sendEvent

public void sendEvent(ScopeEvent event)
Proxy to OdeRTInstanceContext.sendEvent(org.apache.ode.bpel.evt.ProcessInstanceEvent).

Specified by:
sendEvent in interface OdeInternalInstance
Parameters:
event -

unregisterActivityForRecovery

public void unregisterActivityForRecovery(ActivityRecoveryChannel recoveryChannel)
Specified by:
unregisterActivityForRecovery in interface OdeInternalInstance

registerActivityForRecovery

public void registerActivityForRecovery(ActivityRecoveryChannel recoveryChannel,
                                        long id,
                                        java.lang.String reason,
                                        java.util.Date dateTime,
                                        org.w3c.dom.Element details,
                                        java.lang.String[] actions,
                                        int retryCount)
Proxy to RecoveryContext.registerActivityForRecovery(String, long, String, Date, Element, String[], int).

Specified by:
registerActivityForRecovery in interface OdeInternalInstance

registerTimer

public void registerTimer(TimerResponseChannel timerChannel,
                          java.util.Date future)
Proxy to IOContext.registerTimer(String, Date) .

Specified by:
registerTimer in interface OdeInternalInstance

readProperty

public java.lang.String readProperty(VariableInstance variable,
                                     OProcess.OProperty property)
                              throws FaultException
Proxy to VariableContext.readVariableProperty(Variable, QName).

Specified by:
readProperty in interface OdeInternalInstance
Throws:
FaultException

genId

public long genId()
Proxy to OdeRTInstanceContext.genId().

Specified by:
genId in interface OdeInternalInstance

initializeVariable

public org.w3c.dom.Node initializeVariable(VariableInstance var,
                                           org.apache.ode.bpel.rtrep.v2.ScopeFrame scopeFrame,
                                           org.w3c.dom.Node val)
                                    throws ExternalVariableModuleException
Proxy to VariableContext.initializeVariable(Variable, Node) then write properties.

Specified by:
initializeVariable in interface OdeInternalInstance
Throws:
ExternalVariableModuleException

fetchMyRoleEndpointReferenceData

public org.w3c.dom.Node fetchMyRoleEndpointReferenceData(PartnerLinkInstance link)
Proxy to VariableContext.fetchMyRoleEndpointReferenceData(PartnerLink).

Specified by:
fetchMyRoleEndpointReferenceData in interface OdeInternalInstance

fetchPartnerRoleEndpointReferenceData

public org.w3c.dom.Node fetchPartnerRoleEndpointReferenceData(PartnerLinkInstance link)
                                                       throws FaultException
Specified by:
fetchPartnerRoleEndpointReferenceData in interface OdeInternalInstance
Throws:
FaultException

convertEndpointReference

public org.w3c.dom.Node convertEndpointReference(org.w3c.dom.Element epr,
                                                 org.w3c.dom.Node lvaluePtr)
Proxy to VariableContext.convertEndpointReference(Element, Node).

Specified by:
convertEndpointReference in interface OdeInternalInstance

commitChanges

public void commitChanges(VariableInstance var,
                          org.apache.ode.bpel.rtrep.v2.ScopeFrame scopeFrame,
                          org.w3c.dom.Node value)
                   throws ExternalVariableModuleException
Specified by:
commitChanges in interface OdeInternalInstance
Throws:
ExternalVariableModuleException

writeEndpointReference

public void writeEndpointReference(PartnerLinkInstance plval,
                                   org.w3c.dom.Element element)
Proxy to BpelRuntimeContext# .

Specified by:
writeEndpointReference in interface OdeInternalInstance

createScopeInstance

public java.lang.Long createScopeInstance(java.lang.Long scopeInstanceId,
                                          OScope scopedef)
Proxy to VariableContext.createScopeInstance(Long, String, int).

Specified by:
createScopeInstance in interface OdeInternalInstance

fetchMySessionId

public java.lang.String fetchMySessionId(PartnerLinkInstance linkInstance)
Proxy to BpelRuntimeContext# .

Specified by:
fetchMySessionId in interface OdeInternalInstance

cancel

public void cancel(PickResponseChannel responseChannel)
Proxy to BpelRuntimeContext# .

Specified by:
cancel in interface OdeInternalInstance

getMyRequest

public org.w3c.dom.Element getMyRequest(java.lang.String mexId)
Proxy to BpelRuntimeContext# .

Specified by:
getMyRequest in interface OdeInternalInstance

initializePartnersSessionId

public void initializePartnersSessionId(PartnerLinkInstance instance,
                                        java.lang.String partnersSessionId)
Proxy to BpelRuntimeContext# .

Specified by:
initializePartnersSessionId in interface OdeInternalInstance

getSourceSessionId

public java.lang.String getSourceSessionId(java.lang.String mexId)
Proxy to IOContext.getSourceSessionId(String).

Specified by:
getSourceSessionId in interface OdeInternalInstance

getSourceEPR

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

createExtensionActivityImplementation

public ExtensionOperation createExtensionActivityImplementation(javax.xml.namespace.QName name)
Specified by:
createExtensionActivityImplementation in interface OdeInternalInstance

getPid

public java.lang.Long getPid()
Proxy to ProcessControlContext# .

Specified by:
getPid in interface OdeInternalInstance

getPartnerResponse

public org.w3c.dom.Element getPartnerResponse(java.lang.String mexId)
Proxy to IOContext.getPartnerResponse(String).

Specified by:
getPartnerResponse in interface OdeInternalInstance

releasePartnerMex

public void releasePartnerMex(java.lang.String mexId,
                              boolean instanceSucceeded)
Proxy to IOContext#releasePartnerMex(String) .

Specified by:
releasePartnerMex in interface OdeInternalInstance

getPartnerFault

public javax.xml.namespace.QName getPartnerFault(java.lang.String mexId)
Proxy to IOContext.getPartnerFault(String).

Specified by:
getPartnerFault in interface OdeInternalInstance

getPartnerResponseType

public javax.xml.namespace.QName getPartnerResponseType(java.lang.String mexId)
Proxy to IOContext.getPartnerResponseType(String).

Specified by:
getPartnerResponseType in interface OdeInternalInstance

getPartnerFaultExplanation

public java.lang.String getPartnerFaultExplanation(java.lang.String mexId)
Proxy to IOContext.getPartnerFaultExplanation(String).

Specified by:
getPartnerFaultExplanation in interface OdeInternalInstance

sendEvent

public void sendEvent(ProcessInstanceStartedEvent evt)
Proxy to OdeRTInstanceContext.sendEvent(org.apache.ode.bpel.evt.ProcessInstanceEvent).

Specified by:
sendEvent in interface OdeInternalInstance

reply

public void reply(PartnerLinkInstance plink,
                  java.lang.String opName,
                  java.lang.String bpelmex,
                  org.w3c.dom.Element element,
                  javax.xml.namespace.QName fault)
           throws FaultException
Proxy to IOContext#reply(PartnerLink, String, String, Element, QName) .

Specified by:
reply in interface OdeInternalInstance
Throws:
FaultException

forceFlush

public void forceFlush()
Proxy to ProcessControlContext.forceFlush().

Specified by:
forceFlush in interface OdeInternalInstance

forceRollback

public void forceRollback()
Proxy to ProcessControlContext.forceRollback().

Specified by:
forceRollback in interface OdeInternalInstance

terminate

public void terminate()
Proxy to ProcessControlContext.terminate().

Specified by:
terminate in interface OdeInternalInstance

getPartData

public org.w3c.dom.Node getPartData(org.w3c.dom.Element message,
                                    OMessageVarType.Part part)
Specified by:
getPartData in interface OdeInternalInstance

invoke

public java.lang.String invoke(java.lang.String invokeId,
                               PartnerLinkInstance instance,
                               javax.wsdl.Operation operation,
                               org.w3c.dom.Element outboundMsg,
                               java.lang.Object object)
                        throws FaultException
Specified by:
invoke in interface OdeInternalInstance
Parameters:
instance -
operation -
outboundMsg -
object -
Throws:
FaultException

getExpLangRuntime

public ExpressionLanguageRuntimeRegistry getExpLangRuntime()
Specified by:
getExpLangRuntime in interface OdeInternalInstance
Returns:

onSelectEvent

public void onSelectEvent(java.lang.String selectId,
                          java.lang.String messageExchangeId,
                          int selectorIdx)
Description copied from interface: OdeRTInstance
Called when the engine detects a matching selector (i.e. when a partner invokes the process).

Specified by:
onSelectEvent in interface OdeRTInstance
Parameters:
selectId - selector identifier
messageExchangeId - message exchange identifier
selectorIdx - which selector in the set matched

onTimerEvent

public void onTimerEvent(java.lang.String timerId)
Description copied from interface: OdeRTInstance
Called when the engine determines that a registered timer is ready to fire.

Specified by:
onTimerEvent in interface OdeRTInstance

execute

public boolean execute()
Specified by:
execute in interface OdeRTInstance
Returns:

onInvokeResponse

public void onInvokeResponse(java.lang.String invokeId,
                             OdeRTInstance.InvokeResponseType irt,
                             java.lang.String mexid)
Description copied from interface: OdeRTInstance
Called when an invoke received a response.

Specified by:
onInvokeResponse in interface OdeRTInstance

recoverActivity

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

saveState

public java.lang.Object saveState(java.io.OutputStream bos)
                           throws java.io.IOException
Description copied from interface: OdeRTInstance
Save the execution state into the given output stream, and return a cached representation of the state. The cached representation will be used by the engine to speed up state recovery (i.e. when de-serializing can be avoided).

Specified by:
saveState in interface OdeRTInstance
Returns:
cached
Throws:
java.io.IOException

onCreateInstance

public void onCreateInstance(java.lang.String messageExchangeId)
Description copied from interface: OdeRTInstance
Called when the engine creates an instance (i.e. a create-instance mex is received).

Specified by:
onCreateInstance in interface OdeRTInstance
Parameters:
messageExchangeId - message exchange id for create-instance mex

setContext

public void setContext(OdeRTInstanceContext ctx)
Description copied from interface: OdeRTInstance
Set the execution context.

Specified by:
setContext in interface OdeRTInstance

getBaseResourceURI

public java.net.URI getBaseResourceURI()
Specified by:
getBaseResourceURI in interface OdeInternalInstance

getRetryDelay

public int getRetryDelay()
Specified by:
getRetryDelay in interface OdeInternalInstance

isFirstTry

public boolean isFirstTry()
Specified by:
isFirstTry in interface OdeInternalInstance

isRetryable

public boolean isRetryable()
Specified by:
isRetryable in interface OdeInternalInstance

setRetriedOnce

public void setRetriedOnce()
Specified by:
setRetriedOnce in interface OdeInternalInstance

setRetriesDone

public void setRetriesDone()
Specified by:
setRetriesDone in interface OdeInternalInstance

setAtomicScope

public void setAtomicScope(boolean atomicScope)
Specified by:
setAtomicScope in interface OdeInternalInstance

getProcessProperty

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

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