Thanks Alan,

Yes, in the interest of trimming the example, I may have trimmed too much
detail.  Let me clarify:

public class Someclass implements JessListener {
  public static Logger logger = Logger.getLogger(Someclass.class);
  private Rete engine;
  private final String cmd1 = "(batch main.clp)";
  private final String cmd2 = "(batch resolver.clp)";
  private final String cmd3 = "(batch scheduler.clp)";


  public Someclass(){
    this.engine = new Rete();
  }

  public void process() {
    engine.addJessListener(this); // Register this Someclass instance as a
JessListener
    engine.setEventMask(JessEvent.ACTIVATION); // for example.  I assume I
can include others with a bitwise OR
    engine.executeCommand(cmd1);  // run batch 1
    engine.executeCommand(cmd2);  // run batch 2
    engine.executeCommand(cmd3);  // run batch 3
    engine.reset(); // mainly to load deffacts
    engine.runUntilHalt();  // keep churning until a result is produced
  }

  public void eventHappened(JessEvent je) throws JessException {
    switch (je.getType()) {
      case JessEvent.ACTIVATION:
        Activation activation = (Activation) je.getObject();
        String ruleName = activation.getRule().getDisplayName();
          logger.info("Activation: " + ruleName
             + " was activated or deactivated.");
       break;
  // ... more code
  }
}// end class

Now, I'd expect some code like:

        Someclass objSomeclass = new Someclass();
        objSomeclass.process();

to run the Jess batches and log the various events.

You also mentioned routing the Jess output to the log files, which is also
something that I'd like to do.

I'm only familiar with passing Strings to Log4J loggers, but I see that you
can pass other objects as long as you provide a ObjectRenderer
implemetation.  So assuming that Jess's addOutputRouter() accepts any Writer
object, do you have a Renderer already coded that maps Jess STDOUT to Log4J?

Thanks again, Alan!
-JM
------------------------

Jason Morris
Morris Technical Solutions
[EMAIL PROTECTED]
www.morristechnicalsolutions.com
fax/phone: 503.692.1088

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to