| java.lang.Object tcl.lang.Extension
All known Subclasses: test.tjc.TJCExtension, tcl.lang.JavaTestExtension, tcl.lang.BlendExtension, tests.javaload.Test1Extension, tcl.lang.TclParserExtension, test.tjcext.TJCExtension, itcl.lang.ItclExtension,
Extension | abstract public class Extension (Code) | | Base class for all Tcl Extensions. A Tcl Extension defines a set of
commands that can be loaded into an Interp as a single unit.
When a Tcl Extension is loaded into an Interp, either statically
(using the "new" operator inside Java code) or dynamically (using
the java::load command in Tcl scripts), it usually creates a set of
commands inside the interpreter. Occasionally, loading an Extension
may lead to additional side effects. For example, a communications
Extension may open network connections when it's loaded. Please
refer to the documentation of the specific Extension for details.
|
Constructor Summary | |
public | Extension() Default constructor. |
Method Summary | |
abstract public void | init(Interp interp) Initialize the Extension to run in a normal (unsafe)
interpreter. | final public static void | loadOnDemand(Interp interp, String cmdName, String clsName) Create a stub command which autoloads the real command the first time
the stub command is invoked. | public void | safeInit(Interp safeInterp) Initialize the Extension to run in a safe interpreter. |
Extension | public Extension()(Code) | | Default constructor. Does nothing. The purpose of this
constructor is to make sure instances of this Extension can be
loaded dynamically using the "java::load" command, which calls
Class.newInstance().
|
init | abstract public void init(Interp interp) throws TclException(Code) | | Initialize the Extension to run in a normal (unsafe)
interpreter. This usually means creating all the commands
provided by this class. A particular implementation can arrange
the commands to be loaded on-demand using the loadOnDemand()
function.
Parameters: interp - current interpreter. |
loadOnDemand | final public static void loadOnDemand(Interp interp, String cmdName, String clsName)(Code) | | Create a stub command which autoloads the real command the first time
the stub command is invoked. Register the stub command in the
interpreter.
Parameters: interp - current interp. Parameters: cmdName - name of the command, e.g., "after". Parameters: clsName - name of the Java class that implements this command,e.g. "tcl.lang.AfterCmd" |
safeInit | public void safeInit(Interp safeInterp) throws TclException(Code) | | Initialize the Extension to run in a safe interpreter. This
method should be written carefully, so that it initializes the
safe interpreter only with partial functionality provided by
the Extension that is safe for use by untrusted code.
The default implementation always throws a TclException, so that
a subclass of Extension cannot be loaded into a safe interpreter
unless it has overridden the safeInit() method.
Parameters: safeInterp - the safe interpreter in which the Extension shouldbe initialized. |
|
|