org.apache.batik.script

Class InterpreterPool

public class InterpreterPool extends Object

A class allowing to create/query an {@link org.apache.batik.script.Interpreter} corresponding to a particular Document and scripting language.

By default, it is able to create interpreters for ECMAScript, Python and Tcl scripting languages if you provide the right jar files in your CLASSPATH (i.e. Rhino, JPython and Jacl jar files).

Field Summary
static StringBIND_NAME_DOCUMENT
Name of the "document" object when referenced by scripts
protected static MapdefaultFactories
The default InterpreterFactory map.
protected Mapfactories
The InterpreterFactory map.
Constructor Summary
InterpreterPool()
Constructs a new InterpreterPool.
Method Summary
InterpretercreateInterpreter(Document document, String language)
Creates a new interpreter for the specified document and according to the specified language.
voidputInterpreterFactory(String language, InterpreterFactory factory)
Adds for the specified language, the specified Interpreter factory.
voidremoveInterpreterFactory(String language)
Removes the InterpreterFactory associated to the specified language.

Field Detail

BIND_NAME_DOCUMENT

public static final String BIND_NAME_DOCUMENT
Name of the "document" object when referenced by scripts

defaultFactories

protected static Map defaultFactories
The default InterpreterFactory map.

factories

protected Map factories
The InterpreterFactory map.

Constructor Detail

InterpreterPool

public InterpreterPool()
Constructs a new InterpreterPool.

Method Detail

createInterpreter

public Interpreter createInterpreter(Document document, String language)
Creates a new interpreter for the specified document and according to the specified language. This method can return null if no interpreter has been found for the specified language.

Parameters: document the document that needs the interpreter language the scripting language

putInterpreterFactory

public void putInterpreterFactory(String language, InterpreterFactory factory)
Adds for the specified language, the specified Interpreter factory.

Parameters: language the language for which the factory is registered factory the InterpreterFactory to register

removeInterpreterFactory

public void removeInterpreterFactory(String language)
Removes the InterpreterFactory associated to the specified language.

Parameters: language the language for which the factory should be removed.

Copyright B) 2007 Apache Software Foundation. All Rights Reserved.