cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: cocoon-2.1/src/scratchpad/src/org/apache/cocoon/generation FlowVelocityGenerator.java JXFormsGenerator.java JXTemplateGenerator.java TraxGenerator.java
Date Sun, 18 May 2003 16:36:42 GMT
vgritsenko    2003/05/18 09:36:41

  Modified:    src/java/org/apache/cocoon/components/flow
                        AbstractInterpreter.java
               src/java/org/apache/cocoon/components/flow/javascript
                        JavaScriptFlow.java JavaScriptInterpreter.java
               src/java/org/apache/cocoon/components/language/markup/xsp/java
                        jpath.xsl
               src/java/org/apache/cocoon/transformation
                        JPathTransformer.java
               src/scratchpad/src/org/apache/cocoon/generation
                        FlowVelocityGenerator.java JXFormsGenerator.java
                        JXTemplateGenerator.java TraxGenerator.java
  Added:       src/java/org/apache/cocoon/components/flow FlowHelper.java
  Removed:     src/java/org/apache/cocoon/components/flow Flow.java
  Log:
  o.a.c.c.flow.Flow cleanup:
   * Rename Flow to FlowHelper
   * public static -> public static final
   * name constant consistently with ObjectModelHelper
   * don't create Session in JavaScriptInterpreter.removeSessionScope
   * 4-space code align
  
  Revision  Changes    Path
  1.4       +141 -143  cocoon-2.1/src/java/org/apache/cocoon/components/flow/AbstractInterpreter.java
  
  Index: AbstractInterpreter.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/flow/AbstractInterpreter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractInterpreter.java	7 May 2003 04:36:33 -0000	1.3
  +++ AbstractInterpreter.java	18 May 2003 16:36:40 -0000	1.4
  @@ -67,6 +67,7 @@
   import java.io.OutputStream;
   import java.util.ArrayList;
   import java.util.Map;
  +
   /**
    * Abstract superclass for various scripting languages used by Cocoon
    * for flow control. Defines some useful behavior like the ability to
  @@ -82,146 +83,143 @@
     implements Component, Composable, Contextualizable, Interpreter,
                SingleThreaded, Configurable
   {
  -  /**
  -   * List of source locations that need to be resolved.
  -   */
  -  protected ArrayList needResolve = new ArrayList();
  -
  -  protected org.apache.cocoon.environment.Context context;
  -  protected ComponentManager manager;
  -  protected ContinuationsManager continuationsMgr;
  -
  -  /**
  -   * Whether reloading of scripts should be done. Specified through
  -   * the "reload-scripts" attribute in <code>flow.xmap</code>.
  -   */
  -  protected boolean reloadScripts;
  -
  -  /**
  -   * Interval between two checks for modified script files. Specified
  -   * through the "check-time" XML attribute in <code>flow.xmap</code>.
  -   */
  -  protected long checkTime;
  -
  -  public void configure(Configuration config)
  -    throws ConfigurationException
  -  {
  -    reloadScripts = config.getChild("reload-scripts").getValueAsBoolean(false);
  -    checkTime = config.getChild("check-time").getValueAsLong(1000L);
  -  }
  -
  -  public void compose(ComponentManager manager)
  -    throws ComponentException
  -  {
  -    this.manager = manager;
  -
  -    // FIXME: Why is the manager null here?
  -    if (manager != null)
  -      continuationsMgr
  -        = (ContinuationsManager)manager.lookup(ContinuationsManager.ROLE);
  -  }
  -
  -  public void contextualize(org.apache.avalon.framework.context.Context context)
  -    throws ContextException
  -  {
  -    this.context = (Context)context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
  -  }
  -
  -  /**
  -   * Registers a source file with the interpreter. Using this method
  -   * an implementation keeps track of all the script files which are
  -   * compiled. This allows them to reload the script files which get
  -   * modified on the file system.
  -   *
  -   * <p>The parsing/compilation of a script file by an interpreter
  -   * happens in two phases. In the first phase the file's location is
  -   * registered in the <code>needResolve</code> array.
  -   *
  -   * <p>The second is possible only when a Cocoon
  -   * <code>Environment</code> is passed to the Interpreter. This
  -   * allows the file location to be resolved using Cocoon's
  -   * <code>SourceFactory</code> class.
  -   *
  -   * <p>Once a file's location can be resolved, it is removed from the
  -   * <code>needResolve</code> array and placed in the
  -   * <code>scripts</code> hash table. The key in this hash table is
  -   * the file location string, and the value is a
  -   * DelayedRefreshSourceWrapper instance which keeps track of when
  -   * the file needs to re-read.
  -   *
  -   * @param source the location of the script
  -   *
  -   * @see org.apache.cocoon.components.source.SourceFactory
  -   * @see org.apache.cocoon.environment.Environment
  -   * @see org.apache.cocoon.components.source.impl.DelayedRefreshSourceWrapper
  -   */
  -  public void register(String source)
  -  {
  -    synchronized(this) {
  -      needResolve.add(source);
  -    }
  -  }
  -
  -  /**
  -   * Call the Cocoon sitemap for the given URI, sending the output of the
  -   * eventually matched pipeline to the specified outputstream.
  -   *
  -   * @param uri The URI for which the request should be generated.
  -   * @param biz Extra data associated with the subrequest.
  -   * @param out An OutputStream where the output should be written to.
  -   * @param env The environment of the original request.
  -   * @return Whatever the Cocoon processor returns (????).
  -   * @exception Exception If an error occurs.
  -   */
  -  public boolean process(String uri, Object biz, OutputStream out, Environment env)
  -  throws Exception {
  -    if (out == null) {
  -        throw new NullPointerException("No outputstream specified for process");
  -    }
  -
  -    // Create a wrapper environment for the subrequest to be processed.
  -    EnvironmentWrapper wrapper = new EnvironmentWrapper(env, uri, "", getLogger());
  -    wrapper.setURI("",uri);
  -    wrapper.setOutputStream(out);
  -    wrapper.setAttribute("bean-dict", biz);
  -
  -    // Attermpt to start processing the wrapper environment
  -    Object key = CocoonComponentManager.startProcessing(wrapper);
  -
  -    Processor processor = null;
  -    boolean result = false;
  -    try {
  -        // Retrieve a processor instance
  -        processor = (Processor)this.manager.lookup(Processor.ROLE);
  -
  -        // Enter the environment
  -        CocoonComponentManager.enterEnvironment(wrapper, this.manager, processor);
  -
  -        // Process the subrequest
  -        result = processor.process(wrapper);
  -        wrapper.commitResponse();
  -        out.flush();
  -
  -        // Return whatever the processor returned us
  -        return(result);
  -    } catch (Exception any) {
  -        throw(any);
  -    } finally {
  -        // Leave the environment, terminate processing and release processor
  -        CocoonComponentManager.leaveEnvironment();
  -        CocoonComponentManager.endProcessing(wrapper, key);
  -        this.manager.release(processor);
  -    }
  -  }
  -
  -  public void forwardTo(String uri, Object bizData,
  -                        WebContinuation continuation,
  -                        Environment environment)
  -    throws Exception
  -  {
  -    Map objectModel = environment.getObjectModel();
  -    Flow.setContextObject(objectModel, bizData);
  -    Flow.setWebContinuation(objectModel, continuation);
  -    PipelinesNode.getRedirector(environment).redirect(false, uri);
  -  }
  +    /**
  +     * List of source locations that need to be resolved.
  +     */
  +    protected ArrayList needResolve = new ArrayList();
  +
  +    protected org.apache.cocoon.environment.Context context;
  +    protected ComponentManager manager;
  +    protected ContinuationsManager continuationsMgr;
  +
  +    /**
  +     * Whether reloading of scripts should be done. Specified through
  +     * the "reload-scripts" attribute in <code>flow.xmap</code>.
  +     */
  +    protected boolean reloadScripts;
  +
  +    /**
  +     * Interval between two checks for modified script files. Specified
  +     * through the "check-time" XML attribute in <code>flow.xmap</code>.
  +     */
  +    protected long checkTime;
  +
  +    public void configure(Configuration config) throws ConfigurationException {
  +        reloadScripts = config.getChild("reload-scripts").getValueAsBoolean(false);
  +        checkTime = config.getChild("check-time").getValueAsLong(1000L);
  +    }
  +
  +    public void compose(ComponentManager manager) throws ComponentException {
  +        this.manager = manager;
  +
  +        // FIXME: Why is the manager null here?
  +        if (manager != null) {
  +            continuationsMgr
  +                    = (ContinuationsManager)manager.lookup(ContinuationsManager.ROLE);
  +        }
  +    }
  +
  +    public void contextualize(org.apache.avalon.framework.context.Context context)
  +            throws ContextException
  +    {
  +        this.context = (Context)context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
  +    }
  +
  +    /**
  +     * Registers a source file with the interpreter. Using this method
  +     * an implementation keeps track of all the script files which are
  +     * compiled. This allows them to reload the script files which get
  +     * modified on the file system.
  +     *
  +     * <p>The parsing/compilation of a script file by an interpreter
  +     * happens in two phases. In the first phase the file's location is
  +     * registered in the <code>needResolve</code> array.
  +     *
  +     * <p>The second is possible only when a Cocoon
  +     * <code>Environment</code> is passed to the Interpreter. This
  +     * allows the file location to be resolved using Cocoon's
  +     * <code>SourceFactory</code> class.
  +     *
  +     * <p>Once a file's location can be resolved, it is removed from the
  +     * <code>needResolve</code> array and placed in the
  +     * <code>scripts</code> hash table. The key in this hash table is
  +     * the file location string, and the value is a
  +     * DelayedRefreshSourceWrapper instance which keeps track of when
  +     * the file needs to re-read.
  +     *
  +     * @param source the location of the script
  +     *
  +     * @see org.apache.cocoon.components.source.SourceFactory
  +     * @see org.apache.cocoon.environment.Environment
  +     * @see org.apache.cocoon.components.source.impl.DelayedRefreshSourceWrapper
  +     */
  +    public void register(String source)
  +    {
  +        synchronized(this) {
  +            needResolve.add(source);
  +        }
  +    }
  +
  +    /**
  +     * Call the Cocoon sitemap for the given URI, sending the output of the
  +     * eventually matched pipeline to the specified outputstream.
  +     *
  +     * @param uri The URI for which the request should be generated.
  +     * @param biz Extra data associated with the subrequest.
  +     * @param out An OutputStream where the output should be written to.
  +     * @param env The environment of the original request.
  +     * @return Whatever the Cocoon processor returns (????).
  +     * @exception Exception If an error occurs.
  +     */
  +    public boolean process(String uri, Object biz, OutputStream out, Environment env)
  +            throws Exception {
  +        if (out == null) {
  +            throw new NullPointerException("No outputstream specified for process");
  +        }
  +
  +        // Create a wrapper environment for the subrequest to be processed.
  +        EnvironmentWrapper wrapper = new EnvironmentWrapper(env, uri, "", getLogger());
  +        wrapper.setURI("",uri);
  +        wrapper.setOutputStream(out);
  +        wrapper.setAttribute("bean-dict", biz);
  +
  +        // Attermpt to start processing the wrapper environment
  +        Object key = CocoonComponentManager.startProcessing(wrapper);
  +
  +        Processor processor = null;
  +        boolean result = false;
  +        try {
  +            // Retrieve a processor instance
  +            processor = (Processor)this.manager.lookup(Processor.ROLE);
  +
  +            // Enter the environment
  +            CocoonComponentManager.enterEnvironment(wrapper, this.manager, processor);
  +
  +            // Process the subrequest
  +            result = processor.process(wrapper);
  +            wrapper.commitResponse();
  +            out.flush();
  +
  +            // Return whatever the processor returned us
  +            return(result);
  +        } catch (Exception any) {
  +            throw(any);
  +        } finally {
  +            // Leave the environment, terminate processing and release processor
  +            CocoonComponentManager.leaveEnvironment();
  +            CocoonComponentManager.endProcessing(wrapper, key);
  +            this.manager.release(processor);
  +        }
  +    }
  +
  +    public void forwardTo(String uri, Object bizData,
  +                          WebContinuation continuation,
  +                          Environment environment)
  +            throws Exception
  +    {
  +        Map objectModel = environment.getObjectModel();
  +        FlowHelper.setContextObject(objectModel, bizData);
  +        FlowHelper.setWebContinuation(objectModel, continuation);
  +        PipelinesNode.getRedirector(environment).redirect(false, uri);
  +    }
   }
  
  
  
  1.1                  cocoon-2.1/src/java/org/apache/cocoon/components/flow/FlowHelper.java
  
  Index: FlowHelper.java
  ===================================================================
  /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
  */
  package org.apache.cocoon.components.flow;
  
  import org.apache.cocoon.environment.ObjectModelHelper;
  import org.apache.cocoon.environment.Request;
  import java.util.Map;
  
  /**
   * Provides the interface between the flow controller layer and the 
   * view layer. A view can obtain the context object sent by a flow
   * script and the current web continuation, if any.
   */
  public class FlowHelper {
  
      /**
       * Request attribute name used to store flow context.
       */
      public static final String CONTEXT_OBJECT = "cocoon.flow.context";
  
      /**
       * Request attribute name used to store flow continuation.
       */
      public static final String CONTINUATION_OBJECT = "cocoon.flow.continuation";
  
      /**
       * Get the flow context object associated with the current request
       *
       * @param objectModel The Cocoon Environment's object model
       * @return The context object 
       */
      public final static Object getContextObject(Map objectModel) {
          Request request = ObjectModelHelper.getRequest(objectModel);
          return request.getAttribute(CONTEXT_OBJECT);
      }
  
      /**
       * Get the web continuation associated with the current request
       *
       * @param objectModel The Cocoon Environment's object model
       * @return The web continuation
       */
      public final static WebContinuation getWebContinuation(Map objectModel) {
          Request request = ObjectModelHelper.getRequest(objectModel);
          return (WebContinuation)request.getAttribute(CONTINUATION_OBJECT);
      }
  
      /**
       * Set the web continuation associated with the current request
       *
       * @param objectModel The Cocoon Environment's object model
       * @param kont The web continuation
       */
      public final static void setWebContinuation(Map objectModel,
                                            WebContinuation kont) {
          Request request = ObjectModelHelper.getRequest(objectModel);
          request.setAttribute(CONTINUATION_OBJECT, kont);
      }
  
      /**
       * Set the flow context object associated with the current request
       *
       * @param objectModel The Cocoon Environment's object model
       * @param obj The context object 
       */
      public final static void setContextObject(Map objectModel, Object obj) {
          Request request = ObjectModelHelper.getRequest(objectModel);
          request.setAttribute(CONTEXT_OBJECT, obj);
      }
  }
  
  
  
  1.2       +11 -13    cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/JavaScriptFlow.java
  
  Index: JavaScriptFlow.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/JavaScriptFlow.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JavaScriptFlow.java	7 May 2003 04:36:33 -0000	1.1
  +++ JavaScriptFlow.java	18 May 2003 16:36:40 -0000	1.2
  @@ -44,7 +44,8 @@
   
   */
   package org.apache.cocoon.components.flow.javascript;
  -import org.apache.cocoon.components.flow.Flow;
  +
  +import org.apache.cocoon.components.flow.FlowHelper;
   import org.mozilla.javascript.Scriptable;
   import org.apache.cocoon.environment.ObjectModelHelper;
   import org.apache.cocoon.environment.Request;
  @@ -56,12 +57,12 @@
    * allow access to Java constructors) through this interface
    */
   
  -public class JavaScriptFlow extends Flow {
  +public class JavaScriptFlow extends FlowHelper {
   
  -    public static final String COCOON_FLOW_JS_PACKAGES =
  -	"cocoon.flow.js.rhino.packages";
  -    public static final String COCOON_FLOW_JS_JAVA_PACKAGE =
  -	"cocoon.flow.js.rhino.packages.java";
  +    public static final String PACKAGES_OBJECT =
  +            "cocoon.flow.js.packages";
  +    public static final String JAVA_PACKAGE_OBJECT =
  +            "cocoon.flow.js.packages.java";
   
       /** 
        * Return the JS "Packages" property (that gives access to Java
  @@ -71,7 +72,7 @@
        */
       public static Scriptable getPackages(Map objectModel) {
           Request request = ObjectModelHelper.getRequest(objectModel);
  -        return (Scriptable)request.getAttribute(COCOON_FLOW_JS_PACKAGES);
  +        return (Scriptable)request.getAttribute(PACKAGES_OBJECT);
       }
   
   
  @@ -83,29 +84,26 @@
        */
       public static Scriptable getJavaPackage(Map objectModel) {
           Request request = ObjectModelHelper.getRequest(objectModel);
  -        return (Scriptable)request.getAttribute(COCOON_FLOW_JS_JAVA_PACKAGE);
  +        return (Scriptable)request.getAttribute(JAVA_PACKAGE_OBJECT);
       }
   
   
       /** 
        * Set the JS "Packages" property in the current request
        * @param objectModel The Cocoon Environment's object model
  -     * @return The Packages property
        */
       public static void setPackages(Map objectModel, Scriptable pkgs) {
           Request request = ObjectModelHelper.getRequest(objectModel);
  -        request.setAttribute(COCOON_FLOW_JS_PACKAGES, pkgs);
  +        request.setAttribute(PACKAGES_OBJECT, pkgs);
       }
   
       /** 
        * Set the JS "java" property in the current request
        * @param objectModel The Cocoon Environment's object model
  -     * @return The "java" property
        */
       public static void setJavaPackage(Map objectModel, Scriptable javaPkg) {
           Request request = ObjectModelHelper.getRequest(objectModel);
  -        request.setAttribute(COCOON_FLOW_JS_JAVA_PACKAGE, javaPkg);
  +        request.setAttribute(JAVA_PACKAGE_OBJECT, javaPkg);
       }
  -
   }
   
  
  
  
  1.20      +9 -11     cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/JavaScriptInterpreter.java
  
  Index: JavaScriptInterpreter.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/JavaScriptInterpreter.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- JavaScriptInterpreter.java	8 May 2003 00:05:04 -0000	1.19
  +++ JavaScriptInterpreter.java	18 May 2003 16:36:40 -0000	1.20
  @@ -44,6 +44,7 @@
   
   */
   package org.apache.cocoon.components.flow.javascript;
  +
   import java.io.BufferedReader;
   import java.io.InputStream;
   import java.io.InputStreamReader;
  @@ -333,13 +334,13 @@
       {
           Map objectModel = environment.getObjectModel();
           Request request = ObjectModelHelper.getRequest(objectModel);
  -        Session session = request.getSession(true);
  -
  -        HashMap userScopes = (HashMap)session.getAttribute(USER_GLOBAL_SCOPE);
  -        if (userScopes == null)
  -            return;
  -
  -        userScopes.remove(environment.getURIPrefix());
  +        Session session = request.getSession(false);
  +        if (session != null) {
  +            HashMap userScopes = (HashMap)session.getAttribute(USER_GLOBAL_SCOPE);
  +            if (userScopes != null) {
  +                userScopes.remove(environment.getURIPrefix());
  +            }
  +        }
       }
   
       /**
  @@ -715,6 +716,3 @@
           super.forwardTo(uri, bizData, continuation, environment);
       }
   }
  -
  -
  -
  
  
  
  1.3       +3 -3      cocoon-2.1/src/java/org/apache/cocoon/components/language/markup/xsp/java/jpath.xsl
  
  Index: jpath.xsl
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/language/markup/xsp/java/jpath.xsl,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- jpath.xsl	7 May 2003 04:36:33 -0000	1.2
  +++ jpath.xsl	18 May 2003 16:36:41 -0000	1.3
  @@ -28,7 +28,7 @@
           <xsp:include>java.util.Iterator</xsp:include>
           <xsp:include>org.apache.cocoon.environment.Environment</xsp:include>
           <xsp:include>org.apache.cocoon.components.flow.WebContinuation</xsp:include>
  -        <xsp:include>org.apache.cocoon.components.flow.Flow</xsp:include>
  +        <xsp:include>org.apache.cocoon.components.flow.FlowHelper</xsp:include>
           <xsp:include>org.apache.commons.jxpath.JXPathContext</xsp:include>
           <xsp:include>org.apache.commons.jxpath.CompiledExpression</xsp:include>
         </xsp:structure>
  @@ -37,9 +37,9 @@
         </xsp:logic>
   
         <xsp:init-page>
  -        Object bean = Flow.getContextObject(this.objectModel);
  +        Object bean = FlowHelper.getContextObject(this.objectModel);
           WebContinuation kont
  -          = Flow.getWebContinuation(this.objectModel);
  +          = FlowHelper.getWebContinuation(this.objectModel);
           JXPathContext jxpathContext = JXPathContext.newContext(bean);
           Object __jxpathResult;
           // Generate the compiled representation of the JXPath
  
  
  
  1.4       +4 -4      cocoon-2.1/src/java/org/apache/cocoon/transformation/JPathTransformer.java
  
  Index: JPathTransformer.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/transformation/JPathTransformer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JPathTransformer.java	7 May 2003 11:27:59 -0000	1.3
  +++ JPathTransformer.java	18 May 2003 16:36:41 -0000	1.4
  @@ -57,7 +57,7 @@
   import org.apache.avalon.framework.activity.Initializable;
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.ProcessingException;
  -import org.apache.cocoon.components.flow.Flow;
  +import org.apache.cocoon.components.flow.FlowHelper;
   import org.apache.cocoon.components.flow.WebContinuation;
   import org.apache.cocoon.environment.SourceResolver;
   import org.apache.commons.jxpath.JXPathContext;
  @@ -160,8 +160,8 @@
           super.setup(resolver, objectModel, src, parameters);
   
           // setup the jpath transformer for this thread
  -        Object bean = Flow.getContextObject(objectModel);
  -        m_kont = Flow.getWebContinuation(objectModel);
  +        Object bean = FlowHelper.getContextObject(objectModel);
  +        m_kont = FlowHelper.getWebContinuation(objectModel);
           m_jxpathContext = JXPathContext.newContext(bean);
       }
   
  
  
  
  1.9       +4 -4      cocoon-2.1/src/scratchpad/src/org/apache/cocoon/generation/FlowVelocityGenerator.java
  
  Index: FlowVelocityGenerator.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/scratchpad/src/org/apache/cocoon/generation/FlowVelocityGenerator.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- FlowVelocityGenerator.java	7 May 2003 11:36:18 -0000	1.8
  +++ FlowVelocityGenerator.java	18 May 2003 16:36:41 -0000	1.9
  @@ -69,7 +69,7 @@
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.ResourceNotFoundException;
  -import org.apache.cocoon.components.flow.Flow;
  +import org.apache.cocoon.components.flow.FlowHelper;
   import org.apache.cocoon.components.flow.WebContinuation;
   import org.apache.cocoon.environment.ObjectModelHelper;
   import org.apache.cocoon.environment.Request;
  @@ -857,10 +857,10 @@
           this.resolverContext.put(CONTEXT_SOURCE_CACHE_KEY, new HashMap());
   
           // FIXME: Initialize the Velocity context. Use objectModel to pass these
  -        final Object bean = Flow.getContextObject(objectModel);
  +        final Object bean = FlowHelper.getContextObject(objectModel);
           if (bean != null) {
   
  -            final WebContinuation kont = Flow.getWebContinuation(objectModel);
  +            final WebContinuation kont = FlowHelper.getWebContinuation(objectModel);
   
               // Hack? I use JXPath to determine the properties of the bean object
               final JXPathBeanInfo bi = JXPathIntrospector.getBeanInfo(bean.getClass());
  
  
  
  1.17      +3 -3      cocoon-2.1/src/scratchpad/src/org/apache/cocoon/generation/JXFormsGenerator.java
  
  Index: JXFormsGenerator.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/scratchpad/src/org/apache/cocoon/generation/JXFormsGenerator.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- JXFormsGenerator.java	16 May 2003 07:12:27 -0000	1.16
  +++ JXFormsGenerator.java	18 May 2003 16:36:41 -0000	1.17
  @@ -59,7 +59,7 @@
   
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.ProcessingException;
  -import org.apache.cocoon.components.flow.Flow;
  +import org.apache.cocoon.components.flow.FlowHelper;
   import org.apache.cocoon.components.flow.WebContinuation;
   import org.apache.cocoon.components.jxforms.validation.Violation;
   import org.apache.cocoon.components.jxforms.xmlform.Form;
  @@ -1193,8 +1193,8 @@
                   }
               }
           }
  -        bean = Flow.getContextObject(objectModel);
  -        kont = Flow.getWebContinuation(objectModel);
  +        bean = FlowHelper.getContextObject(objectModel);
  +        kont = FlowHelper.getWebContinuation(objectModel);
           this.objectModel = objectModel;
       }
   
  
  
  
  1.12      +5 -4      cocoon-2.1/src/scratchpad/src/org/apache/cocoon/generation/JXTemplateGenerator.java
  
  Index: JXTemplateGenerator.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/scratchpad/src/org/apache/cocoon/generation/JXTemplateGenerator.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- JXTemplateGenerator.java	16 May 2003 07:12:27 -0000	1.11
  +++ JXTemplateGenerator.java	18 May 2003 16:36:41 -0000	1.12
  @@ -66,7 +66,7 @@
   
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.ProcessingException;
  -import org.apache.cocoon.components.flow.Flow;
  +import org.apache.cocoon.components.flow.FlowHelper;
   import org.apache.cocoon.components.flow.WebContinuation;
   import org.apache.cocoon.components.flow.javascript.JavaScriptFlow;
   import org.apache.cocoon.components.source.SourceUtil;
  @@ -1947,8 +1947,8 @@
                   }
               }
           }
  -        Object bean = Flow.getContextObject(objectModel);
  -        WebContinuation kont = Flow.getWebContinuation(objectModel);
  +        Object bean = FlowHelper.getContextObject(objectModel);
  +        WebContinuation kont = FlowHelper.getWebContinuation(objectModel);
           setContexts(bean, kont,
                       ObjectModelHelper.getRequest(objectModel),
                       ObjectModelHelper.getResponse(objectModel),
  @@ -2025,7 +2025,8 @@
           if (contextObject != null) {
               map.put("flowContext", contextObject);
               map.put("continuation", kont);
  -            // Here I use Rhino's live-connect objects to allow Jexl to call 
  +            // FIXME (VG): Is this required (what it's used for - examples)?
  +            // Here I use Rhino's live-connect objects to allow Jexl to call
               // java constructors
               Object javaPkg = JavaScriptFlow.getJavaPackage(objectModel);
               Object pkgs = JavaScriptFlow.getPackages(objectModel);
  
  
  
  1.7       +10 -6     cocoon-2.1/src/scratchpad/src/org/apache/cocoon/generation/TraxGenerator.java
  
  Index: TraxGenerator.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/scratchpad/src/org/apache/cocoon/generation/TraxGenerator.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TraxGenerator.java	7 May 2003 11:36:18 -0000	1.6
  +++ TraxGenerator.java	18 May 2003 16:36:41 -0000	1.7
  @@ -62,7 +62,7 @@
   
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.ProcessingException;
  -import org.apache.cocoon.components.flow.Flow;
  +import org.apache.cocoon.components.flow.FlowHelper;
   import org.apache.cocoon.components.flow.WebContinuation;
   import org.apache.cocoon.components.jxdom.DocumentAdapter;
   import org.apache.cocoon.environment.Context;
  @@ -80,17 +80,22 @@
   /**
    * <p>XSLT Generator: works by taking a Java Bean as an input "document"</p>
    */
  -
   public class TraxGenerator extends TraxTransformer implements Generator {
  -    
  +
  +    //
  +    // VG: Caching aspect: DocumentAdapter will have to dynamically generate
  +    // cache validity depending on what resources had been used during
  +    // generation phase. Another option is to leave it uncacheable.
  +    //
  +
       DocumentAdapter doc;
   
       public void setup(SourceResolver resolver, Map objectModel,
                         String src, Parameters parameters)
           throws ProcessingException, SAXException, IOException {
           super.setup(resolver, objectModel, src, parameters);
  -        Object bean = Flow.getContextObject(objectModel);
  -        WebContinuation kont = Flow.getWebContinuation(objectModel);
  +        Object bean = FlowHelper.getContextObject(objectModel);
  +        WebContinuation kont = FlowHelper.getWebContinuation(objectModel);
           Map map = new HashMap();
           Request request = ObjectModelHelper.getRequest(objectModel);
           Response response = ObjectModelHelper.getResponse(objectModel);
  @@ -169,5 +174,4 @@
           super.recycle();
           doc = null;
       }
  -
   }
  
  
  

Mime
View raw message