cziegeler    2003/03/17 01:49:32

  Modified:    lib      jars.xml
               src/webapp/WEB-INF cocoon.xconf
               src/java/org/apache/cocoon cocoon.roles
               src/documentation cocoon.xconf
  Added:       src/java/org/apache/cocoon/components/store/impl
                        DefaultStore.java
               lib/core excalibur-store-20030317.jar
  Removed:     lib/core excalibur-store-20020820.jar
  Log:
  Removing deprecated stuff from build docs
  Finishing store implementation
  
  Revision  Changes    Path
  1.1                  
cocoon-2.1/src/java/org/apache/cocoon/components/store/impl/DefaultStore.java
  
  Index: DefaultStore.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
      [EMAIL PROTECTED]
  
   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  <[EMAIL PROTECTED]>. 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.Initializable;
  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.impl.AbstractJispFilesystemStore;
  import org.apache.excalibur.store.impl.JispStringKey;
  
  /**
   * 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:[EMAIL PROTECTED]">Gerhard Froehlich</a>
   * @author <a href="mailto:[EMAIL PROTECTED]">Vadim Gritsenko</a>
   * @version CVS $Id: DefaultStore.java,v 1.1 2003/03/17 09:49:31 cziegeler Exp $
   */
  public final class DefaultStore extends AbstractJispFilesystemStore
      implements org.apache.excalibur.store.Store,
                 Contextualizable,
                 ThreadSafe,
                 Initializable,
                 Parameterizable {
  
      protected File m_workDir;
      protected File m_cacheDir;
  
      private File m_databaseFile;
      private File m_indexFile;
      private int m_Order;
  
      /**
       * Contextualize the Component
       *
       * @param  context the Context of the Application
       * @exception  ContextException
       */
      public void contextualize(final Context context) throws ContextException {
          this.m_workDir = (File)context.get(Constants.CONTEXT_WORK_DIR);
          this.m_cacheDir = (File)context.get(Constants.CONTEXT_CACHE_DIR);
      }
  
      /**
       *  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 {
  
          try {
              if (params.getParameterAsBoolean("use-cache-directory", false)) {
                  if (getLogger().isDebugEnabled()) {
                      getLogger().debug("Using cache directory: " + m_cacheDir);
                  }
                  setDirectory(m_cacheDir);
              } else if (params.getParameterAsBoolean("use-work-directory", false)) {
                  if (getLogger().isDebugEnabled()) {
                      getLogger().debug("Using work directory: " + m_workDir);
                  }
                  setDirectory(m_workDir);
              } else if (params.getParameter("directory", null) != null) {
                  String dir = params.getParameter("directory");
                  dir = IOUtils.getContextFilePath(m_workDir.getPath(), dir);
                  if (getLogger().isDebugEnabled()) {
                      getLogger().debug("Using directory: " + dir);
                  }
                  setDirectory(new File(dir));
              } else {
                  try {
                      // Default
                      setDirectory(m_workDir);
                  } catch (IOException e) {
                      // Ignored
                  }
              }
          } catch (IOException e) {
              throw new ParameterException("Unable to set directory", e);
          }
  
          String databaseName = params.getParameter("datafile", "cocoon.dat");
          String indexName = params.getParameter("m_indexFile", "cocoon.idx");
          m_Order = params.getParameterAsInteger("order", 301);
          if (getLogger().isDebugEnabled()) {
              getLogger().debug("Database file name = " + databaseName);
              getLogger().debug("Index file name = " + indexName);
              getLogger().debug("Order=" + m_Order);
          }
  
          this.m_databaseFile = new File(m_directoryFile, databaseName);
          m_indexFile = new File(m_directoryFile, indexName);
      }
  
      /**
       * Initialize the Component
       */
      public void initialize() {
          if (getLogger().isDebugEnabled()) {
              getLogger().debug("initialize() JispFilesystemStore");
          }
  
          try {
              if (m_databaseFile.exists()) {
                  if (getLogger().isDebugEnabled()) {
                      getLogger().debug("initialize(): Datafile exists");
                  }
                  m_Database = new IndexedObjectDatabase(m_databaseFile.toString(), 
false);
                  m_Index = new BTreeIndex(m_indexFile.toString());
                  m_Database.attachIndex(m_Index);
              } else {
                  if (getLogger().isDebugEnabled()) {
                      getLogger().debug("initialize(): Datafile does not exist");
                  }
                  m_Database = new IndexedObjectDatabase(m_databaseFile.toString(), 
false);
                  m_Index = new BTreeIndex(m_indexFile.toString(),
                                          m_Order, new JispStringKey(), false);
                  m_Database.attachIndex(m_Index);
              }
          } catch (KeyNotFound ignore) {
          } catch (Exception e) {
              getLogger().error("initialize(..) Exception", e);
          }
      }
  }
  
  
  
  1.1                  cocoon-2.1/lib/core/excalibur-store-20030317.jar
  
        <<Binary file>>
  
  
  1.6       +1 -1      cocoon-2.1/lib/jars.xml
  
  Index: jars.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/lib/jars.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- jars.xml  13 Mar 2003 16:06:07 -0000      1.5
  +++ jars.xml  17 Mar 2003 09:49:31 -0000      1.6
  @@ -170,7 +170,7 @@
        <description>Part of jakarta-avalon, it is a set of classes and patterns that
          support high level server development.</description>
        <used-by>Cocoon</used-by>
  -     <lib>core/excalibur-store-20020820.jar</lib>
  +     <lib>core/excalibur-store-20030317.jar</lib>
        <homepage>http://jakarta.apache.org/avalon/excalibur/</homepage>
    </file>
    <file>
  
  
  
  1.9       +4 -3      cocoon-2.1/src/webapp/WEB-INF/cocoon.xconf
  
  Index: cocoon.xconf
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/webapp/WEB-INF/cocoon.xconf,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- cocoon.xconf      15 Mar 2003 08:31:33 -0000      1.8
  +++ cocoon.xconf      17 Mar 2003 09:49:31 -0000      1.9
  @@ -354,7 +354,8 @@
   
     <!--+
         | Persistent Store: holds objects that have to survive shutdown.
  -      | WARNING: FilesystemStore is broken. Cocoon uses JispFilesystemStore instead.
  +      | 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
  @@ -364,12 +365,12 @@
         |  directory: Specifies directory to use. Absolute or relative to the
         |             work directory.
         |
  -      | JispFilesystemStore configuration parameters:
  +      | 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.JispFilesystemStore"
  +  <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"/>
  
  
  
  1.6       +1 -1      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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- cocoon.roles      12 Mar 2003 19:07:55 -0000      1.5
  +++ cocoon.roles      17 Mar 2003 09:49:32 -0000      1.6
  @@ -68,7 +68,7 @@
     <!-- Stores: -->
     <role name="org.apache.excalibur.store.Store"
          shorthand="persistent-store"
  -       default-class="org.apache.cocoon.components.store.impl.FilesystemStore"/>
  +       default-class="org.apache.cocoon.components.store.impl.DefaultStore"/>
   
     <role name="org.apache.excalibur.store.Store/TransientStore"
           shorthand="transient-store"
  
  
  
  1.4       +0 -12     cocoon-2.1/src/documentation/cocoon.xconf
  
  Index: cocoon.xconf
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/documentation/cocoon.xconf,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- cocoon.xconf      14 Mar 2003 08:39:16 -0000      1.3
  +++ cocoon.xconf      17 Mar 2003 09:49:32 -0000      1.4
  @@ -45,18 +45,6 @@
        <parameter name="use-store" value="true"/> 
     </xslt-processor>
   
  -  <!-- URL Factory: THIS COMPONENT IS DEPRECATED AND SHOULD NOT BE USED ANYMORE -->
  -  <url-factory logger="core.url-factory">
  -    <protocol name="resource" 
class="org.apache.cocoon.components.url.ResourceURLFactory"/>
  -    <protocol name="context"  
class="org.apache.cocoon.components.url.ContextURLFactory"/>
  -  </url-factory>
  -
  -  <!-- Source Handler: THIS COMPONENT IS DEPRECATED AND SHOULD NOT BE USED ANYMORE 
-->
  -  <source-handler logger="core.source-handler">
  -    <protocol class="org.apache.cocoon.components.source.FileSourceFactory" 
name="file"/>
  -    <protocol class="org.apache.cocoon.components.source.ContextSourceFactory" 
name="context"/>
  -  </source-handler>
  -
     <!-- Source Factories -->
     <source-factories>
       <component-instance 
class="org.apache.excalibur.source.impl.ResourceSourceFactory" name="resource"/>
  
  
  

Reply via email to