jess
Class Main

java.lang.Object
  extended byjess.Main
All Implemented Interfaces:
java.util.Observer

public class Main
extends java.lang.Object
implements java.util.Observer

An interactive interface for Jess. The main() method uses this class to implement a command-line interface. The Main class is also displayed graphically by the jess.ConsolePanel.

(C) 2005 Sandia National Laboratories


Constructor Summary
Main()
           
 
Method Summary
 void execute(boolean doPrompt)
          Repeatedly parse and excute commands, from location determined during initialize().
 Main initialize(java.lang.String[] argv, Rete r)
          Set a Main object up for later execution.
 boolean isRunning()
          Returns true until the debugger is commanded to exit.
static void main(java.lang.String[] argv)
          Starts Jess as a command-line application.
 void setDebugMode(int debugPort, int eventPort)
          Starts a debug server on the given ports.
 void showLogo()
          Display the Jess startup banner on the Rete object's standard output.
 void update(java.util.Observable o, java.lang.Object arg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Main

public Main()
Method Detail

main

public static void main(java.lang.String[] argv)
Starts Jess as a command-line application. Create an instance of jess.Main and jess.Rete, calls Main.initialize() with this method's arguments, then calls Main.execute().

Parameters:
argv - command-line arguments
See Also:
initialize(String[], Rete), execute(boolean)

showLogo

public void showLogo()
Display the Jess startup banner on the Rete object's standard output. It will look something like

 Jess, the Rule Engine for the Java Platform
 Copyright (C) 2005 Sandia Corporation
 Jess Version 7.0 8/1/05
 


initialize

public Main initialize(java.lang.String[] argv,
                       Rete r)
Set a Main object up for later execution. Can take a filename argument preceded by the following flags: -nologo, which surpresses the logo; -stacktrace, which produces full stack traces on error; -warnings, which tells the Jess parser to report warnings as well as errors; -exit, which forces the program to exit at the first error; and -debugPorts, which should be followed by two numbers representing the TCP ports which this application should listen on for debugger comments and send events, respectively.

Parameters:
argv - Command-line arguments
r - an initialized Rete object, with routers set up
Returns:
this object

setDebugMode

public void setDebugMode(int debugPort,
                         int eventPort)
Starts a debug server on the given ports. Commands are accepted on the debug port, and events are sent to the event port.

Parameters:
debugPort - the source for debug commands
eventPort - the sink for debugger events

execute

public void execute(boolean doPrompt)
Repeatedly parse and excute commands, from location determined during initialize().

Parameters:
doPrompt - True if a prompt should be printed, false otherwise. Prompts will never be printed during a (batch) command.

isRunning

public boolean isRunning()
Returns true until the debugger is commanded to exit.

Returns:
true until the debug server is exiting

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Specified by:
update in interface java.util.Observer

© 2006 Sandia Corporation