The Java Rule-Engine API

Considering that rule-based programming offers such benefits for enterprise systems development, it should be no surprise that the Java Community Process instigated a JSR on the subject. JSR-94 covers the integration of rule-engine technology into the J2SE platform, and its existence highlights that rule-engine technology is more than just an academic exercise where commercial systems are concerned.

The need for JSR-94 arose from the proprietary nature of rule-engine vendor APIs. Currently, rule-engine vendors each offer their own proprietary interfaces for integrating their particular rule engines into Java applications. Due to the lack of a suitable standard, a diverse range of rule-engine interfaces has resulted. Software engineers must learn each vendor's API and rewrite application code should they wish to migrate between different rule-engine products.

In order to address this problem, JSR-94 defines javax.rules, a lightweight API that looks to standardize access to rule engines from Java. Although the JSR specifies the J2SE platform, it is relevant for use in the J2EE environment.

The javax.rules API detailed in the JSR employs an approach similar to that of the JDBC API, whereby the client communicates via a standard interface with a vendor-supplied rule-service provider. The following code snippet is taken from JSR-94 and illustrates this approach:

 Class.forName(""); RuleServiceProvider serviceProvider =   RuleServiceProviderManager.getRuleServiceProvider(     ""); 

The use of the javax.rules API is intended to provide compile-time compatibility between rule engines. Runtime compatibility, however, is not accommodated because the JSR does not encompass the definition of the rule language's semantics. Consequently, while code written with javax.rules compiles against any rule-engine provider compliant with the JSR, the implementation of the rules themselves likely will need to be migrated according to each rule engine's language.

JSR-94 has been approved and is available for download from

The reference implementation bundled with the JSR is implemented as a wrapper over Jess, which operates as the driver for the rule-service provider. An example application comes with the JSR but requires the installation of a current jess.jar. The full details for building and running the example are provided with the JSR.

    Rapid J2EE Development. An Adaptive Foundation for Enterprise Applications
    Rapid J2EEв„ў Development: An Adaptive Foundation for Enterprise Applications
    ISBN: 0131472208
    EAN: 2147483647
    Year: 2005
    Pages: 159
    Authors: Alan Monnox © 2008-2017.
    If you may any questions please contact us: