org.drools
Class RuleBaseConfiguration

java.lang.Object
  extended by org.drools.RuleBaseConfiguration
All Implemented Interfaces:
Externalizable, Serializable, org.drools.conf.KnowledgeBaseOptionsConfiguration, org.drools.KnowledgeBaseConfiguration, org.drools.PropertiesConfiguration

public class RuleBaseConfiguration
extends Object
implements org.drools.KnowledgeBaseConfiguration, Externalizable

Available configuration options:

 drools.maintainTms = <true|false>
 drools.sequential = <true|false>
 drools.sequential.agenda = <sequential|dynamic>
 drools.removeIdentities = <true|false>
 drools.shareAlphaNodes  = <true|false>
 drools.shareBetaNodes = <true|false>
 drools.alphaNodeHashingThreshold = <1...n>
 drools.compositeKeyDepth  =<1..3>
 drools.indexLeftBetaMemory = <true/false>
 drools.indexRightBetaMemory = <true/false>
 drools.assertBehaviour = <identity|equality>
 drools.logicalOverride = <discard|preserve>
 drools.executorService = <qualified class name>
 drools.conflictResolver = <qualified class name>
 drools.consequenceExceptionHandler = <qualified class name>
 drools.ruleBaseUpdateHandler = <qualified class name>
 drools.sessionClock = <qualified class name>
 drools.maxThreads = <-1|1..n>
 drools.multithreadEvaluation = <true|false>
 drools.mbeans = <enabled|disabled>
 drools.classLoaderCacheEnabled = <true|false>
 drools.lrUnlinkingEnabled = <true|false> 
 

See Also:
Serialized Form

Nested Class Summary
static class RuleBaseConfiguration.AssertBehaviour
           
static class RuleBaseConfiguration.LogicalOverride
           
static class RuleBaseConfiguration.SequentialAgenda
           
 
Field Summary
static String DEFAULT_SIGN_ON_SERIALIZATION
           
 
Constructor Summary
RuleBaseConfiguration()
          Creates a new rulebase with a default parent class loader set according to the following algorithm: If a Thread.currentThread().getContextClassLoader() returns a non-null class loader, it will be used as the parent class loader for this rulebase class loaders, otherwise, the RuleBaseConfiguration.class.getClassLoader() class loader will be used.
RuleBaseConfiguration(ClassLoader... classLoaders)
          A constructor that sets the parent classloader to be used while dealing with this rule base
RuleBaseConfiguration(Properties properties)
          Creates a new rulebase configuration using the provided properties as configuration options.
RuleBaseConfiguration(Properties properties, ClassLoader... classLoaders)
          A constructor that sets the classloader to be used as the parent classloader of this rule base classloaders, and the properties to be used as base configuration options
 
Method Summary
 void addActivationListener(String name, ActivationListenerFactory factory)
           
 ActivationListenerFactory getActivationListenerFactory(String name)
           
 AgendaGroupFactory getAgendaGroupFactory()
           
 int getAlphaNodeHashingThreshold()
           
 RuleBaseConfiguration.AssertBehaviour getAssertBehaviour()
           
 org.drools.util.CompositeClassLoader getClassLoader()
           
 int getCompositeKeyDepth()
           
 ConflictResolver getConflictResolver()
           
 String getConsequenceExceptionHandler()
           
static RuleBaseConfiguration getDefaultInstance()
           
 org.drools.conf.EventProcessingOption getEventProcessingMode()
           
 String getExecutorService()
           
 RuleBaseConfiguration.LogicalOverride getLogicalOverride()
           
 int getMaxThreads()
          Returns the configured number of maximum threads to use for concurrent propagation when multi-thread evaluation is enabled.
<T extends org.drools.conf.SingleValueKnowledgeBaseOption>
T
getOption(Class<T> option)
           
<T extends org.drools.conf.MultiValueKnowledgeBaseOption>
T
getOption(Class<T> option, String key)
           
 String getProperty(String name)
           
 String getRuleBaseUpdateHandler()
           
 RuleBaseConfiguration.SequentialAgenda getSequentialAgenda()
           
 List<Map<String,Object>> getWorkDefinitions()
           
 boolean isAdvancedProcessRuleIntegration()
           
 boolean isClassLoaderCacheEnabled()
           
 boolean isImmutable()
          Returns true if this configuration object is immutable or false otherwise.
 boolean isIndexLeftBetaMemory()
           
 boolean isIndexRightBetaMemory()
           
 boolean isLRUnlinkingEnabled()
           
 boolean isMaintainTms()
           
 boolean isMBeansEnabled()
          Returns true if the management and monitoring through MBeans is active
 boolean isMultithreadEvaluation()
          Returns true if the partitioning of the rulebase is enabled and false otherwise.
 boolean isRemoveIdentities()
           
 boolean isSequential()
           
 boolean isShareAlphaNodes()
           
 boolean isShareBetaNodes()
           
 void makeImmutable()
          Makes the configuration object immutable.
 void readExternal(ObjectInput in)
           
 void setAdvancedProcessRuleIntegration(boolean advancedProcessRuleIntegration)
           
 void setAlphaNodeHashingThreshold(int alphaNodeHashingThreshold)
           
 void setAssertBehaviour(RuleBaseConfiguration.AssertBehaviour assertBehaviour)
           
 void setClassLoader(ClassLoader... classLoaders)
           
 void setClassLoaderCacheEnabled(boolean classLoaderCacheEnabled)
           
 void setCompositeKeyDepth(int compositeKeyDepth)
           
 void setConflictResolver(ConflictResolver conflictResolver)
           
 void setConsequenceExceptionHandler(String consequenceExceptionHandler)
           
 void setEventProcessingMode(org.drools.conf.EventProcessingOption mode)
           
 void setExecutorService(String executorService)
           
 void setIndexLeftBetaMemory(boolean indexLeftBetaMemory)
           
 void setIndexRightBetaMemory(boolean indexRightBetaMemory)
           
 void setLogicalOverride(RuleBaseConfiguration.LogicalOverride logicalOverride)
           
 void setLRUnlinkingEnabled(boolean enabled)
          Enable Left & Right Unlinking.
 void setMaintainTms(boolean maintainTms)
           
 void setMaxThreads(int maxThreads)
          If multi-thread evaluation is enabled, this parameter configures the maximum number of threads each session can use for concurrent Rete propagation.
 void setMBeansEnabled(boolean mbeansEnabled)
          Defines if the RuleBase should expose management and monitoring MBeans
 void setMultithreadEvaluation(boolean enableMultithread)
          Defines if the RuleBase should be executed using a pool of threads for evaluating the rules ("true"), or if the rulebase should work in classic single thread mode ("false").
<T extends org.drools.conf.KnowledgeBaseOption>
void
setOption(T option)
           
 void setProperty(String name, String value)
           
 void setRemoveIdentities(boolean removeIdentities)
           
 void setRuleBaseUpdateHandler(String ruleBaseUpdateHandler)
           
 void setSequential(boolean sequential)
           
 void setSequentialAgenda(RuleBaseConfiguration.SequentialAgenda sequentialAgenda)
           
 void setShareAlphaNodes(boolean shareAlphaNodes)
           
 void setShareBetaNodes(boolean shareBetaNodes)
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SIGN_ON_SERIALIZATION

public static final String DEFAULT_SIGN_ON_SERIALIZATION
See Also:
Constant Field Values
Constructor Detail

RuleBaseConfiguration

public RuleBaseConfiguration(Properties properties)
Creates a new rulebase configuration using the provided properties as configuration options. Also, if a Thread.currentThread().getContextClassLoader() returns a non-null class loader, it will be used as the parent classloader for this rulebase class loaders, otherwise, the RuleBaseConfiguration.class.getClassLoader() class loader will be used.

Parameters:
properties -

RuleBaseConfiguration

public RuleBaseConfiguration()
Creates a new rulebase with a default parent class loader set according to the following algorithm: If a Thread.currentThread().getContextClassLoader() returns a non-null class loader, it will be used as the parent class loader for this rulebase class loaders, otherwise, the RuleBaseConfiguration.class.getClassLoader() class loader will be used.


RuleBaseConfiguration

public RuleBaseConfiguration(ClassLoader... classLoaders)
A constructor that sets the parent classloader to be used while dealing with this rule base

Parameters:
classLoader -

RuleBaseConfiguration

public RuleBaseConfiguration(Properties properties,
                             ClassLoader... classLoaders)
A constructor that sets the classloader to be used as the parent classloader of this rule base classloaders, and the properties to be used as base configuration options

Parameters:
classLoder -
properties -
Method Detail

getDefaultInstance

public static RuleBaseConfiguration getDefaultInstance()

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

setProperty

public void setProperty(String name,
                        String value)
Specified by:
setProperty in interface org.drools.PropertiesConfiguration

getProperty

public String getProperty(String name)
Specified by:
getProperty in interface org.drools.PropertiesConfiguration

makeImmutable

public void makeImmutable()
Makes the configuration object immutable. Once it becomes immutable, there is no way to make it mutable again. This is done to keep consistency.


isImmutable

public boolean isImmutable()
Returns true if this configuration object is immutable or false otherwise.

Returns:

setSequential

public void setSequential(boolean sequential)

isSequential

public boolean isSequential()

isMaintainTms

public boolean isMaintainTms()

setMaintainTms

public void setMaintainTms(boolean maintainTms)

isRemoveIdentities

public boolean isRemoveIdentities()

setRemoveIdentities

public void setRemoveIdentities(boolean removeIdentities)

isShareAlphaNodes

public boolean isShareAlphaNodes()

setShareAlphaNodes

public void setShareAlphaNodes(boolean shareAlphaNodes)

isShareBetaNodes

public boolean isShareBetaNodes()

setShareBetaNodes

public void setShareBetaNodes(boolean shareBetaNodes)

getAlphaNodeHashingThreshold

public int getAlphaNodeHashingThreshold()

setAlphaNodeHashingThreshold

public void setAlphaNodeHashingThreshold(int alphaNodeHashingThreshold)

getAssertBehaviour

public RuleBaseConfiguration.AssertBehaviour getAssertBehaviour()

setAssertBehaviour

public void setAssertBehaviour(RuleBaseConfiguration.AssertBehaviour assertBehaviour)

getEventProcessingMode

public org.drools.conf.EventProcessingOption getEventProcessingMode()

setEventProcessingMode

public void setEventProcessingMode(org.drools.conf.EventProcessingOption mode)

getCompositeKeyDepth

public int getCompositeKeyDepth()

setCompositeKeyDepth

public void setCompositeKeyDepth(int compositeKeyDepth)

isIndexLeftBetaMemory

public boolean isIndexLeftBetaMemory()

setIndexLeftBetaMemory

public void setIndexLeftBetaMemory(boolean indexLeftBetaMemory)

isIndexRightBetaMemory

public boolean isIndexRightBetaMemory()

setIndexRightBetaMemory

public void setIndexRightBetaMemory(boolean indexRightBetaMemory)

getLogicalOverride

public RuleBaseConfiguration.LogicalOverride getLogicalOverride()

setLogicalOverride

public void setLogicalOverride(RuleBaseConfiguration.LogicalOverride logicalOverride)

getExecutorService

public String getExecutorService()

setExecutorService

public void setExecutorService(String executorService)

getConsequenceExceptionHandler

public String getConsequenceExceptionHandler()

setConsequenceExceptionHandler

public void setConsequenceExceptionHandler(String consequenceExceptionHandler)

getRuleBaseUpdateHandler

public String getRuleBaseUpdateHandler()

setRuleBaseUpdateHandler

public void setRuleBaseUpdateHandler(String ruleBaseUpdateHandler)

getAgendaGroupFactory

public AgendaGroupFactory getAgendaGroupFactory()

getSequentialAgenda

public RuleBaseConfiguration.SequentialAgenda getSequentialAgenda()

setSequentialAgenda

public void setSequentialAgenda(RuleBaseConfiguration.SequentialAgenda sequentialAgenda)

setMultithreadEvaluation

public void setMultithreadEvaluation(boolean enableMultithread)
Defines if the RuleBase should be executed using a pool of threads for evaluating the rules ("true"), or if the rulebase should work in classic single thread mode ("false").

Parameters:
enableMultithread - true for multi-thread or false for single-thread. Default is false.

isMultithreadEvaluation

public boolean isMultithreadEvaluation()
Returns true if the partitioning of the rulebase is enabled and false otherwise. Default is false.

Returns:

setMaxThreads

public void setMaxThreads(int maxThreads)
If multi-thread evaluation is enabled, this parameter configures the maximum number of threads each session can use for concurrent Rete propagation.

Parameters:
maxThreads - the maximum number of threads to use. If 0 or a negative number is set, the engine will use number of threads equal to the number of partitions in the rule base. Default number of threads is 0.

getMaxThreads

public int getMaxThreads()
Returns the configured number of maximum threads to use for concurrent propagation when multi-thread evaluation is enabled. Default is zero.

Returns:

isClassLoaderCacheEnabled

public boolean isClassLoaderCacheEnabled()

setClassLoaderCacheEnabled

public void setClassLoaderCacheEnabled(boolean classLoaderCacheEnabled)

isLRUnlinkingEnabled

public boolean isLRUnlinkingEnabled()
Returns:
whether or not Left & Right Unlinking is enabled.

setLRUnlinkingEnabled

public void setLRUnlinkingEnabled(boolean enabled)
Enable Left & Right Unlinking. It will also disable sequential mode and multithread evaluation as these are incompatible with L&R unlinking.

Parameters:
enabled -

getWorkDefinitions

public List<Map<String,Object>> getWorkDefinitions()

isAdvancedProcessRuleIntegration

public boolean isAdvancedProcessRuleIntegration()

setAdvancedProcessRuleIntegration

public void setAdvancedProcessRuleIntegration(boolean advancedProcessRuleIntegration)

addActivationListener

public void addActivationListener(String name,
                                  ActivationListenerFactory factory)

getActivationListenerFactory

public ActivationListenerFactory getActivationListenerFactory(String name)

setConflictResolver

public void setConflictResolver(ConflictResolver conflictResolver)

getConflictResolver

public ConflictResolver getConflictResolver()

getClassLoader

public org.drools.util.CompositeClassLoader getClassLoader()

setClassLoader

public void setClassLoader(ClassLoader... classLoaders)

setMBeansEnabled

public void setMBeansEnabled(boolean mbeansEnabled)
Defines if the RuleBase should expose management and monitoring MBeans

Parameters:
enableMultithread - true for multi-thread or false for single-thread. Default is false.

isMBeansEnabled

public boolean isMBeansEnabled()
Returns true if the management and monitoring through MBeans is active

Returns:

getOption

public <T extends org.drools.conf.SingleValueKnowledgeBaseOption> T getOption(Class<T> option)
Specified by:
getOption in interface org.drools.conf.KnowledgeBaseOptionsConfiguration

setOption

public <T extends org.drools.conf.KnowledgeBaseOption> void setOption(T option)
Specified by:
setOption in interface org.drools.conf.KnowledgeBaseOptionsConfiguration

getOption

public <T extends org.drools.conf.MultiValueKnowledgeBaseOption> T getOption(Class<T> option,
                                                                             String key)
Specified by:
getOption in interface org.drools.conf.KnowledgeBaseOptionsConfiguration


Copyright © 2001-2013 JBoss Inc.. All Rights Reserved.