org.apache.ode.bpel.memdao
Class ProcessInstanceDaoImpl

java.lang.Object
  extended by org.apache.ode.bpel.memdao.ProcessInstanceDaoImpl
All Implemented Interfaces:
ProcessInstanceDAO

public class ProcessInstanceDaoImpl
extends java.lang.Object
implements ProcessInstanceDAO

A very simple, in-memory implementation of the ProcessInstanceDAO interface.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.ode.bpel.dao.ProcessInstanceDAO
ProcessInstanceDAO.EventsFirstLastCountTuple
 
Method Summary
 void addMessageExchange(java.lang.String identifier, byte[] data)
           
 void createActivityRecovery(java.lang.String channel, long activityId, java.lang.String reason, java.util.Date dateTime, org.w3c.dom.Element data, java.lang.String[] actions, int retries)
          Create an activity recovery object for a given activity instance.
 ScopeDAO createScope(ScopeDAO parentScope, java.lang.String scopeType, int scopeModelId)
          Creates a new scope.
 void delete(java.util.Set<ProcessConf.CLEANUP_CATEGORY> cleanupCategories)
          Delete the process instance object from the database.
 void deleteActivityRecovery(java.lang.String channel)
          Delete previously registered activity recovery.
 void finishCompletion()
          A simple callback to allow the ProcessInstance to perform post-completion duties.
 long genMonotonic()
          Get the next number from a monotonically increasing sequence.
 int getActivityFailureCount()
          Get number of activities in the failure state.
 java.util.Date getActivityFailureDateTime()
          Get date/time of last activity failure.
 java.util.Collection<ActivityRecoveryDAO> getActivityRecoveries()
          Returns all activity recovery objects for this process instance.
 BpelDAOConnection getConnection()
           
 CorrelationSetDAO getCorrelationSet(java.lang.String name)
          Get a correlation set by its name from this process
 java.util.Set<CorrelationSetDAO> getCorrelationSets()
          Get all the correlation sets for this process.
 java.util.Date getCreateTime()
           
 int getEventCount()
           
 java.util.List<ProcessInstanceEvent> getEvents(int idx, int count)
           
 ProcessInstanceDAO.EventsFirstLastCountTuple getEventsFirstLastCount()
          Get a triple containing the first
 byte[] getExecutionState()
          Get the (opaque) instance execution state.
 FaultDAO getFault()
          The un-caught fault associated with the process.
 java.lang.Long getInstanceId()
          Get the instance identifier.
 CorrelatorDAO getInstantiatingCorrelator()
          Return the correlator which results in the instantiation of the process instance.
 java.util.Date getLastActiveTime()
          Get the time when the process instance was last active (re-hydrated).
 byte[] getMessageExchange(java.lang.String identifier)
           
 short getPreviousState()
          Returns the next to last state.
 ProcessDAO getProcess()
          Get the process.
 ScopeDAO getRootScope()
          Get the root (global) scope for the process.
 ScopeDAO getScope(java.lang.Long scopeInstanceId)
          Returns a scope using its instance id.
 java.util.Collection<ScopeDAO> getScopes()
          Returns all the scopes belonging to this isntance.
 java.util.Collection<ScopeDAO> getScopes(java.lang.String scopeName)
          Returns all the scopes with the associated name.
 java.lang.Object getSoup()
           
 short getState()
          Get the state of the process instance; one of the STATE_XXX constants defined in ProcessState.
 XmlDataDAO[] getVariables(java.lang.String variableName, int scopeModelId)
          Returns all variable instances matching the variable name for a specified scope.
 void insertBpelEvent(ProcessInstanceEvent event)
          Insert a BPEL event to the database (associating with this process).
 void setExecutionState(byte[] bytes)
          Set the (opaque) instance execution state.
 void setFault(FaultDAO fault)
          The un-caught fault associated with the process.
 void setFault(javax.xml.namespace.QName name, java.lang.String explanation, int lineNo, int activityId, org.w3c.dom.Element faultData)
           
 void setLastActiveTime(java.util.Date dt)
          Set last activity time for the process instance
 void setSoup(java.lang.Object soup)
           
 void setState(short state)
          Set the state of the process instance; one of the STATE_XXX constants defined in ProcessState.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.ode.bpel.dao.ProcessInstanceDAO
getCreateTime
 

Method Detail

getVariables

public XmlDataDAO[] getVariables(java.lang.String variableName,
                                 int scopeModelId)
Description copied from interface: ProcessInstanceDAO
Returns all variable instances matching the variable name for a specified scope.

Specified by:
getVariables in interface ProcessInstanceDAO

getCorrelationSets

public java.util.Set<CorrelationSetDAO> getCorrelationSets()
Description copied from interface: ProcessInstanceDAO
Get all the correlation sets for this process.

Specified by:
getCorrelationSets in interface ProcessInstanceDAO
Returns:
Set of CorrelationSetDAO objects

getCorrelationSet

public CorrelationSetDAO getCorrelationSet(java.lang.String name)
Description copied from interface: ProcessInstanceDAO
Get a correlation set by its name from this process

Specified by:
getCorrelationSet in interface ProcessInstanceDAO
Returns:
a CorrelationSetDAO object

setFault

public void setFault(javax.xml.namespace.QName name,
                     java.lang.String explanation,
                     int lineNo,
                     int activityId,
                     org.w3c.dom.Element faultData)
Specified by:
setFault in interface ProcessInstanceDAO

setFault

public void setFault(FaultDAO fault)
Description copied from interface: ProcessInstanceDAO
The un-caught fault associated with the process. This will be null if no fault occurred or if all faults are caught and processed.

Specified by:
setFault in interface ProcessInstanceDAO
Parameters:
fault - the fault

getFault

public FaultDAO getFault()
Description copied from interface: ProcessInstanceDAO
The un-caught fault associated with the process. This will be null if no fault occurred or if all faults are caught and processed.

Specified by:
getFault in interface ProcessInstanceDAO
Returns:
the fault

getExecutionState

public byte[] getExecutionState()
Description copied from interface: ProcessInstanceDAO
Get the (opaque) instance execution state.

Specified by:
getExecutionState in interface ProcessInstanceDAO
Returns:
opaque execution state
See Also:
ProcessInstanceDAO.getExecutionState()

setExecutionState

public void setExecutionState(byte[] bytes)
Description copied from interface: ProcessInstanceDAO
Set the (opaque) instance execution state.

Specified by:
setExecutionState in interface ProcessInstanceDAO
Parameters:
bytes - execuction state

getSoup

public java.lang.Object getSoup()

setSoup

public void setSoup(java.lang.Object soup)

getMessageExchange

public byte[] getMessageExchange(java.lang.String identifier)

getProcess

public ProcessDAO getProcess()
Description copied from interface: ProcessInstanceDAO
Get the process.

Specified by:
getProcess in interface ProcessInstanceDAO
Returns:
process reference.
See Also:
ProcessInstanceDAO.getProcess()

getRootScope

public ScopeDAO getRootScope()
Description copied from interface: ProcessInstanceDAO
Get the root (global) scope for the process.

Specified by:
getRootScope in interface ProcessInstanceDAO
Returns:
the root scope
See Also:
ProcessInstanceDAO.getRootScope()

setState

public void setState(short state)
Description copied from interface: ProcessInstanceDAO
Set the state of the process instance; one of the STATE_XXX constants defined in ProcessState. This should automatically populate the previous state.

Specified by:
setState in interface ProcessInstanceDAO
Parameters:
state - new state of the process instance
See Also:
ProcessInstanceDAO.setState(short)

getState

public short getState()
Description copied from interface: ProcessInstanceDAO
Get the state of the process instance; one of the STATE_XXX constants defined in ProcessState.

Specified by:
getState in interface ProcessInstanceDAO
Returns:
state of process instance
See Also:
ProcessInstanceDAO.getState()

addMessageExchange

public void addMessageExchange(java.lang.String identifier,
                               byte[] data)

createScope

public ScopeDAO createScope(ScopeDAO parentScope,
                            java.lang.String scopeType,
                            int scopeModelId)
Description copied from interface: ProcessInstanceDAO
Creates a new scope.

Specified by:
createScope in interface ProcessInstanceDAO
Parameters:
parentScope - parent scope of the new scope, or null if this is the root scope.
scopeType - scope name
Returns:
the newly created scope

getInstanceId

public java.lang.Long getInstanceId()
Description copied from interface: ProcessInstanceDAO
Get the instance identifier.

Specified by:
getInstanceId in interface ProcessInstanceDAO
Returns:
the instance identifier

getScope

public ScopeDAO getScope(java.lang.Long scopeInstanceId)
Description copied from interface: ProcessInstanceDAO
Returns a scope using its instance id.

Specified by:
getScope in interface ProcessInstanceDAO
Returns:
See Also:
ProcessInstanceDAO.getScope(java.lang.Long)

getEvents

public java.util.List<ProcessInstanceEvent> getEvents(int idx,
                                                      int count)

insertBpelEvent

public void insertBpelEvent(ProcessInstanceEvent event)
Description copied from interface: ProcessInstanceDAO
Insert a BPEL event to the database (associating with this process).

Specified by:
insertBpelEvent in interface ProcessInstanceDAO
Parameters:
event - BPEL event
See Also:
ProcessInstanceDAO.insertBpelEvent(org.apache.ode.bpel.evt.ProcessInstanceEvent)

getEventCount

public int getEventCount()

getInstantiatingCorrelator

public CorrelatorDAO getInstantiatingCorrelator()
Description copied from interface: ProcessInstanceDAO
Return the correlator which results in the instantiation of the process instance.

Specified by:
getInstantiatingCorrelator in interface ProcessInstanceDAO
Returns:
See Also:
ProcessInstanceDAO.getInstantiatingCorrelator()

getScopes

public java.util.Collection<ScopeDAO> getScopes(java.lang.String scopeName)
Description copied from interface: ProcessInstanceDAO
Returns all the scopes with the associated name.

Specified by:
getScopes in interface ProcessInstanceDAO
Returns:
See Also:
ProcessInstanceDAO.getScopes(java.lang.String)

getPreviousState

public short getPreviousState()
Description copied from interface: ProcessInstanceDAO
Returns the next to last state.

Specified by:
getPreviousState in interface ProcessInstanceDAO
Returns:
See Also:
ProcessInstanceDAO.getPreviousState()

getLastActiveTime

public java.util.Date getLastActiveTime()
Description copied from interface: ProcessInstanceDAO
Get the time when the process instance was last active (re-hydrated).

Specified by:
getLastActiveTime in interface ProcessInstanceDAO
Returns:
time of activity
See Also:
ProcessInstanceDAO.getLastActiveTime()

setLastActiveTime

public void setLastActiveTime(java.util.Date dt)
Description copied from interface: ProcessInstanceDAO
Set last activity time for the process instance

Specified by:
setLastActiveTime in interface ProcessInstanceDAO
Parameters:
dt - tiem of activity
See Also:
ProcessInstanceDAO.setLastActiveTime(java.util.Date)

finishCompletion

public void finishCompletion()
Description copied from interface: ProcessInstanceDAO
A simple callback to allow the ProcessInstance to perform post-completion duties. The DAO's state indicates whether any fault has occured.

Specified by:
finishCompletion in interface ProcessInstanceDAO
See Also:
ProcessInstanceDAO.finishCompletion()

delete

public void delete(java.util.Set<ProcessConf.CLEANUP_CATEGORY> cleanupCategories)
Description copied from interface: ProcessInstanceDAO
Delete the process instance object from the database.

Specified by:
delete in interface ProcessInstanceDAO

getScopes

public java.util.Collection<ScopeDAO> getScopes()
Description copied from interface: ProcessInstanceDAO
Returns all the scopes belonging to this isntance.

Specified by:
getScopes in interface ProcessInstanceDAO
Returns:

getEventsFirstLastCount

public ProcessInstanceDAO.EventsFirstLastCountTuple getEventsFirstLastCount()
Description copied from interface: ProcessInstanceDAO
Get a triple containing the first

Specified by:
getEventsFirstLastCount in interface ProcessInstanceDAO
Returns:

getActivityFailureCount

public int getActivityFailureCount()
Description copied from interface: ProcessInstanceDAO
Get number of activities in the failure state.

Specified by:
getActivityFailureCount in interface ProcessInstanceDAO

getActivityFailureDateTime

public java.util.Date getActivityFailureDateTime()
Description copied from interface: ProcessInstanceDAO
Get date/time of last activity failure.

Specified by:
getActivityFailureDateTime in interface ProcessInstanceDAO

getActivityRecoveries

public java.util.Collection<ActivityRecoveryDAO> getActivityRecoveries()
Description copied from interface: ProcessInstanceDAO
Returns all activity recovery objects for this process instance.

Specified by:
getActivityRecoveries in interface ProcessInstanceDAO

createActivityRecovery

public void createActivityRecovery(java.lang.String channel,
                                   long activityId,
                                   java.lang.String reason,
                                   java.util.Date dateTime,
                                   org.w3c.dom.Element data,
                                   java.lang.String[] actions,
                                   int retries)
Description copied from interface: ProcessInstanceDAO
Create an activity recovery object for a given activity instance. Specify the reason and optional data associated with the failure. Date/time failure occurred, and the recovery channel and available recovery actions.

Specified by:
createActivityRecovery in interface ProcessInstanceDAO

deleteActivityRecovery

public void deleteActivityRecovery(java.lang.String channel)
Description copied from interface: ProcessInstanceDAO
Delete previously registered activity recovery.

Specified by:
deleteActivityRecovery in interface ProcessInstanceDAO

genMonotonic

public long genMonotonic()
Description copied from interface: ProcessInstanceDAO
Get the next number from a monotonically increasing sequence.

Specified by:
genMonotonic in interface ProcessInstanceDAO
Returns:
next number in seqeunce

getConnection

public BpelDAOConnection getConnection()
Specified by:
getConnection in interface ProcessInstanceDAO

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getCreateTime

public java.util.Date getCreateTime()