You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by un...@apache.org on 2004/03/08 22:36:26 UTC

cvs commit: cocoon-2.1/legal ehcache-0.7.jar.license.txt

unico       2004/03/08 13:36:26

  Added:       src/blocks/scratchpad/lib ehcache-0.7.jar
               src/blocks/scratchpad/java/org/apache/cocoon/components/store
                        EHStore.java
               legal    ehcache-0.7.jar.license.txt
  Log:
  start new experimental store implementation based on ehcache (http://ehcache.sourceforge.net/)
  
  Revision  Changes    Path
  1.1                  cocoon-2.1/src/blocks/scratchpad/lib/ehcache-0.7.jar
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/components/store/EHStore.java
  
  Index: EHStore.java
  ===================================================================
  /*
   * Copyright 2004,2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.cocoon.components.store;
  
  import java.io.IOException;
  import java.io.Serializable;
  import java.util.Collections;
  import java.util.Enumeration;
  
  import net.sf.ehcache.Cache;
  import net.sf.ehcache.CacheException;
  import net.sf.ehcache.CacheManager;
  import net.sf.ehcache.Element;
  
  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.excalibur.store.Store;
  
  /**
   * Store implementation based on EHCache.
   * (http://ehcache.sourceforge.net/)
   */
  public class EHStore extends AbstractLogEnabled implements Store, Parameterizable {
      
      private Cache m_cache;
      private CacheManager m_cacheManager;
      
      private String m_cacheName;
      private int m_maximumSize;
      
      public EHStore() {
      }
      
      public void parameterize(Parameters parameters) throws ParameterException {
          m_cacheName = parameters.getParameter("cache-name","main");
          m_maximumSize = parameters.getParameterAsInteger("max-objects",100);
      }
      
      public void initialize() throws Exception {
          m_cacheManager = CacheManager.create();
          m_cache = new Cache(m_cacheName,m_maximumSize,true,false,0,0);
          m_cacheManager.addCache(m_cache);
      }
      
      /* (non-Javadoc)
       * @see org.apache.excalibur.store.Store#free()
       */
      public Object get(Object key) {
          try {
              return m_cache.get((Serializable) key);
          }
          catch (CacheException e) {
              getLogger().error("Failure retrieving object from store", e);
          }
          return null;
      }
  
      /* (non-Javadoc)
       * @see org.apache.excalibur.store.Store#free()
       */
      public void store(Object key, Object value) throws IOException {
          final Element element = new Element((Serializable) key, (Serializable) value);
          m_cache.put(element);
      }
  
      /* (non-Javadoc)
       * @see org.apache.excalibur.store.Store#free()
       */
      public void free() {
      }
  
      /* (non-Javadoc)
       * @see org.apache.excalibur.store.Store#remove(java.lang.Object)
       */
      public void remove(Object key) {
          m_cache.remove((Serializable) key);
      }
  
      /* (non-Javadoc)
       * @see org.apache.excalibur.store.Store#clear()
       */
      public void clear() {
          try {
              m_cache.removeAll();
          }
          catch (IOException e) {
              getLogger().error("Failure to clearing store", e);
          }
      }
  
      /* (non-Javadoc)
       * @see org.apache.excalibur.store.Store#containsKey(java.lang.Object)
       */
      public boolean containsKey(Object key) {
          try {
              return m_cache.get((Serializable) key) != null;
          }
          catch (CacheException e) {
              getLogger().error("Failure retrieving object from store",e);
          }
          return false;
      }
  
      /* (non-Javadoc)
       * @see org.apache.excalibur.store.Store#keys()
       */
      public Enumeration keys() {
          return Collections.enumeration(m_cache.getKeys());
      }
  
      /* (non-Javadoc)
       * @see org.apache.excalibur.store.Store#size()
       */
      public int size() {
          return m_cache.getSize();
      }
  
  }
  
  
  
  1.1                  cocoon-2.1/legal/ehcache-0.7.jar.license.txt
  
  Index: ehcache-0.7.jar.license.txt
  ===================================================================
  /*
   * $Id: ehcache-0.7.jar.license.txt,v 1.1 2004/03/08 21:36:26 unico Exp $
   *
   * ====================================================================
   *
   * 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
   * modification, 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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", 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 names without prior written
   *    permission of the Apache Group.
   *
   * 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 (INCLUDING, 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.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  
  

Re: cvs commit: cocoon-2.1/legal ehcache-0.7.jar.license.txt

Posted by Joerg Heinicke <jo...@gmx.de>.
On 08.03.2004 22:36, unico@apache.org wrote:

> unico       2004/03/08 13:36:26
> 
>   Added:       src/blocks/scratchpad/lib ehcache-0.7.jar
>                src/blocks/scratchpad/java/org/apache/cocoon/components/store
>                         EHStore.java
>                legal    ehcache-0.7.jar.license.txt
>   Log:
>   start new experimental store implementation based on ehcache (http://ehcache.sourceforge.net/)
>   
>   Index: ehcache-0.7.jar.license.txt

...

>    * 3. The end-user documentation included with the redistribution, if
>    *    any, must include the following acknowlegement:
>    *       "This product includes software developed by the
>    *        Apache Software Foundation (http://www.apache.org/)."

...

>    * 4. The names "The Jakarta Project", "Commons", 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 names without prior written
>    *    permission of the Apache Group.

...

>    * This software consists of voluntary contributions made by many
>    * individuals on behalf of the Apache Software Foundation.  For more
>    * information on the Apache Software Foundation, please see
>    * <http://www.apache.org/>.

Maybe someone should tell them that their license is somewhat unaccurate.

Joerg