ovidiu      02/04/15 17:20:22

  Modified:    src/scratchpad/schecoon/src/org/apache/cocoon/components/flow/javascript
                        JSCocoon.java
  Log:
  Remove the need to store the ContinuationsManager, now that the
  ExcaliburComponentManager problem has been solved.
  
  Revision  Changes    Path
  1.10      +21 -15    
xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/flow/javascript/JSCocoon.java
  
  Index: JSCocoon.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/flow/javascript/JSCocoon.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JSCocoon.java     10 Apr 2002 00:39:51 -0000      1.9
  +++ JSCocoon.java     16 Apr 2002 00:20:22 -0000      1.10
  @@ -2,6 +2,8 @@
   
   import java.util.HashMap;
   import java.util.Map;
  +import org.apache.avalon.framework.component.Component;
  +import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.cocoon.components.flow.AbstractInterpreter;
   import org.apache.cocoon.components.flow.ContinuationsManager;
  @@ -12,6 +14,7 @@
   import org.apache.cocoon.environment.ObjectModelHelper;
   import org.apache.cocoon.environment.Request;
   import org.apache.cocoon.environment.Response;
  +import org.apache.cocoon.environment.Session;
   import org.mozilla.javascript.NativeArray;
   import org.mozilla.javascript.ScriptRuntime;
   import org.mozilla.javascript.Scriptable;
  @@ -33,7 +36,6 @@
     protected Environment environment;
     protected InvokeContext context;
     protected ComponentManager manager;
  -  protected ContinuationsManager continuationsMgr;
   
     public JSCocoon() {}
   
  @@ -77,16 +79,6 @@
       context = null;
     }
   
  -  public void setContinuationsManager(ContinuationsManager mgr)
  -  {
  -    this.continuationsMgr = mgr;
  -  }
  -
  -  ContinuationsManager getContinuationsManager()
  -  {
  -    return continuationsMgr;
  -  }
  -
     public NativeArray jsGet_parameters()
     {
       return parameters;
  @@ -119,6 +111,11 @@
       return ObjectModelHelper.getResponse(objectModel);
     }
   
  +  public Session jsGet_session()
  +  {
  +    return jsGet_request().getSession();
  +  }
  +
     public Context jsGet_context()
     {
       Map objectModel = environment.getObjectModel();
  @@ -168,13 +165,22 @@
     }
   
     public void jsFunction_diplayAllContinuations()
  +    throws ComponentException
     {
  -    if (continuationsMgr instanceof ContinuationsManagerImpl)
  -      ((ContinuationsManagerImpl)continuationsMgr).displayAllContinuations();
  +    ContinuationsManager continuationsMgr
  +      = (ContinuationsManager)manager.lookup(ContinuationsManager.ROLE);
  +
  +    try {
  +      if (continuationsMgr instanceof ContinuationsManagerImpl)
  +        ((ContinuationsManagerImpl)continuationsMgr).displayAllContinuations();
  +    }
  +    finally {
  +      manager.release((Component)continuationsMgr);
  +    }
     }
   
  -  // All right, this breaks the encapsulation, but I couldn't
  -  // find any better way to obtain the ComponentManager from a
  +  // All right, this breaks the encapsulation, but I couldn't find any
  +  // better way to obtain the ComponentManager for a
     // JSWebContinuation.
     ComponentManager getComponentManager()
     {
  
  
  

----------------------------------------------------------------------
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