|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.drools.repository.RulesRepository
public class RulesRepository
RulesRepository is the class that defines the bahavior for the JBoss Rules (drools) rule repository based upon the JCR specification (JSR-170).
An instance of this class is capable of storing rules used by the JBoss Rule engine. It also provides a versioning capability for rules. Rules can be imported from specified files. The RulesRepository is also capable of storing DSL content. Rules can be explicitly tied to a particular DSL node within the repository, and this reference can either follow the head version, or a specific version of the DSL node.
The RulesRepository also is capable of storing RulePackages, which aggregate one or more Rules into a set. RulePackages hold references to the nodes storing the content of the rules in the set within the repository. Each entry in a rulepackage can either refer to the head version of the given rule node, or a specific version.
Rules can be tagged. Tags are stored in a separate area of the repository, and can be added on demand. Rules can have 0 or more tags. Tags are intended to help provide a means for searching for specific types of rules quickly, even when they aren't all part of the same rulepackage.
Rules can be associated with 0 or 1 states. States are created in a seperate area of the repository. States are intended to help track the progress of a rule as it traverses its life- cycle. (e.g. draft, approved, deprecated, etc.)
Field Summary | |
---|---|
static java.lang.String |
DSL_AREA
The name of the DSL area of the repository |
static java.lang.String |
RULE_AREA
The name of the rule area of the repository |
static java.lang.String |
RULE_PACKAGE_AREA
The name of the rulepackage area of the repository |
static java.lang.String |
RULES_REPOSITORY_NAME
The name of the rules repository within the JCR repository |
static java.lang.String |
STATE_AREA
The name of the state area of the repository |
static java.lang.String |
TAG_AREA
The name of the tag area of the repository |
Constructor Summary | |
---|---|
RulesRepository()
This will create the JCR repository automatically if it does not already exist. |
|
RulesRepository(boolean clearRepository)
This will create the JCR repository automatically if it does not already exist. |
Method Summary | |
---|---|
DslItem |
addDslFromFile(java.io.File file)
Adds a DSL node in the repository using the content and attributes of the specified file |
protected javax.jcr.Node |
addNodeIfNew(javax.jcr.Node parent,
java.lang.String nodeName,
java.lang.String type)
Will add a node named 'nodeName' of type 'type' to 'parent' if such a node does not already exist. |
RuleItem |
addRuleFromFile(java.io.File file)
Adds a Rule node in the repository using the content and attributes of the specified file |
RuleItem |
addRuleFromFile(java.io.File file,
DslItem dslItem)
Adds a Rule node in the repository using the content and attributes of the specified file. |
RuleItem |
addRuleFromFile(java.io.File file,
DslItem dslItem,
boolean followDslHead)
Adds a Rule node in the repository using the content and attributes of the specified file. |
void |
clearRepository()
Clears out the entire tree below the rules repository node of the JCR repository. |
RulePackageItem |
createRulePackage(java.lang.String name)
Adds a rule package node in the repository. |
void |
dumpRepository()
Recursively outputs the contents of the workspace starting from root. |
StateItem |
getState(java.lang.String name)
Gets a StateItem for the specified state name. |
TagItem |
getTag(java.lang.String tagName)
Gets a TagItem object that encapsulates the node for the specified tag name. |
void |
logout()
Explicitly logout of the underlying JCR repository. |
protected void |
setupRepository()
Attempts to setup the repository. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String RULE_PACKAGE_AREA
public static final java.lang.String RULE_AREA
public static final java.lang.String DSL_AREA
public static final java.lang.String TAG_AREA
public static final java.lang.String STATE_AREA
public static final java.lang.String RULES_REPOSITORY_NAME
Constructor Detail |
---|
public RulesRepository()
public RulesRepository(boolean clearRepository)
clearRepository
- whether or not to erase the contents of the rules repository
portion of the JCR repositoryMethod Detail |
---|
public void clearRepository()
protected void setupRepository() throws RulesRepositoryException
RulesRepositoryException
protected javax.jcr.Node addNodeIfNew(javax.jcr.Node parent, java.lang.String nodeName, java.lang.String type) throws RulesRepositoryException
parent
- the parent node to add the new node tonodeName
- the name of the new nodetype
- the type of the new node
RulesRepositoryException
public void logout()
public void dumpRepository() throws RulesRepositoryException
RulesRepositoryException
public DslItem addDslFromFile(java.io.File file) throws RulesRepositoryException
file
- the file to use to import the DSL content and attributes
RulesRepositoryException
public RuleItem addRuleFromFile(java.io.File file) throws RulesRepositoryException
file
- the file to use to import the DSL content and attributes
RulesRepositoryException
public RuleItem addRuleFromFile(java.io.File file, DslItem dslItem) throws RulesRepositoryException
file
- the file to use to import the DSL content and attributesdslItem
- the DslItem containing the node to link the newly created rule node with
RulesRepositoryException
public RuleItem addRuleFromFile(java.io.File file, DslItem dslItem, boolean followDslHead) throws RulesRepositoryException
file
- the file to use to import the DSL content and attributesdslItem
- the DslItem containing the node to link the newly created rule node withfollowDslHead
- if true, the link to the DSL node will follow the head revision of that
node. if false, it will continue to refer to the specified version even
if a new version of the DSL node is checked in
RulesRepositoryException
public RulePackageItem createRulePackage(java.lang.String name) throws RulesRepositoryException
name
- what to name the node added
RulesRepositoryException
public StateItem getState(java.lang.String name) throws RulesRepositoryException
name
- the name of the state to get
RulesRepositoryException
public TagItem getTag(java.lang.String tagName) throws RulesRepositoryException
tagName
- the name of the tag to get. If the tag to get is within a heirarchy of
tag nodes, specify the full path to the tag node of interest (e.g. if
you want to get back 'child-tag', use "parent-tag/child-tag")
RulesRepositoryException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |