|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.drools.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.RuleBase |
---|
RETEOO |
Constructor Summary | |
---|---|
AbstractRuleBase()
Default constructor - for Externalizable. |
|
AbstractRuleBase(String id,
RuleBaseConfiguration config,
FactHandleFactory factHandleFactory)
Construct. |
Method Summary | |
---|---|
void |
addEventListener(RuleBaseEventListener listener)
Add an event listener. |
void |
addPackages(Collection<Package> newPkgs)
Add a Package to the network. |
void |
addProcess(org.drools.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)
|
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 |
Map |
getAgendaGroupRuleTotals()
|
ClassFieldAccessorCache |
getClassFieldAccessorCache()
|
RuleBaseConfiguration |
getConfig()
|
RuleBaseConfiguration |
getConfiguration()
|
FactHandleFactory |
getFactHandleFactory()
|
org.drools.definition.type.FactType |
getFactType(String name)
Returns a declared FactType. |
Map |
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.drools.definition.process.Process |
getProcess(String id)
|
org.drools.definition.process.Process[] |
getProcesses()
|
int |
getRemovalsSinceLock()
Returns the number of removal operations applied since the last lock() was obtained |
org.drools.util.CompositeClassLoader |
getRootClassLoader()
|
List<RuleBaseEventListener> |
getRuleBaseEventListeners()
Returns all event listeners. |
StatefulSession[] |
getStatefulSessions()
Returns an array of all the referenced StatefulSessions |
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 |
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. |
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.common.InternalRuleBase |
---|
assertObject, getNodeCount, getRete, getReteooBuilder, retractObject |
Methods inherited from interface org.drools.RuleBase |
---|
addPackage, addPackages, 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 InternalRuleBase
public int getWorkingMemoryCounter()
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public String getId()
getId
in interface InternalRuleBase
public RuleBaseConfiguration getConfig()
public StatefulSession newStatefulSession()
RuleBase
WorkingMemory
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 RuleBase
WorkingMemory
.
IMPORTANT: when using the stateful session REMEMBER TO CALL dispose()
when you are done with the session.RuleBase
public void disposeStatefulSession(StatefulSession statefulSession)
disposeStatefulSession
in interface InternalRuleBase
public FactHandleFactory getFactHandleFactory()
RuleBase
public FactHandleFactory newFactHandleFactory()
newFactHandleFactory
in interface InternalRuleBase
public FactHandleFactory newFactHandleFactory(int id, long counter)
newFactHandleFactory
in interface InternalRuleBase
public org.drools.definition.process.Process[] getProcesses()
getProcesses
in interface InternalRuleBase
public Package[] getPackages()
getPackages
in interface RuleBase
public Map<String,Package> getPackagesMap()
getPackagesMap
in interface InternalRuleBase
public Map getGlobals()
getGlobals
in interface InternalRuleBase
public Map getAgendaGroupRuleTotals()
getAgendaGroupRuleTotals
in interface InternalRuleBase
public int getAdditionsSinceLock()
RuleBase
getAdditionsSinceLock
in interface RuleBase
public int getRemovalsSinceLock()
RuleBase
getRemovalsSinceLock
in interface RuleBase
public void lock()
RuleBase
lock
in interface RuleBase
public void unlock()
RuleBase
unlock
in interface RuleBase
public void readLock()
InternalRuleBase
readLock
in interface InternalRuleBase
public void readUnlock()
InternalRuleBase
readUnlock
in interface InternalRuleBase
public 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.
newPkg
- The package to add.public TypeDeclaration getTypeDeclaration(Class<?> clazz)
InternalRuleBase
getTypeDeclaration
in interface InternalRuleBase
public Collection<TypeDeclaration> getTypeDeclarations()
InternalRuleBase
getTypeDeclarations
in interface InternalRuleBase
public void addRule(Package pkg, Rule rule) throws InvalidPatternException
InvalidPatternException
protected abstract void addRule(Rule rule) throws InvalidPatternException
rule
-
InvalidPatternException
public 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 RuleBase
protected 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.
rule
- public void addProcess(org.drools.definition.process.Process process)
public void removeProcess(String id)
RuleBase
removeProcess
in interface RuleBase
public org.drools.definition.process.Process getProcess(String id)
getProcess
in interface InternalRuleBase
public void addStatefulSession(StatefulSession statefulSession)
public Package getPackage(String name)
getPackage
in interface InternalRuleBase
getPackage
in interface RuleBase
public StatefulSession[] getStatefulSessions()
RuleBase
getStatefulSessions
in interface RuleBase
public InternalWorkingMemory[] getWorkingMemories()
getWorkingMemories
in interface InternalRuleBase
public RuleBaseConfiguration getConfiguration()
getConfiguration
in interface InternalRuleBase
public org.drools.util.CompositeClassLoader getRootClassLoader()
getRootClassLoader
in interface InternalRuleBase
public void executeQueuedActions()
executeQueuedActions
in interface InternalRuleBase
public RuleBasePartitionId createNewPartitionId()
InternalRuleBase
createNewPartitionId
in interface InternalRuleBase
public List<RuleBasePartitionId> getPartitionIds()
InternalRuleBase
getPartitionIds
in interface InternalRuleBase
public void addEventListener(RuleBaseEventListener listener)
RuleBaseEventManager
addEventListener
in interface RuleBaseEventManager
listener
- The listener to add.public void removeEventListener(RuleBaseEventListener listener)
RuleBaseEventManager
removeEventListener
in interface RuleBaseEventManager
listener
- The listener to remove.public List<RuleBaseEventListener> getRuleBaseEventListeners()
RuleBaseEventManager
getRuleBaseEventListeners
in interface RuleBaseEventManager
public boolean isEvent(Class<?> clazz)
InternalRuleBase
isEvent
in interface InternalRuleBase
public org.drools.definition.type.FactType getFactType(String name)
RuleBase
getFactType
in interface RuleBase
name
- - 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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |