Rule Execution Server API

ilog.rules.engine
Class IlrRulesetArchiveParser

java.lang.Object
  extended by ilog.rules.engine.IlrRulesetArchiveParser

public class IlrRulesetArchiveParser
extends Object

This class is a parser of ruleset archives. The archive is given as a stream. The parsing provides:

Since:
JRules 6.0
See Also:
IlrRulesetArchiveBuilder, IlrRulesetArchive

Constructor Summary
IlrRulesetArchiveParser()
          Parses a ruleset archive to provide an executable ruleset.
 
Method Summary
 IlrRulesetFactory checkArchive(IlrRulesetArchive archive)
          Checks the ruleset archive and builds a ruleset factory on this archive.
 IlrRulesetFactory checkArchive(IlrRulesetArchiveLoader loader)
          Checks the ruleset archive and builds a ruleset factory on this archive.
 IlrRulesetFactory checkArchive(JarInputStream stream)
          Checks the ruleset archive and builds a ruleset factory on this archive.
 void displayMessages(boolean error)
          Displays the parsing error or warning messages.
 IlrRulesetArchive getArchive()
          Deprecated. no replacement.
 IlrReflect getBusinessReflect()
          Returns the business reflect.
 String[] getErrors()
          Returns the errors found during the IRL parsing.
 IlrReflect getExecutionReflect()
          Returns the execution reflect.
 IlrRuleset getRuleset()
          Returns a ruleset issued from a ruleset archive parsing.
 String[] getWarnings()
          Returns the warnings found during the IRL parsing.
 boolean parseArchive(IlrRulesetArchive archive)
          Parses the ruleset archive.
 boolean parseArchive(IlrRulesetArchiveLoader loader)
          Parses the ruleset archive.
 boolean parseArchiveFactory()
          Parses the ruleset factory built by the checkArchive method in order to build a ruleset.
 void setBusinessReflect(IlrReflect reflect)
          Sets the business reflect.
 void setExecutionReflect(IlrReflect reflect)
          Sets the execution reflect.
 void setMessageWriter(PrintWriter writer)
           Sets the error message writer of the ruleset archive parser.
 void setRuleset(IlrRuleset ruleset)
          Sets the ruleset to be filled with the archive contents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlrRulesetArchiveParser

public IlrRulesetArchiveParser()
Parses a ruleset archive to provide an executable ruleset.

Method Detail

setBusinessReflect

public void setBusinessReflect(IlrReflect reflect)
Sets the business reflect. This business reflect is used to load the business model, in case the ruleset archive is a business archive. In case no business reflect is provided, one will be created.

Parameters:
reflect - The reflect used as a business reflect; it will load the business model.
See Also:
setExecutionReflect(ilog.rules.factory.IlrReflect)

getBusinessReflect

public IlrReflect getBusinessReflect()
Returns the business reflect. This is the reflect used to load the business model and to parse the IRL archive contents, because in a business archive the IRL is based on the business model.

Returns:
The reflect that contains the business model.
See Also:
getExecutionReflect()

setExecutionReflect

public void setExecutionReflect(IlrReflect reflect)
Sets the execution reflect. This execution reflect is used to load the execution model for an archive. The archive may or may not be a business model. In case no execution reflect is provided, one will be created.

Parameters:
reflect - The reflect used as the execution reflect; it will load the execution model.
See Also:
setBusinessReflect(ilog.rules.factory.IlrReflect)

getExecutionReflect

public IlrReflect getExecutionReflect()
Returns the execution reflect. This is the reflect used to load the execution model. The final executable ruleset is based on this reflect.

Returns:
The reflect that contains the execution model.
See Also:
getBusinessReflect()

getRuleset

public IlrRuleset getRuleset()
Returns a ruleset issued from a ruleset archive parsing. This ruleset is based on the execution ruleset.

Returns:
A ruleset that may be null in case errors occured during the archive parsing.

setRuleset

public void setRuleset(IlrRuleset ruleset)
Sets the ruleset to be filled with the archive contents. This ruleset shall be created with the execution reflect.

Parameters:
ruleset - The ruleset to be filled.
See Also:
setExecutionReflect(ilog.rules.factory.IlrReflect)

getArchive

public IlrRulesetArchive getArchive()
Deprecated. no replacement.

Returns the ruleset archive generated by the parser.

Returns:
The ruleset archive built by parsing. It may be null in case errors occur during the archive parsing.
See Also:
parseArchive(IlrRulesetArchiveLoader), IlrRulesetArchive.extractArchive(IlrRulesetArchiveLoader)

getErrors

public String[] getErrors()
Returns the errors found during the IRL parsing.

Returns:
A string array containing the IRL parsing errors.

getWarnings

public String[] getWarnings()
Returns the warnings found during the IRL parsing.

Returns:
A string array containing the IRL parsing warnings.

setMessageWriter

public void setMessageWriter(PrintWriter writer)

Sets the error message writer of the ruleset archive parser.

Parameters:
writer - The new writer to which error messages are printed.

displayMessages

public void displayMessages(boolean error)
Displays the parsing error or warning messages.

Parameters:
error - Set to true to display the error messages; set to false to display the warning messages.

checkArchive

public IlrRulesetFactory checkArchive(JarInputStream stream)
Checks the ruleset archive and builds a ruleset factory on this archive. In case there are errors, the returned ruleset is null. The archive in the given stream conforms to the Jar format. The extracted archive is persisted in memory. If the archive is a business archive, the returned ruleset is also business; the translations have not been applied.

Parameters:
stream - The stream in Jar format that contains the archive.
Returns:
An IlrRulesetFactory when the archive is correct, or else it returns null.

checkArchive

public IlrRulesetFactory checkArchive(IlrRulesetArchiveLoader loader)
Checks the ruleset archive and builds a ruleset factory on this archive. In case there are errors, the returned ruleset is null. The archive is extracted through the archive loader. The extracted archive is persisted in memory. If the archive is a business archive, the returned ruleset is also business; the translations have not been applied.

Parameters:
loader - The loader used to extract the archive.
Returns:
An IlrRulesetFactory when the archive is correct, or else it returns null.

checkArchive

public IlrRulesetFactory checkArchive(IlrRulesetArchive archive)
Checks the ruleset archive and builds a ruleset factory on this archive. In case there are errors, the returned ruleset is null. If the archive is a business archive, the returned ruleset is also business; the translations have not been applied.

Parameters:
archive - The ruleset archive.
Returns:
An IlrRulesetFactory when the archive is correct, or else it returns null.

parseArchiveFactory

public boolean parseArchiveFactory()
Parses the ruleset factory built by the checkArchive method in order to build a ruleset. It returns a boolean indicating whether the parsing has succeeded or not. In case of errors during the parsing, the ruleset (as IlrRuleset) is null, and error messages are available. If the checkArchive method returned null, the ruleset factory is null and the parsing returns false.

Returns:
true if the parsing occurred without error. Otherwise, it returns false.
See Also:
getRuleset(), displayMessages(boolean error), getExecutionReflect(), getBusinessReflect(), checkArchive(ilog.rules.archive.IlrRulesetArchive), checkArchive(java.util.jar.JarInputStream)

parseArchive

public boolean parseArchive(IlrRulesetArchiveLoader loader)
Parses the ruleset archive. At the end of the parsing, an executable ruleset is available. In case of errors during the parsing, the ruleset is null, and error messages are available. In the case of a business ruleset archive, two reflects take part in the parsing. If the ruleset archive is not business, only one reflect is needed. Both can be obtained after the parsing.

Parameters:
loader - The loader in charge of archive loading.
Returns:
true if the parsing occurred without error. Otherwise, it returns false.
See Also:
getRuleset(), displayMessages(boolean error), getExecutionReflect(), getBusinessReflect()

parseArchive

public boolean parseArchive(IlrRulesetArchive archive)
Parses the ruleset archive. At the end of the parsing, an executable ruleset is available. In case of errors during the parsing, the ruleset is null, and error messages are available. In the case of a business ruleset archive, two reflects take part in the parsing. If the ruleset archive is not business, only one reflect is needed. Both can be obtained after the parsing.

Parameters:
archive - The archive to be parsed.
Returns:
true if the parsing occurred without error. Otherwise, it returns false.
See Also:
getRuleset(), displayMessages(boolean error), getExecutionReflect(), getBusinessReflect()

Rule Execution Server API

© Copyright IBM Corp. 1987, 2013