|
Drools :: Core 6.0.0.Beta5 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.drools.core.common.AbstractRuleBase
public abstract class AbstractRuleBase
Implementation of RuleBase.
| Nested Class Summary | |
|---|---|
static interface |
AbstractRuleBase.RuleBaseAction
|
| Field Summary | |
|---|---|
protected Map<String,Package> |
pkgs
|
| Fields inherited from interface org.drools.core.RuleBase |
|---|
RETEOO |
| Constructor Summary | |
|---|---|
AbstractRuleBase()
Default constructor - for Externalizable. |
|
AbstractRuleBase(String id,
RuleBaseConfiguration config,
FactHandleFactory factHandleFactory)
Construct. |
|
| Method Summary | |
|---|---|
protected void |
addEntryPoint(Package pkg,
String id)
|
protected abstract void |
addEntryPoint(String id)
This method is called with the rulebase lock held. |
void |
addEventListener(RuleBaseEventListener listener)
Add an event listener. |
void |
addPackages(Collection<Package> newPkgs)
Add a Package to the network. |
void |
addProcess(org.kie.api.definition.process.Process process)
|
void |
addRule(Package pkg,
Rule rule)
|
protected abstract void |
addRule(Rule rule)
This method is called with the rulebase lock held. |
void |
addStatefulSession(StatefulSession statefulSession)
|
void |
addWindowDeclaration(Package pkg,
WindowDeclaration window)
|
protected abstract void |
addWindowDeclaration(WindowDeclaration window)
This method is called with the rulebase lock held. |
RuleBasePartitionId |
createNewPartitionId()
Creates and allocates a new partition ID for this rulebase |
void |
disposeStatefulSession(StatefulSession statefulSession)
|
void |
executeQueuedActions()
|
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()
|
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 |
ClassLoader |
getRootClassLoader()
|
List<RuleBaseEventListener> |
getRuleBaseEventListeners()
Returns all event listeners. |
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()
|
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. |
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 |
Class<?> |
registerAndLoadTypeDefinition(String className,
byte[] def)
|
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 |
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 abstract void |
removeRule(Rule rule)
Handle rule removal. |
void |
removeRule(String packageName,
String ruleName)
Remove a specific Rule in a Package |
void |
unlock()
Unlocks the RuleBase and all of the referenced StatefulSessions. |
protected abstract 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 |
| Methods inherited from interface org.drools.core.common.InternalRuleBase |
|---|
assertObject, getAddedEntryNodeCache, getNodeCount, getRemovedEntryNodeCache, getRete, getReteooBuilder, registerAddedEntryNodeCache, registeRremovedEntryNodeCache, retractObject |
| Methods inherited from interface org.drools.core.RuleBase |
|---|
addPackage, addPackages, newStatefulSession, newStatefulSession, newStatefulSession, newStatefulSession, newStatefulSession, newStatelessSession |
| Field Detail |
|---|
protected Map<String,Package> pkgs
| Constructor Detail |
|---|
public AbstractRuleBase()
public AbstractRuleBase(String id,
RuleBaseConfiguration config,
FactHandleFactory factHandleFactory)
id - The rete network.| Method Detail |
|---|
public int nextWorkingMemoryCounter()
nextWorkingMemoryCounter in interface InternalRuleBasepublic int getWorkingMemoryCounter()
public void writeExternal(ObjectOutput out)
throws IOException
writeExternal in interface ExternalizableIOException
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
readExternal in interface ExternalizableIOException
ClassNotFoundExceptionpublic 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 abstract void updateDependentTypes(Package newPkg,
TypeDeclaration typeDeclaration)
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 abstract void addRule(Rule rule)
throws InvalidPatternException
rule -
InvalidPatternExceptionprotected abstract void addEntryPoint(String id)
id - the entry point ID
InvalidPatternException
public void addWindowDeclaration(Package pkg,
WindowDeclaration window)
throws InvalidPatternException
InvalidPatternException
protected abstract void addWindowDeclaration(WindowDeclaration window)
throws InvalidPatternException
window -
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 abstract void removeRule(Rule rule)
before-rule-removed
event is fired, and before the rule is physically removed from the package.
This method is called with the rulebase lock held.
rule -
public void removeFunction(String packageName,
String functionName)
RuleBase
removeFunction in interface RuleBaseprotected void removeFunction(String functionName)
before-function-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()
|
Drools :: Core 6.0.0.Beta5 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||