ILOG JRules User Guide > Executing Rules > Concepts > Rule Engine > The Engine Application Programming Interface (API)

The Application Programming Interface (API) manages the ruleset using a set of class libraries. The rule engine class defines the methods and fields to which the rules have access. The API controls the interaction between the rule engine, rules, and the application objects.

The deployment artifact for the rule engine is the ruleset archive. The engine provides the API to load an archive in an IlrRuleset.

images/engineexec.png

Rule Engine Classes

In ILOG JRules, the rule engine is an instance of the IlrContext class, so the rule engine is simply a Java object. This class contains all the methods required to control the rule engine.

An IlrContext is always attached to an IlrRuleset. The constructor for an IlrContext may take the form IlrContext(IlrRuleset) or IlrContext(). If the IlrContext object is created without a ruleset passed as an argument, it creates its own ruleset. The IlrRuleset class manages the rules inside the ruleset archive; IlrContext executes the rules.

An IlrContext associates a ruleset with application objects and implements the rule engine that controls the relationship between the rule part of the application and the application data. An application can contain several rule engine objects. These can be direct instances of the IlrContext class, or instances of derived classes.

A rule in ILOG JRules is represented as an object--an instance of the IlrRule class. The IlrRule class enables you to obtain information about a particular rule in the archive. It is always attached to a rule engine object.

Rule Engine Packages

The ILOG JRules class library consists of packages containing classes for different components such as EJB integration, business rule language support and database support. The ilog.rules.engine package contains the classes IlrRuleset, IlrContext, and IlrRule.

The main classes for implementing the rule engine objects are IlrRuleset and IlrContext. Rules in ILOG JRules are instances of the IlrRule class.

To facilitate the parsing of a ruleset to your application, JRules provides an interface to each ruleset. The interface describes the input parameters required to invoke the ruleset, and the output parameters that are returned by its execution. The interface is saved as a ruleset signature file that contains a description of the ruleset parameters. The interface provides a means to generate a component that implements this signature. The ruleset signature is stored inside a ruleset archive: IlrRulesetArchive. The IlrRulesetParameter class indicates if the parameter is anin, out, or inout parameter.

Related Concepts

The Rule Engine Object

Related Tasks

Executing a Ruleset Using a Native Rule Engine