org.shiftone.cache
Class CacheConfiguration

java.lang.Object
  extended byorg.shiftone.cache.CacheConfiguration

public class CacheConfiguration
extends java.lang.Object

Version:
$Revision: 1.21 $
Author:
Jeff Drost

Constructor Summary
CacheConfiguration()
          create a default cache configuration
CacheConfiguration(java.util.Properties properties)
           
CacheConfiguration(java.lang.String fileName)
           
CacheConfiguration(java.lang.String[] fileNames)
           
 
Method Summary
 Cache createConfiguredCache(java.lang.String cacheName)
          Create a new cache, using the configured values for the factory, timeout, and maxSize.
 Cache createConfiguredCache(java.lang.String cacheName, long timeout, int maxSize)
          Create a new cache by looking up the configured factory, and then using supplied name, timeout and max size.
 Cache createConfiguredCacheSafely(java.lang.String cacheName)
          Attempt to create a configured cache, as in createConfiguredCache, except if an error occures, a "zero cache" will be returned.
 CacheFactory getCacheFactory(java.lang.String factoryName)
          Obtain a configured cache factory by it's name.
 CacheFactory getConfiguredFactoryForCache(java.lang.String cacheName)
           
 int getConfiguredMaxSizeForCache(java.lang.String cacheName)
           
 long getConfiguredTimeoutForCache(java.lang.String cacheName)
           
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheConfiguration

public CacheConfiguration()
                   throws ConfigurationException
create a default cache configuration


CacheConfiguration

public CacheConfiguration(java.lang.String fileName)
                   throws ConfigurationException

CacheConfiguration

public CacheConfiguration(java.lang.String[] fileNames)
                   throws ConfigurationException

CacheConfiguration

public CacheConfiguration(java.util.Properties properties)
                   throws ConfigurationException
Method Detail

getCacheFactory

public CacheFactory getCacheFactory(java.lang.String factoryName)
                             throws ConfigurationException
Obtain a configured cache factory by it's name. If no factory exists by this name, a ConfigurationException is thrown.

Throws:
ConfigurationException

createConfiguredCache

public Cache createConfiguredCache(java.lang.String cacheName)
                            throws ConfigurationException
Create a new cache, using the configured values for the factory, timeout, and maxSize.

Throws:
ConfigurationException

createConfiguredCache

public Cache createConfiguredCache(java.lang.String cacheName,
                                   long timeout,
                                   int maxSize)
                            throws ConfigurationException
Create a new cache by looking up the configured factory, and then using supplied name, timeout and max size. Method requested by Neville.

Throws:
ConfigurationException

createConfiguredCacheSafely

public Cache createConfiguredCacheSafely(java.lang.String cacheName)
Attempt to create a configured cache, as in createConfiguredCache, except if an error occures, a "zero cache" will be returned. In other words, any exception is supressed, and the failure is hidden from the application (except there won't be any caching).


getConfiguredFactoryForCache

public CacheFactory getConfiguredFactoryForCache(java.lang.String cacheName)
                                          throws ConfigurationException
Throws:
ConfigurationException

getConfiguredTimeoutForCache

public long getConfiguredTimeoutForCache(java.lang.String cacheName)
                                  throws ConfigurationException
Throws:
ConfigurationException

getConfiguredMaxSizeForCache

public int getConfiguredMaxSizeForCache(java.lang.String cacheName)
                                 throws ConfigurationException
Throws:
ConfigurationException

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception