cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: xml-cocoon2/webapp/WEB-INF web.xml
Date Wed, 18 Jul 2001 10:44:27 GMT
dims        01/07/18 03:44:26

  Modified:    .        build.xml
               src/org/apache/cocoon Constants.java Main.java
               src/org/apache/cocoon/components/store MRUMemoryStore.java
               src/org/apache/cocoon/servlet CocoonServlet.java
               webapp/WEB-INF web.xml
  Log:
  - Patches from Gerhard Froehlich for File/MRU system store
  - fix problem in build.xml, added dummy prepare-sitewebapp
  
  Revision  Changes    Path
  1.31      +7 -0      xml-cocoon2/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/build.xml,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- build.xml	2001/07/18 07:43:02	1.30
  +++ build.xml	2001/07/18 10:44:26	1.31
  @@ -504,6 +504,13 @@
     </target>
   
     <!-- =================================================================== -->
  +  <!-- Prepares the sitewebapp directories                                 -->
  +  <!-- =================================================================== -->
  +  <target name="prepare-sitewebapp" depends="copy-webapp">
  +      <!-- Simply do nothing, just invoke all dependencies -->
  +  </target>
  +
  +  <!-- =================================================================== -->
     <!-- Prepares the libraries for the war package                          -->
     <!-- =================================================================== -->
     <target name="prepare-xsp" depends="package" if="compile.xsp">
  
  
  
  1.10      +2 -1      xml-cocoon2/src/org/apache/cocoon/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/Constants.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Constants.java	2001/07/12 12:28:06	1.9
  +++ Constants.java	2001/07/18 10:44:26	1.10
  @@ -10,7 +10,7 @@
   
   /**
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.9 $ $Date: 2001/07/12 12:28:06 $
  + * @version CVS $Revision: 1.10 $ $Date: 2001/07/18 10:44:26 $
    */
   
   public interface Constants {
  @@ -67,6 +67,7 @@
       String CONTEXT_CLASS_LOADER    = "class-loader";
       String CONTEXT_WORK_DIR        = "work-directory";
       String CONTEXT_UPLOAD_DIR      = "upload-directory";
  +    String CONTEXT_CACHE_DIR       = "cache-directory";
       String CONTEXT_CLASSPATH       = "classpath";
       String CONTEXT_CONFIG_URL      = "config-url";
       String CONTEXT_LOG_DIR         = "log-directory";
  
  
  
  1.10      +2 -1      xml-cocoon2/src/org/apache/cocoon/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/Main.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Main.java	2001/07/13 14:09:17	1.9
  +++ Main.java	2001/07/18 10:44:26	1.10
  @@ -48,7 +48,7 @@
    * Command line entry point.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.9 $ $Date: 2001/07/13 14:09:17 $
  + * @version CVS $Revision: 1.10 $ $Date: 2001/07/18 10:44:26 $
    */
   
   public class Main {
  @@ -247,6 +247,7 @@
               appContext.put(Constants.CONTEXT_CLASSPATH, getClassPath(contextDir));
               appContext.put(Constants.CONTEXT_WORK_DIR, work);
               appContext.put(Constants.CONTEXT_UPLOAD_DIR, contextDir + "image-dir");
  +            appContext.put(Constants.CONTEXT_CACHE_DIR, contextDir + "cache-dir");
               appContext.put(Constants.CONTEXT_CONFIG_URL, conf.toURL());
               appContext.put(Constants.CONTEXT_LOG_DIR, logDir);
               appContext.put(Constants.CONTEXT_LOG_FILE, logFile);
  
  
  
  1.6       +38 -5     xml-cocoon2/src/org/apache/cocoon/components/store/MRUMemoryStore.java
  
  Index: MRUMemoryStore.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/store/MRUMemoryStore.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MRUMemoryStore.java	2001/07/17 10:41:56	1.5
  +++ MRUMemoryStore.java	2001/07/18 10:44:26	1.6
  @@ -14,10 +14,14 @@
   import java.util.HashMap;
   import java.util.LinkedList;
   import java.util.Stack;
  +import java.util.StringTokenizer;
  +import java.util.Vector;
   
  +import org.apache.cocoon.Constants;
   import org.apache.cocoon.util.ClassUtils;
   import org.apache.cocoon.util.IOUtils;
   
  +
   import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
  @@ -25,6 +29,9 @@
   import org.apache.avalon.framework.configuration.Configurable;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
  +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.AbstractLoggable;
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.avalon.framework.thread.ThreadSafe;
  @@ -43,7 +50,9 @@
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    */
   
  -public class MRUMemoryStore extends AbstractLoggable implements Store, Configurable, ThreadSafe,
Runnable, Composable {
  +public class MRUMemoryStore extends AbstractLoggable implements Store, Configurable, 
  +                                                                ThreadSafe, Runnable, 
  +                                                                Composable, Contextualizable
{
     /**
      * Indicates how much memory should be left free in the JVM for
      * normal operation.
  @@ -93,10 +102,15 @@
     private Store fsstore;
     private Stack writerstack;
     private Thread writer;
  -
  -   /** the component manager */
  +  private File cachedir;
  +  private String cachedirstr;
  + 
  +  /** the component manager */
     protected ComponentManager manager;
   
  +  /**
  +   * Get the filesystem store from the component manager
  +   */
     public void compose(ComponentManager manager) throws ComponentException {
       try {
         this.manager = manager;
  @@ -106,6 +120,25 @@
         getLogger().error("Error in MRUMemoryStore!",e);
       }
     }
  +  
  +  /**
  +   * Get the caching directory from the servlet context
  +   */
  +  public void contextualize(Context context) throws ContextException {
  +    this.cachedirstr = new String();
  +    try {
  +        this.cachedir = (File)context.get(Constants.CONTEXT_CACHE_DIR);
  +        StringTokenizer stizer = new StringTokenizer(this.cachedir.getPath(),this.cachedir.separator);
  +        Vector v = new Vector();
  +        while (stizer.hasMoreTokens()) {
  +          v.add(stizer.nextToken());
  +        }
  +        cachedirstr = (String)v.lastElement();
  +        getLogger().debug("MRUMemoryStore contextualize strcachedir=" + this.cachedirstr);
  +    } catch (Exception e) {
  +        getLogger().error("Error in MRUMemoryStore()",e);
  +    }
  +  }
   
     /**
      * Initialize the MRUMemoryStore.
  @@ -144,7 +177,7 @@
       }
   
       this.usecleanupthread = params.getParameter("usecleanupthread","true").equals("true");
  -  
  +    
       if (this.usecleanupthread) {
         getLogger().debug("MRUMemoryStore intializing checker thread");
         Thread checker = new Thread(this);
  @@ -195,7 +228,7 @@
               tmpstackobject = (TmpStackObject)this.writerstack.pop();
               key = tmpstackobject.getKey();
               object = tmpstackobject.getObject();
  -            this.fsstore.store(URLEncoder.encode(key.toString()),object);
  +            this.fsstore.store(this.cachedirstr + "/" + URLEncoder.encode(key.toString()),object);
               key = null;
               object = null;
               tmpstackobject = null;
  
  
  
  1.19      +12 -1     xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java
  
  Index: CocoonServlet.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- CocoonServlet.java	2001/07/13 19:07:46	1.18
  +++ CocoonServlet.java	2001/07/18 10:44:26	1.19
  @@ -59,7 +59,7 @@
    * @author <a href="mailto:nicolaken@supereva.it">Nicola Ken Barozzi</a> Aisa
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.18 $ $Date: 2001/07/13 19:07:46 $
  + * @version CVS $Revision: 1.19 $ $Date: 2001/07/18 10:44:26 $
    */
   
   public class CocoonServlet extends HttpServlet {
  @@ -89,6 +89,7 @@
       private static final int MAX_UPLOAD_SIZE = 10000000; // 10Mb
       private File uploadDir;
       private File workDir;
  +    private File cacheDir;
   
       protected ServletContext servletContext;
       protected RepositoryClassLoader classLoader;
  @@ -141,6 +142,16 @@
           this.appContext.put(Constants.CONTEXT_UPLOAD_DIR, this.uploadDir);
           this.uploadDir.mkdirs();
   
  +        String cacheDirParam = conf.getInitParameter("cache-directory");
  +        if ((cacheDirParam != null) && (cacheDirParam.trim().equals("") == false))
{
  +            this.cacheDir = IOUtils.createFile( new File(this.servletContext.getRealPath("/"))
, cacheDirParam);
  +        } else        {
  +            this.cacheDir = IOUtils.createFile(workDir, "cache-dir" + File.separator);
  +        }
  + 
  +        this.appContext.put(Constants.CONTEXT_CACHE_DIR, this.cacheDir);
  +        this.cacheDir.mkdirs();
  +      
           this.appContext.put(Constants.CONTEXT_CONFIG_URL,
           this.getConfigFile(conf.getInitParameter("configurations")));
   
  
  
  
  1.5       +12 -0     xml-cocoon2/webapp/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/webapp/WEB-INF/web.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- web.xml	2001/07/12 11:08:28	1.4
  +++ web.xml	2001/07/18 10:44:26	1.5
  @@ -113,6 +113,18 @@
         <param-value>/WEB-INF/work/image-dir</param-value>
       </init-param>
       -->
  +
  +    <!-- 
  +      This parameter allows to specify where Cocoon should put files 
  +      which are cached by the storing class. The path specified 
  +      is always relative to the context path of the servlet. 
  +      The default directory is "cache-dir" in the work-directory
  +
  +    <init-param>
  +      <param-name>cache-directory</param-name>
  +      <param-value>/WEB-INF/work/cache-dir</param-value>
  +    </init-param>
  +    -->
     
       <!-- 
         This parameter allows to specify where Cocoon should put it's
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message