advertisement
javaboutique
Search Tips
Articles  |   Tutorials  |   Reviews  |   Tools  |   by Category  |   by Date  |   by Name  |   Submit  |   Source  |   Forums  |  
javaboutique
Browse DevX


Partners & Affiliates











advertisement

Tutorials : A Closer Look at the Java Rules Engine API (JSR 94) :

A Closer Look at the Java Rules Engine API (JSR 94)

by Benoy Jose

Introduction

The most frustrating part of a project is change and the sad reality is that change is inevitable. I cannot think of any project that was built the way it was originally designed without any changes made to the original. The problem of change becomes more evident in complex projects involving a lot of business logic, which keeps changing based on external circumstances. Sometimes the business rules have changed even before the project goes into production causing untold, mass rework to accommodate the changes. A good example is the insurance industry, new laws or market economics force changes, which cannot be foreseen and planned for during design. The solution for a dynamic environment like the above is to have a rules engine. Rule engines allow the business users to change rules without affecting the overall running of an application. The rules are defined separately from the application, and the logic to deal with the rules is built in during design. The rule engine takes care of applying the rules and the associated actions on the rules.

Now that we realize that there could be a need to have a rules engine to cater to changing business needs the problem is to choose one. Just like application servers and other softwares there are numerous rule engines in the market (Jrules, Ilog, JESS to name a few). Some of the factors that might have deterred companies from implementing a rules engine could be cost, lack of standards and compatibility with the existing frameworks. Most of these rule engines are proprietary and have their own proprietary APIs, which makes them less flexible to integrate with external applications. So a decision to abandon a particular product and pick another one would mean rewriting most if not all of the application code including application logic and API calls. Also, the cost of some of these rule engines could be cost-prohibitive. Another aspect worth noting is the lack of standards in the rule engine industry. JSR 94 is an attempt to standardize rule engine implementations for the Java language. The specification defines guidelines to provide a common API for use in rule engines. The JSR only provides guidelines for the rule administration APIs and rule runtime APIs. It does not define any guidelines for how the rules and actions need to be defined and what language will be used to define the rules. It does not provide technical guidelines on how the rule engine would read and evaluate rules. The specification leaves all the above questions to the discretion of the vendor implementing the rules engine.

Architecture

The architecture of the Rules Engine Specification is divided into two main sections, the Runtime client API and the rules administration API. Rules. The administrator API has classes to load rules and their associated actions as execution sets. It also maintains them. Rules can be loaded from external resources like URIs, Input streams, XML streams and readers. The administrator API provides for registering and de-registering execution sets and doing other maintenance functions on execution sets. The Administrative API is defined in the javax.rules.admin package of the Rules Engine API. Defining the rules using the admin package helps to control the access and running of rules by clients. The admin package can help to define the permissions on execution sets so that unauthorized users would be denied access to some controlled rules.

The Runtime API provides classes and methods to rule engine clients so that they can run the rules and get results. The rules registered using the rules admin API are the only rules accessible to the runtime clients. The Runtime API helps runtime users to acquire rule sessions and execute rules within the session. The methods and classes of the Runtime API are defined in the javax.rules package.

How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.

XML error: undefined entity at line 19
advertisement
Receive Articles via our XML/RSS feed
Receive Articles via our XML/RSS feed

JavaBytes
Internet Cyclone
This powerful, easy-to-use, internet optimizer is for Windows 95, 98, ME, NT, 2000 and XP. It's designed to automatically optimize your Windows settings, boosting your Internet connection up to 200%.

Linux Vendors Head to the Cloud in Search of Cash
iPhone 3GS: Overheating Fears, OS Update Nears
PostgreSQL 8.4 Revs Up Database Admin, Security
PHP 5.3 Accelerates PHP
Sun Releases NetBeans 6.7 IDE for Java, PHP
Why Firefox Doesn't Take Google Chrome Features
First Major PHP Update in Years Coming Soon
Red Hat CEO Calls on Oracle to Keep Java Open
Google Widens AdSense for iPhone, Android Apps
Eclipse Galileo Releases 33 Open Source Projects

A Taste of JavaFX for the Uninitiated
A Guide to Caching and Compression for High Performance Web Applications
How User-Centered Design Can Put User Stories in Proper Context
Explore C# 4's New Dynamic Types and Named/Optional Parameters
Enterprise Architecture: The Journey Begins Here, Part 2
Create a Syslog Sender/Receiver Using the MS Winsock Control
AMD CodeAnalyst Helps Developers Optimize and Tune Applications
Securing Microsoft's Cloud Infrastructure
Introducing the Azure Services Platform
An Introduction to Microsoft .NET Services for Developers

Advertising Info  |   Member Services  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs