cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: cocoon-2.1/src/java/org/apache/cocoon cocoon.roles
Date Mon, 01 Sep 2003 14:45:08 GMT
cziegeler    2003/09/01 07:45:08

  Modified:    .        status.xml
               src/java/org/apache/cocoon/components
                        GlobalRequestLifecycleComponent.java
                        RequestLifecycleComponent.java
               src/blocks/portal/conf portal.xconf
               src/java/org/apache/cocoon cocoon.roles
  Added:       src/java/org/apache/cocoon/components/persistence
                        RequestDataStoreImpl.java RequestDataStore.java
  Removed:     src/blocks/portal/java/org/apache/cocoon/components/persistence
                        RequestDataStoreImpl.java RequestDataStore.java
  Log:
     <action dev="CZ" type="add">
       Adding new RequestDataStore component making the extra component
       marker interfaces RequestLifeCycleComponent and 
       GlobalRequestLifeCycleComponent obsolete.
     </action>
  
  Revision  Changes    Path
  1.133     +6 -1      cocoon-2.1/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/status.xml,v
  retrieving revision 1.132
  retrieving revision 1.133
  diff -u -r1.132 -r1.133
  --- status.xml	1 Sep 2003 14:07:33 -0000	1.132
  +++ status.xml	1 Sep 2003 14:45:07 -0000	1.133
  @@ -189,6 +189,11 @@
     <changes>
   
    <release version="@version@" date="@date@">
  +   <action dev="CZ" type="add">
  +     Adding new RequestDataStore component making the extra component
  +     marker interfaces RequestLifeCycleComponent and 
  +     GlobalRequestLifeCycleComponent obsolete.
  +   </action>
      <action dev="UV" type="fix">
        Changed logkit attribute of &lt;logging in cli.xconf to be relative to context
dir, 
        rather than CLI invocation dir.
  
  
  
  1.3       +3 -1      cocoon-2.1/src/java/org/apache/cocoon/components/GlobalRequestLifecycleComponent.java
  
  Index: GlobalRequestLifecycleComponent.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/GlobalRequestLifecycleComponent.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GlobalRequestLifecycleComponent.java	11 Jul 2003 20:34:22 -0000	1.2
  +++ GlobalRequestLifecycleComponent.java	1 Sep 2003 14:45:07 -0000	1.3
  @@ -69,6 +69,8 @@
    *
    * @see org.apache.cocoon.components.RequestLifecycleComponent
    * 
  + * @deprecated This component is deprecated. Use the 
  + *             {@link org.apache.cocoon.components.persistence.RequestDataStore} instead.
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
    * @version CVS $Id$
    */
  
  
  
  1.4       +3 -1      cocoon-2.1/src/java/org/apache/cocoon/components/RequestLifecycleComponent.java
  
  Index: RequestLifecycleComponent.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/RequestLifecycleComponent.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RequestLifecycleComponent.java	11 Jul 2003 20:34:22 -0000	1.3
  +++ RequestLifecycleComponent.java	1 Sep 2003 14:45:07 -0000	1.4
  @@ -70,6 +70,8 @@
    * 
    * @see org.apache.cocoon.components.GlobalRequestLifecycleComponent
    * 
  + * @deprecated This component is deprecated. Use the 
  + *             {@link org.apache.cocoon.components.persistence.RequestDataStore} instead.
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
    * @version CVS $Id$
    */
  
  
  
  1.1                  cocoon-2.1/src/java/org/apache/cocoon/components/persistence/RequestDataStoreImpl.java
  
  Index: RequestDataStoreImpl.java
  ===================================================================
  /*
  
   ============================================================================
                     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.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.cocoon.components.persistence;
  
  import java.util.HashMap;
  import java.util.Map;
  
  import org.apache.avalon.framework.component.Component;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.ContextException;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.framework.thread.ThreadSafe;
  import org.apache.cocoon.components.ContextHelper;
  import org.apache.cocoon.environment.ObjectModelHelper;
  
  /**
   * The default implementation
   * 
   * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
   * 
   * @version CVS $Id: RequestDataStoreImpl.java,v 1.1 2003/09/01 14:45:07 cziegeler Exp $
   * @since 2.1.1
   */
  public class RequestDataStoreImpl
      extends AbstractLogEnabled
      implements Component, ThreadSafe, RequestDataStore, Contextualizable {
          
      protected Context context;
  
      protected String requestDataKey;
      
      protected String globalRequestDataKey;
  
      /* (non-Javadoc)
       * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
       */
      public void contextualize(Context context) throws ContextException {
          this.context = context;
          this.requestDataKey = this.getClass().getName() + "/RD";
          this.globalRequestDataKey = this.getClass().getName() + "/GRD";
      }
  
      /* (non-Javadoc)
       * @see org.apache.cocoon.components.persistance.RequestDataStore#getGlobalRequestData(java.lang.String)
       */
      public Object getGlobalRequestData(String key) {
          Object value = null;
          final Map objectModel = (Map)ContextHelper.getObjectModel(this.context);
          Map m = (Map)objectModel.get(this.globalRequestDataKey);
          if ( m != null ) {
              value = m.get( key );
          }
          return value;
      }
  
      /* (non-Javadoc)
       * @see org.apache.cocoon.components.persistance.RequestDataStore#getRequestData(java.lang.String)
       */
      public Object getRequestData(String key) {
          Object value = null;
          final Map objectModel = (Map)ContextHelper.getObjectModel(this.context);
          Map m = (Map)objectModel.get(this.requestDataKey + ObjectModelHelper.getRequest(objectModel).hashCode());
          if ( m != null ) {
              value = m.get( key );
          }
          return value;
      }
  
      /* (non-Javadoc)
       * @see org.apache.cocoon.components.persistance.RequestDataStore#removeGlobalRequestData(java.lang.String)
       */
      public void removeGlobalRequestData(String key) {
          final Map objectModel = (Map)ContextHelper.getObjectModel(this.context);
          Map m = (Map)objectModel.get(this.globalRequestDataKey);
          if ( m != null ) {
              objectModel.remove( key );
          }
      }
  
      /* (non-Javadoc)
       * @see org.apache.cocoon.components.persistance.RequestDataStore#removeRequestData(java.lang.String)
       */
      public void removeRequestData(String key) {
          final Map objectModel = (Map)ContextHelper.getObjectModel(this.context);
          Map m = (Map)objectModel.get(this.requestDataKey + ObjectModelHelper.getRequest(objectModel).hashCode());
          if ( m != null ) {
              objectModel.remove( key );
          }
      }
  
      /* (non-Javadoc)
       * @see org.apache.cocoon.components.persistance.RequestDataStore#setGlobalRequestData(java.lang.String,
java.lang.Object)
       */
      public void setGlobalRequestData(String key, Object value) {
          final Map objectModel = (Map)ContextHelper.getObjectModel(this.context);
          Map m = (Map)objectModel.get(this.globalRequestDataKey);
          if ( m == null ) {
              m = new HashMap();
              objectModel.put(this.globalRequestDataKey, m);
          }
          m.put(key, value);
      }
  
      /* (non-Javadoc)
       * @see org.apache.cocoon.components.persistance.RequestDataStore#setRequestData(java.lang.String,
java.lang.Object)
       */
      public void setRequestData(String key, Object value) {
          final Map objectModel = (Map)ContextHelper.getObjectModel(this.context);
          Map m = (Map)objectModel.get(this.requestDataKey + ObjectModelHelper.getRequest(objectModel).hashCode());
          if ( m == null ) {
              m = new HashMap();
              objectModel.put(this.requestDataKey + ObjectModelHelper.getRequest(objectModel).hashCode(),
m);
          }
          m.put(key, value);
      }
  
  }
  
  
  
  1.1                  cocoon-2.1/src/java/org/apache/cocoon/components/persistence/RequestDataStore.java
  
  Index: RequestDataStore.java
  ===================================================================
  /*
  
   ============================================================================
                     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.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.cocoon.components.persistence;
  
  
  /**
   * A request data store is a component that manages data that are
   * linked to the current request.
   * With the setRequestData() method you can link any object to the
   * current request. This object can be fetched via getRequestData()
   * as long as the request is running. This data is not available
   * in any sub-request (cocoon: protocol calls).
   * If you want to share data between the main request and any sub-request
   * than you have to use the setGlobalRequestData etc. methods.
   * 
   * This component is a replacement for the request lifecycle and
   * global request lifecycle components.
   * 
   * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
   * 
   * @version CVS $Id: RequestDataStore.java,v 1.1 2003/09/01 14:45:07 cziegeler Exp $
   * @since 2.1.1
   */
  public interface RequestDataStore {
          
      String ROLE = RequestDataStore.class.getName();
      
      Object getRequestData(String key);
  
      void removeRequestData(String key);
  
      void setRequestData(String key, Object value);
  
      Object getGlobalRequestData(String key);
  
      void removeGlobalRequestData(String key);
  
      void setGlobalRequestData(String key, Object value);
  }
  
  
  
  1.25      +0 -1      cocoon-2.1/src/blocks/portal/conf/portal.xconf
  
  Index: portal.xconf
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/conf/portal.xconf,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- portal.xconf	21 Aug 2003 06:41:19 -0000	1.24
  +++ portal.xconf	1 Sep 2003 14:45:07 -0000	1.25
  @@ -82,5 +82,4 @@
    <component class="org.apache.cocoon.portal.profile.impl.MapProfileLS" role="org.apache.cocoon.portal.profile.ProfileLS"
/>
   
    <component class="org.apache.cocoon.components.variables.DefaultVariableResolverFactory"
role="org.apache.cocoon.components.variables.VariableResolverFactory" />
  - <component class="org.apache.cocoon.components.persistence.RequestDataStoreImpl" role="org.apache.cocoon.components.persistence.RequestDataStore"
/>
   </xconf>
  
  
  
  1.9       +5 -0      cocoon-2.1/src/java/org/apache/cocoon/cocoon.roles
  
  Index: cocoon.roles
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/cocoon.roles,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- cocoon.roles	21 Jun 2003 13:48:20 -0000	1.8
  +++ cocoon.roles	1 Sep 2003 14:45:08 -0000	1.9
  @@ -203,5 +203,10 @@
     <role name="org.apache.cocoon.components.modules.input.SitemapVariableHolder"
           shorthand="global-variables"
           default-class="org.apache.cocoon.components.modules.input.SitemapVariableHolder"/>
  +  
  +  <!-- Storing data in the current request -->
  +  <role name="org.apache.cocoon.components.persistence.RequestDataStore"
  +        shorthand="request-data-store"
  +        default-class="org.apache.cocoon.components.persistence.RequestDataStoreImpl"/>
   
   </role-list>
  
  
  

Mime
View raw message