asmuts      02/02/12 07:47:21

  Added:       src/java/org/apache/stratum/jcs JCS.java
  Log:
  Simple class to get access to the cache.  Should make using JCS much easier.
  Most users will only need to use this one class.
  
  Revision  Changes    Path
  1.1                  jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/JCS.java
  
  Index: JCS.java
  ===================================================================
  package org.apache.stratum.jcs;
  
  import org.apache.stratum.jcs.access.GroupCacheAccess;
  import org.apache.stratum.jcs.engine.control.Cache;
  import org.apache.stratum.jcs.engine.control.CacheAttributes;
  
  import org.apache.stratum.jcs.engine.group.GroupAttrName;
  import org.apache.stratum.jcs.engine.group.GroupCacheManager;
  import org.apache.stratum.jcs.engine.group.GroupCacheManagerFactory;
  import org.apache.stratum.jcs.engine.group.GroupId;
  import org.apache.stratum.jcs.access.exception.CacheException;
  import org.apache.stratum.jcs.engine.behavior.ICompositeCacheAttributes;
  
  /**
   *  To make using JCS a bit easier.
   *
   *@author     asmuts
   *@created    February 12, 2002
   */
  public class JCS extends GroupCacheAccess
  {
  
      private static GroupCacheManager cacheMgr;
  
      ///////////////////////////////////////////
      /**
       *  Constructor for the JCS object
       *
       *@param  cacheControl  Description of the Parameter
       */
      protected JCS( Cache cacheControl )
      {
          super( cacheControl );
      }
  
  
      /////////////////////////////////////////
      /**
       *  Gets the groupAccess attribute of the GroupCacheAccess class
       *
       *@param  region              Description of the Parameter
       *@return                     The groupAccess value
       *@exception  CacheException  Description of the Exception
       */
      public static JCS getJCS( String region )
          throws CacheException
      {
          if ( cacheMgr == null )
          {
              synchronized ( GroupCacheAccess.class )
              {
                  if ( cacheMgr == null )
                  {
                      cacheMgr = GroupCacheManagerFactory.getInstance();
                  }
              }
          }
          return new JCS( ( Cache ) cacheMgr.getCache( region ) );
      }
  
  
      /////////////////////////////////////////
      /**
       *  Gets the groupAccess attribute of the GroupCacheAccess class
       *
       *@param  region              Description of the Parameter
       *@param  icca                Description of the Parameter
       *@return                     The groupAccess value
       *@exception  CacheException  Description of the Exception
       */
      public static JCS getJCS( String region, ICompositeCacheAttributes icca )
          throws CacheException
      {
          if ( cacheMgr == null )
          {
              synchronized ( GroupCacheAccess.class )
              {
                  if ( cacheMgr == null )
                  {
                      cacheMgr = GroupCacheManagerFactory.getInstance();
                  }
              }
          }
  
          return new JCS( ( Cache ) cacheMgr.getCache( region, icca ) );
      }
  
  
  
  }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to