org.apache.cocoon.components.flow.javascript.fom
Class FOM_JavaScriptInterpreter

java.lang.Object
  extended byorg.apache.cocoon.util.AbstractLogEnabled
      extended byorg.apache.cocoon.components.flow.AbstractInterpreter
          extended byorg.apache.cocoon.components.flow.CompilingInterpreter
              extended byorg.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter
All Implemented Interfaces:
Configurable, Contextualizable, Disposable, Initializable, org.apache.cocoon.components.flow.Interpreter, Serviceable, SingleThreaded

public class FOM_JavaScriptInterpreter
extends CompilingInterpreter
implements Initializable

Interface with the JavaScript interpreter.

Since:
March 25, 2002
Version:
$Id: FOM_JavaScriptInterpreter.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Nested Class Summary
static class FOM_JavaScriptInterpreter.ThreadScope
           
 
Nested classes inherited from class org.apache.cocoon.components.flow.CompilingInterpreter
CompilingInterpreter.ScriptSourceEntry
 
Nested classes inherited from class org.apache.cocoon.components.flow.Interpreter
org.apache.cocoon.components.flow.Interpreter.Argument
 
Field Summary
 
Fields inherited from class org.apache.cocoon.components.flow.CompilingInterpreter
compiledScripts, sourceresolver
 
Fields inherited from class org.apache.cocoon.components.flow.AbstractInterpreter
avalonContext, checkTime, continuationsMgr, manager, needResolve, newObjectModel, processInfoProvider, reloadScripts, settings
 
Fields inherited from interface org.apache.cocoon.components.flow.Interpreter
ROLE
 
Constructor Summary
FOM_JavaScriptInterpreter()
           
 
Method Summary
 void callFunction(String funName, List params, org.apache.cocoon.environment.Redirector redirector)
          Calls a JavaScript function, passing params as its arguments.
protected  org.mozilla.javascript.Script compileScript(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable scope, Source src)
          TODO - This is a little bit strange, the interpreter calls ScriptSourceEntry#compile which in turn calls this compileScript mthod on the interpreter.
 void configure(Configuration config)
           
 void forwardTo(org.mozilla.javascript.Scriptable scope, FOM_Cocoon cocoon, String uri, Object bizData, FOM_WebContinuation fom_wk, org.apache.cocoon.environment.Redirector redirector)
           
 String getScriptExtension()
           
 void handleContinuation(String id, List params, org.apache.cocoon.environment.Redirector redirector)
           
 void initialize()
           
 
Methods inherited from class org.apache.cocoon.components.flow.CompilingInterpreter
dispose, service
 
Methods inherited from class org.apache.cocoon.components.flow.AbstractInterpreter
contextualize, forwardTo, getInterpreterID, register, setInterpreterID
 
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FOM_JavaScriptInterpreter

public FOM_JavaScriptInterpreter()
Method Detail

configure

public void configure(Configuration config)
               throws ConfigurationException
Specified by:
configure in interface Configurable
Throws:
ConfigurationException

initialize

public void initialize()
                throws Exception
Specified by:
initialize in interface Initializable
Throws:
Exception

compileScript

protected org.mozilla.javascript.Script compileScript(org.mozilla.javascript.Context cx,
                                                      org.mozilla.javascript.Scriptable scope,
                                                      Source src)
                                               throws Exception
Description copied from class: CompilingInterpreter
TODO - This is a little bit strange, the interpreter calls CompilingInterpreter.ScriptSourceEntry.compile(org.mozilla.javascript.Context, org.mozilla.javascript.Scriptable) which in turn calls this compileScript mthod on the interpreter. I think we need more refactoring here.

Specified by:
compileScript in class CompilingInterpreter
Throws:
Exception

callFunction

public void callFunction(String funName,
                         List params,
                         org.apache.cocoon.environment.Redirector redirector)
                  throws Exception
Calls a JavaScript function, passing params as its arguments. In addition to this, it makes available the parameters through the cocoon.parameters JavaScript array (indexed by the parameter names).

Specified by:
callFunction in interface org.apache.cocoon.components.flow.Interpreter
Parameters:
funName - a String value
params - a List value
redirector -
Throws:
Exception - if an error occurs

handleContinuation

public void handleContinuation(String id,
                               List params,
                               org.apache.cocoon.environment.Redirector redirector)
                        throws Exception
Specified by:
handleContinuation in interface org.apache.cocoon.components.flow.Interpreter
Throws:
Exception

forwardTo

public void forwardTo(org.mozilla.javascript.Scriptable scope,
                      FOM_Cocoon cocoon,
                      String uri,
                      Object bizData,
                      FOM_WebContinuation fom_wk,
                      org.apache.cocoon.environment.Redirector redirector)
               throws Exception
Throws:
Exception

getScriptExtension

public String getScriptExtension()
Specified by:
getScriptExtension in interface org.apache.cocoon.components.flow.Interpreter
See Also:
AbstractInterpreter.getScriptExtension()


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