|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.dna.repository.rules.RuleService
@ThreadSafe public class RuleService
A rule service that is capable of executing rule sets using one or more JSR-94 rule engines. Sets of rules are
added
, updated
, and removed
(usually by some other component), and then these named rule sets can be run
with
inputs and facts to obtain output.
This service is thread safe. While multiple rule sets can be safely executed
at
the same time, all executions will be properly synchronized with methods to add
,
update
, and remove
rule sets.
Constructor Summary | |
---|---|
RuleService()
Create a new rule service, configured with no rule sets. |
Method Summary | |
---|---|
boolean |
addRuleSet(RuleSet ruleSet)
Add a rule set, or update any existing one that represents the same rule set |
List<?> |
executeRules(String ruleSetName,
Map<String,Object> globals,
Object... facts)
Execute the set of rules defined by the supplied rule set name. |
ServiceAdministrator |
getAdministrator()
Return the administrative component for this service. |
ClassLoaderFactory |
getClassLoaderFactory()
Get the class loader factory that should be used to load sequencers. |
Logger |
getLogger()
Get the logger for this system |
Collection<RuleSet> |
getRuleSets()
Obtain the rule sets that are currently available in this service. |
boolean |
removeRuleSet(String ruleSetName)
Remove a rule set. |
void |
setClassLoaderFactory(ClassLoaderFactory classLoaderFactory)
Set the Maven Repository that should be used to load the sequencer classes. |
void |
setLogger(Logger logger)
Set the logger for this system. |
boolean |
updateRuleSet(RuleSet ruleSet)
Update the configuration for a sequencer, or add it if there is no matching configuration . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RuleService()
paused
and must be configured and then started
.
Method Detail |
---|
public ServiceAdministrator getAdministrator()
getAdministrator
in interface AdministeredService
public ClassLoaderFactory getClassLoaderFactory()
current thread's context class loader
(if not null) or the class
loader that loaded this class.
setClassLoaderFactory(ClassLoaderFactory)
public void setClassLoaderFactory(ClassLoaderFactory classLoaderFactory)
current thread's context class loader
(if not
null) or the class loader that loaded this class.
classLoaderFactory
- the class loader factory reference, or null if the default class loader factory should be used.getClassLoaderFactory()
public Collection<RuleSet> getRuleSets()
public boolean addRuleSet(RuleSet ruleSet)
same rule set
ruleSet
- the new rule set
IllegalArgumentException
- if ruleSet
is null
InvalidRuleSetException
- if the supplied rule set is invalid, incomplete, incorrectly defined, or uses a JSR-94
service provider that cannot be foundupdateRuleSet(RuleSet)
,
removeRuleSet(String)
public boolean updateRuleSet(RuleSet ruleSet)
matching configuration
.
ruleSet
- the rule set to be updated
InvalidRuleSetException
- if the supplied rule set is invalid, incomplete, incorrectly defined, or uses a JSR-94
service provider that cannot be foundaddRuleSet(RuleSet)
,
removeRuleSet(String)
public boolean removeRuleSet(String ruleSetName)
ruleSetName
- the name of the rule set to be removed
IllegalArgumentException
- if ruleSetName
is null or empty
SystemFailureException
- if the rule set was found but there was a problem removing itaddRuleSet(RuleSet)
,
updateRuleSet(RuleSet)
public Logger getLogger()
public void setLogger(Logger logger)
logger
- the logger, or null if the standard logging should be usedpublic List<?> executeRules(String ruleSetName, Map<String,Object> globals, Object... facts)
add
, update
, and remove
rule sets.
ruleSetName
- the name
of the RuleSet
that should be usedglobals
- the global variablesfacts
- the facts
IllegalArgumentException
- if the rule set name is null, empty or blank, or if there is no rule set with the given
name
SystemFailureException
- if there is no JSR-94 rule service provider with the RuleSet's provider URI
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |