org.schmant.app.js
Class JsScriptExecutorFactory

java.lang.Object
  extended by org.schmant.ScriptExecutorFactory
      extended by org.schmant.app.js.JsScriptExecutorFactory

public final class JsScriptExecutorFactory
extends ScriptExecutorFactory

Script executor factory for creating ScriptExecutor objects that are used to run JavaScript scripts (file name extension js) using either Mozilla's Rhino implementation (preferred) or Sun's version of Mozilla's implementation.

By setting the script property PROP_JS_IMPLEMENTATION to either Mozilla or Sun (case insensitive) when starting Schmant, this executor can be forced to use either of the implementations.

Since:
1.1
Author:
Karl Gustafsson
See Also:
MozillaRhinoExecutor, SunJavaScriptExecutor

Field Summary
static String PROP_JS_IMPLEMENTATION
          If this script property is set to either Mozilla or Sun (case insensitive), it forces this script executor to use the selected JavaScript implementation.
 
Constructor Summary
JsScriptExecutorFactory()
           
 
Method Summary
 boolean canHandleScriptFileNameExtension(String extension)
          Does this script executor factory create a ScriptExecutor that can handle build scripts with the supplied file name extension?
 ScriptExecutor create(LauncherSettings ls, Report r)
          Create a ScriptExecutor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_JS_IMPLEMENTATION

public static final String PROP_JS_IMPLEMENTATION
If this script property is set to either Mozilla or Sun (case insensitive), it forces this script executor to use the selected JavaScript implementation. If the property is not set, this executor uses Mozilla Rhino, if that is on the classpath, or the implementation bundled with Sun's JDK.

See Also:
Constant Field Values
Constructor Detail

JsScriptExecutorFactory

public JsScriptExecutorFactory()
Method Detail

canHandleScriptFileNameExtension

public boolean canHandleScriptFileNameExtension(String extension)
Description copied from class: ScriptExecutorFactory
Does this script executor factory create a ScriptExecutor that can handle build scripts with the supplied file name extension?

Specified by:
canHandleScriptFileNameExtension in class ScriptExecutorFactory
Parameters:
extension - The file name extension in lower case, without the leading dot.
Returns:
true if this script executor factory can handle the script file.

create

public ScriptExecutor create(LauncherSettings ls,
                             Report r)
Description copied from class: ScriptExecutorFactory
Create a ScriptExecutor.

Specified by:
create in class ScriptExecutorFactory
Parameters:
ls - Command line arguments.
r - A report for logging output to.
Returns:
A script executor.