This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Java rule engine with rules expressed in Scheme


I am trying to write a Java rule engine application where the rules can be
expressed in scheme. The scheme script should be able to access Java
business objects. 

To present a very simple case of my problem - I have a business object
called Security that has four attributes (java bean properties):

assetClass, secType, daysToMaturity, isCashEquiv.

The goal of the scheme script is to look at the first three attributes and
then determine whether to set the isCashEquiv property to true or false. 

Therefore the three steps are:

1. Create a new Security object from Java code.
     e.g. 
       Security mySecurity = new Security("Fixed", "BOND", 200);

2. Invoke a scheme script that can examine the attributes of the Security
object and set the isCashEquiv property.
     e.g.
       //invoke scheme script that can access the mySecurity object created
above

3. Examine the isCashEquiv property (in Java code).
    e.g.
       if (mySecurity.isCashEquiv())
           System.out.println("Security is a cash equivalent.");

Can you help me and give me more details on how I can achieve this. I have
read the kawa online documentation but could not clearly find out how to do
this.

How do I invoke scheme scripts from Java? How can the script access the
mySecurity java object?

-Shoeb


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]