org.clapper.util.scripting.javax_script
Class JavaxScriptEngineManager

java.lang.Object
  extended by org.clapper.util.scripting.UnifiedScriptEngineManager
      extended by org.clapper.util.scripting.javax_script.JavaxScriptEngineManager

public class JavaxScriptEngineManager
extends UnifiedScriptEngineManager

UnifiedScriptEngineManager that uses the Java 6 javax.script (a.k.a., JSR 223) scripting framework.

Version:
$Revision: 6735 $

Constructor Summary
JavaxScriptEngineManager()
          Creates a new instance of JavaxScriptEngineManager
 
Method Summary
 void clearBindings()
          Clear all current bindings.
 java.lang.Object get(java.lang.String key)
          Get the value for a specified key in the object bindings.
 java.util.Map<java.lang.String,java.lang.Object> getBindings()
          Get the global object bindings.
 UnifiedScriptEngine getEngineByExtension(java.lang.String ext)
          Get a UnifiedScriptEngine for the specified language, by mapping a file name extension to the language.
 UnifiedScriptEngine getEngineByName(java.lang.String language)
          Get a UnifiedScriptEngine for the specified language.
 ScriptFrameworkType getType()
          Get the framework type (ScriptFrameworkType associated with the UnifiedScriptEngineManager object.
 void put(java.lang.String name, java.lang.Object object)
          Put an object into the script environment.
 
Methods inherited from class org.clapper.util.scripting.UnifiedScriptEngineManager
getEngineForFile, getManager, getManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaxScriptEngineManager

public JavaxScriptEngineManager()
Creates a new instance of JavaxScriptEngineManager

Method Detail

getType

public ScriptFrameworkType getType()
Get the framework type (ScriptFrameworkType associated with the UnifiedScriptEngineManager object.

Specified by:
getType in class UnifiedScriptEngineManager
Returns:
the framework type

getBindings

public java.util.Map<java.lang.String,java.lang.Object> getBindings()
                                                             throws UnifiedScriptException
Get the global object bindings. Unlike JSR 223, this interface only supports global bindings (largely because BSF doesn't easily support anything other than global bindings.

Specified by:
getBindings in class UnifiedScriptEngineManager
Returns:
a Map of global bindings
Throws:
UnifiedScriptException - on error
See Also:
clearBindings(), put(java.lang.String, java.lang.Object)

clearBindings

public void clearBindings()
                   throws UnifiedScriptException
Clear all current bindings.

Specified by:
clearBindings in class UnifiedScriptEngineManager
Throws:
UnifiedScriptException - on error
See Also:
put(java.lang.String, java.lang.Object)

put

public void put(java.lang.String name,
                java.lang.Object object)
         throws UnifiedScriptException
Put an object into the script environment. This operation is also known as "binding" an object to the scripting environment. If the scripting infrastructure supports different scopes (e.g., JSR 223), then this method puts the object in the global scope.

Specified by:
put in class UnifiedScriptEngineManager
Parameters:
name - the name by which the object will be known to scripts
object - the object
Throws:
UnifiedScriptException - on error

get

public java.lang.Object get(java.lang.String key)
Get the value for a specified key in the object bindings.

Specified by:
get in class UnifiedScriptEngineManager
Parameters:
key - the key
Returns:
the bound object, or null

getEngineByName

public UnifiedScriptEngine getEngineByName(java.lang.String language)
                                    throws UnifiedScriptException
Get a UnifiedScriptEngine for the specified language.

Specified by:
getEngineByName in class UnifiedScriptEngineManager
Parameters:
language - the language name
Returns:
the script engine, or null if no engine for that language can be found
Throws:
UnifiedScriptException - on error

getEngineByExtension

public UnifiedScriptEngine getEngineByExtension(java.lang.String ext)
                                         throws UnifiedScriptException
Get a UnifiedScriptEngine for the specified language, by mapping a file name extension to the language.

Specified by:
getEngineByExtension in class UnifiedScriptEngineManager
Parameters:
ext - the extension
Returns:
the script engine, or null if no engine for that language can be found
Throws:
UnifiedScriptException - on error


Copyright © 2004-2007 Brian M. Clapper. All Rights Reserved.