jess
Class Batch

java.lang.Object
  extended byjess.Batch
All Implemented Interfaces:
java.io.Serializable, Userfunction

public class Batch
extends java.lang.Object
implements Userfunction, java.io.Serializable

This class implements the "batch" command, and several static methods are available that you can call to load Jess code.

(C) 2005 Sandia National Laboratories

See Also:
Rete.batch(java.lang.String), Serialized Form

Constructor Summary
Batch()
           
 
Method Summary
static Value batch(java.lang.String filename, Rete engine)
          Execute a file of Jess code, either in the Jess rule language or in JessML.
static Value batch(java.lang.String filename, Rete engine, Context context)
          Execute a file of Jess code, either in the Jess rule language or in JessML.
static Value batch(java.lang.String filename, Rete engine, Context context, ErrorHandler handler)
          Execute a file of Jess code, either in the Jess rule language or in JessML.
 Value call(ValueVector vv, Context context)
          The implementation of the Jess language "batch" command, which just calls batch(java.lang.String, jess.Rete).
static java.io.PushbackReader findDocument(Rete engine, java.lang.String filename)
           
 java.lang.String getName()
          Return the name of this function.
static boolean isXMLDocument(java.io.PushbackReader fis)
          Returns true if the first character of the file is a "<".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Batch

public Batch()
Method Detail

getName

public java.lang.String getName()
Description copied from interface: Userfunction
Return the name of this function. Called once when the function is installed into a Rete engine.

Specified by:
getName in interface Userfunction
Returns:
The name of this function, as seen by the Jess language

batch

public static Value batch(java.lang.String filename,
                          Rete engine)
                   throws JessException
Execute a file of Jess code, either in the Jess rule language or in JessML. The filename will be looked for first on the file system; if it's not found, Jess will search the classpath. If Jess is used in an Applet, the applet's document base will be checked first. The code will be evaluated in the Rete object's global execution context. Any errors will terminate parsing.

Parameters:
filename - the name of a file, or a relative or absolute path
engine - the Rete object to load with the constructs from the file
Returns:
the last expression parsed
Throws:
JessException - if anything goes wrong

batch

public static Value batch(java.lang.String filename,
                          Rete engine,
                          Context context)
                   throws JessException
Execute a file of Jess code, either in the Jess rule language or in JessML. The filename will be looked for first on the file system; if it's not found, Jess will search the classpath. If Jess is used in an Applet, the applet's document base will be checked first. The code will be evaluated in the given execution context. Any errors will terminate parsing.

Parameters:
filename - the name of a file, or a relative or absolute path
engine - the Rete object to load with the constructs from the file
context - the execution context to use
Returns:
the last expression parsed
Throws:
JessException - if anything goes wrong

batch

public static Value batch(java.lang.String filename,
                          Rete engine,
                          Context context,
                          ErrorHandler handler)
                   throws JessException
Execute a file of Jess code, either in the Jess rule language or in JessML. The filename will be looked for first on the file system; if it's not found, Jess will search the classpath. If Jess is used in an Applet, the applet's document base will be checked first. The code will be evaluated in the given execution context. If any errors are encountered, the given error handler will be invoked. If the error handler rethrows the exception, parsing will terminate; otherwise parsing will continue.

Parameters:
filename - the name of a file, or a relative or absolute path
engine - the Rete object to load with the constructs from the file
context - the execution context to use
handler - notified in case of exceptions
Returns:
the last expression parsed
Throws:
JessException - if anything goes wrong

findDocument

public static java.io.PushbackReader findDocument(Rete engine,
                                                  java.lang.String filename)
                                           throws JessException,
                                                  java.io.IOException
Throws:
JessException
java.io.IOException

isXMLDocument

public static boolean isXMLDocument(java.io.PushbackReader fis)
                             throws java.io.IOException
Returns true if the first character of the file is a "<".

Parameters:
fis - the open file
Returns:
true if the file is XML
Throws:
java.io.IOException - if anything goes wrong

call

public Value call(ValueVector vv,
                  Context context)
           throws JessException
The implementation of the Jess language "batch" command, which just calls batch(java.lang.String, jess.Rete).

Specified by:
call in interface Userfunction
Parameters:
vv - the function call
context - the execution context
Returns:
the last expression parsed
Throws:
JessException - if anything goes wrong
See Also:
Value.resolveValue(jess.Context)

© 2006 Sandia Corporation