|
Drools :: Core 6.1.0.Beta1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.drools.core.reteoo.ReteooRuleBase
public class ReteooRuleBase
Implementation of RuleBase.
| Nested Class Summary | |
|---|---|
static interface |
ReteooRuleBase.RuleBaseAction
|
| Field Summary | |
|---|---|
Set<EntryPointNode> |
addedEntryNodeCache
|
protected static org.slf4j.Logger |
logger
|
protected Map<String,Package> |
pkgs
|
Set<EntryPointNode> |
removedEntryNodeCache
|
| Fields inherited from interface org.drools.core.RuleBase |
|---|
RETEOO |
| Constructor Summary | |
|---|---|
ReteooRuleBase()
Default constructor - for Externalizable. |
|
ReteooRuleBase(String id,
RuleBaseConfiguration config)
Construct. |
|
| Method Summary | |
|---|---|
protected void |
addEntryPoint(Package pkg,
String id)
|
protected void |
addEntryPoint(String id)
|
void |
addEventListener(RuleBaseEventListener listener)
Add an event listener. |
void |
addPackage(Package newPkg)
|
void |
addPackages(Collection<Package> newPkgs)
Add a Package to the network. |
void |
addPackages(Package[] pkgs)
|
void |
addProcess(org.kie.api.definition.process.Process process)
|
void |
addRule(Package pkg,
Rule rule)
|
protected void |
addRule(Rule rule)
|
void |
addStatefulSession(StatefulSession statefulSession)
|
void |
addWindowDeclaration(Package pkg,
WindowDeclaration window)
|
protected void |
addWindowDeclaration(WindowDeclaration window)
|
void |
assertObject(FactHandle handle,
Object object,
PropagationContext context,
InternalWorkingMemory workingMemory)
Assert a fact object. |
RuleBasePartitionId |
createNewPartitionId()
Creates and allocates a new partition ID for this rulebase |
void |
disposeStatefulSession(StatefulSession statefulSession)
|
void |
executeQueuedActions()
|
Set<EntryPointNode> |
getAddedEntryNodeCache()
|
int |
getAdditionsSinceLock()
Returns the number of additive operations applied since the last lock() was obtained |
ClassFieldAccessorCache |
getClassFieldAccessorCache()
|
RuleBaseConfiguration |
getConfig()
|
RuleBaseConfiguration |
getConfiguration()
|
Set<String> |
getEntryPointIds()
|
FactHandleFactory |
getFactHandleFactory()
|
org.kie.api.definition.type.FactType |
getFactType(String name)
Returns a declared FactType. |
Map<String,Class<?>> |
getGlobals()
|
String |
getId()
|
int |
getNodeCount()
|
Package |
getPackage(String name)
|
Package[] |
getPackages()
|
Map<String,Package> |
getPackagesMap()
|
List<RuleBasePartitionId> |
getPartitionIds()
Return the list of Partition IDs for this rulebase |
org.kie.api.definition.process.Process |
getProcess(String id)
|
org.kie.api.definition.process.Process[] |
getProcesses()
|
int |
getRemovalsSinceLock()
Returns the number of removal operations applied since the last lock() was obtained |
Set<EntryPointNode> |
getRemovedEntryNodeCache()
|
Rete |
getRete()
Retrieve the Rete-OO network for this RuleBase. |
ReteooBuilder |
getReteooBuilder()
|
ClassLoader |
getRootClassLoader()
|
List<RuleBaseEventListener> |
getRuleBaseEventListeners()
Returns all event listeners. |
SegmentMemory |
getSegmentFromPrototype(InternalWorkingMemory wm,
LeftTupleSource tupleSource)
|
StatefulSession[] |
getStatefulSessions()
Returns an array of all the referenced StatefulSessions |
TraitRegistry |
getTraitRegistry()
|
TripleStore |
getTripleStore()
|
TypeDeclaration |
getTypeDeclaration(Class<?> clazz)
Returns the type declaration associated to the given class |
Collection<TypeDeclaration> |
getTypeDeclarations()
Returns a collection with all TypeDeclarations in this rulebase |
InternalWorkingMemory[] |
getWorkingMemories()
|
int |
getWorkingMemoryCounter()
|
void |
invalidateSegmentPrototype(LeftTupleSource tupleSource)
|
boolean |
isEvent(Class<?> clazz)
Returns true if clazz represents an Event class. |
void |
lock()
This locks the current RuleBase and all there referenced StatefulSessions. |
FactHandleFactory |
newFactHandleFactory()
|
FactHandleFactory |
newFactHandleFactory(int id,
long counter)
|
StatefulSession |
newStatefulSession()
Create a new WorkingMemory session for this
RuleBase. |
StatefulSession |
newStatefulSession(boolean keepReference)
|
StatefulSession |
newStatefulSession(InputStream stream)
|
StatefulSession |
newStatefulSession(InputStream stream,
boolean keepReference)
|
StatefulSession |
newStatefulSession(InputStream stream,
boolean keepReference,
SessionConfiguration conf)
|
StatefulSession |
newStatefulSession(SessionConfiguration sessionConfig,
org.kie.api.runtime.Environment environment)
Create a new WorkingMemory session for this
RuleBase. |
StatelessSession |
newStatelessSession()
|
int |
nextWorkingMemoryCounter()
|
void |
readExternal(ObjectInput in)
Handles the read serialization of the Package. |
void |
readLock()
Acquires a read lock on the rulebase |
void |
readUnlock()
Releases a read lock on the rulebase |
void |
registerAddedEntryNodeCache(EntryPointNode node)
|
Class<?> |
registerAndLoadTypeDefinition(String className,
byte[] def)
|
void |
registeRremovedEntryNodeCache(EntryPointNode node)
|
void |
registerSegmentPrototype(LeftTupleSource tupleSource,
SegmentMemory smem)
|
void |
removeEventListener(RuleBaseEventListener listener)
Remove an event listener. |
protected void |
removeFunction(String functionName)
Handle function removal. |
void |
removeFunction(String packageName,
String functionName)
Removes a specific function in a specific package. |
void |
removeObjectsGeneratedFromResource(org.kie.api.io.Resource resource)
|
void |
removePackage(String packageName)
Remove the package and all it's rules, functions etc |
void |
removeProcess(String id)
Removes a process by the process' id |
void |
removeQuery(String packageName,
String ruleName)
Remove a specific Query in a Package |
void |
removeRule(Package pkg,
Rule rule)
Notify listeners and sub-classes about imminent removal of a rule from a package. |
protected void |
removeRule(Rule rule)
|
void |
removeRule(String packageName,
String ruleName)
Remove a specific Rule in a Package |
void |
retractObject(FactHandle handle,
PropagationContext context,
AbstractWorkingMemory workingMemory)
Retract a fact object. |
protected void |
setupRete()
|
void |
unlock()
Unlocks the RuleBase and all of the referenced StatefulSessions. |
protected void |
updateDependentTypes(Package newPkg,
TypeDeclaration typeDeclaration)
|
void |
writeExternal(ObjectOutput out)
Handles the write serialization of the Package. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static transient org.slf4j.Logger logger
public Set<EntryPointNode> addedEntryNodeCache
public Set<EntryPointNode> removedEntryNodeCache
protected Map<String,Package> pkgs
| Constructor Detail |
|---|
public ReteooRuleBase()
public ReteooRuleBase(String id,
RuleBaseConfiguration config)
id - The rete network.| Method Detail |
|---|
public int nextWorkingMemoryCounter()
nextWorkingMemoryCounter in interface InternalRuleBasepublic int getWorkingMemoryCounter()
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
readExternal in interface ExternalizableIOException
ClassNotFoundException
public void writeExternal(ObjectOutput out)
throws IOException
writeExternal in interface ExternalizableIOExceptionpublic String getId()
getId in interface InternalRuleBasepublic RuleBaseConfiguration getConfig()
public StatefulSession newStatefulSession()
RuleBaseWorkingMemory session for this
RuleBase. By default the RuleBase retains a
weak reference to returned WorkingMemory.
The created WorkingMemory uses the default conflict
resolution strategy.
newStatefulSession in interface RuleBaseWorkingMemory.
IMPORTANT: when using the stateful session REMEMBER TO CALL dispose() when you are done with the session.RuleBasepublic void disposeStatefulSession(StatefulSession statefulSession)
disposeStatefulSession in interface InternalRuleBasepublic FactHandleFactory getFactHandleFactory()
RuleBasepublic FactHandleFactory newFactHandleFactory()
newFactHandleFactory in interface InternalRuleBase
public FactHandleFactory newFactHandleFactory(int id,
long counter)
newFactHandleFactory in interface InternalRuleBasepublic org.kie.api.definition.process.Process[] getProcesses()
getProcesses in interface InternalRuleBasepublic Package[] getPackages()
getPackages in interface RuleBasepublic Map<String,Package> getPackagesMap()
getPackagesMap in interface InternalRuleBasepublic Map<String,Class<?>> getGlobals()
getGlobals in interface InternalRuleBasepublic int getAdditionsSinceLock()
RuleBase
getAdditionsSinceLock in interface RuleBasepublic int getRemovalsSinceLock()
RuleBase
getRemovalsSinceLock in interface RuleBasepublic void lock()
RuleBase
lock in interface RuleBasepublic void unlock()
RuleBase
unlock in interface RuleBasepublic void readLock()
InternalRuleBase
readLock in interface InternalRuleBasepublic void readUnlock()
InternalRuleBase
readUnlock in interface InternalRuleBasepublic void addPackages(Collection<Package> newPkgs)
Package to the network. Iterates through the
Package adding Each individual Rule to the
network. Before update network each referenced WorkingMemory
is locked.
newPkgs - The package to add.
public Class<?> registerAndLoadTypeDefinition(String className,
byte[] def)
throws ClassNotFoundException
ClassNotFoundException
protected void updateDependentTypes(Package newPkg,
TypeDeclaration typeDeclaration)
protected void setupRete()
public void registerAddedEntryNodeCache(EntryPointNode node)
registerAddedEntryNodeCache in interface InternalRuleBasepublic Set<EntryPointNode> getAddedEntryNodeCache()
getAddedEntryNodeCache in interface InternalRuleBasepublic void registeRremovedEntryNodeCache(EntryPointNode node)
registeRremovedEntryNodeCache in interface InternalRuleBasepublic Set<EntryPointNode> getRemovedEntryNodeCache()
getRemovedEntryNodeCache in interface InternalRuleBasepublic Rete getRete()
RuleBase.
getRete in interface InternalRuleBasepublic ReteooBuilder getReteooBuilder()
getReteooBuilder in interface InternalRuleBase
public void assertObject(FactHandle handle,
Object object,
PropagationContext context,
InternalWorkingMemory workingMemory)
throws FactException
assertObject in interface InternalRuleBasehandle - The handle.object - The fact.workingMemory - The working-memory.
FactException - If an error occurs while performing the assertion.
public void retractObject(FactHandle handle,
PropagationContext context,
AbstractWorkingMemory workingMemory)
throws FactException
retractObject in interface InternalRuleBasehandle - The handle.workingMemory - The working-memory.
FactException - If an error occurs while performing the retraction.public StatefulSession newStatefulSession(boolean keepReference)
newStatefulSession in interface RuleBasepublic StatefulSession newStatefulSession(InputStream stream)
newStatefulSession in interface RuleBase
public StatefulSession newStatefulSession(InputStream stream,
boolean keepReference)
newStatefulSession in interface RuleBase
public StatefulSession newStatefulSession(InputStream stream,
boolean keepReference,
SessionConfiguration conf)
newStatefulSession in interface RuleBase
public StatefulSession newStatefulSession(SessionConfiguration sessionConfig,
org.kie.api.runtime.Environment environment)
RuleBaseWorkingMemory session for this
RuleBase.
newStatefulSession in interface RuleBasesessionConfig - the session configuration object to use for the
created session.
WorkingMemory.WorkingMemory,
org.kie.conflict.DefaultConflictResolverpublic StatelessSession newStatelessSession()
newStatelessSession in interface RuleBasepublic int getNodeCount()
getNodeCount in interface InternalRuleBasepublic void addPackages(Package[] pkgs)
addPackages in interface RuleBasepublic void addPackage(Package newPkg)
addPackage in interface RuleBase
public void registerSegmentPrototype(LeftTupleSource tupleSource,
SegmentMemory smem)
public void invalidateSegmentPrototype(LeftTupleSource tupleSource)
public SegmentMemory getSegmentFromPrototype(InternalWorkingMemory wm,
LeftTupleSource tupleSource)
public TypeDeclaration getTypeDeclaration(Class<?> clazz)
InternalRuleBase
getTypeDeclaration in interface InternalRuleBasepublic Collection<TypeDeclaration> getTypeDeclarations()
InternalRuleBase
getTypeDeclarations in interface InternalRuleBase
public void addRule(Package pkg,
Rule rule)
throws InvalidPatternException
InvalidPatternException
protected void addEntryPoint(Package pkg,
String id)
throws InvalidPatternException
InvalidPatternException
protected void addRule(Rule rule)
throws InvalidPatternException
InvalidPatternException
protected void addEntryPoint(String id)
throws InvalidPatternException
InvalidPatternException
public void addWindowDeclaration(Package pkg,
WindowDeclaration window)
throws InvalidPatternException
InvalidPatternException
protected void addWindowDeclaration(WindowDeclaration window)
throws InvalidPatternException
InvalidPatternExceptionpublic void removePackage(String packageName)
RuleBase
removePackage in interface RuleBase
public void removeQuery(String packageName,
String ruleName)
RuleBase
removeQuery in interface RuleBase
public void removeRule(String packageName,
String ruleName)
RuleBase
removeRule in interface RuleBase
public void removeRule(Package pkg,
Rule rule)
pkg - rule - protected void removeRule(Rule rule)
public void removeFunction(String packageName,
String functionName)
RuleBase
removeFunction in interface RuleBaseprotected void removeFunction(String functionName)
before-rule-removed
event is fired, and before the function is physically removed from the package.
This method is called with the rulebase lock held.
functionName - public void addProcess(org.kie.api.definition.process.Process process)
public void removeProcess(String id)
RuleBase
removeProcess in interface RuleBasepublic org.kie.api.definition.process.Process getProcess(String id)
getProcess in interface InternalRuleBasepublic void addStatefulSession(StatefulSession statefulSession)
public Package getPackage(String name)
getPackage in interface InternalRuleBasegetPackage in interface RuleBasepublic StatefulSession[] getStatefulSessions()
RuleBase
getStatefulSessions in interface RuleBasepublic InternalWorkingMemory[] getWorkingMemories()
getWorkingMemories in interface InternalRuleBasepublic RuleBaseConfiguration getConfiguration()
getConfiguration in interface InternalRuleBasepublic ClassLoader getRootClassLoader()
getRootClassLoader in interface InternalRuleBasepublic void executeQueuedActions()
executeQueuedActions in interface InternalRuleBasepublic RuleBasePartitionId createNewPartitionId()
InternalRuleBase
createNewPartitionId in interface InternalRuleBasepublic List<RuleBasePartitionId> getPartitionIds()
InternalRuleBase
getPartitionIds in interface InternalRuleBasepublic void addEventListener(RuleBaseEventListener listener)
RuleBaseEventManager
addEventListener in interface RuleBaseEventManagerlistener - The listener to add.public void removeEventListener(RuleBaseEventListener listener)
RuleBaseEventManager
removeEventListener in interface RuleBaseEventManagerlistener - The listener to remove.public List<RuleBaseEventListener> getRuleBaseEventListeners()
RuleBaseEventManager
getRuleBaseEventListeners in interface RuleBaseEventManagerpublic boolean isEvent(Class<?> clazz)
InternalRuleBase
isEvent in interface InternalRuleBasepublic org.kie.api.definition.type.FactType getFactType(String name)
RuleBase
getFactType in interface RuleBasename - - the name of the declared type (a type defined in the rules).
This would typically be packagename + . + type name.
Eg, if there is a delcared type of name "Driver", and the package name is "com.company".
Then the string you pass in would be "com.company.Driver".public ClassFieldAccessorCache getClassFieldAccessorCache()
public Set<String> getEntryPointIds()
getEntryPointIds in interface RuleBasepublic TripleStore getTripleStore()
public TraitRegistry getTraitRegistry()
public void removeObjectsGeneratedFromResource(org.kie.api.io.Resource resource)
|
Drools :: Core 6.1.0.Beta1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||