You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2003/07/11 10:04:23 UTC

cvs commit: cocoon-2.1/src/java/org/apache/cocoon/caching/impl CacheImpl.java

cziegeler    2003/07/11 01:04:22

  Modified:    src/java/org/apache/cocoon/caching/impl CacheImpl.java
  Log:
  Make the store to use configurable
  
  Revision  Changes    Path
  1.2       +16 -3     cocoon-2.1/src/java/org/apache/cocoon/caching/impl/CacheImpl.java
  
  Index: CacheImpl.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/caching/impl/CacheImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CacheImpl.java	9 Mar 2003 00:08:46 -0000	1.1
  +++ CacheImpl.java	11 Jul 2003 08:04:22 -0000	1.2
  @@ -55,6 +55,9 @@
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  +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.ProcessingException;
   import org.apache.cocoon.caching.Cache;
  @@ -76,7 +79,7 @@
    */
   public class CacheImpl
   extends AbstractLogEnabled
  -implements Cache, ThreadSafe, Composable, Disposable {
  +implements Cache, ThreadSafe, Composable, Disposable, Parameterizable {
   
       /** The store containing the cached responses */
       protected Store store;
  @@ -84,13 +87,16 @@
       /** The component manager */
       protected ComponentManager manager;
   
  +    /** The role name of the store to use */
  +    protected String storeName;
  +    
       /**
        * Composable Interface
        */
       public void compose (ComponentManager manager)
       throws ComponentException {
           this.manager = manager;
  -        this.store = (Store)this.manager.lookup(Store.TRANSIENT_STORE);
  +        this.store = (Store)this.manager.lookup(this.storeName);
       }
   
       /**
  @@ -145,6 +151,13 @@
        */
       public void clear() {
           this.store.clear();
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.avalon.framework.parameters.Parameterizable#parameterize(org.apache.avalon.framework.parameters.Parameters)
  +     */
  +    public void parameterize(Parameters parameters) throws ParameterException {
  +        this.storeName = parameters.getParameter("store", Store.TRANSIENT_STORE);
       }
   
   }