|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.drools.common.AbstractRuleBase
public abstract class AbstractRuleBase
Implementation of RuleBase
.
Field Summary | |
---|---|
protected RuleBaseConfiguration |
config
|
protected FactHandleFactory |
factHandleFactory
The fact handle factory. |
protected Map |
globals
|
protected String |
id
|
protected CompositePackageClassLoader |
packageClassLoader
|
protected Map |
pkgs
|
protected Map |
processes
|
protected ObjectHashSet |
statefulSessions
WeakHashMap to keep references of WorkingMemories but allow them to be garbage collected |
protected int |
workingMemoryCounter
|
Fields inherited from interface org.drools.RuleBase |
---|
LEAPS, RETEOO |
Constructor Summary | |
---|---|
AbstractRuleBase()
Default constructor - for Externalizable. |
|
AbstractRuleBase(String id,
RuleBaseConfiguration config,
FactHandleFactory factHandleFactory)
Construct. |
Method Summary | |
---|---|
void |
addPackage(Package newPkg)
Add a Package to the network. |
void |
addProcess(IProcess process)
|
protected void |
addRule(Rule rule)
|
protected void |
addStatefulSession(StatefulSession statefulSession)
|
void |
disposeStatefulSession(StatefulSession statefulSession)
|
void |
doReadExternal(ObjectInput stream,
Object[] objects)
Handles the read serialization of the Package. |
void |
doWriteExternal(ObjectOutput stream,
Object[] objects)
Handles the write serialization of the Package. |
RuleBaseConfiguration |
getConfiguration()
|
FactHandleFactory |
getFactHandleFactory()
|
Map |
getGlobals()
|
String |
getId()
|
Package[] |
getPackages()
|
IProcess |
getProcess(String id)
|
IProcess[] |
getProcesses()
|
StatefulSession[] |
getStatefulSessions()
|
InternalWorkingMemory[] |
getWorkingMemories()
|
FactHandleFactory |
newFactHandleFactory()
|
StatefulSession |
newStatefulSession()
Create a new WorkingMemory session for this
RuleBase . |
abstract StatefulSession |
newStatefulSession(boolean keepReference)
Create a new WorkingMemory session for this
RuleBase . |
StatefulSession |
newStatefulSession(InputStream stream)
RuleBases handle the returning of a Serialized WorkingMemory pass as an InputStream. |
StatefulSession |
newStatefulSession(InputStream stream,
boolean keepReference)
RuleBases handle the returning of a Serialized WorkingMemory pass as an InputStream. |
void |
removePackage(String packageName)
|
void |
removeProcess(String id)
|
protected abstract void |
removeRule(Rule rule)
|
void |
removeRule(String packageName,
String ruleName)
|
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, retractObject |
Methods inherited from interface org.drools.RuleBase |
---|
newStatelessSession |
Methods inherited from interface java.io.Externalizable |
---|
readExternal, writeExternal |
Field Detail |
---|
protected String id
protected int workingMemoryCounter
protected RuleBaseConfiguration config
protected Map pkgs
protected Map processes
protected transient CompositePackageClassLoader packageClassLoader
protected FactHandleFactory factHandleFactory
protected Map globals
protected transient ObjectHashSet statefulSessions
Constructor Detail |
---|
public AbstractRuleBase()
public AbstractRuleBase(String id, RuleBaseConfiguration config, FactHandleFactory factHandleFactory)
rete
- The rete network.Method Detail |
---|
public void doWriteExternal(ObjectOutput stream, Object[] objects) throws IOException
IOException
public void doReadExternal(ObjectInput stream, Object[] objects) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public String getId()
getId
in interface InternalRuleBase
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
.RuleBase
public abstract StatefulSession newStatefulSession(boolean keepReference)
RuleBase
WorkingMemory
session for this
RuleBase
. Optionally the RuleBase retains a
weak reference to returned WorkingMemory.
The created WorkingMemory
uses the default conflict
resolution strategy.
newStatefulSession
in interface RuleBase
WorkingMemory
.RuleBase
public void disposeStatefulSession(StatefulSession statefulSession)
disposeStatefulSession
in interface InternalRuleBase
public FactHandleFactory getFactHandleFactory()
RuleBase
public FactHandleFactory newFactHandleFactory()
newFactHandleFactory
in interface InternalRuleBase
public IProcess[] getProcesses()
public Package[] getPackages()
getPackages
in interface RuleBase
public Map getGlobals()
getGlobals
in interface InternalRuleBase
public void addPackage(Package newPkg) throws PackageIntegrationException
Package
to the network. Iterates through the
Package
adding Each individual Rule
to the
network. Before update network each referenced WorkingMemory
is locked.
addPackage
in interface RuleBase
pkg
- The package to add.
PackageIntegrationException
RuleIntegrationException
- if an error prevents complete construction of the network for
the Rule
.
FactException
InvalidPatternException
protected void addRule(Rule rule) throws InvalidPatternException
InvalidPatternException
public void removePackage(String packageName)
removePackage
in interface RuleBase
public void removeRule(String packageName, String ruleName)
removeRule
in interface RuleBase
protected abstract void removeRule(Rule rule)
public void addProcess(IProcess process)
addProcess
in interface RuleBase
public void removeProcess(String id)
removeProcess
in interface RuleBase
public IProcess getProcess(String id)
getProcess
in interface RuleBase
protected void addStatefulSession(StatefulSession statefulSession)
public StatefulSession[] getStatefulSessions()
getStatefulSessions
in interface RuleBase
public InternalWorkingMemory[] getWorkingMemories()
public RuleBaseConfiguration getConfiguration()
getConfiguration
in interface InternalRuleBase
public StatefulSession newStatefulSession(InputStream stream) throws IOException, ClassNotFoundException
RuleBase
The created WorkingMemory
uses the default conflict
resolution strategy.
newStatefulSession
in interface RuleBase
WorkingMemory
.
IOException
ClassNotFoundException
WorkingMemory
,
DefaultConflictResolver
public StatefulSession newStatefulSession(InputStream stream, boolean keepReference) throws IOException, ClassNotFoundException
RuleBase
The created WorkingMemory
uses the default conflict
resolution strategy.
newStatefulSession
in interface RuleBase
WorkingMemory
.
IOException
ClassNotFoundException
WorkingMemory
,
DefaultConflictResolver
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |