javax.script
Class ScriptEngineManager

java.lang.Object
  extended by javax.script.ScriptEngineManager

public class ScriptEngineManager
extends Object

See Javadoc of Java Scripting API


Constructor Summary
ScriptEngineManager()
          Constructs a ScriptEngineManager and initializes it using the current context classloader.
ScriptEngineManager(ClassLoader loader)
          Constructs a ScriptEngineManager and initializes it using the specified classloader.
 
Method Summary
 Object get(String key)
          Retrieves the associated value for the spefied key in the GLOBAL_SCOPE
 Bindings getBindings()
          Retrieves the bindings corresponds to GLOBAL_SCOPE.
 ScriptEngine getEngineByExtension(String extension)
          Retrieves a new instance of a ScriptingEngine for the specified extension of a script file.
 ScriptEngine getEngineByMimeType(String mimeType)
          Retrieves new instance the ScriptingEngine for a specifed MIME type.
 ScriptEngine getEngineByName(String shortName)
          Retrieves a new instance of a ScriptEngine the specified descriptive name.
 List getEngineFactories()
          Retrieves an array of instances of ScriptEngineFactory class which are found by the discovery mechanism.
 void put(String key, Object value)
          Associates the specifed value with the specified key in GLOBAL_SCOPE.
 void registerEngineExtension(String extension, ScriptEngineFactory factory)
          Register a extension with a ScriptEngineFactory.
 void registerEngineMimeType(String mimeType, ScriptEngineFactory factory)
          Registers a MIME type with a ScriptEngineFactory.
 void registerEngineName(String name, ScriptEngineFactory factory)
          Registers descriptive name with a ScriptEngineFactory.
 void setBindings(Bindings bindings)
          Sets the GLOBAL_SCOPE value to the specified bindings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptEngineManager

public ScriptEngineManager()
Constructs a ScriptEngineManager and initializes it using the current context classloader.


ScriptEngineManager

public ScriptEngineManager(ClassLoader loader)
Constructs a ScriptEngineManager and initializes it using the specified classloader.

Parameters:
loader - the classloader to use (may be null)
Method Detail

get

public Object get(String key)
Retrieves the associated value for the spefied key in the GLOBAL_SCOPE

Parameters:
key - the associated key of the value stored in the GLOBAL_SCOPE
Returns:
the value associated with the specifed key

getEngineByExtension

public ScriptEngine getEngineByExtension(String extension)
Retrieves a new instance of a ScriptingEngine for the specified extension of a script file. Returns null if no suitable ScriptingEngine is found.

Parameters:
extension - the specified extension of a script file
Returns:
a new instance of a ScriptingEngine which supports the specified script file extension
Throws:
NullPointerException - if extension is null

getEngineByMimeType

public ScriptEngine getEngineByMimeType(String mimeType)
Retrieves new instance the ScriptingEngine for a specifed MIME type. Returns null if no suitable ScriptingEngine is found.

Parameters:
mimeType - the specified MIME type
Returns:
a new instance of a ScriptingEngine which supports the specified MIME type
Throws:
NullPointerException - if mimeType is null

getEngineByName

public ScriptEngine getEngineByName(String shortName)
Retrieves a new instance of a ScriptEngine the specified descriptive name. Returns null if no suitable ScriptEngine is found.

Parameters:
shortName - the short name of the engine
Returns:
a new instance of a ScriptEngine which supports the specifed name
Throws:
NullPointerException - - if shortName is null

getEngineFactories

public List getEngineFactories()
Retrieves an array of instances of ScriptEngineFactory class which are found by the discovery mechanism.

Returns:
a list of all discovered ScriptEngineFactory instances

getBindings

public Bindings getBindings()
Retrieves the bindings corresponds to GLOBAL_SCOPE.

Returns:
the bindings of GLOBAL_SCOPE

put

public void put(String key,
                Object value)
Associates the specifed value with the specified key in GLOBAL_SCOPE.

Parameters:
key - the associated key for specified value
value - the associated value for the specified key
Throws:
NullPointerException - if key is null
IllegalArgumentException - if key is the empty String

registerEngineExtension

public void registerEngineExtension(String extension,
                                    ScriptEngineFactory factory)
Register a extension with a ScriptEngineFactory. It overrides any such association discovered previously.

Parameters:
extension - the extension associated with the specified ScriptEngineFactory class
factory - the ScriptEngineFactory associated with the specified extension
Throws:
NullPointerException - if any of the parameters is null

registerEngineName

public void registerEngineName(String name,
                               ScriptEngineFactory factory)
Registers descriptive name with a ScriptEngineFactory. It overrides any associations discovered previously.

Parameters:
name - a descriptive name associated with the specifed ScriptEngineFactory class
factory - the ScriptEngineFactory associated with the specified descriptive name
Throws:
NullPointerException - if any of the parameters is null

registerEngineMimeType

public void registerEngineMimeType(String mimeType,
                                   ScriptEngineFactory factory)
Registers a MIME type with a ScriptEngineFactory. It overrides any associations discovered previously.

Parameters:
mimeType - the MIME type associated with specified ScriptEngineFactory class
factory - the ScriptEngineFactory associated with the specified MIME type
Throws:
NullPointerException - if any of the parameters is null

setBindings

public void setBindings(Bindings bindings)
Sets the GLOBAL_SCOPE value to the specified bindings.

Parameters:
bindings - the bindings to be stored in GLOBAL_SCOPE
Throws:
IllegalArgumentException - if bindings is null


Copyright © 1999-2012 The Apache Software Foundation. All Rights Reserved.