cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From un...@apache.org
Subject cvs commit: cocoon-2.2/src/java/org/apache/cocoon/caching/impl CacheImpl.java
Date Sat, 31 Jan 2004 19:52:35 GMT
unico       2004/01/31 11:52:35

  Modified:    src/java/org/apache/cocoon/bean CocoonBean.java
               lib      jars.xml
               src/java/org/apache/cocoon/components/store/impl
                        DefaultStore.java
               src/webapp/WEB-INF cocoon.xconf
               src/java/org/apache/cocoon/caching/impl CacheImpl.java
  Added:       lib/core excalibur-store-1.0-dev-20040131.jar
               src/java/org/apache/cocoon/components/store/impl
                        DefaultTransientStore.java
                        DefaultPersistentStore.java
  Removed:     lib/core excalibur-store-1.0-dev.jar
  Log:
  Sylvain's store improvements
  
  Revision  Changes    Path
  1.1                  cocoon-2.2/lib/core/excalibur-store-1.0-dev-20040131.jar
  
  	<<Binary file>>
  
  
  1.49      +1 -0      cocoon-2.2/src/java/org/apache/cocoon/bean/CocoonBean.java
  
  Index: CocoonBean.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/bean/CocoonBean.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- CocoonBean.java	23 Jan 2004 11:07:28 -0000	1.48
  +++ CocoonBean.java	31 Jan 2004 19:52:34 -0000	1.49
  @@ -277,6 +277,7 @@
               Map.Entry entry = (Map.Entry)it.next();
               initContext.put(entry.getKey(), entry.getValue());
           }
  +        initContext.put(Constants.CONTEXT_WORK_DIR,m_workDirectory);
   
           m_contManager = new DefaultContainerManager( initContext, m_initializationLogger
);
           ContainerUtil.initialize( m_contManager );
  
  
  
  1.123     +2 -2      cocoon-2.2/lib/jars.xml
  
  Index: jars.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/lib/jars.xml,v
  retrieving revision 1.122
  retrieving revision 1.123
  diff -u -r1.122 -r1.123
  --- jars.xml	26 Jan 2004 02:34:35 -0000	1.122
  +++ jars.xml	31 Jan 2004 19:52:34 -0000	1.123
  @@ -213,7 +213,7 @@
         support high level server development.
       </description>
       <used-by>Cocoon</used-by>
  -    <lib>core/excalibur-store-1.0-dev.jar</lib>
  +    <lib>core/excalibur-store-1.0-dev-20040131.jar</lib>
       <homepage>http://avalon.apache.org/excalibur/</homepage>
     </file>
   
  
  
  
  1.10      +27 -144   cocoon-2.2/src/java/org/apache/cocoon/components/store/impl/DefaultStore.java
  
  Index: DefaultStore.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/store/impl/DefaultStore.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DefaultStore.java	28 Jan 2004 17:24:22 -0000	1.9
  +++ DefaultStore.java	31 Jan 2004 19:52:34 -0000	1.10
  @@ -50,162 +50,45 @@
   */
   package org.apache.cocoon.components.store.impl;
   
  -import java.io.File;
  -import java.io.IOException;
  -
  -import com.coyotegulch.jisp.BTreeIndex;
  -import com.coyotegulch.jisp.IndexedObjectDatabase;
  -import com.coyotegulch.jisp.KeyNotFound;
  -
  -import org.apache.avalon.framework.activity.Disposable;
  -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.parameters.ParameterException;
  -import org.apache.avalon.framework.parameters.Parameterizable;
   import org.apache.avalon.framework.parameters.Parameters;
  -import org.apache.cocoon.Constants;
  -import org.apache.cocoon.util.IOUtils;
  -import org.apache.excalibur.store.Store;
  -import org.apache.excalibur.store.impl.AbstractJispFilesystemStore;
  +import org.apache.avalon.framework.service.ServiceException;
  +import org.apache.avalon.framework.service.ServiceManager;
  +import org.apache.excalibur.store.impl.MRUMemoryStore;
  +
   
   /**
  - * This store is based on the Jisp library
  - * (http://www.coyotegulch.com/jisp/index.html). This store uses B-Tree indexes
  - * to access variable-length serialized data stored in files.
  - *
  - * @author <a href="mailto:g-froehlich@gmx.de">Gerhard Froehlich</a>
  - * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
  + * Default implementation of Cocoon's store. It's a <code>MRUMemoryStore</code>
whose
  + * "<code>use-persistent-cache</code>" parameter defaults to <code>true</code>.
  + * <p>
  + * This default setting allows the store to be an in-memory front-end to the persistent
store.
  + * 
  + * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a>
    * @version CVS $Id$
    * 
    * @avalon.component
  - * @avalon.service type=Store
  + * @avalon.service type=org.apache.excalibur.store.Store
    * @x-avalon.lifestyle type=singleton
  - * @x-avalon.info name=persistent-store
  + * @x-avalon.info name=store
    */
  -public class DefaultStore extends AbstractJispFilesystemStore
  -    implements Store,
  -               Contextualizable,
  -               Parameterizable,
  -               Disposable {
  -
  -    /** The context containing the work and the cache directory */
  -    protected Context context;
  +public class DefaultStore extends MRUMemoryStore {
       
  -    /**
  -     * Contextualize the Component
  -     *
  -     * @param  context the Context of the Application
  -     * @exception  ContextException
  -     */
  -    public void contextualize(final Context context) throws ContextException {
  -        this.context = context;
  +    public void parameterize(Parameters params) throws ParameterException {
  +        if (!params.isParameter("use-persistent-cache")) {
  +            params.setParameter("use-persistent-cache", "true");
  +        }
  +        super.parameterize(params);
       }
  -
  +    
       /**
  -     *  Configure the Component.<br>
  -     *  A few options can be used
  -     *  <UL>
  -     *    <LI> datafile = the name of the data file (Default: cocoon.dat)
  -     *    </LI>
  -     *    <LI> m_indexFile = the name of the index file (Default: cocoon.idx)
  -     *    </LI>
  -     *    <LI> order = The page size of the B-Tree</LI>
  -     *  </UL>
  -     *
  -     * @param params the configuration paramters
  -     * @exception  ParameterException
  +     * NOTE: the Store dependency is commented out because 
  +     * Fortress chokes on cyclic dependencies.
  +     * 
  +     * @avalon.dependency type=org.apache.excalibur.store.StoreJanitor
  +     * @@avalon.dependency type=org.apache.excalibur.store.Store
        */
  -    public void parameterize(Parameters params) throws ParameterException {
  -        
  -        // get the directory to use
  -        try {
  -            final File workDir = (File)context.get(Constants.CONTEXT_WORK_DIR);
  -            if (params.getParameterAsBoolean("use-cache-directory", false)) {
  -                final File cacheDir = (File)context.get(Constants.CONTEXT_CACHE_DIR);
  -                if (getLogger().isDebugEnabled()) {
  -                    getLogger().debug("Using cache directory: " + cacheDir);
  -                }
  -                this.setDirectory(cacheDir);
  -            } else if (params.getParameterAsBoolean("use-work-directory", false)) {
  -                if (getLogger().isDebugEnabled()) {
  -                    getLogger().debug("Using work directory: " + workDir);
  -                }
  -                this.setDirectory(workDir);
  -            } else if (params.getParameter("directory", null) != null) {
  -                String dir = params.getParameter("directory");
  -                dir = IOUtils.getContextFilePath(workDir.getPath(), dir);
  -                if (getLogger().isDebugEnabled()) {
  -                    getLogger().debug("Using directory: " + dir);
  -                }
  -                this.setDirectory(new File(dir));
  -            } else {
  -                try {
  -                    // Default
  -                    this.setDirectory(workDir);
  -                } catch (IOException e) {
  -                    // Ignored
  -                }
  -            }
  -        } catch (ContextException ce) {
  -            throw new ParameterException("Unable to get directory information from context.",
ce);
  -        } catch (IOException e) {
  -            throw new ParameterException("Unable to set directory", e);
  -        }
  -
  -        // get store configuration
  -        final String databaseName = params.getParameter("datafile", "cocoon.dat");
  -        final String indexName = params.getParameter("m_indexFile", "cocoon.idx");
  -        final int order = params.getParameterAsInteger("order", 301);
  -        if (getLogger().isDebugEnabled()) {
  -            getLogger().debug("Database file name = " + databaseName);
  -            getLogger().debug("Index file name = " + indexName);
  -            getLogger().debug("Order=" + order);
  -        }
  -
  -        // open index and dat file
  -        final File databaseFile = new File(m_directoryFile, databaseName);
  -        final File indexFile = new File(m_directoryFile, indexName);
  -
  -        if (getLogger().isDebugEnabled()) {
  -            getLogger().debug("Initializing JispFilesystemStore");
  -        }
  -        try {
  -            final boolean databaseExists = databaseFile.exists();
  -            if (getLogger().isDebugEnabled()) {
  -                getLogger().debug("Datafile exists: " + databaseExists);
  -            }
  -            super.m_Database = new IndexedObjectDatabase(databaseFile.toString(),
  -                                                         !databaseExists);
  -
  -            if (!databaseExists) {
  -                // Create new index
  -                super.m_Index = new BTreeIndex(indexFile.toString(),
  -                                               order, super.getNullKey(), false);
  -            } else {
  -                // Open existing index
  -                super.m_Index = new BTreeIndex(indexFile.toString());
  -            }
  -            super.m_Database.attachIndex(super.m_Index);
  -        } catch (KeyNotFound ignore) {
  -        } catch (Exception e) {
  -            getLogger().error("Exception during initialization of jisp store.", e);
  -        }
  +    public void service(ServiceManager manager) throws ServiceException {
  +        super.service(manager);
       }
   
  -    public void dispose() {
  -        try {
  -            getLogger().debug("Disposing");
  -
  -            if (super.m_Index != null) {
  -                super.m_Index.close();
  -            }
  -
  -            if (super.m_Database != null) {
  -                super.m_Database.close();
  -            }
  -        } catch (Exception e) {
  -            getLogger().error("dispose(..) Exception", e);
  -        }
  -    }
   }
  
  
  
  1.1                  cocoon-2.2/src/java/org/apache/cocoon/components/store/impl/DefaultTransientStore.java
  
  Index: DefaultTransientStore.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.store.impl;
  
  import org.apache.avalon.framework.parameters.ParameterException;
  import org.apache.avalon.framework.parameters.Parameters;
  import org.apache.avalon.framework.service.ServiceException;
  import org.apache.avalon.framework.service.ServiceManager;
  import org.apache.excalibur.store.impl.MRUMemoryStore;
  
  /**
   * Default implementation of Cocoon's transient store. This is a <code>MRUMemoryStore</code>
   * that cannot be backed by a persistent store (this ensure it is really transient).
   * 
   * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a>
   * @version CVS $Id: DefaultTransientStore.java,v 1.1 2004/01/31 19:52:34 unico Exp $
   * 
   * @avalon.component
   * @avalon.service type=org.apache.excalibur.store.Store
   * @x-avalon.lifestyle type=singleton
   * @x-avalon.info name=transient-store
   */
  public class DefaultTransientStore extends MRUMemoryStore {
      
      public void parameterize(Parameters params) throws ParameterException {
          if (params.getParameterAsBoolean("use-persistent-cache", false)) {
              throw new ParameterException("A transient store cannot be backed by a persistent
store.");
          }
          super.parameterize(params);
      }
      
      /**
       * NOTE: the Store dependency is commented out because 
       * Fortress chokes on cyclic dependencies.
       * 
       * @avalon.dependency type=org.apache.excalibur.store.StoreJanitor
       * @@avalon.dependency type=org.apache.excalibur.store.Store
       */
      public void service(ServiceManager manager) throws ServiceException {
          super.service(manager);
      }
  }
  
  
  
  1.1                  cocoon-2.2/src/java/org/apache/cocoon/components/store/impl/DefaultPersistentStore.java
  
  Index: DefaultPersistentStore.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.store.impl;
  
  import java.io.File;
  import java.io.IOException;
  
  import com.coyotegulch.jisp.BTreeIndex;
  import com.coyotegulch.jisp.IndexedObjectDatabase;
  import com.coyotegulch.jisp.KeyNotFound;
  
  import org.apache.avalon.framework.activity.Disposable;
  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.parameters.ParameterException;
  import org.apache.avalon.framework.parameters.Parameterizable;
  import org.apache.avalon.framework.parameters.Parameters;
  import org.apache.avalon.framework.thread.ThreadSafe;
  import org.apache.cocoon.Constants;
  import org.apache.cocoon.util.IOUtils;
  import org.apache.excalibur.store.Store;
  import org.apache.excalibur.store.impl.AbstractJispFilesystemStore;
  
  /**
   * This store is based on the Jisp library
   * (http://www.coyotegulch.com/jisp/index.html). This store uses B-Tree indexes
   * to access variable-length serialized data stored in files.
   *
   * @author <a href="mailto:g-froehlich@gmx.de">Gerhard Froehlich</a>
   * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
   * @version CVS $Id: DefaultPersistentStore.java,v 1.1 2004/01/31 19:52:34 unico Exp $
   * 
   * @avalon.component
   * @avalon.service type=Store
   * @x-avalon.lifestyle type=singleton
   * @x-avalon.info name=persistent-store
   */
  public class DefaultPersistentStore extends AbstractJispFilesystemStore
      implements Store,
                 Contextualizable,
                 ThreadSafe,
                 Parameterizable,
                 Disposable {
  
      /** The context containing the work and the cache directory */
      protected Context context;
      
      /**
       * Contextualize the Component
       *
       * @param  context the Context of the Application
       * @exception  ContextException
       */
      public void contextualize(final Context context) throws ContextException {
          this.context = context;
      }
  
      /**
       *  Configure the Component.<br>
       *  A few options can be used
       *  <UL>
       *    <LI> datafile = the name of the data file (Default: cocoon.dat)
       *    </LI>
       *    <LI> m_indexFile = the name of the index file (Default: cocoon.idx)
       *    </LI>
       *    <LI> order = The page size of the B-Tree</LI>
       *  </UL>
       *
       * @param params the configuration paramters
       * @exception  ParameterException
       */
      public void parameterize(Parameters params) throws ParameterException {
          
          // get the directory to use
          try {
              final File workDir = (File)context.get(Constants.CONTEXT_WORK_DIR);
              if (params.getParameterAsBoolean("use-cache-directory", false)) {
                  final File cacheDir = (File)context.get(Constants.CONTEXT_CACHE_DIR);
                  if (getLogger().isDebugEnabled()) {
                      getLogger().debug("Using cache directory: " + cacheDir);
                  }
                  this.setDirectory(cacheDir);
              } else if (params.getParameterAsBoolean("use-work-directory", false)) {
                  if (getLogger().isDebugEnabled()) {
                      getLogger().debug("Using work directory: " + workDir);
                  }
                  this.setDirectory(workDir);
              } else if (params.getParameter("directory", null) != null) {
                  String dir = params.getParameter("directory");
                  dir = IOUtils.getContextFilePath(workDir.getPath(), dir);
                  if (getLogger().isDebugEnabled()) {
                      getLogger().debug("Using directory: " + dir);
                  }
                  this.setDirectory(new File(dir));
              } else {
                  try {
                      // Default
                      this.setDirectory(workDir);
                  } catch (IOException e) {
                      // Ignored
                  }
              }
          } catch (ContextException ce) {
              throw new ParameterException("Unable to get directory information from context.",
ce);
          } catch (IOException e) {
              throw new ParameterException("Unable to set directory", e);
          }
  
          // get store configuration
          final String databaseName = params.getParameter("datafile", "cocoon.dat");
          final String indexName = params.getParameter("m_indexFile", "cocoon.idx");
          final int order = params.getParameterAsInteger("order", 301);
          if (getLogger().isDebugEnabled()) {
              getLogger().debug("Database file name = " + databaseName);
              getLogger().debug("Index file name = " + indexName);
              getLogger().debug("Order=" + order);
          }
  
          // open index and dat file
          final File databaseFile = new File(m_directoryFile, databaseName);
          final File indexFile = new File(m_directoryFile, indexName);
  
          if (getLogger().isDebugEnabled()) {
              getLogger().debug("Initializing JispFilesystemStore");
          }
          try {
              final boolean databaseExists = databaseFile.exists();
              if (getLogger().isDebugEnabled()) {
                  getLogger().debug("Datafile exists: " + databaseExists);
              }
              super.m_Database = new IndexedObjectDatabase(databaseFile.toString(),
                                                           !databaseExists);
  
              if (!databaseExists) {
                  // Create new index
                  super.m_Index = new BTreeIndex(indexFile.toString(),
                                                 order, super.getNullKey(), false);
              } else {
                  // Open existing index
                  super.m_Index = new BTreeIndex(indexFile.toString());
              }
              super.m_Database.attachIndex(super.m_Index);
          } catch (KeyNotFound ignore) {
          } catch (Exception e) {
              getLogger().error("Exception during initialization of jisp store.", e);
          }
      }
  
      public void dispose() {
          try {
              getLogger().debug("Disposing");
  
              if (super.m_Index != null) {
                  super.m_Index.close();
              }
  
              if (super.m_Database != null) {
                  super.m_Database.close();
              }
          } catch (Exception e) {
              getLogger().error("dispose(..) Exception", e);
          }
      }
  }
  
  
  
  1.41      +110 -101  cocoon-2.2/src/webapp/WEB-INF/cocoon.xconf
  
  Index: cocoon.xconf
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/webapp/WEB-INF/cocoon.xconf,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- cocoon.xconf	31 Jan 2004 16:58:24 -0000	1.40
  +++ cocoon.xconf	31 Jan 2004 19:52:34 -0000	1.41
  @@ -271,13 +271,119 @@
     
     <cache id="cache" />
     
  -  <mem-store id="TransientStore" />
  +<!-- ============================ Object Stores =========================== -->
  +
  +  <!--+
  +      | Store: generic store. The default implementation is an in-memory store
  +      | backed by the persistent store (see below). This forms a two-stage
  +      | cache composed of a fast in-memory MRU front-end and a persistent
  +      | back-end storing less used objects.
  +      |
  +      | Common configuration parameters:
  +      | maxobjects: Indicates how many objects will be hold in the cache.
  +      |    When the number of maxobjects has been reached. The last object
  +      |    in the cache will be thrown out.
  +      +-->
  +  <store id="Store" default="true" logger="core.store">
  +    <parameter name="maxobjects" value="100"/>
  +  </store>
     
  -  <persistent-store id="persistent-store" />
  +  <!--+
  +      | Transient Store: holds objects that don't have to survive shutdown
  +      |
  +      | Common configuration parameters:
  +      | maxobjects: Indicates how many objects will be hold in the cache.
  +      |    When the number of maxobjects has been reached. The last object
  +      |    in the cache will be thrown out.
  +      +-->
  +  <transient-store id="TransientStore" logger="core.store.transient">
  +    <parameter name="maxobjects" value="100"/>
  +  </transient-store>
  +
  +  <!--+
  +      | Persistent Store: holds objects that have to survive shutdown.
  +      | WARNING: FilesystemStore is broken. Cocoon uses DefaultPersistentStore based
  +      | on the Avalon Excalibur JispStore instead.
  +      |
  +      | Common configuration parameters:
  +      |  use-cache-directory: Indicates that cache directory specified in
  +      |                       web.xml should be used.
  +      |  use-work-directory: Indicates that work directory specified in
  +      |                      web.xml should be used.
  +      |  directory: Specifies directory to use. Absolute or relative to the
  +      |             work directory.
  +      |
  +      | DefaultStore configuration parameters:
  +      |  datafile: Name of the store file to use. Defaults to cocoon.dat
  +      |  indexfile: Name of the index file to use. Defaults to cocoon.idx
  +      |  order: FIXME: put description here.
  +      +-->
  +  <persistent-store id="PersistentStore" logger="core.store.persistent">
  +    <parameter name="use-cache-directory" value="true"/>
  +    <parameter name="order" value="2701"/>
  +  </persistent-store>
     
  -  <xml-serializer id="xml-serializer"/>
  +  <!--+
  +      | Store Janitor: the store garbage collector and memory usage controller.
  +      |
  +      | WARNING: Be careful with the heapsize and freememory parameters.
  +      |           Wrong values can cause high cpu usage.
  +      |
  +      | Example configuration:
  +      | Jvm settings:
  +      |    -Xmx200000000
  +      | store-janitor settings:
  +      |    <parameter name="freememory" value="5000000"/>
  +      |    <parameter name="heapsize" value="196000000"/>
  +      |
  +      | It is recommended to have heapsize equal to -Xmx, especially on Sun's
  +      | JVM which are unable to shrink its heap once it grows above minimum.
  +      | Freememory should be greater than amount of memory necessary for normal
  +      | application operation.
  +      | BUT: The heap size of the memory of the JVM is a little bit less than
  +      |      the value you specify for -Xmx, so you have to set the heapsize
  +      |      for the store janitor to a value which is lower (2% less seems
  +      |      to be a working value).
  +      +-->
  +  <store-janitor id="StoreJanitor" logger="core.store.janitor">
  +    <!-- How much free memory shall be available in the jvm -->
  +    <parameter name="freememory" value="2048000"/>
  +    <!-- Indicates the limit of the jvm memory consumption. The default max
  +         heapsize for Sun's JVM is (almost) 64Mb -->
  +    <parameter name="heapsize" value="66600000"/>
  +    <!-- How often shall the cleanup thread check memory -->
  +    <parameter name="cleanupthreadinterval" value="10"/>
  +    <!-- Experimental adaptive algorithm for cleanup interval
  +    <parameter name="adaptivethreadinterval" value="true"/>
  +    -->
  +    <!-- Indicates the thread priority of the cleanup thread -->
  +    <parameter name="threadpriority" value="5"/>
  +    <!-- How much percent of the elements of each registered Store
  +         shall be removed when low on memory. Default 10% -->
  +    <parameter name="percent_to_free" value="10"/>
  +    <!-- Invoke the garbage collector when low memory is reached -->
  +    <parameter name="invokegc" value="false"/>
  +  </store-janitor>
     
  -  <xml-deserializer id="xml-deserializer"/>
  +  <!--+
  +      | XML compiler/decompiler
  +      |
  +      | these components are used to process SAX events and produce a binary
  +      | representation that is much more compact and efficient for
  +      | subsequent parsing. These are used by the cache system to save
  +      | the intermediate results of the pipeline stages reducing the overhead
  +      | of xml parsing/serialization.
  +      +-->
  +  <xml-serializer
  +    id="xml-serializer"
  +    logger="core.xml-serializer"
  +    pool-grow="4" pool-max="32" pool-min="2"
  +  />
  +  <xml-deserializer
  +    id="xml-deserializer"
  +    logger="core.xml-serializer"
  +    pool-grow="4" pool-max="32" pool-min="2"
  +  />
     
   <!-- TODO: entries below are still 2.1 configuration -->
   
  @@ -469,91 +575,6 @@
       <component-instance logger="core.modules.output" name="session-attr"   class="org.apache.cocoon.components.modules.output.SessionAttributeOutputModule"/>
     </output-modules>
   
  -<!-- ============================ Object Stores =========================== -->
  -
  -  <!--+
  -      | Transient Store: holds objects that don't have to survive shutdown
  -      +-->
  -  <transient-store logger="core.store.transient">
  -
  -     <!--+
  -         | Indicates how many objects will be hold in the cache.
  -         | When the number of maxobjects has been reached. The last object
  -         | in the cache will be thrown out.
  -         +-->
  -     <parameter name="maxobjects" value="100"/>
  -
  -     <!-- Turns swapping of the objects into persistent cache on and off. -->
  -     <parameter name="use-persistent-cache" value="true"/>
  -  </transient-store>
  -
  -  <!--+
  -      | Persistent Store: holds objects that have to survive shutdown.
  -      | WARNING: FilesystemStore is broken. Cocoon uses DefaultStore based
  -      | on the Avalon Excalibur JispStore instead.
  -      |
  -      | Common configuration parameters:
  -      |  use-cache-directory: Indicates that cache directory specified in
  -      |                       web.xml should be used.
  -      |  use-work-directory: Indicates that work directory specified in
  -      |                      web.xml should be used.
  -      |  directory: Specifies directory to use. Absolute or relative to the
  -      |             work directory.
  -      |
  -      | DefaultStore configuration parameters:
  -      |  datafile: Name of the store file to use. Defaults to cocoon.dat
  -      |  indexfile: Name of the index file to use. Defaults to cocoon.idx
  -      |  order: FIXME: put description here.
  -      +-->
  -  <persistent-store class="org.apache.cocoon.components.store.impl.DefaultStore"
  -                    logger="core.store.persistent">
  -    <parameter name="use-cache-directory" value="true"/>
  -    <parameter name="order" value="2701"/>
  -  </persistent-store>
  -
  -  <!--+
  -      | Store Janitor: the store garbage collector and memory usage controller.
  -      |
  -      | Be careful with the heapsize and freememory parameters. Wrong values
  -      | can cause high cpu usage. Example configuration:
  -      | Jvm settings:
  -      |    -Xmx200000000
  -      | store-janitor settings:
  -      |    <parameter name="freememory" value="5000000"/>
  -      |    <parameter name="heapsize" value="196000000"/>
  -      |
  -      | It is recommended to have heapsize equal to -Xmx, especially on Sun's
  -      | JVM which are unable to shrink its heap once it grows above minimum.
  -      | Freememory should be greater than amount of memory necessary for normal
  -      | application operation.
  -      | BUT: The heap size of the memory of the JVM is a little bit less than
  -      |      the value you specify for -Xmx, so you have to set the heapsize
  -      |      for the store janitor to a value which is lower (2% less seems
  -      |      to be a working value).
  -      +-->
  -  <store-janitor logger="core.store.janitor">
  -     <!-- How much free memory shall be available in the jvm -->
  -     <parameter name="freememory" value="2048000"/>
  -     <!-- Indicates the limit of the jvm memory consumption. The default max
  -          heapsize for Sun's JVM is (almost) 64Mb -->
  -     <parameter name="heapsize" value="66600000"/>
  -     <!-- How often shall the cleanup thread check memory -->
  -     <parameter name="cleanupthreadinterval" value="10"/>
  -     <!-- Experimental adaptive algorithm for cleanup interval
  -     <parameter name="adaptivethreadinterval" value="true"/>
  -     -->
  -     <!-- Indicates the thread priority of the cleanup thread -->
  -     <parameter name="threadpriority" value="5"/>
  -     <!-- How much percent of the elements of each registered Store
  -          shall be removed when low on memory. Default 10% -->
  -     <parameter name="percent_to_free" value="10"/>
  -     <!-- Invoke the garbage collector when low memory is reached -->
  -     <parameter name="invokegc" value="false"/>
  -  </store-janitor>
  -
  -<!-- ========================= Protocol Handlers =========================== -->
  -
  -
   <!-- ================ Internationalization Catalogs =================== -->
   
     <!--+
  @@ -798,18 +819,6 @@
         | The core classloader implementation
         +-->
     <classloader class="org.apache.cocoon.components.classloader.ClassLoaderManagerImpl"
logger="core.classloader"/>
  -
  -  <!--+
  -      | XML compiler/decompiler
  -      |
  -      | these components are used to process SAX events and produce a binary
  -      | representation that is much more compact and efficient for
  -      | subsequent parsing. These are used by the cache system to save
  -      | the intermediate results of the pipeline stages reducing the overhead
  -      | of xml parsing/serialization.
  -      +-->
  -  <xml-serializer class="org.apache.cocoon.components.sax.XMLByteStreamCompiler" logger="core.xml-serializer"
pool-grow="4" pool-max="32" pool-min="8"/>
  -  <xml-deserializer class="org.apache.cocoon.components.sax.XMLByteStreamInterpreter"
logger="core.xml-deserializer" pool-grow="4" pool-max="32" pool-min="8"/>
   
     <!--+
         | The Monitor keeps track on changes to a Resource.
  
  
  
  1.12      +3 -3      cocoon-2.2/src/java/org/apache/cocoon/caching/impl/CacheImpl.java
  
  Index: CacheImpl.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/caching/impl/CacheImpl.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- CacheImpl.java	31 Jan 2004 16:54:49 -0000	1.11
  +++ CacheImpl.java	31 Jan 2004 19:52:35 -0000	1.12
  @@ -105,11 +105,11 @@
       /**
        * Reads the value of the <code>store</code> parameter that specifies the
        * lookup hint of the Store service to use and looks it up on the service
  -     * manager. If the parameter is not present the default transient store 
  +     * manager. If the parameter is not present the default store 
        * is attempted.
        */
       public void parameterize(Parameters parameters) throws ParameterException {
  -        String storeName = parameters.getParameter("store", Store.TRANSIENT_STORE);
  +        String storeName = parameters.getParameter("store", Store.ROLE);
           try {
               this.store = (Store)this.manager.lookup(storeName);
           } catch (ServiceException ce) {
  
  
  

Mime
View raw message