Configuration API and properties

To manage engine configurations and load configuration files, you use a specific API. Configuration properties determine how a property defined for a class or interface can be used by the subclasses or implementing classes.

The rule engine is set up by a configuration resource. This resource uses the API to configure the rule engine. You define properties for the configuration classes in the same way as Java™ modifiers.

Engine configuration API

Engine configuration is managed through the API class IlrResources. An instance of this class contains the properties and their associated values. In Decision Server, each IlrReflect instance owns an IlrResources object. When an IlrReflect instance is created, it creates a new IlrResources object. Moreover, an IlrResources object can set an alternative class loader used to find the resource files. Use the IlrReflect.getResources and setResources methods to access and specify resources.

The creation of an IlrResources object loads the default resource file engine.conf that is provided in jrulesall.jar or jrules-engine.jar, in the /ilog/rules/engine directory (within the JAR file).

The engine.conf file defines the default settings of the rule engine.

Then, one of the following files is loaded:

  • The resource stream META-INF/engine.conf. You must place a non-null stream of this name in the META-INF directory of a JAR.

  • If the stream is not found, then the engine attempts to load another configuration file by using the system property ilog.rules.engine.config.file. If it is defined, the property value represents the name of a file to be loaded.

    Note:

    If the file in META-INF is found, the file supplied by the system property, if any, is ignored.

The META-INF file is well suited to Java EE. In Java EE, the Enterprise Beans or Web components are often packaged in separate JAR files. Each JAR file is deployed by a separate class loader. This approach provides a way of attaching the engine configuration along with the classes that build up the EJBs or the Web components.

The system property file is more for stand-alone applications, in which it is possible to define a system property when Java is launched. Stand-alone applications often have fewer security managers installed, providing Decision Server with the permission to load the file.

Apart from engine configuration files and system property files, Decision Server does not automatically load any other files. In Rule Designer, the link between the repository and the ruleset is made by the extractor. You can create your own extractor to manage configuration properties so as to generate the necessary IRL code. To load any other configuration files explicitly, you must use the API .

Note:

Configuration files must be loaded before any Decision Server engine API that refers to the properties defined in those files.

Configuration properties

Configuration properties can be of different types. When you define a property for some class or interface, you must also define the inheritance scheme for that property. Suppose that the property Accept_Null specifies whether some collections accept null elements. Because the property is attached to some class or interface, you must define a typology for properties so that these properties are used by the subclasses or implementing classes.

This configuration typology is borrowed from the Java modifiers and is outlined here.

Static properties

A static property is not attached to any particular class or interface. It can either be explicitly defined or assigned a default value. For example, the fact that a JVM should use a JIT is a static property.

Private class properties

When a property is specified for a class or an interface, and the property is ignored by the subclasses or implementing classes, that property is said to be a private class property. The subclasses or implementing classes must repeat the definition of that property explicitly. For example, if the property Accept_Null defined for some collection is private, it also requests that the subclasses or implementing classes be redefined explicitly.

Public class properties

A property is public when it is defined for a class or interface and used by the subclasses or implementing classes when these classes or interfaces do not define this property. A public property can be redefined by subclasses or implementing classes to supply a different value. For example, the property Accept_Null defined for a collection could be public and redefined by subclasses when needed.

Public final class properties

A property is a public final property when it is defined only once for the root class of a whole hierarchy. If the property is defined for a class, the subclasses use the property without having the capability to redefine it. If the property is defined for an interface, all the extending interfaces or implementing classes use that property without being able to redefine it. For example, the property IsANumber defined as true for the class Number cannot be changed by the subclasses of the Number class. If this property has been defined for Enumeration as false, it cannot be redefined by the extending interfaces or the implementing classes.