|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jbpm.process.StatefulProcessSession
public class StatefulProcessSession
| Field Summary | |
|---|---|
protected Queue<org.drools.common.WorkingMemoryAction> |
actionQueue
|
| Constructor Summary | |
|---|---|
StatefulProcessSession(KnowledgeBase kbase,
KnowledgeSessionConfiguration sessionConfiguration,
Environment environment)
|
|
| Method Summary | ||
|---|---|---|
void |
abortProcessInstance(long processInstanceId)
Aborts the process instance with the given id. |
|
void |
addEventListener(AgendaEventListener listener)
Add an event listener. |
|
void |
addEventListener(ProcessEventListener listener)
Add a process event listener. |
|
void |
addEventListener(WorkingMemoryEventListener listener)
Add an event listener. |
|
ProcessInstance |
createProcessInstance(String processId,
Map<String,Object> parameters)
Creates a new process instance (but does not yet start it). |
|
void |
dispose()
Releases all the current session resources, setting up the session for garbage collection. |
|
void |
endOperation()
|
|
|
execute(Command<T> command)
Execute the command and return a ExecutionResults for the results of the Command. |
|
void |
executeQueuedActions()
|
|
int |
fireAllRules()
Fire all Activations on the Agenda. |
|
int |
fireAllRules(AgendaFilter agendaFilter)
Fire all Activations on the Agenda |
|
int |
fireAllRules(AgendaFilter agendaFilter,
int i)
Fire all Activations on the Agenda |
|
int |
fireAllRules(int max)
Fire Activations on the Agenda up to the given maximum number of activations, before returning the control to the application. |
|
void |
fireUntilHalt()
Keeps firing activations until a halt is called. |
|
void |
fireUntilHalt(AgendaFilter agendaFilter)
Keeps firing activations until a halt is called. |
|
Queue<org.drools.common.WorkingMemoryAction> |
getActionQueue()
|
|
Agenda |
getAgenda()
Returns a reference to this session's Agenda. |
|
Collection<AgendaEventListener> |
getAgendaEventListeners()
Returns all event listeners. |
|
Calendars |
getCalendars()
|
|
Map<String,Channel> |
getChannels()
|
|
String |
getEntryPointId()
Returns the String Id of this entry point |
|
Environment |
getEnvironment()
|
|
long |
getFactCount()
Returns the total number of facts currently in this entry point |
|
FactHandle |
getFactHandle(Object object)
Returns the fact handle associated with the given object. |
|
|
getFactHandles()
Returns all FactHandles from the current session. |
|
|
getFactHandles(ObjectFilter filter)
Returns all FactHandles from the current session for which the facts are accepted by
the given filter. |
|
Object |
getGlobal(String identifier)
|
|
Globals |
getGlobals()
|
|
int |
getId()
|
|
KnowledgeBase |
getKnowledgeBase()
Returns the KnowledgeBase reference from which this stateful session was created. |
|
long |
getLastIdleTimestamp()
|
|
Object |
getObject(FactHandle factHandle)
Returns the object associated with the given FactHandle. |
|
Collection<Object> |
getObjects()
Returns all facts from the current session as a Collection. |
|
Collection<Object> |
getObjects(ObjectFilter filter)
Returns all facts from the current session that are accepted by the given ObjectFilter. |
|
Collection<ProcessEventListener> |
getProcessEventListeners()
Returns all event listeners. |
|
ProcessInstance |
getProcessInstance(long processInstanceId)
Returns the process instance with the given id. |
|
Collection<ProcessInstance> |
getProcessInstances()
Returns a collection of currently active process instances. |
|
InternalProcessRuntime |
getProcessRuntime()
|
|
QueryResults |
getQueryResults(String query,
Object... arguments)
Retrieve the QueryResults of the specified query and arguments |
|
SessionClock |
getSessionClock()
Returns the session clock instance assigned to this session |
|
KnowledgeSessionConfiguration |
getSessionConfiguration()
|
|
org.drools.time.TimerService |
getTimerService()
|
|
WorkingMemoryEntryPoint |
getWorkingMemoryEntryPoint(String name)
Returns the WorkingMemoryEntryPoint instance associated with the given name. |
|
Collection<? extends WorkingMemoryEntryPoint> |
getWorkingMemoryEntryPoints()
Returns a collection of all available working memory entry points for this session. |
|
Collection<WorkingMemoryEventListener> |
getWorkingMemoryEventListeners()
Returns all event listeners. |
|
WorkItemManager |
getWorkItemManager()
Returns the WorkItemManager related to this session. |
|
void |
halt()
Request the engine to stop firing rules. |
|
FactHandle |
insert(Object object)
Inserts a new fact into this entry point |
|
LiveQuery |
openLiveQuery(String query,
Object[] arguments,
ViewChangedEventListener listener)
|
|
void |
queueWorkingMemoryAction(org.drools.common.WorkingMemoryAction action)
|
|
void |
registerChannel(String name,
Channel channel)
|
|
void |
registerExitPoint(String name,
ExitPoint exitPoint)
|
|
void |
removeEventListener(AgendaEventListener listener)
Remove an event listener. |
|
void |
removeEventListener(ProcessEventListener listener)
Remove a process event listener. |
|
void |
removeEventListener(WorkingMemoryEventListener listener)
Remove an event listener. |
|
void |
retract(FactHandle handle)
Retracts the fact for which the given FactHandle was assigned. |
|
void |
setEndOperationListener(org.drools.common.EndOperationListener listener)
|
|
void |
setGlobal(String identifier,
Object object)
Sets a global value on the internal collection |
|
void |
setId(int id)
|
|
void |
signalEvent(String type,
Object event)
Signals the engine that an event has occurred. |
|
void |
signalEvent(String type,
Object event,
long processInstanceId)
Signals the process instance that an event has occurred. |
|
void |
startOperation()
|
|
ProcessInstance |
startProcess(String processId)
Start a new process instance. |
|
ProcessInstance |
startProcess(String processId,
Map<String,Object> parameters)
Start a new process instance. |
|
ProcessInstance |
startProcessInstance(long processInstanceId)
Starts the given process instance (which was created by using createProcesInstance but not yet started). |
|
void |
unregisterChannel(String name)
|
|
void |
unregisterExitPoint(String name)
|
|
void |
update(FactHandle handle,
Object object)
Updates the fact for which the given FactHandle was assigned with the new fact set as the second parameter in this method. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Queue<org.drools.common.WorkingMemoryAction> actionQueue
| Constructor Detail |
|---|
public StatefulProcessSession(KnowledgeBase kbase,
KnowledgeSessionConfiguration sessionConfiguration,
Environment environment)
| Method Detail |
|---|
public void abortProcessInstance(long processInstanceId)
ProcessRuntimeIllegalArgumentException.
abortProcessInstance in interface ProcessRuntimepublic ProcessInstance getProcessInstance(long processInstanceId)
ProcessRuntimenull.
getProcessInstance in interface ProcessRuntimenull if it cannot be foundpublic Collection<ProcessInstance> getProcessInstances()
ProcessRuntime
getProcessInstances in interface ProcessRuntime
public void signalEvent(String type,
Object event)
ProcessRuntime
signalEvent in interface ProcessRuntimetype - the type of eventevent - the data associated with this event
public void signalEvent(String type,
Object event,
long processInstanceId)
ProcessRuntime
signalEvent in interface ProcessRuntimetype - the type of eventevent - the data associated with this eventprocessInstanceId - the id of the process instance that should be signaledpublic ProcessInstance startProcess(String processId)
ProcessRuntime
startProcess in interface ProcessRuntimeprocessId - The id of the process that should be started
ProcessInstance that represents the instance of the process that was started
public ProcessInstance startProcess(String processId,
Map<String,Object> parameters)
ProcessRuntime
startProcess in interface ProcessRuntimeprocessId - the id of the process that should be startedparameters - the process variables that should be set when starting the process instance
ProcessInstance that represents the instance of the process that was started
public ProcessInstance createProcessInstance(String processId,
Map<String,Object> parameters)
ProcessRuntime
createProcessInstance in interface ProcessRuntimeprocessId - the id of the process that should be startedparameters - the process variables that should be set when creating the process instance
ProcessInstance that represents the instance of the process that was created (but not yet started)public ProcessInstance startProcessInstance(long processInstanceId)
ProcessRuntime
startProcessInstance in interface ProcessRuntimeprocessInstanceId - the id of the process instance that needs to be started
ProcessInstance that represents the instance of the process that was startedpublic void addEventListener(ProcessEventListener listener)
ProcessEventManager
addEventListener in interface ProcessEventManagerlistener - the listener to add.public Collection<ProcessEventListener> getProcessEventListeners()
ProcessEventManager
getProcessEventListeners in interface ProcessEventManagerpublic void removeEventListener(ProcessEventListener listener)
ProcessEventManager
removeEventListener in interface ProcessEventManagerlistener - the listener to removepublic KnowledgeBase getKnowledgeBase()
KnowledgeRuntime
getKnowledgeBase in interface KnowledgeRuntimepublic WorkItemManager getWorkItemManager()
ProcessRuntimeWorkItemManager related to this session. This can be used to
register new WorkItemHandlers or to complete (or abort) WorkItems.
getWorkItemManager in interface ProcessRuntimeWorkItemManager related to this sessionpublic Environment getEnvironment()
getEnvironment in interface KnowledgeRuntimepublic InternalProcessRuntime getProcessRuntime()
getProcessRuntime in interface org.drools.common.InternalKnowledgeRuntimepublic KnowledgeSessionConfiguration getSessionConfiguration()
getSessionConfiguration in interface KnowledgeRuntimepublic org.drools.time.TimerService getTimerService()
getTimerService in interface org.drools.common.InternalKnowledgeRuntimepublic void startOperation()
startOperation in interface org.drools.common.InternalKnowledgeRuntimepublic void endOperation()
endOperation in interface org.drools.common.InternalKnowledgeRuntimepublic void executeQueuedActions()
executeQueuedActions in interface org.drools.common.InternalKnowledgeRuntimepublic Queue<org.drools.common.WorkingMemoryAction> getActionQueue()
getActionQueue in interface org.drools.common.InternalKnowledgeRuntimepublic void queueWorkingMemoryAction(org.drools.common.WorkingMemoryAction action)
queueWorkingMemoryAction in interface org.drools.common.InternalKnowledgeRuntimepublic void dispose()
StatefulKnowledgeSession
dispose in interface StatefulKnowledgeSessionpublic void setId(int id)
setId in interface org.drools.common.InternalKnowledgeRuntimepublic int getId()
getId in interface StatefulKnowledgeSessionpublic void setEndOperationListener(org.drools.common.EndOperationListener listener)
setEndOperationListener in interface org.drools.common.InternalKnowledgeRuntimepublic int fireAllRules()
StatefulRuleSession
fireAllRules in interface StatefulRuleSessionpublic int fireAllRules(int max)
StatefulRuleSessionfireAllRules() again.
fireAllRules in interface StatefulRuleSessionmax - the maximum number of rules that should be fired
public int fireAllRules(AgendaFilter agendaFilter)
StatefulRuleSession
fireAllRules in interface StatefulRuleSessionagendaFilter - filters the activations that may fire
public int fireAllRules(AgendaFilter agendaFilter,
int i)
StatefulRuleSession
fireAllRules in interface StatefulRuleSessionagendaFilter - filters the activations that may firei - the maximum number of rules that should be fired
public void fireUntilHalt()
StatefulRuleSession
fireUntilHalt in interface StatefulRuleSessionpublic void fireUntilHalt(AgendaFilter agendaFilter)
StatefulRuleSession
fireUntilHalt in interface StatefulRuleSessionagendaFilter - filters the activations that may firepublic <T> T execute(Command<T> command)
CommandExecutor
execute in interface CommandExecutorpublic Calendars getCalendars()
getCalendars in interface KnowledgeRuntimepublic Map<String,Channel> getChannels()
getChannels in interface KnowledgeRuntimepublic Object getGlobal(String identifier)
getGlobal in interface KnowledgeRuntimepublic Globals getGlobals()
getGlobals in interface KnowledgeRuntimepublic SessionClock getSessionClock()
KnowledgeRuntime
getSessionClock in interface KnowledgeRuntime
public void registerChannel(String name,
Channel channel)
registerChannel in interface KnowledgeRuntime
public void registerExitPoint(String name,
ExitPoint exitPoint)
registerExitPoint in interface KnowledgeRuntime
public void setGlobal(String identifier,
Object object)
KnowledgeRuntime
setGlobal in interface KnowledgeRuntimeidentifier - the global identifierobject - the value assigned to the global identifierpublic void unregisterChannel(String name)
unregisterChannel in interface KnowledgeRuntimepublic void unregisterExitPoint(String name)
unregisterExitPoint in interface KnowledgeRuntimepublic Agenda getAgenda()
WorkingMemoryAgenda.
getAgenda in interface WorkingMemory
public QueryResults getQueryResults(String query,
Object... arguments)
WorkingMemory
getQueryResults in interface WorkingMemoryquery - The name of the query.arguments - The arguments used for the query
public WorkingMemoryEntryPoint getWorkingMemoryEntryPoint(String name)
WorkingMemory
getWorkingMemoryEntryPoint in interface WorkingMemorypublic Collection<? extends WorkingMemoryEntryPoint> getWorkingMemoryEntryPoints()
WorkingMemory
getWorkingMemoryEntryPoints in interface WorkingMemorypublic void halt()
WorkingMemoryRequest the engine to stop firing rules. If the engine is currently firing a rule, it will finish executing this rule's consequence before stopping.
This method will not remove active activations from the Agenda.
In case the application later wants to continue firing rules from the point where it stopped,
it should just call org.drools.runtime.StatefulKnowledgeSession.fireAllRules() or
org.drools.runtime.StatefulKnowledgeSession.fireUntilHalt() again.
halt in interface WorkingMemory
public LiveQuery openLiveQuery(String query,
Object[] arguments,
ViewChangedEventListener listener)
openLiveQuery in interface WorkingMemorypublic String getEntryPointId()
WorkingMemoryEntryPoint
getEntryPointId in interface WorkingMemoryEntryPointpublic long getFactCount()
WorkingMemoryEntryPoint
getFactCount in interface WorkingMemoryEntryPointpublic FactHandle getFactHandle(Object object)
WorkingMemoryEntryPoint
getFactHandle in interface WorkingMemoryEntryPointobject - the fact for which the fact handle will be returned.
KnowledgeBaseConfigurationpublic <T extends FactHandle> Collection<T> getFactHandles()
WorkingMemoryEntryPointFactHandles from the current session.
getFactHandles in interface WorkingMemoryEntryPointpublic <T extends FactHandle> Collection<T> getFactHandles(ObjectFilter filter)
WorkingMemoryEntryPointFactHandles from the current session for which the facts are accepted by
the given filter.
getFactHandles in interface WorkingMemoryEntryPointfilter - the filter to be applied to the returned collection of FactHandles.
public Object getObject(FactHandle factHandle)
WorkingMemoryEntryPoint
getObject in interface WorkingMemoryEntryPointpublic Collection<Object> getObjects()
WorkingMemoryEntryPointReturns all facts from the current session as a Collection.
This class is not a general-purpose Collection implementation! While this class implements the Collection interface, it intentionally violates Collection general contract, which mandates the use of the equals method when comparing objects.
Instead the approach used when comparing objects with the contains(Object) method is dependent on the WorkingMemory configuration, where it can be configured for Identity or for Equality.
getObjects in interface WorkingMemoryEntryPointpublic Collection<Object> getObjects(ObjectFilter filter)
WorkingMemoryEntryPointObjectFilter.
getObjects in interface WorkingMemoryEntryPointfilter - the filter to be applied to the returned collection of facts.
public FactHandle insert(Object object)
WorkingMemoryEntryPoint
insert in interface WorkingMemoryEntryPointobject - the fact to be inserted
public void retract(FactHandle handle)
WorkingMemoryEntryPoint
retract in interface WorkingMemoryEntryPointhandle - the handle whose fact is to be retracted.
public void update(FactHandle handle,
Object object)
WorkingMemoryEntryPoint
update in interface WorkingMemoryEntryPointhandle - the FactHandle for the fact to be updated.object - the new value for the fact being updated.public void addEventListener(WorkingMemoryEventListener listener)
WorkingMemoryEventManager
addEventListener in interface WorkingMemoryEventManagerlistener - The listener to add.public void addEventListener(AgendaEventListener listener)
WorkingMemoryEventManager
addEventListener in interface WorkingMemoryEventManagerlistener - The listener to add.public Collection<AgendaEventListener> getAgendaEventListeners()
WorkingMemoryEventManager
getAgendaEventListeners in interface WorkingMemoryEventManagerpublic Collection<WorkingMemoryEventListener> getWorkingMemoryEventListeners()
WorkingMemoryEventManager
getWorkingMemoryEventListeners in interface WorkingMemoryEventManagerpublic void removeEventListener(WorkingMemoryEventListener listener)
WorkingMemoryEventManager
removeEventListener in interface WorkingMemoryEventManagerlistener - The listener to remove.public void removeEventListener(AgendaEventListener listener)
WorkingMemoryEventManager
removeEventListener in interface WorkingMemoryEventManagerlistener - The listener to remove.public long getLastIdleTimestamp()
getLastIdleTimestamp in interface org.drools.common.InternalKnowledgeRuntime
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||