Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 75266 invoked from network); 31 Jan 2004 19:52:38 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 31 Jan 2004 19:52:38 -0000 Received: (qmail 50536 invoked by uid 500); 31 Jan 2004 19:52:27 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 50462 invoked by uid 500); 31 Jan 2004 19:52:27 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 50420 invoked by uid 500); 31 Jan 2004 19:52:26 -0000 Delivered-To: apmail-cocoon-2.2-cvs@apache.org Received: (qmail 50407 invoked from network); 31 Jan 2004 19:52:26 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 31 Jan 2004 19:52:26 -0000 Received: (qmail 75227 invoked by uid 1758); 31 Jan 2004 19:52:35 -0000 Date: 31 Jan 2004 19:52:35 -0000 Message-ID: <20040131195235.75226.qmail@minotaur.apache.org> From: unico@apache.org To: cocoon-2.2-cvs@apache.org Subject: cvs commit: cocoon-2.2/src/java/org/apache/cocoon/caching/impl CacheImpl.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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 <> 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. Cocoon - core/excalibur-store-1.0-dev.jar + core/excalibur-store-1.0-dev-20040131.jar http://avalon.apache.org/excalibur/ 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 Gerhard Froehlich - * @author Vadim Gritsenko + * Default implementation of Cocoon's store. It's a MRUMemoryStore whose + * "use-persistent-cache" parameter defaults to true. + *

+ * This default setting allows the store to be an in-memory front-end to the persistent store. + * + * @author Sylvain Wallez * @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.
- * A few options can be used - *

    - *
  • datafile = the name of the data file (Default: cocoon.dat) - *
  • - *
  • m_indexFile = the name of the index file (Default: cocoon.idx) - *
  • - *
  • order = The page size of the B-Tree
  • - *
- * - * @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 . For more information on the Apache Software Foundation, please see . */ 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 MRUMemoryStore * that cannot be backed by a persistent store (this ensure it is really transient). * * @author Sylvain Wallez * @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 . For more information on the Apache Software Foundation, please see . */ 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 Gerhard Froehlich * @author Vadim Gritsenko * @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.
* A few options can be used *
    *
  • datafile = the name of the data file (Default: cocoon.dat) *
  • *
  • m_indexFile = the name of the index file (Default: cocoon.idx) *
  • *
  • order = The page size of the B-Tree
  • *
* * @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 @@ - + + + + + + - + + + + + + + + + + - + + + + + + + + + + + + + + + + - + + + @@ -469,91 +575,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -