org.drools.reteoo
Class EntryPointNode

java.lang.Object
  extended by org.drools.common.BaseNode
      extended by org.drools.reteoo.ObjectSource
          extended by org.drools.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 inherited from class org.drools.reteoo.ObjectSource
sink, source
 
Fields inherited from class org.drools.common.BaseNode
associations, id, partitionId, partitionsEnabled
 
Constructor Summary
EntryPointNode()
           
EntryPointNode(int id, ObjectSource objectSource, BuildContext context)
           
EntryPointNode(int id, RuleBasePartitionId partitionId, boolean partitionsEnabled, ObjectSource objectSource, EntryPoint entryPoint)
           
 
Method Summary
 void addObjectSink(ObjectSink objectSink)
          Adds the ObjectSink so that it may receive Objects propagated from this ObjectSource.
 void assertActivation(InternalFactHandle factHandle, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void assertObject(InternalFactHandle factHandle, PropagationContext context, InternalWorkingMemory workingMemory)
          This is the entry point into the network for all asserted Facts.
 void assertObject(InternalFactHandle handle, PropagationContext context, ObjectTypeConf objectTypeConf, InternalWorkingMemory workingMemory)
           
 void assertQuery(InternalFactHandle factHandle, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void attach()
          Attaches the node into the network.
 void attach(InternalWorkingMemory[] workingMemories)
           
protected  void doRemove(RuleRemovalContext context, ReteooBuilder builder, BaseNode node, InternalWorkingMemory[] workingMemories)
          Removes the node from teh network.
 boolean equals(Object object)
           
 EntryPoint getEntryPoint()
           
 Map<ObjectType,ObjectTypeNode> getObjectTypeNodes()
           
 int hashCode()
          The hashCode return is simply the unique id of the node.
 boolean isObjectMemoryEnabled()
           
 void modifyActivation(InternalFactHandle factHandle, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void modifyObject(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void modifyObject(InternalFactHandle handle, PropagationContext context, ObjectTypeConf objectTypeConf, InternalWorkingMemory workingMemory)
           
 void modifyQuery(InternalFactHandle factHandle, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void readExternal(ObjectInput in)
           
protected  void removeObjectSink(ObjectSink objectSink)
          Removes the ObjectSink
 void retractActivation(InternalFactHandle factHandle, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void retractObject(InternalFactHandle handle, PropagationContext context, ObjectTypeConf objectTypeConf, InternalWorkingMemory workingMemory)
          Retract a fact object from this RuleBase and the specified WorkingMemory.
 void retractQuery(InternalFactHandle factHandle, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void setObjectMemoryEnabled(boolean objectMemoryEnabled)
           
 String toString()
           
 void updateSink(ObjectSink sink, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class org.drools.reteoo.ObjectSource
getParentObjectSource, getSinkPropagator, isInUse, networkUpdated
 
Methods inherited from class org.drools.common.BaseNode
addAssociation, getAssociations, getId, getPartitionId, remove, removeAssociation, setPartitionId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.drools.common.NetworkNode
getId, getPartitionId
 

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,
                      EntryPoint entryPoint)
Method Detail

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class ObjectSource
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class ObjectSource
Throws:
IOException

getEntryPoint

public EntryPoint getEntryPoint()
Returns:
the entryPoint

assertQuery

public void assertQuery(InternalFactHandle factHandle,
                        PropagationContext context,
                        InternalWorkingMemory workingMemory)

retractQuery

public void retractQuery(InternalFactHandle factHandle,
                         PropagationContext context,
                         InternalWorkingMemory workingMemory)

modifyQuery

public void modifyQuery(InternalFactHandle factHandle,
                        PropagationContext context,
                        InternalWorkingMemory workingMemory)

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 context,
                         ObjectTypeConf objectTypeConf,
                         InternalWorkingMemory workingMemory)

modifyObject

public void modifyObject(InternalFactHandle factHandle,
                         ModifyPreviousTuples modifyPreviousTuples,
                         PropagationContext context,
                         InternalWorkingMemory workingMemory)
Specified by:
modifyObject in interface ObjectSink

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 matching ObjectTypdeNodes asserting the Fact. If the cache does not exist it first iterates and builds the cache.

Specified by:
assertObject in interface ObjectSink
Parameters:
factHandle - The FactHandle of the fact to assert
context - The PropagationContext of the WorkingMemory action
workingMemory - The working memory session.

retractObject

public void retractObject(InternalFactHandle handle,
                          PropagationContext context,
                          ObjectTypeConf objectTypeConf,
                          InternalWorkingMemory workingMemory)
Retract a fact object from this RuleBase and the specified WorkingMemory.

Parameters:
handle - The handle of the fact to retract.
workingMemory - The working memory session.

addObjectSink

public void addObjectSink(ObjectSink objectSink)
Adds the ObjectSink so that it may receive Objects propagated from this ObjectSource.

Overrides:
addObjectSink in class ObjectSource
Parameters:
objectSink - The ObjectSink to receive propagated Objects. Rete only accepts ObjectTypeNodes as parameters to this method, though.

removeObjectSink

protected void removeObjectSink(ObjectSink objectSink)
Description copied from class: ObjectSource
Removes the ObjectSink

Overrides:
removeObjectSink in class ObjectSource
Parameters:
objectSink - The ObjectSink to remove

attach

public void attach()
Description copied from class: BaseNode
Attaches the node into the network. Usually to the parent ObjectSource or TupleSource

Specified by:
attach in class BaseNode

attach

public void attach(InternalWorkingMemory[] workingMemories)
Specified by:
attach in class BaseNode

doRemove

protected void doRemove(RuleRemovalContext context,
                        ReteooBuilder builder,
                        BaseNode node,
                        InternalWorkingMemory[] workingMemories)
Description copied from class: BaseNode
Removes the node from teh network. Usually from the parent ObjectSource or TupleSource

Overrides:
doRemove in class ObjectSource

getObjectTypeNodes

public Map<ObjectType,ObjectTypeNode> getObjectTypeNodes()

hashCode

public int hashCode()
Description copied from class: BaseNode
The hashCode return is simply the unique id of the node. It is expected that base classes will also implement equals(Object object).

Overrides:
hashCode in class BaseNode

equals

public boolean equals(Object object)
Overrides:
equals in class Object

updateSink

public void updateSink(ObjectSink sink,
                       PropagationContext context,
                       InternalWorkingMemory workingMemory)
Specified by:
updateSink in class ObjectSource

isObjectMemoryEnabled

public boolean isObjectMemoryEnabled()

setObjectMemoryEnabled

public void setObjectMemoryEnabled(boolean objectMemoryEnabled)

toString

public String toString()
Overrides:
toString in class BaseNode


Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.