GATE
Version 3.1-2270

gate.util
Class Jacl

java.lang.Object
  extended by gate.util.Jacl

public class Jacl
extends Object

This class provides access to the Jacl Tcl interpreter, and caters for loading any Tcl scripts that live in the GATE source. It also serves as examples of how Tcl can be used from Java using the Jacl library (which is my excuse for those cases where there was an obvious easier way!).

Note that all GATE Tcl scripts should be in the namespace "GATE".


Constructor Summary
Jacl()
          Construction
 
Method Summary
 List findScripts()
          Locate any files named .tcl in the directory hierarchy under .
 List findScripts(String prelimScript)
          Locate any files named .tcl in the directory hierarchy under .
 tcl.lang.Interp getInterp()
          Get the interpreter
 void loadScripts()
          Loads all the scripts in the GATE source.
 void loadScripts(List scriptPaths)
          Load a list of Tcl scripts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Jacl

public Jacl()
Construction

Method Detail

getInterp

public tcl.lang.Interp getInterp()
Get the interpreter


findScripts

public List findScripts()
                 throws tcl.lang.TclException
Locate any files named .tcl in the directory hierarchy under . and return a list of them.

Throws:
tcl.lang.TclException

findScripts

public List findScripts(String prelimScript)
                 throws tcl.lang.TclException
Locate any files named .tcl in the directory hierarchy under . and return a list of them. The prelimScript parameter should be a non-null string containing Tcl code that will be evaluated before the finder script runs (so it can be used to change directory, for e.g.).

Throws:
tcl.lang.TclException

loadScripts

public void loadScripts(List scriptPaths)
                 throws tcl.lang.TclException
Load a list of Tcl scripts. The class loader is used to find the scripts, so they must be on the class path, preferably in the same code base as this class. Naming: each path in the list should be the path to the script relative to the CLASSPATH. So, for e.g., if you have MyJar.jar on the classpath, and it contains a script housed in package x.y called z.tcl, the name should be x/y/z.tcl. (The class loader can then be asked to retrieve /x/y/z.tcl and will find the file in the jar.)

Throws:
tcl.lang.TclException

loadScripts

public void loadScripts()
                 throws tcl.lang.TclException
Loads all the scripts in the GATE source. So to get a Tcl interpreter that's fully initialised with all the GATE Tcl code do:
 Jacl jacl = new Jacl();
 jacl.loadScripts();
 

Throws:
tcl.lang.TclException

GATE
Version 3.1-2270