Configuration file syntax

This section describes the syntax of TIBCO BusinessEvents® Extreme configuration. TIBCO BusinessEvents® Extreme configuration files must have a suffix of .kcs (Kabira Configuration Service).

Conventions

Words that are not white space, within comments, or formed with capital letters and underscores, are literal within the examples in this section. Examples include the words configuration and version and the characters { }.

Syntax

The TIBCO BusinessEvents® Extreme configuration syntax is shown below in an EBNF-like syntax. Capital letters are grammar rules, lower case strings are literal, and punctuation is literal with the following exceptions:

  • parentheses denote an optional grammar element. It may appear zero or one time.

  • parentheses followed by a plus sign denote a mandatory grammar element that may appear one or more times.

  • parentheses followed by an asterisk denote an optional grammar element that may appear zero or more times.

Example 7.7. Configuration file syntax

CONFIGURATION 
        configuration STRING 
        version STRING 
        type STRING 
        { 
                (CONFIG_BLOCK)+ 
        }; 
CONFIG_BLOCK 
        configure IDENTIFIER 
        { 
                (CONFIG_CLASS)+ | (CONFIG_BLOCK)* 
        } 
CONFIG_CLASS
        IDENTIFIER 
        { 
                (FIELD)* 
        }; 
FIELD 
        IDENTIFIER = VALUE; 
VALUE 
        PRIMITIVE_VALUE 
        | ARRAY_VALUE 
        | OBJECT_VALUE 
ARRAY_VALUE 
        { 
                (VALUE (, VALUE)*)* 
        } 
OBJECT_VALUE 
        { 
                (IDENTIFIER = VALUE;)* 
        }

Be aware of the following specific syntax features:

  • outside of quoted strings, white space (spaces, tabs, newlines, etc.) are ignored.

  • white space is preserved within quoted strings.

  • Java comments are supported.

  • a configuration file may only contain a single configuration specification.

Strings

The only string character that needs to be escaped is a double-quote - "". An un-escaped double-quote terminates a literal string. To add a double quote in a string, escape it with a back-slashes - "\". For example:

myString = "this is \"a quoted\" string";

All other back-slashes are treated as character literals.

For example:

//
//    Configuration file syntax
//
myString = "this is single quoted \'c\' entry";
myOtherString = "this is \\"a quoted\\" string";

//
//    Configuration data in memory
//
this is single quoted \'c\' entry   // myString
this is \"a quoted\" string     // myOtherString

String values are 8-bit clean, but do not support embedded null values, or multi-byte character values with embedded null values.

Definitions

These definitions are used in the section called “Syntax”.

STRING

A literal string enclosed within leading and trailing double quote characters. A string may span multiple lines.

IDENTIFIER

An unquoted string containing no white space, or a STRING. Follows the same rules as Java identifiers. IDENTIFIER is used for scope, class, field and object element names.

CONFIG_BLOCK

CONFIG_BLOCKs define the scope for the CONFIG_CLASS identifiers. There must be a configure IDENTIFIER block to define the package scope for each CONFIG_CLASS.

CONFIG_CLASS

INDENTIFIERs for a configuration class are an unscoped IDENTIFIER. A configuration class may contain zero or more FIELDs.

FIELD

An IDENTIFIER which is the unscoped name of the configuration value. Fields may appear in any order within a configuration class. It is an error to specify the same field more than once. A field value may be a simple value, an array value or an object value.

OBJECT_VALUE

An IDENTIFIER which is the unscoped name of an object element.

VALUE

Initialization data for a field. The value must match the type of the field it is being applied to.

Values fall into three categories, primitive values, array values, and object values. A primitive value is one of the following:

  • String - multi-byte clean, string literals that are loaded without any conversion.

  • Long - Decimal, hexadecimal, and octal representations using Java conventions. A negative number must be indicated with a leading "-".

  • Boolean - true/false and TRUE/FALSE.

  • Enumerations - Scoped name of an enumeration value. The scope is either a fully scoped package name or the enumeration name.

    package my.enum.test;
    
    import com.kabira.platform.kcs.Configuration;
    
    enum Numbers
    {
        ONE,
        TWO,
        THREE
    }
    
    public class SomeClass extends Configuration
    {
        public Numbers      myNumbers;
    }
    
    
    configuration "myconfiguration" version "1.0" type "enumtest"
    {
            configure my.enum.test
            {
                    SomeClass
                    {
                            //
                            // Package scoped enumeration
                            //
                            myNumbers = my.enum.test.Numbers.ONE;
                    };
                    SomeClass
                    {
                            //
                            // Enumeration name scoping
                            //
                            myNumbers = Numbers.ONE;
                    };
            };
    };
  • Date - A string with a format of Y-M-D T where:

    • Y is the year, including a century, expressed as a decimal number, e.g. 2011.

    • M is the month expressed as a decimal number from 01 to 12, e.g. 12 for December.

    • D is the day of the month expressed as a decimal number from 01 to 31, e.g. 04.

    • T is the time expressed as H:M:S where H is a decimal number between representing a 24 hour clock from 00 to 23, M is the minute expressed as a decimal number from 00 to 59, and S is the second expressed as a decimal number from 00-60, e.g. 11:05:23.

  • Byte - A single character represented using supported Java character constant syntax (e.g. 'a' or '\n'). Or an unsigned value between 0 and 255.

An array value is a comma-separated list, within curly braces. The final element of the list does not have a trailing comma.

FIELD = { “red”, “green”, “yellow” };

Arrays may be of primitive types, objects, or arrays.

An object value is enclosed in curly braces, and has individual object element names.

FIELD = 
{ 
        ELEMENT_NAME = VALUE; 
        ELEMENT_NAME = VALUE; 
};

Objects may contain elements of primitive types, arrays, or objects.

Example

Here is a simple sample configuration file:

Example 7.8. Configuration file example

configuration "simple config" version "1.2A" type "simple" 
{
    // a CONFIG_BLOCK
    configure simple.name
    {
        // a CONFIG_CLASS
        Person 
        {
            // string FIELD
            name = "Sir Raleigh Walter";

            // Long FIELD
            age = 42;

            //  Boolean FIELD
            lactoseIntolerant = false; 
        }; 
    };

    // another CONFIG_BLOCK
    configure popmusic.bands
    {
        // a CONFIG_CLASS
        Band 
        {
            // String FIELD
            bandName = "The Beatles";

            // A ARRAY_VALUE of OBJECT_VALUEs 
            bandMembers = 
            {
                // A OBJECT_VALUE
                { 
                    name = "John Lennon"; 
                    instrument = Guitar; 
                },
 
                // Another OBJECT_VALUE
                { 
                    name = "Paul McCartney"; 
                    instrument = Bass; 
                },

                // Yet another OBJECT_VALUE
                { 
                    name = "George Harrison"; 
                    instrument = Guitar; 
                },

                // The last OBJECT_VALUE
                { 
                    name = "Ringo Starr";
                    instrument = Drums; 
                } 
            };

            // A ARRAY_VALUE of Strings
            songList = 
            { 
                "Hey Bulldog", 
                "Only a Northern Song", 
                "All Together Now" 
            }; 
        }; 
    };
};