org.drools
Interface RuleBase

All Superinterfaces:
Externalizable, RuleBaseEventManager, Serializable
All Known Subinterfaces:
InternalRuleBase
All Known Implementing Classes:
AbstractRuleBase, ReteooRuleBase

public interface RuleBase
extends Externalizable, RuleBaseEventManager

Active collection of Rules.

From a RuleBase many WorkingMemory rule sessions may be instantiated. Additionally, it may be inspected to determine which Package s it contains.

See Also:
WorkingMemory

Field Summary
static int RETEOO
           
 
Method Summary
 void addPackage(Package pkg)
           
 void addPackages(Package[] pkgs)
           
 int getAdditionsSinceLock()
          Returns the number of additive operations applied since the last lock() was obtained
 Set<String> getEntryPointIds()
           
 org.drools.definition.type.FactType getFactType(String string)
          Returns a declared FactType.
 Package getPackage(String name)
           
 Package[] getPackages()
           
 int getRemovalsSinceLock()
          Returns the number of removal operations applied since the last lock() was obtained
 StatefulSession[] getStatefulSessions()
          Returns an array of all the referenced StatefulSessions
 void lock()
          This locks the current RuleBase and all there referenced StatefulSessions.
 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 config, org.drools.runtime.Environment environment)
          Create a new WorkingMemory session for this RuleBase.
 StatelessSession newStatelessSession()
           
 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 queryName)
          Remove a specific Query in a Package
 void removeRule(String packageName, String ruleName)
          Remove a specific Rule in a Package
 void unlock()
          Unlocks the RuleBase and all of the referenced StatefulSessions.
 
Methods inherited from interface java.io.Externalizable
readExternal, writeExternal
 
Methods inherited from interface org.drools.RuleBaseEventManager
addEventListener, getRuleBaseEventListeners, removeEventListener
 

Field Detail

RETEOO

static final int RETEOO
See Also:
Constant Field Values
Method Detail

newStatelessSession

StatelessSession newStatelessSession()

newStatefulSession

StatefulSession newStatefulSession()
Create a new 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.

Returns:
A newly initialized WorkingMemory. IMPORTANT: when using the stateful session REMEMBER TO CALL dispose() when you are done with the session.
See Also:
WorkingMemory, org.drools.conflict.DefaultConflictResolver

newStatefulSession

StatefulSession newStatefulSession(boolean keepReference)

newStatefulSession

StatefulSession newStatefulSession(InputStream stream)

newStatefulSession

StatefulSession newStatefulSession(InputStream stream,
                                   boolean keepReference)

newStatefulSession

StatefulSession newStatefulSession(InputStream stream,
                                   boolean keepReference,
                                   SessionConfiguration conf)

newStatefulSession

StatefulSession newStatefulSession(SessionConfiguration config,
                                   org.drools.runtime.Environment environment)
Create a new WorkingMemory session for this RuleBase.

Parameters:
config - the session configuration object to use for the created session.
Returns:
A newly initialized WorkingMemory.
See Also:
WorkingMemory, org.drools.conflict.DefaultConflictResolver

getPackages

Package[] getPackages()

getPackage

Package getPackage(String name)

addPackages

void addPackages(Package[] pkgs)

addPackage

void addPackage(Package pkg)

lock

void lock()
This locks the current RuleBase and all there referenced StatefulSessions. This should be used when there is a number of dynamic RuleBase changes you wish to make, but cannot have any normal WorkingMemory operations occuring inbetween.


unlock

void unlock()
Unlocks the RuleBase and all of the referenced StatefulSessions.


getAdditionsSinceLock

int getAdditionsSinceLock()
Returns the number of additive operations applied since the last lock() was obtained

Returns:

getRemovalsSinceLock

int getRemovalsSinceLock()
Returns the number of removal operations applied since the last lock() was obtained

Returns:

removePackage

void removePackage(String packageName)
Remove the package and all it's rules, functions etc

Parameters:
packageName -

removeRule

void removeRule(String packageName,
                String ruleName)
Remove a specific Rule in a Package

Parameters:
packageName -
ruleName -

removeQuery

void removeQuery(String packageName,
                 String queryName)
Remove a specific Query in a Package

Parameters:
packageName -
ruleName -

removeFunction

void removeFunction(String packageName,
                    String functionName)
Removes a specific function in a specific package.

Parameters:
packageName -
functionName -

removeProcess

void removeProcess(String id)
Removes a process by the process' id

Parameters:
id -

getStatefulSessions

StatefulSession[] getStatefulSessions()
Returns an array of all the referenced StatefulSessions

Returns:

getFactType

org.drools.definition.type.FactType getFactType(String string)
Returns a declared FactType. FactTypes are types that are declared as part of the rules (an alternative to POJOs). From a fact type you can generate instances of facts which you can use to communicate with the engine.

Parameters:
string - - 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".

getEntryPointIds

Set<String> getEntryPointIds()


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