ovidiu      02/03/21 15:16:14

  Modified:    src/scratchpad/schecoon/src/org/apache/cocoon/components/flow
                        JavaScriptInterpreter.java
  Log:
  Define JSWebContinuation as object available in JavaScript.
  
  Revision  Changes    Path
  1.8       +12 -9     
xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/flow/JavaScriptInterpreter.java
  
  Index: JavaScriptInterpreter.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/flow/JavaScriptInterpreter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JavaScriptInterpreter.java        19 Mar 2002 09:36:08 -0000      1.7
  +++ JavaScriptInterpreter.java        21 Mar 2002 23:16:14 -0000      1.8
  @@ -10,6 +10,7 @@
   import org.apache.cocoon.components.flow.javascript.JSCocoon;
   import org.apache.cocoon.components.flow.javascript.JSGlobal;
   import org.apache.cocoon.components.flow.javascript.JSLog;
  +import org.apache.cocoon.components.flow.javascript.JSWebContinuation;
   import org.apache.cocoon.components.treeprocessor.InvokeContext;
   import org.apache.cocoon.components.treeprocessor.MapStackResolver;
   import org.apache.cocoon.components.treeprocessor.ProcessingNode;
  @@ -28,10 +29,10 @@
     implements Initializable
   {
     // This is the only optimization level that supports continuations
  -  // in the Rhino JavaScript implementation
  +  // in the Christoper Oliver's Rhino JavaScript implementation
     static int OPTIMIZATION_LEVEL = -1;
   
  -  Scriptable scope;
  +  JSGlobal scope;
   
     public void initialize()
       throws Exception
  @@ -51,6 +52,9 @@
         // Access to Cocoon internal objects
         ScriptableObject.defineClass(scope, JSCocoon.class);
   
  +      // Wrapper for WebContinuation
  +      ScriptableObject.defineClass(scope, JSWebContinuation.class);
  +
         // Define some functions on the top level scope
         String[] names = { "print" };
         try {
  @@ -66,6 +70,7 @@
         Scriptable log = context.newObject(scope, "Log", args);
         ((JSLog)log).setLogger(getLogger());
         scope.put("log", scope, log);
  +
       } catch (Exception e) {
         context.exit();
         System.out.println("problem initializing JavaScriptInterpreter: ");
  @@ -94,8 +99,9 @@
       Object args[] = {};
       Scriptable cocoon = context.newObject(scope, "Cocoon", args);
       ((JSCocoon)cocoon).setInterpreter(this);
  -    ((JSCocoon)cocoon).setContext(environment, ctx);
  -    thrScope.put("cocoon", scope, cocoon);
  +    ((JSCocoon)cocoon).setContext(manager, environment, ctx);
  +    ((JSCocoon)cocoon).setContinuationsManager(continuationsMgr);
  +    thrScope.put("cocoon", thrScope, cocoon);
   
       return thrScope;
     }
  @@ -112,14 +118,13 @@
       Context.getCurrentContext().exit();
     }
   
  -  public synchronized Source readScript(Environment environment,
  -                                        String sourceName)
  +  public Source readScript(Environment environment, String sourceName)
       throws Exception
     {
       Scriptable thrScope = null;
       Source source = null;
   
  -    System.out.println("Reading JavaScript script " + sourceName);
  +    System.out.println("Reading file " + sourceName);
   
       try {
         thrScope = enterContext(environment, null);
  @@ -146,8 +151,6 @@
       Scriptable thrScope = null;
   
       checkForModifiedScripts(environment);
  -    System.out.println("JavaScript: invoking " + funName
  -                       + ", params = " + params);
   
       try {
         thrScope = enterContext(environment, ctx);
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to