Configuration resource

A configuration resource is a file, a reader, or a stream. The engine loads it to pass property values to the execution process.

To configure the execution engine, you can use a configuration resource. A configuration resource can be a file, named engine.conf. The rule engine systematically looks for the engine.conf file and, if it finds it, loads it and passes the values that it contains to the execution process. The configuration resource can also be a reader or a stream.

The following example shows a simple configuration resource file:

node meta
{
  element name = "java.lang";
};

node java.lang.String
{
  element useIntern = true;
  element maxHashCharacters = 24;
  element paddingCharacter = '#';
};

This file is written in the true syntax of the engine configuration format. The configuration file contains properties grouped in blocks, starting with node. A node can in turn contain leaf elements and child nodes. The full property names are formed by the concatenation of all the names in the path of the property.

The following table describes the properties defined in the example above.

Property name Value Type
meta.name java.lang String
java.lang.String.useIntern true boolean
java.lang.String.maxHashCharacters 24 int
java.lang.String.paddingCharacter # char

How these properties are used depends on the specific code. In the example, you could develop a string manipulation algorithm to take these properties into account.

Each time a string is created, it is interned because the useIntern property is set to true. The property base name useIntern is predefined. The full property name is then obtained by concatenating the class name of String and the property base name.

In the same way, the algorithm hashes a String object using its first 24 characters at most. This is determined by the maxHashCharacters property .

The property meta.name is not designed to be used by the algorithms. A metanode provides identification information about a property file. When this file is read, the value of the meta.name property is kept. This way, the resource file is marked as read.

The configuration resource file has the following characteristics: