Package org.drools.core.reteoo
Class EntryPointNode
- java.lang.Object
-
- org.drools.core.common.BaseNode
-
- org.drools.core.reteoo.ObjectSource
-
- org.drools.core.reteoo.EntryPointNode
-
- All Implemented Interfaces:
Externalizable
,Serializable
,NetworkNode
,ObjectSink
,Sink
public class EntryPointNode extends ObjectSource implements Externalizable, ObjectSink
A node that is an entry point into the Rete network. As we move the design to support network partitions and concurrent processing of parts of the network, we also need to support multiple, independent entry points and this class represents that. It replaces the function of the Rete Node class in previous designs.- See Also:
ObjectTypeNode
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Logger
log
protected Map<ObjectType,ObjectTypeNode>
objectTypeNodes
The object type nodes under this nodeprotected ObjectTypeNode
queryNode
-
Fields inherited from class org.drools.core.reteoo.ObjectSource
alphaNodeHashingThreshold, alphaNodeRangeIndexThreshold, declaredMask, inferredMask, sink, source
-
Fields inherited from class org.drools.core.common.BaseNode
associations, hashcode, id, memoryId, partitionId, partitionsEnabled
-
-
Constructor Summary
Constructors Constructor Description EntryPointNode()
EntryPointNode(int id, RuleBasePartitionId partitionId, boolean partitionsEnabled, ObjectSource objectSource, EntryPointId entryPoint)
EntryPointNode(int id, ObjectSource objectSource, BuildContext context)
-
Method Summary
-
Methods inherited from class org.drools.core.reteoo.ObjectSource
getDeclaredMask, getKnowledgeBase, getObjectSinkPropagator, getObjectTypeNode, getParentObjectSource, initDeclaredMask, isInUse, networkUpdated, resetInferredMask, setObjectSinkPropagator, setParentObjectSource, setPartitionId, setPartitionIdWithSinks, setSourcePartitionId, updateMask
-
Methods inherited from class org.drools.core.common.BaseNode
addAssociation, addAssociation, attach, getAssociatedRules, getAssociatedRuleSize, getAssociationsSize, getAssociationsSize, getId, getMemoryId, getPartitionId, getSinks, hashCode, initMemoryId, isAssociatedWith, isStreamMode, remove, removeAssociation, setId, setPartitionsEnabled, setStreamMode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.drools.core.common.NetworkNode
getAssociatedRules, getAssociatedRuleSize, getAssociationsSize, getAssociationsSize, getId, getPartitionId, isAssociatedWith
-
-
-
-
Field Detail
-
log
protected static final transient org.slf4j.Logger log
-
objectTypeNodes
protected Map<ObjectType,ObjectTypeNode> objectTypeNodes
The object type nodes under this node
-
queryNode
protected ObjectTypeNode queryNode
-
-
Constructor Detail
-
EntryPointNode
public EntryPointNode()
-
EntryPointNode
public EntryPointNode(int id, ObjectSource objectSource, BuildContext context)
-
EntryPointNode
public EntryPointNode(int id, RuleBasePartitionId partitionId, boolean partitionsEnabled, ObjectSource objectSource, EntryPointId entryPoint)
-
-
Method Detail
-
getTypeConfReg
public ObjectTypeConfigurationRegistry getTypeConfReg()
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternal
in interfaceExternalizable
- Overrides:
readExternal
in classObjectSource
- Throws:
IOException
ClassNotFoundException
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Overrides:
writeExternal
in classObjectSource
- Throws:
IOException
-
getType
public short getType()
- Specified by:
getType
in interfaceNetworkNode
-
getEntryPoint
public EntryPointId getEntryPoint()
- Returns:
- the entryPoint
-
getQueryNode
public ObjectTypeNode getQueryNode()
-
assertActivation
public void assertActivation(InternalFactHandle factHandle, PropagationContext context, InternalWorkingMemory workingMemory)
-
retractActivation
public void retractActivation(InternalFactHandle factHandle, PropagationContext context, InternalWorkingMemory workingMemory)
-
modifyActivation
public void modifyActivation(InternalFactHandle factHandle, PropagationContext context, InternalWorkingMemory workingMemory)
-
assertObject
public void assertObject(InternalFactHandle handle, PropagationContext context, ObjectTypeConf objectTypeConf, InternalWorkingMemory workingMemory)
-
modifyObject
public void modifyObject(InternalFactHandle handle, PropagationContext pctx, ObjectTypeConf objectTypeConf, InternalWorkingMemory workingMemory)
-
removeRightTuplesMatchingOTN
public static void removeRightTuplesMatchingOTN(PropagationContext pctx, InternalWorkingMemory wm, ModifyPreviousTuples modifyPreviousTuples, ObjectTypeNode node, int partition)
-
modifyObject
public void modifyObject(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, InternalWorkingMemory workingMemory)
- Specified by:
modifyObject
in interfaceObjectSink
-
assertObject
public void assertObject(InternalFactHandle factHandle, PropagationContext context, InternalWorkingMemory workingMemory)
This is the entry point into the network for all asserted Facts. Iterates a cache of matchingObjectTypdeNode
s asserting the Fact. If the cache does not exist it first iterates and builds the cache.- Specified by:
assertObject
in interfaceObjectSink
- Parameters:
factHandle
- The FactHandle of the fact to assertcontext
- ThePropagationContext
of theWorkingMemory
actionworkingMemory
- The working memory session.
-
retractObject
public void retractObject(InternalFactHandle handle, PropagationContext context, ObjectTypeConf objectTypeConf, InternalWorkingMemory workingMemory)
Retract a fact object from thisRuleBase
and the specifiedWorkingMemory
.- Parameters:
handle
- The handle of the fact to retract.workingMemory
- The working memory session.
-
propagateRetract
public void propagateRetract(InternalFactHandle handle, PropagationContext context, ObjectTypeConf objectTypeConf, InternalWorkingMemory workingMemory)
-
addObjectSink
public void addObjectSink(ObjectSink objectSink)
Adds theObjectSink
so that it may receiveObjects
propagated from thisObjectSource
.- Overrides:
addObjectSink
in classObjectSource
- Parameters:
objectSink
- TheObjectSink
to receive propagatedObjects
. Rete only acceptsObjectTypeNode
s as parameters to this method, though.
-
removeObjectSink
public void removeObjectSink(ObjectSink objectSink)
Description copied from class:ObjectSource
Removes theObjectSink
- Overrides:
removeObjectSink
in classObjectSource
- Parameters:
objectSink
- TheObjectSink
to remove
-
removeObjectType
public void removeObjectType(ObjectType objectType)
-
attach
public void attach()
-
doAttach
public void doAttach(BuildContext context)
-
doRemove
protected boolean doRemove(RuleRemovalContext context, ReteooBuilder builder)
Description copied from class:BaseNode
Removes the node from the network. Usually from the parentObjectSource
orTupleSource
- Overrides:
doRemove
in classObjectSource
-
getObjectTypeNodes
public Map<ObjectType,ObjectTypeNode> getObjectTypeNodes()
-
updateSink
public void updateSink(ObjectSink sink, PropagationContext context, InternalWorkingMemory workingMemory)
- Specified by:
updateSink
in classObjectSource
-
byPassModifyToBetaNode
public void byPassModifyToBetaNode(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, InternalWorkingMemory workingMemory)
- Specified by:
byPassModifyToBetaNode
in interfaceObjectSink
-
calculateDeclaredMask
public BitMask calculateDeclaredMask(Class modifiedClass, List<String> settableProperties)
- Specified by:
calculateDeclaredMask
in classObjectSource
-
-