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

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.flow.AbstractInterpreter
          extended by org.apache.cocoon.components.flow.CompilingInterpreter
              extended by org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter
All Implemented Interfaces:
Disposable, Initializable, Component, Configurable, Contextualizable, LogEnabled, Serviceable, SingleThreaded, Interpreter

public class FOM_JavaScriptInterpreter
extends CompilingInterpreter
implements Initializable

Interface with the JavaScript interpreter.

Since:
March 25, 2002
Version:
CVS $Id: FOM_JavaScriptInterpreter.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Ovidiu Predescu, Marcus Crafter

Nested Class Summary
static class FOM_JavaScriptInterpreter.ThreadScope
           
 
Nested classes/interfaces inherited from class org.apache.cocoon.components.flow.CompilingInterpreter
CompilingInterpreter.ScriptSourceEntry
 
Nested classes/interfaces inherited from interface org.apache.cocoon.components.flow.Interpreter
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, context, continuationsMgr, manager, needResolve, reloadScripts
 
Fields inherited from interface org.apache.cocoon.components.flow.Interpreter
ROLE
 
Constructor Summary
FOM_JavaScriptInterpreter()
           
 
Method Summary
 void callFunction(String funName, List params, 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 get Script on the ScriptSourceEntry which in turn calls compileScript 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, Redirector redirector)
           
protected  ServiceManager getServiceManager()
          Needed to get things working with JDK 1.3.
 void handleContinuation(String id, List params, Redirector redirector)
          Continues a previously started processing.
 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, process, register, setInterpreterID
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
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

getServiceManager

protected ServiceManager getServiceManager()
Needed to get things working with JDK 1.3. Can be removed once we don't support that platform any more.


configure

public void configure(Configuration config)
               throws ConfigurationException
Specified by:
configure in interface Configurable
Overrides:
configure in class AbstractInterpreter
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 get Script on the ScriptSourceEntry which in turn calls compileScript 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,
                         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 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,
                               Redirector redirector)
                        throws Exception
Description copied from interface: Interpreter
Continues a previously started processing. The continuation object where the processing should start from is indicated by the continuationId string.

Specified by:
handleContinuation in interface Interpreter
Parameters:
id - a String value
params - a List value, containing the parameters to be passed when invoking the continuation. As opposed to the parameters passed by callFunction, these parameters will only become available in the language's environment, if at all.
redirector - a Redirector used to call views
Throws:
Exception - if an error occurs

forwardTo

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


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