public class InterpreterPool
extends java.lang.Object
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).
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BIND_NAME_DOCUMENT
Name of the "document" object when referenced by scripts
|
protected static java.util.Map |
defaultFactories
The default InterpreterFactory map.
|
protected java.util.Map |
factories
The InterpreterFactory map.
|
Constructor and Description |
---|
InterpreterPool()
Constructs a new
InterpreterPool . |
Modifier and Type | Method and Description |
---|---|
Interpreter |
createInterpreter(Document document,
java.lang.String language)
Creates a new interpreter for the specified document and
according to the specified language.
|
Interpreter |
createInterpreter(Document document,
java.lang.String language,
ImportInfo imports)
Creates a new interpreter for the specified document and
according to the specified language.
|
void |
putInterpreterFactory(java.lang.String language,
InterpreterFactory factory)
Adds for the specified language, the specified Interpreter factory.
|
void |
removeInterpreterFactory(java.lang.String language)
Removes the InterpreterFactory associated to the specified language.
|
public static final java.lang.String BIND_NAME_DOCUMENT
protected static java.util.Map defaultFactories
protected java.util.Map factories
public Interpreter createInterpreter(Document document, java.lang.String language)
document
- the document that needs the interpreterlanguage
- the scripting languagepublic Interpreter createInterpreter(Document document, java.lang.String language, ImportInfo imports)
document
- the document that needs the interpreterlanguage
- the scripting languageimports
- The set of classes/packages to import (if
the interpreter supports that).public void putInterpreterFactory(java.lang.String language, InterpreterFactory factory)
language
- the language for which the factory is registeredfactory
- the InterpreterFactory
to registerpublic void removeInterpreterFactory(java.lang.String language)
language
- the language for which the factory should be removed.Copyright © 2022 Apache Software Foundation. All Rights Reserved.