[jboss-cvs] JBossCache/src-50/org/jboss/cache/pojo/factory ...

Ben Wang bwang at jboss.com
Tue Sep 5 02:11:25 EDT 2006


  User: bwang   
  Date: 06/09/05 02:11:25

  Added:       src-50/org/jboss/cache/pojo/factory  PojoCacheFactory.java
  Log:
  First cuto of the using 2.0 Cache API
  
  Revision  Changes    Path
  1.1      date: 2006/09/05 06:11:25;  author: bwang;  state: Exp;JBossCache/src-50/org/jboss/cache/pojo/factory/PojoCacheFactory.java
  
  Index: PojoCacheFactory.java
  ===================================================================
  /*
   * JBoss, Home of Professional Open Source
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  
  package org.jboss.cache.pojo.factory;
  
  import org.jboss.cache.factories.DefaultCacheFactory;
  import org.jboss.cache.Cache;
  import org.jboss.cache.pojo.PojoTreeCache;
  import org.jboss.cache.config.ConfigurationException;
  import org.jboss.cache.config.Configuration;
  
  /**
   * Implementation of the Cache Factory
   *
   * @author <a href="mailto:ben.wang at jboss.com">Ben Wang</a>
   */
  public class PojoCacheFactory extends DefaultCacheFactory
  {
      public Cache createCache(Configuration configuration, boolean start) throws ConfigurationException
      {
          try
          {
              PojoTreeCache cache = new PojoTreeCache();
              cache.setConfiguration(configuration);
              if (start) cache.start();
              return cache.getCacheSPI();
          }
          catch (Exception e)
          {
              if (e instanceof ConfigurationException) throw (ConfigurationException) e;
              throw new ConfigurationException(e.getMessage());
          }
      }
  }
  
  
  



More information about the jboss-cvs-commits mailing list