Rule Execution Server API

ilog.rules.archive
Class IlrRulesetArchive

java.lang.Object
  extended by ilog.rules.archive.IlrRulesetArchive
All Implemented Interfaces:
Serializable

public class IlrRulesetArchive
extends Object
implements Serializable

Model of a ruleset archive. The archive contents are managed by a content manager.

Since:
JRules 6.0
See Also:
IlrRulesetArchiveBuilderBase, IlrRulesetArchiveBuilder, IlrRulesetArchiveParser, Serialized Form

Nested Class Summary
 class IlrRulesetArchive.Element
          Model of an archive element.
static class IlrRulesetArchive.RulesetArchiveException
          The class of the exception obtained when a problem occurs during the construction or parsing of a ruleset archive.
 
Field Summary
static int B2X
          A constant used to type an archive element as an element that contains a mapping between a business object model and an executable object model.
static int BOM
          A constant used to type an archive element as an element that contains a business object model.
static int ENGINE_CONF
          A constant used to type an archive element as an element that contains an engine configuration file.
static int GENERATED
          A constant used to type an archive element as an element whose content has been generated by the archive builder.
static int IRL
          A constant used to type an archive element as an element that contains IRL code.
static int MISC
          A constant used to type an archive element as an element that contains miscellaneous data.
static int USER_DATA
          A constant used to type an archive element as an element that contains user data.
static String VARIABLES
          The base name of the IRL element that contains the variables declaration for a given package.
static int WSDL
          A constant used to type an archive element as an element that contains a WSDL.
static int XOM
          A constant used to type an archive element as an element that contains an executable object model.
static int XSD
          A constant used to type an archive element as an element that contains an XSD.
 
Constructor Summary
IlrRulesetArchive()
          Creates an empty ruleset archive based on UTF-8 encoding.
IlrRulesetArchive(String encoding)
          Creates an empty ruleset archive based on the given encoding.
 
Method Summary
 boolean compare(IlrRulesetArchive archive)
          Compares two ruleset archives to determine if they have the same content.
static IlrRulesetArchive extractArchive(IlrRulesetArchiveLoader loader)
          Obtains a ruleset archive object filled from the archive given through the archive loader.
 String getContent(String entryName)
          Returns the contents of an archive element as a string.
 IlrRulesetArchive.Element getElement(String key)
          Returns the element in the archive whose name is specified by the parameter.
 Collection getElements()
          Returns the elements that compose the archive.
 Collection getElements(int kind)
          Returns the elements of a given type contained in the archive.
 String getEncoding()
          Returns the encoding used in the archive.
 String getIRL(String pkgName, String artifactName)
          Returns the IRL code stored in the archive for the specified artifact name and package.
 String getRulesetSignature()
          Returns the part of the descriptor that contains the ruleset signature, in XML.
 Object getSchema(String namespace, String name)
          Returns a schema as an input stream or a URL depending on what is present inside the archive.
 Map getSchemaNames(boolean onlyContained)
          Returns a map that associates to a namespace all the schema's file names declared or contained inside this archive.
 String getXmlEncoding()
          Returns the encoding used for the XML parts in the archive.
 boolean isBusiness()
          Indicates whether the archive is a business archive or not.
 boolean isBusinessDataXmlServiceEnable()
          Allows you to determine if this ruleset archive parsed will produce a ruleset that could have parameters set with XML BOM objects.
 void reset()
          Resets the archive.
 void setBusinessDataXmlServiceEnable(boolean businessDataXmlServiceEnable)
          Enables the use of XML BOM objects as parameters on the ruleset resulting from the parsing of this ruleset archive.
 void write(JarOutputStream jarOutputStream)
          Writes the ruleset archive contents in the given jar stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VARIABLES

public static final String VARIABLES
The base name of the IRL element that contains the variables declaration for a given package.

See Also:
Constant Field Values

IRL

public static final int IRL
A constant used to type an archive element as an element that contains IRL code. Its value is 0.

See Also:
Constant Field Values

BOM

public static final int BOM
A constant used to type an archive element as an element that contains a business object model. Its value is 1.

See Also:
Constant Field Values

B2X

public static final int B2X
A constant used to type an archive element as an element that contains a mapping between a business object model and an executable object model. Its value is 2.

See Also:
Constant Field Values

XOM

public static final int XOM
A constant used to type an archive element as an element that contains an executable object model. Its value is 3.

See Also:
Constant Field Values

ENGINE_CONF

public static final int ENGINE_CONF
A constant used to type an archive element as an element that contains an engine configuration file. Its value is 4.

See Also:
Constant Field Values

USER_DATA

public static final int USER_DATA
A constant used to type an archive element as an element that contains user data. Its value is 5.

See Also:
Constant Field Values

XSD

public static final int XSD
A constant used to type an archive element as an element that contains an XSD. Its value is 6.

See Also:
Constant Field Values

WSDL

public static final int WSDL
A constant used to type an archive element as an element that contains a WSDL. Its value is 7.

See Also:
Constant Field Values

MISC

public static final int MISC
A constant used to type an archive element as an element that contains miscellaneous data. Its value is 8.

See Also:
Constant Field Values

GENERATED

public static final int GENERATED
A constant used to type an archive element as an element whose content has been generated by the archive builder. Its value is 20.

See Also:
Constant Field Values
Constructor Detail

IlrRulesetArchive

public IlrRulesetArchive(String encoding)
Creates an empty ruleset archive based on the given encoding. The archive contents are stored in memory.

Parameters:
encoding - The encoding used to store the archive contents.

IlrRulesetArchive

public IlrRulesetArchive()
Creates an empty ruleset archive based on UTF-8 encoding. The archive contents are stored in memory.

Method Detail

getElements

public Collection getElements()
Returns the elements that compose the archive.

Returns:
A collection of archive elements.

reset

public void reset()
Resets the archive.


getEncoding

public String getEncoding()
Returns the encoding used in the archive.

Returns:
The archive encoding.

getXmlEncoding

public String getXmlEncoding()
Returns the encoding used for the XML parts in the archive.

Returns:
The XML encoding.

getElements

public Collection getElements(int kind)
Returns the elements of a given type contained in the archive. The possible values for the kind are: IRL, BOM, B2X, XOM, XSD, WSDL, USER_DATA, ENGINE_CONF, MISC

Parameters:
kind - The type of the required elements.
Returns:
A collection that contains the archive elements of a certain type.

getRulesetSignature

public String getRulesetSignature()
Returns the part of the descriptor that contains the ruleset signature, in XML.

Returns:
A string that represents the ruleset signature in XML format.

getSchema

public Object getSchema(String namespace,
                        String name)

Returns a schema as an input stream or a URL depending on what is present inside the archive.

Parameters:
namespace - schema's namespace
name - schema's file name.
Returns:
null if nothing matches, or an input stream or a URL depending on what is contained inside the archive.
See Also:
IlrRulesetArchiveBuilderBase.addSchema(String, String, java.io.InputStream), IlrRulesetArchiveBuilderBase.addSchema(String, String, java.net.URL)

getSchemaNames

public Map getSchemaNames(boolean onlyContained)

Returns a map that associates to a namespace all the schema's file names declared or contained inside this archive.

Parameters:
onlyContained - true if only the schema contained inside this archive should be considered
Returns:
the map that associates the namespace to schema names.
See Also:
IlrRulesetArchiveBuilderBase.addSchema(String, String, java.net.URL), IlrRulesetArchiveBuilderBase.addSchema(String, String, java.io.InputStream)

getElement

public IlrRulesetArchive.Element getElement(String key)
Returns the element in the archive whose name is specified by the parameter.

Parameters:
key - The name of the element we are looking for.
Returns:
The element in the archive whose name is equal to the parameter, or null if there is no such element in the archive.

isBusiness

public boolean isBusiness()
Indicates whether the archive is a business archive or not.

A business archive contains business object models, with the IRL based on these models. Translations can be provided to move from the business model to the execution model. If no translation is given, an implicit one-to-one mapping is applied.

Returns:
true if the archive is a business archive, else it returns false.

write

public void write(JarOutputStream jarOutputStream)
           throws IOException
Writes the ruleset archive contents in the given jar stream. The XML-generated parts of the archive are stored with the UTF-8 encoding. The archive contents given by the user are stored with the encoding specified for the archive. By default, the encoding is UTF-8. It is the responsibility of the user to close the given stream.

Throws:
IOException
Parameters:
jarOutputStream - The stream in which the archive is persisted.

compare

public boolean compare(IlrRulesetArchive archive)
Compares two ruleset archives to determine if they have the same content.

Parameters:
archive - The archive to compare with this.
Returns:
true if the archives have the same content, else it returns false.

extractArchive

public static IlrRulesetArchive extractArchive(IlrRulesetArchiveLoader loader)
Obtains a ruleset archive object filled from the archive given through the archive loader. The archive contents are stored in memory.

Parameters:
loader - The loader in charge of archive loading.
Returns:
The ruleset archive object filled from the source archive managed by the loader.

getIRL

public String getIRL(String pkgName,
                     String artifactName)
Returns the IRL code stored in the archive for the specified artifact name and package. To get the package variables declaration, use the artifact name of IlrRulesetArchive.VARIABLES.

Parameters:
pkgName - The name of the package given when the artifact was inserted in the archive.
artifactName - The name of the artifact given when the artifact was inserted in the archive.
Returns:
The IRL code of the specified artifact.

getContent

public String getContent(String entryName)
Returns the contents of an archive element as a string.

Parameters:
entryName - The name of the element whose contents are to be returned.
Returns:
The contents of the element whose name is given. It returns null if no such element is found in the archive.

isBusinessDataXmlServiceEnable

public boolean isBusinessDataXmlServiceEnable()
Allows you to determine if this ruleset archive parsed will produce a ruleset that could have parameters set with XML BOM objects.

Returns:
true if XML BOM objects could be passed to the parsed ruleset.

setBusinessDataXmlServiceEnable

public void setBusinessDataXmlServiceEnable(boolean businessDataXmlServiceEnable)
Enables the use of XML BOM objects as parameters on the ruleset resulting from the parsing of this ruleset archive.

Parameters:
businessDataXmlServiceEnable -

Rule Execution Server API

© Copyright IBM Corp. 1987, 2013