Hammurapi Rules features a JCA Resource Adapter. With the adapter, rule engine can be easily integrated in J2EE environment. Here we will show how to integrate family relationships inference into a web application on Apache Geronimo J2EE Application server. Once integrated, relationship inference could be another service provided by the application server. This new service could be used by multiple applications. Inference services can be used for:
This example demonstrate the Rule engine integration with JEE Application server through JCA resource adapter. JCA 1.5 resource adapter integrates backward and forward reasoning into J2EE environment. This example demonstrate Forward reasoning through outbound connection.Although this resource adapter can be deployed to any application server(which supports JCA 1.5), Apache Geronimo 2.1.4 is used for demonstration purpose.
The picture above shows dependencies between solution components.
As you can see from the dependency graph, the object model and the rules specification shall be loaded by a classloader which is shared (e.g. parent classloader) by the web application and the resource adapter.
As you can see from the dependency diagram, neither the client, nor the adapter depend on the rule set classes. Each managed session has its own classloader which loads rule classes. Therefore, when there is a change in the rule set, it will be picked up by the application server at the time of creation of a new managed connection (backing rule session). Applications servers (at least some of them) allow to specify connections refresh time interval so they don't get stale. Also (some) application servers allow to forcibly clear connection pools. If you use one of such application severs, you won't have to restart it after you make changes in rule sets. Changes will be picked up without interruption of operation either after the connection refresh interval, or after the connection pool cleanup.
com.hammurapi.reasoning.ra.rar file from the installation using geronimo-ra.xml deployment plan (Show me!).FamilyTies.war, the deployment shall have the tutorial object model and the rar file in its dependencies (Show me!).