### javax.script

# Class ScriptEngineManager

- `java.lang.Object`

- `javax.script.ScriptEngineManager`

`public class ScriptEngineManager`
`extends java.lang.Object`

ScriptEngineManager implements a discovery and instantiation mechanisams for ScriptEngine class. It also contains a collection of key-value pairs which storing state shared by all engines created by manager. Nandika Jayawardana <nandika@opensource.lk> Sanka Samaranayake <sanka@opensource.lk>

## Constructor Summary

`ScriptEngineManager()`
  Constructs ScriptEngineManager and initializes it.

## Method Summary

`java.lang.Object`

`get(java.lang.String key)`
  Retrieves the associated value for the spefied key in the GLOBAL_SCOPE

`ScriptEngine`

`getEngineByExtention(java.lang.String extension)`
  Retrieves a new instance of a ScriptingEngine for the specified extension of a scirpt file.

`ScriptEngine`

`getEngineByMimeType(java.lang.String mimeType)`
  Retrieves new instance the ScriptingEngine for a specifed MIME type.

`ScriptEngine`

`getEngineByName(java.lang.String name)`
  Retrieves a new instance of a ScriptEngine the specified descriptieve name.

`ScriptEngineFactory[]`

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

`Bindings`

`getNameSpace()`
  Retrieves the namespace corresponds to GLOBAL_SCOPE.

`void`

`put(java.lang.String key, java.lang.Object value)`
  Associates the specifed value with the specified key in GLOBAL_SCOPE.

`void`

`registerEngineExtension(java.lang.String extension, java.lang.Class factory)`
  Register a extension with a ScriptEngineFactory class.

`void`

`registerEngineMimeType(java.lang.String mimeType, java.lang.Class factory)`
  Registers a MIME type with a ScriptEngineFactory class.

`void`

`registerEngineName(java.lang.String name, java.lang.Class factory)`
  Registers descriptive name with a ScriptEngineFactory class.

`void`

`setNamespace(Bindings namespace)`
  Sets the GLOBAL_SCOPE value to the specified namespace.

### Methods inherited from class java.lang.Object

`equals`, `getClass`, `hashCode`, `notify`, `notifyAll`, `toString`, `wait`, `wait`, `wait`

## Constructor Details

### ScriptEngineManager

    public ScriptEngineManager()

> Constructs ScriptEngineManager and initializes it.

## Method Details

### get

    public java.lang.Object get(java.lang.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

### getEngineByExtention

    public ScriptEngine getEngineByExtention(java.lang.String extension)

> Retrieves a new instance of a ScriptingEngine for the specified extension of a scirpt 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

### getEngineByMimeType

    public ScriptEngine getEngineByMimeType(java.lang.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

### getEngineByName

    public ScriptEngine getEngineByName(java.lang.String name)

> Retrieves a new instance of a ScriptEngine the specified descriptieve name. Returns null if no suitable ScriptEngine is found.

> Parameters:
>   `name` - the descriptive name

> Returns:
>   a new instance of a ScriptEngine which supports the specifed descriptive name

### getEngineFactories

    public ScriptEngineFactory[] getEngineFactories()

> Retrieves an array of instances of ScriptEngineFactory class which are found by the discovery mechanism.

> Returns:
>   an array of all discovered ScriptEngineFactory instances

### getNameSpace

    public Bindings getNameSpace()

> Retrieves the namespace corresponds to GLOBAL_SCOPE.

> Returns:
>   the namespace of GLOBAL_SCOPE

### put

    public void put(java.lang.String key,
                    java.lang.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

### registerEngineExtension

    public void registerEngineExtension(java.lang.String extension,
                                        java.lang.Class factory)

> Register a extension with a ScriptEngineFactory class. It overrides any such association discovered previously.

> Parameters:
>   `extension` - the extension associated with the specified ScriptEngineFactory class
>   `factory` - the ScriptEngineFactory class associated with the specified extension

### registerEngineMimeType

    public void registerEngineMimeType(java.lang.String mimeType,
                                       java.lang.Class factory)

> Registers a MIME type with a ScriptEngineFactory class. 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

### registerEngineName

    public void registerEngineName(java.lang.String name,
                                   java.lang.Class factory)

> Registers descriptive name with a ScriptEngineFactory class. It overrides any associations discovered previously.

> Parameters:
>   `name` - a descriptive name associated with the specifed ScriptEngineFactory class
>   `factory` - the ScriptEngineFactory class associated with the specified descriptive name

### setNamespace

    public void setNamespace(Bindings namespace)

> Sets the GLOBAL_SCOPE value to the specified namespace.

> Parameters:
>   `namespace` - the namespace to be stored in GLOBAL_SCOPE