Package org.drools.core.common
Class CompositeDefaultAgenda
- java.lang.Object
-
- org.drools.core.common.CompositeDefaultAgenda
-
- All Implemented Interfaces:
Externalizable,Serializable,InternalAgenda,org.kie.api.runtime.rule.Agenda
public class CompositeDefaultAgenda extends Object implements Externalizable, InternalAgenda
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Loggerlog
-
Constructor Summary
Constructors Constructor Description CompositeDefaultAgenda()CompositeDefaultAgenda(InternalKnowledgeBase kBase)CompositeDefaultAgenda(InternalKnowledgeBase kBase, boolean initMain)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivate()voidactivateRuleFlowGroup(String name)Activates theRuleFlowGroupwith the given name.voidactivateRuleFlowGroup(String name, long processInstanceId, String nodeInstanceId)Activates theRuleFlowGroupwith the given name.voidaddAgendaGroupOnStack(AgendaGroup agendaGroup)voidaddEagerRuleAgendaItem(RuleAgendaItem item)voidaddItemToActivationGroup(AgendaItem item)voidaddPropagation(PropagationEntry propagationEntry)voidaddQueryAgendaItem(RuleAgendaItem item)intagendaSize()Iterates all the modules in the focus stack returning the total number ofActivationsvoidcancelActivation(Activation activation)voidclear()voidclearAndCancel()Clears all Activations from the AgendavoidclearAndCancelActivationGroup(String name)Clears all Activations from an Activation-Group.voidclearAndCancelActivationGroup(InternalActivationGroup activationGroup)Clears all Activations from an Activation Group.voidclearAndCancelAgendaGroup(String name)Clears all Activations from an Agenda Group.voidclearAndCancelRuleFlowGroup(String name)AgendaItemcreateAgendaItem(RuleTerminalNodeLeftTuple rtnLeftTuple, int salience, PropagationContext context, RuleAgendaItem ruleAgendaItem, InternalAgendaGroup agendaGroup)RuleAgendaItemcreateRuleAgendaItem(int salience, PathMemory rs, TerminalNode rtn)voiddeactivate()voiddeactivateRuleFlowGroup(String name)Deactivates theRuleFlowGroupwith the given name.booleandispose(InternalWorkingMemory wm)voidevaluateEagerList()voidexecuteFlush()voidexecuteTask(ExecutableEntry executable)intfireAllRules(org.kie.api.runtime.rule.AgendaFilter agendaFilter, int fireLimit)Fires all activations currently in agenda that match the given agendaFilter until the fireLimit is reached or no more activations exist.intfireNextItem(org.kie.api.runtime.rule.AgendaFilter filter, int fireCount, int fireLimit)voidfireUntilHalt()Keeps firing activations until a halt is called.voidfireUntilHalt(org.kie.api.runtime.rule.AgendaFilter agendaFilter)Keeps firing activations until a halt is called.voidflushPropagations()intfocusStackSize()Iterates all theAgendGroups in the focus stack returning the total number ofActivationsIterator<PropagationEntry>getActionsIterator()InternalActivationGroupgetActivationGroup(String name)Map<String,InternalActivationGroup>getActivationGroupsMap()Activation[]getActivations()ActivationsFiltergetActivationsFilter()Returns the current activations filter or null if none is setAgendaGroupgetAgendaGroup(String name)AgendaGroupgetAgendaGroup(String name, InternalKnowledgeBase kBase)AgendaGroup[]getAgendaGroups()Map<String,InternalAgendaGroup>getAgendaGroupsMap()StringgetFocusName()Returns the name of the agenda group that currently has the focusCollection<String>getGroupsName()KnowledgeHelpergetKnowledgeHelper()InternalAgendaGroupgetNextFocus()DefaultAgendagetPartitionedAgenda(int partitionNr)DefaultAgendagetPartitionedAgendaForNode(NetworkNode node)RuleFlowGroupgetRuleFlowGroup(String name)InternalWorkingMemorygetWorkingMemory()Returns the WorkignMemory for this Agendavoidhalt()Stop agenda from firing any other rule.voidhandleException(InternalWorkingMemory wm, Activation activation, Exception e)booleanhasPendingPropagations()voidinsertAndStageActivation(AgendaItem activation)booleanisAlive()booleanisDeclarativeAgenda()booleanisFiring()booleanisParallelAgenda()booleanisRuleActiveInRuleFlowGroup(String ruleflowGroupName, String ruleName, long processInstanceId)booleanisRuleInstanceAgendaItem(String ruleflowGroupName, String ruleName, long processInstanceId)Returns true if there is at least one activation of the given rule name in the given ruleflow group namevoidmodifyActivation(AgendaItem activation, boolean previouslyActive)Adds the activation to the agenda.voidnotifyWaitOnRest()RuleAgendaItempeekNextRule()voidputOnAgendaGroupsMap(String name, InternalAgendaGroup group)voidreadExternal(ObjectInput in)voidregisterExpiration(PropagationContext expirationContext)voidremoveAgendaGroup(String name)voidremoveEagerRuleAgendaItem(RuleAgendaItem item)voidremoveQueryAgendaItem(RuleAgendaItem item)voidreset()voidsetActivationsFilter(ActivationsFilter filter)Sets a filter that prevents activations from being added to the agenda.voidsetFocus(String name)Sets the Agenda's focus to the specified AgendaGroupbooleansetFocus(AgendaGroup agendaGroup)voidsetWorkingMemory(InternalWorkingMemory workingMemory)intsizeOfRuleFlowGroup(String s)voidstageLeftTuple(RuleAgendaItem ruleAgendaItem, AgendaItem justified)booleantryDeactivate()voidwriteExternal(ObjectOutput out)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.drools.core.common.InternalAgenda
getPropagationList
-
-
-
-
Constructor Detail
-
CompositeDefaultAgenda
public CompositeDefaultAgenda()
-
CompositeDefaultAgenda
public CompositeDefaultAgenda(InternalKnowledgeBase kBase)
-
CompositeDefaultAgenda
public CompositeDefaultAgenda(InternalKnowledgeBase kBase, boolean initMain)
-
-
Method Detail
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
getPartitionedAgenda
public DefaultAgenda getPartitionedAgenda(int partitionNr)
-
getPartitionedAgendaForNode
public DefaultAgenda getPartitionedAgendaForNode(NetworkNode node)
-
getWorkingMemory
public InternalWorkingMemory getWorkingMemory()
Description copied from interface:InternalAgendaReturns the WorkignMemory for this Agenda- Specified by:
getWorkingMemoryin interfaceInternalAgenda- Returns:
- The WorkingMemory
-
setWorkingMemory
public void setWorkingMemory(InternalWorkingMemory workingMemory)
- Specified by:
setWorkingMemoryin interfaceInternalAgenda
-
fireAllRules
public int fireAllRules(org.kie.api.runtime.rule.AgendaFilter agendaFilter, int fireLimit)Description copied from interface:InternalAgendaFires all activations currently in agenda that match the given agendaFilter until the fireLimit is reached or no more activations exist.- Specified by:
fireAllRulesin interfaceInternalAgenda- Parameters:
agendaFilter- the filter on which activations may fire.fireLimit- the maximum number of activations that may fire. If -1, then it will fire until no more activations exist.- Returns:
- the number of rules that were actually fired
-
createRuleAgendaItem
public RuleAgendaItem createRuleAgendaItem(int salience, PathMemory rs, TerminalNode rtn)
- Specified by:
createRuleAgendaItemin interfaceInternalAgenda
-
createAgendaItem
public AgendaItem createAgendaItem(RuleTerminalNodeLeftTuple rtnLeftTuple, int salience, PropagationContext context, RuleAgendaItem ruleAgendaItem, InternalAgendaGroup agendaGroup)
- Specified by:
createAgendaItemin interfaceInternalAgenda
-
fireUntilHalt
public void fireUntilHalt()
Description copied from interface:InternalAgendaKeeps firing activations until a halt is called. If in a given moment, there is no activation to fire, it will wait for an activation to be added to an active agenda group or rule flow group.- Specified by:
fireUntilHaltin interfaceInternalAgenda
-
fireUntilHalt
public void fireUntilHalt(org.kie.api.runtime.rule.AgendaFilter agendaFilter)
Description copied from interface:InternalAgendaKeeps firing activations until a halt is called. If in a given moment, there is no activation to fire, it will wait for an activation to be added to an active agenda group or rule flow group.- Specified by:
fireUntilHaltin interfaceInternalAgenda- Parameters:
agendaFilter- filters the activations that may fire
-
dispose
public boolean dispose(InternalWorkingMemory wm)
- Specified by:
disposein interfaceInternalAgenda
-
isAlive
public boolean isAlive()
- Specified by:
isAlivein interfaceInternalAgenda
-
halt
public void halt()
Description copied from interface:InternalAgendaStop agenda from firing any other rule. It will finish the current rule execution though.- Specified by:
haltin interfaceInternalAgenda
-
isFiring
public boolean isFiring()
- Specified by:
isFiringin interfaceInternalAgenda
-
addPropagation
public void addPropagation(PropagationEntry propagationEntry)
- Specified by:
addPropagationin interfaceInternalAgenda
-
flushPropagations
public void flushPropagations()
- Specified by:
flushPropagationsin interfaceInternalAgenda
-
notifyWaitOnRest
public void notifyWaitOnRest()
- Specified by:
notifyWaitOnRestin interfaceInternalAgenda
-
getActionsIterator
public Iterator<PropagationEntry> getActionsIterator()
- Specified by:
getActionsIteratorin interfaceInternalAgenda
-
hasPendingPropagations
public boolean hasPendingPropagations()
- Specified by:
hasPendingPropagationsin interfaceInternalAgenda
-
handleException
public void handleException(InternalWorkingMemory wm, Activation activation, Exception e)
- Specified by:
handleExceptionin interfaceInternalAgenda
-
clear
public void clear()
- Specified by:
clearin interfaceorg.kie.api.runtime.rule.Agenda
-
reset
public void reset()
- Specified by:
resetin interfaceInternalAgenda
-
executeTask
public void executeTask(ExecutableEntry executable)
- Specified by:
executeTaskin interfaceInternalAgenda
-
executeFlush
public void executeFlush()
- Specified by:
executeFlushin interfaceInternalAgenda
-
activate
public void activate()
- Specified by:
activatein interfaceInternalAgenda
-
deactivate
public void deactivate()
- Specified by:
deactivatein interfaceInternalAgenda
-
tryDeactivate
public boolean tryDeactivate()
- Specified by:
tryDeactivatein interfaceInternalAgenda
-
activateRuleFlowGroup
public void activateRuleFlowGroup(String name)
Description copied from interface:InternalAgendaActivates theRuleFlowGroupwith the given name. All activations in the givenRuleFlowGroupare added to the agenda. As long as theRuleFlowGroupremains active, its activations are automatically added to the agenda.- Specified by:
activateRuleFlowGroupin interfaceInternalAgenda
-
activateRuleFlowGroup
public void activateRuleFlowGroup(String name, long processInstanceId, String nodeInstanceId)
Description copied from interface:InternalAgendaActivates theRuleFlowGroupwith the given name. All activations in the givenRuleFlowGroupare added to the agenda. As long as theRuleFlowGroupremains active, its activations are automatically added to the agenda. The given processInstanceId and nodeInstanceId define the process context in which thisRuleFlowGroupis used.- Specified by:
activateRuleFlowGroupin interfaceInternalAgenda
-
deactivateRuleFlowGroup
public void deactivateRuleFlowGroup(String name)
Description copied from interface:InternalAgendaDeactivates theRuleFlowGroupwith the given name. All activations in the givenRuleFlowGroupare removed from the agenda. As long as theRuleFlowGroupremains deactive, its activations are not added to the agenda- Specified by:
deactivateRuleFlowGroupin interfaceInternalAgenda
-
getAgendaGroups
public AgendaGroup[] getAgendaGroups()
- Specified by:
getAgendaGroupsin interfaceInternalAgenda
-
focusStackSize
public int focusStackSize()
Description copied from interface:InternalAgendaIterates all theAgendGroups in the focus stack returning the total number ofActivations- Specified by:
focusStackSizein interfaceInternalAgenda- Returns:
- total number of
Activations on the focus stack
-
agendaSize
public int agendaSize()
Description copied from interface:InternalAgendaIterates all the modules in the focus stack returning the total number ofActivations- Specified by:
agendaSizein interfaceInternalAgenda- Returns:
- total number of activations on the focus stack
-
getActivations
public Activation[] getActivations()
- Specified by:
getActivationsin interfaceInternalAgenda
-
clearAndCancel
public void clearAndCancel()
Description copied from interface:InternalAgendaClears all Activations from the Agenda- Specified by:
clearAndCancelin interfaceInternalAgenda
-
clearAndCancelAgendaGroup
public void clearAndCancelAgendaGroup(String name)
Description copied from interface:InternalAgendaClears all Activations from an Agenda Group. Any Activations that are also in an Xor Group are removed the the Xor Group.- Specified by:
clearAndCancelAgendaGroupin interfaceInternalAgenda
-
clearAndCancelActivationGroup
public void clearAndCancelActivationGroup(String name)
Description copied from interface:InternalAgendaClears all Activations from an Activation-Group. Any Activations that are also in an Agenda Group are removed from the Agenda Group.- Specified by:
clearAndCancelActivationGroupin interfaceInternalAgenda
-
clearAndCancelActivationGroup
public void clearAndCancelActivationGroup(InternalActivationGroup activationGroup)
Description copied from interface:InternalAgendaClears all Activations from an Activation Group. Any Activations that are also in an Agenda Group are removed from the Agenda Group.- Specified by:
clearAndCancelActivationGroupin interfaceInternalAgenda
-
clearAndCancelRuleFlowGroup
public void clearAndCancelRuleFlowGroup(String name)
- Specified by:
clearAndCancelRuleFlowGroupin interfaceInternalAgenda
-
getFocusName
public String getFocusName()
Description copied from interface:InternalAgendaReturns the name of the agenda group that currently has the focus- Specified by:
getFocusNamein interfaceInternalAgenda
-
fireNextItem
public int fireNextItem(org.kie.api.runtime.rule.AgendaFilter filter, int fireCount, int fireLimit)- Specified by:
fireNextItemin interfaceInternalAgenda
-
cancelActivation
public void cancelActivation(Activation activation)
- Specified by:
cancelActivationin interfaceInternalAgenda
-
modifyActivation
public void modifyActivation(AgendaItem activation, boolean previouslyActive)
Description copied from interface:InternalAgendaAdds the activation to the agenda. Depending on the mode the agenda is running, the activation may be added to the agenda priority queue (synchronously or asynchronously) or be executed immediately.- Specified by:
modifyActivationin interfaceInternalAgenda
-
isDeclarativeAgenda
public boolean isDeclarativeAgenda()
- Specified by:
isDeclarativeAgendain interfaceInternalAgenda
-
isRuleInstanceAgendaItem
public boolean isRuleInstanceAgendaItem(String ruleflowGroupName, String ruleName, long processInstanceId)
Description copied from interface:InternalAgendaReturns true if there is at least one activation of the given rule name in the given ruleflow group name- Specified by:
isRuleInstanceAgendaItemin interfaceInternalAgenda
-
getAgendaGroup
public AgendaGroup getAgendaGroup(String name)
- Specified by:
getAgendaGroupin interfaceorg.kie.api.runtime.rule.Agenda- Specified by:
getAgendaGroupin interfaceInternalAgenda
-
removeAgendaGroup
public void removeAgendaGroup(String name)
- Specified by:
removeAgendaGroupin interfaceInternalAgenda
-
getAgendaGroup
public AgendaGroup getAgendaGroup(String name, InternalKnowledgeBase kBase)
- Specified by:
getAgendaGroupin interfaceInternalAgenda
-
setFocus
public void setFocus(String name)
Description copied from interface:InternalAgendaSets the Agenda's focus to the specified AgendaGroup- Specified by:
setFocusin interfaceInternalAgenda
-
setFocus
public boolean setFocus(AgendaGroup agendaGroup)
- Specified by:
setFocusin interfaceInternalAgenda
-
getActivationGroup
public InternalActivationGroup getActivationGroup(String name)
- Specified by:
getActivationGroupin interfaceorg.kie.api.runtime.rule.Agenda- Specified by:
getActivationGroupin interfaceInternalAgenda
-
getRuleFlowGroup
public RuleFlowGroup getRuleFlowGroup(String name)
- Specified by:
getRuleFlowGroupin interfaceorg.kie.api.runtime.rule.Agenda- Specified by:
getRuleFlowGroupin interfaceInternalAgenda
-
setActivationsFilter
public void setActivationsFilter(ActivationsFilter filter)
Description copied from interface:InternalAgendaSets a filter that prevents activations from being added to the agenda.- Specified by:
setActivationsFilterin interfaceInternalAgenda
-
getActivationsFilter
public ActivationsFilter getActivationsFilter()
Description copied from interface:InternalAgendaReturns the current activations filter or null if none is set- Specified by:
getActivationsFilterin interfaceInternalAgenda
-
peekNextRule
public RuleAgendaItem peekNextRule()
- Specified by:
peekNextRulein interfaceInternalAgenda
-
insertAndStageActivation
public void insertAndStageActivation(AgendaItem activation)
- Specified by:
insertAndStageActivationin interfaceInternalAgenda
-
addEagerRuleAgendaItem
public void addEagerRuleAgendaItem(RuleAgendaItem item)
- Specified by:
addEagerRuleAgendaItemin interfaceInternalAgenda
-
removeEagerRuleAgendaItem
public void removeEagerRuleAgendaItem(RuleAgendaItem item)
- Specified by:
removeEagerRuleAgendaItemin interfaceInternalAgenda
-
addQueryAgendaItem
public void addQueryAgendaItem(RuleAgendaItem item)
- Specified by:
addQueryAgendaItemin interfaceInternalAgenda
-
removeQueryAgendaItem
public void removeQueryAgendaItem(RuleAgendaItem item)
- Specified by:
removeQueryAgendaItemin interfaceInternalAgenda
-
stageLeftTuple
public void stageLeftTuple(RuleAgendaItem ruleAgendaItem, AgendaItem justified)
- Specified by:
stageLeftTuplein interfaceInternalAgenda
-
getAgendaGroupsMap
public Map<String,InternalAgendaGroup> getAgendaGroupsMap()
- Specified by:
getAgendaGroupsMapin interfaceInternalAgenda
-
putOnAgendaGroupsMap
public void putOnAgendaGroupsMap(String name, InternalAgendaGroup group)
- Specified by:
putOnAgendaGroupsMapin interfaceInternalAgenda
-
addAgendaGroupOnStack
public void addAgendaGroupOnStack(AgendaGroup agendaGroup)
- Specified by:
addAgendaGroupOnStackin interfaceInternalAgenda
-
evaluateEagerList
public void evaluateEagerList()
- Specified by:
evaluateEagerListin interfaceInternalAgenda
-
getActivationGroupsMap
public Map<String,InternalActivationGroup> getActivationGroupsMap()
- Specified by:
getActivationGroupsMapin interfaceInternalAgenda
-
getNextFocus
public InternalAgendaGroup getNextFocus()
- Specified by:
getNextFocusin interfaceInternalAgenda
-
getGroupsName
public Collection<String> getGroupsName()
- Specified by:
getGroupsNamein interfaceInternalAgenda
-
sizeOfRuleFlowGroup
public int sizeOfRuleFlowGroup(String s)
- Specified by:
sizeOfRuleFlowGroupin interfaceInternalAgenda
-
addItemToActivationGroup
public void addItemToActivationGroup(AgendaItem item)
- Specified by:
addItemToActivationGroupin interfaceInternalAgenda
-
isRuleActiveInRuleFlowGroup
public boolean isRuleActiveInRuleFlowGroup(String ruleflowGroupName, String ruleName, long processInstanceId)
- Specified by:
isRuleActiveInRuleFlowGroupin interfaceInternalAgenda
-
registerExpiration
public void registerExpiration(PropagationContext expirationContext)
- Specified by:
registerExpirationin interfaceInternalAgenda
-
getKnowledgeHelper
public KnowledgeHelper getKnowledgeHelper()
- Specified by:
getKnowledgeHelperin interfaceInternalAgenda
-
isParallelAgenda
public boolean isParallelAgenda()
- Specified by:
isParallelAgendain interfaceInternalAgenda
-
-