Package org.drools.core.common
Class CompositeDefaultAgenda
- java.lang.Object
-
- org.drools.core.common.CompositeDefaultAgenda
-
- All Implemented Interfaces:
Externalizable,Serializable,ActivationsManager,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.voidaddEagerRuleAgendaItem(RuleAgendaItem item)voidaddItemToActivationGroup(AgendaItem item)voidaddPropagation(PropagationEntry propagationEntry)voidaddQueryAgendaItem(RuleAgendaItem item)voidcancelActivation(Activation activation)voidclear()voidclearAndCancel()Clears all Activations from the AgendavoidclearAndCancelActivationGroup(String name)Clears all Activations from an Activation-Group.voidclearAndCancelActivationGroup(InternalActivationGroup activationGroup)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()booleandispose(InternalWorkingMemory wm)voidevaluateEagerList()voidevaluateQueriesForRule(RuleAgendaItem item)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()Iterator<PropagationEntry>getActionsIterator()InternalActivationGroupgetActivationGroup(String name)Map<String,InternalActivationGroup>getActivationGroupsMap()ActivationsFiltergetActivationsFilter()AgendaEventSupportgetAgendaEventSupport()AgendaGroupgetAgendaGroup(String name)AgendaGroupsManagergetAgendaGroupsManager()StringgetFocusName()Returns the name of the agenda group that currently has the focusKnowledgeHelpergetKnowledgeHelper()DefaultAgendagetPartitionedAgenda(int partitionNr)DefaultAgendagetPartitionedAgendaForNode(NetworkNode node)ReteEvaluatorgetReteEvaluator()RuleFlowGroupgetRuleFlowGroup(String name)InternalWorkingMemorygetWorkingMemory()Returns the WorkignMemory for this Agendavoidhalt()Stop agenda from firing any other rule.voidhandleException(Activation activation, Exception e)booleanhasPendingPropagations()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 namevoidnotifyWaitOnRest()RuleAgendaItempeekNextRule()voidreadExternal(ObjectInput in)voidregisterExpiration(PropagationContext expirationContext)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 AgendaGroupvoidsetWorkingMemory(InternalWorkingMemory workingMemory)intsizeOfRuleFlowGroup(String s)voidstageLeftTuple(RuleAgendaItem ruleAgendaItem, AgendaItem justified)booleantryDeactivate()voidwriteExternal(ObjectOutput out)
-
-
-
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
-
getReteEvaluator
public ReteEvaluator getReteEvaluator()
- Specified by:
getReteEvaluatorin interfaceActivationsManager
-
getAgendaGroupsManager
public AgendaGroupsManager getAgendaGroupsManager()
- Specified by:
getAgendaGroupsManagerin interfaceActivationsManager
-
getAgendaEventSupport
public AgendaEventSupport getAgendaEventSupport()
- Specified by:
getAgendaEventSupportin interfaceActivationsManager
-
peekNextRule
public RuleAgendaItem peekNextRule()
- Specified by:
peekNextRulein interfaceActivationsManager
-
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 interfaceActivationsManager- 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 interfaceActivationsManager
-
createAgendaItem
public AgendaItem createAgendaItem(RuleTerminalNodeLeftTuple rtnLeftTuple, int salience, PropagationContext context, RuleAgendaItem ruleAgendaItem, InternalAgendaGroup agendaGroup)
- Specified by:
createAgendaItemin interfaceActivationsManager
-
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 interfaceActivationsManager
-
addPropagation
public void addPropagation(PropagationEntry propagationEntry)
- Specified by:
addPropagationin interfaceActivationsManager
-
flushPropagations
public void flushPropagations()
- Specified by:
flushPropagationsin interfaceActivationsManager
-
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(Activation activation, Exception e)
- Specified by:
handleExceptionin interfaceActivationsManager
-
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 interfaceActivationsManager
-
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
-
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 interfaceActivationsManager- Specified by:
clearAndCancelActivationGroupin interfaceInternalAgenda
-
clearAndCancelActivationGroup
public void clearAndCancelActivationGroup(InternalActivationGroup activationGroup)
- Specified by:
clearAndCancelActivationGroupin interfaceActivationsManager
-
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 interfaceActivationsManager
-
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
-
setFocus
public void setFocus(String name)
Description copied from interface:InternalAgendaSets the Agenda's focus to the specified AgendaGroup- Specified by:
setFocusin interfaceInternalAgenda
-
getActivationGroup
public InternalActivationGroup getActivationGroup(String name)
- Specified by:
getActivationGroupin interfaceorg.kie.api.runtime.rule.Agenda
-
getRuleFlowGroup
public RuleFlowGroup getRuleFlowGroup(String name)
- Specified by:
getRuleFlowGroupin interfaceorg.kie.api.runtime.rule.Agenda
-
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()
- Specified by:
getActivationsFilterin interfaceActivationsManager
-
addEagerRuleAgendaItem
public void addEagerRuleAgendaItem(RuleAgendaItem item)
- Specified by:
addEagerRuleAgendaItemin interfaceActivationsManager
-
removeEagerRuleAgendaItem
public void removeEagerRuleAgendaItem(RuleAgendaItem item)
- Specified by:
removeEagerRuleAgendaItemin interfaceActivationsManager
-
addQueryAgendaItem
public void addQueryAgendaItem(RuleAgendaItem item)
- Specified by:
addQueryAgendaItemin interfaceActivationsManager
-
removeQueryAgendaItem
public void removeQueryAgendaItem(RuleAgendaItem item)
- Specified by:
removeQueryAgendaItemin interfaceActivationsManager
-
stageLeftTuple
public void stageLeftTuple(RuleAgendaItem ruleAgendaItem, AgendaItem justified)
- Specified by:
stageLeftTuplein interfaceActivationsManager
-
evaluateEagerList
public void evaluateEagerList()
- Specified by:
evaluateEagerListin interfaceActivationsManager
-
evaluateQueriesForRule
public void evaluateQueriesForRule(RuleAgendaItem item)
- Specified by:
evaluateQueriesForRulein interfaceActivationsManager
-
getActivationGroupsMap
public Map<String,InternalActivationGroup> getActivationGroupsMap()
- Specified by:
getActivationGroupsMapin interfaceInternalAgenda
-
sizeOfRuleFlowGroup
public int sizeOfRuleFlowGroup(String s)
- Specified by:
sizeOfRuleFlowGroupin interfaceInternalAgenda
-
addItemToActivationGroup
public void addItemToActivationGroup(AgendaItem item)
- Specified by:
addItemToActivationGroupin interfaceActivationsManager
-
isRuleActiveInRuleFlowGroup
public boolean isRuleActiveInRuleFlowGroup(String ruleflowGroupName, String ruleName, long processInstanceId)
- Specified by:
isRuleActiveInRuleFlowGroupin interfaceInternalAgenda
-
registerExpiration
public void registerExpiration(PropagationContext expirationContext)
- Specified by:
registerExpirationin interfaceActivationsManager
-
getKnowledgeHelper
public KnowledgeHelper getKnowledgeHelper()
- Specified by:
getKnowledgeHelperin interfaceActivationsManager
-
isParallelAgenda
public boolean isParallelAgenda()
- Specified by:
isParallelAgendain interfaceInternalAgenda
-
-