com.ibm.websphere.brb
Class RuleImporter
java.lang.Object
|
+--com.ibm.ws.brb.xml.BaseRuleImporterExporter
|
+--com.ibm.websphere.brb.RuleImporter
- public class RuleImporter
- extends com.ibm.ws.brb.xml.BaseRuleImporterExporter
A tool that imports rules from one or more XML documents. The RuleImporter should normally be invoked using the
ruleimporter.bat|sh file that is provided.
Fields inherited from class com.ibm.ws.brb.xml.BaseRuleImporterExporter |
BRB_XML_RESOURCE_BUNDLE, parser |
Constructor Summary |
RuleImporter(javax.naming.InitialContext ic)
Creates a new RuleImporter. |
Method Summary |
void |
addErrorListener(com.ibm.ws.brb.xml.ParsingErrorListener listener)
Add a listener that listens for errors that occured during the
import. |
boolean |
isTestOnly()
Indicates whether the importer is in "test-only" mode, which means that, none of the rules
that are specified in the XML documents will be created, but the documents will still be parsed. |
boolean |
isUpdateDuplicates()
Returns whether to update a rule if a rule found in the database has the same primary
key as a rule in the input document. |
static void |
main(java.lang.String[] args)
Import rules as specified by the given args. |
void |
setTestOnly(boolean option)
Sets whether the importer is in "test-only" mode, which means that, none of the rules
that are specified in the XML documents will be created, but the documents will still be parsed. |
void |
setUpdateDuplicates(boolean option)
Sets whether to update a rule if a rule found in the database has the same primary
key as a rule in the input document. |
Methods inherited from class com.ibm.ws.brb.xml.BaseRuleImporterExporter |
getCurrentFileName, getInitialContext, getMessage, getRootRuleFolder, getVerboseWriter, isCommitEach, isVerbose, parse, setCommitEach, setVerboseWriter |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RuleImporter
public RuleImporter(javax.naming.InitialContext ic)
throws BusinessRuleBeansException
- Creates a new RuleImporter.
- Parameters:
ic
- the initial context to use to connect to the name server- Throws:
BusinessRuleBeansException
- if an error occurs creating the parser
addErrorListener
public void addErrorListener(com.ibm.ws.brb.xml.ParsingErrorListener listener)
- Add a listener that listens for errors that occured during the
import.
- Parameters:
listener
- the error listener
isTestOnly
public boolean isTestOnly()
- Indicates whether the importer is in "test-only" mode, which means that, none of the rules
that are specified in the XML documents will be created, but the documents will still be parsed.
- Returns:
- true if in "test-only" mode, false otherwise
isUpdateDuplicates
public boolean isUpdateDuplicates()
- Returns whether to update a rule if a rule found in the database has the same primary
key as a rule in the input document.
- Returns:
- true if duplicate rules should be updated, false if an error should be generated
main
public static void main(java.lang.String[] args)
throws java.lang.Exception
- Import rules as specified by the given args. The following is the usage:
Usage: java com.ibm.websphere.brb.RuleImporter [options] files ...
Options:
-[?] Display this message
-[v]erbose Verbose output
-[t]est Only parse the input files, do not create rules
-[u]pdate Update duplicate rules
-[c]ommiteach Perform a commit after each bean
-[h]ost {name} The host where the name server is located (default is localhost)
-[p]ort {number} The port where the name server is located (default is 900)
Example: to import rules from two files, committing rule individually:
java com.ibm.websphere.brb.RuleImporter -c -h myserver.ibm.com file1 file2
- Parameters:
args
- the command-line arguments to the RuleImporter
setTestOnly
public void setTestOnly(boolean option)
- Sets whether the importer is in "test-only" mode, which means that, none of the rules
that are specified in the XML documents will be created, but the documents will still be parsed.
setUpdateDuplicates
public void setUpdateDuplicates(boolean option)
- Sets whether to update a rule if a rule found in the database has the same primary
key as a rule in the input document.
- Parameters:
option
- true if duplicate rules should be updated, false if an error should be generated