Java EE 5 SDK

com.sun.appserv.web.cache
Class CacheManager

java.lang.Object
  extended by com.sun.appserv.web.cache.CacheManager

public class CacheManager
extends Object


Field Summary
static String CACHE_MANAGER_ATTR_NAME
           
static String DEFAULT_CACHE_CLASSNAME
           
static int DEFAULT_CACHE_MAX_ENTRIES
           
static int DEFAULT_CACHE_TIMEOUT
           
 
Constructor Summary
CacheManager()
          default constructor
 
Method Summary
 void addCacheHelperDef(String name, HashMap helperDef)
          add a CacheHelper definition
 void addCacheManagerListener(CacheManagerListener listener)
          add CacheManagerListener object
 void addCacheMapping(String name, CacheMapping mapping)
          add cache mapping
 void addProperty(String name, String value)
          add generic property
 Cache createCache()
          create the designated cache object
 Cache createCache(int cacacity, String className)
          create the designated cache object
 void disable()
          enable the cache manager (and all the listeners)
 void enable()
          enable the cache manager (and all the listeners)
 String getCacheClassName()
          get the underlying cache name
 CacheHelper getCacheHelper(String name)
          get the helper by name
 CacheHelper getCacheHelperByFilterName(String filterName)
          get the helper by filter name
 CacheMapping getCacheMapping(String name)
          get cacheMapping given its name
 Cache getDefaultCache()
          get the default application-wide cache
 int getDefaultTimeout()
          get the application wide default cache expiry timeout
 boolean isEnabled()
           
 void removeCacheManagerListener(CacheManagerListener listener)
          remove CacheManagerListener object
 void setDefaultHelperProps(Map map)
          set the default-helper's properties
 void setDefaultTimeout(int defaultTimeout)
          set the defaultTimeout of this cache
 void setEnabled(boolean enabled)
          set the whether this is enabled
 void setMaxEntries(int maxEntries)
          set the maximum number of entries of this cache
 void setServletContext(ServletContext context)
          set the ServletContext of this application
 void start()
          Start this Context component.
 void stop()
          Stop this Context component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CACHE_MANAGER_ATTR_NAME

public static final String CACHE_MANAGER_ATTR_NAME
See Also:
Constant Field Values

DEFAULT_CACHE_MAX_ENTRIES

public static final int DEFAULT_CACHE_MAX_ENTRIES
See Also:
Constant Field Values

DEFAULT_CACHE_TIMEOUT

public static final int DEFAULT_CACHE_TIMEOUT
See Also:
Constant Field Values

DEFAULT_CACHE_CLASSNAME

public static final String DEFAULT_CACHE_CLASSNAME
See Also:
Constant Field Values
Constructor Detail

CacheManager

public CacheManager()
default constructor

Method Detail

setMaxEntries

public void setMaxEntries(int maxEntries)
set the maximum number of entries of this cache

Parameters:
maxEntries - number of entries the cache should carry

setDefaultTimeout

public void setDefaultTimeout(int defaultTimeout)
set the defaultTimeout of this cache

Parameters:
defaultTimeout - in seconds

setEnabled

public void setEnabled(boolean enabled)
set the whether this is enabled

Parameters:
enabled - is this enabled?

isEnabled

public boolean isEnabled()
Returns:
whether this is enabled

addProperty

public void addProperty(String name,
                        String value)
add generic property

Parameters:
name - named property
value - value

addCacheHelperDef

public void addCacheHelperDef(String name,
                              HashMap helperDef)
add a CacheHelper definition

Parameters:
name - CacheHelper name
helperDef - CacheHelper definition

setDefaultHelperProps

public void setDefaultHelperProps(Map map)
set the default-helper's properties

Parameters:
map - a HashMap of properties

setServletContext

public void setServletContext(ServletContext context)
set the ServletContext of this application

Parameters:
context - ServletContext

start

public void start()
           throws org.apache.catalina.LifecycleException
Start this Context component.

Throws:
org.apache.catalina.LifecycleException - if a startup error occurs

getCacheClassName

public String getCacheClassName()
get the underlying cache name

Returns:
the cacheClassName

createCache

public Cache createCache()
                  throws Exception
create the designated cache object

Returns:
the Cache implementation
Throws:
Exception

createCache

public Cache createCache(int cacacity,
                         String className)
                  throws Exception
create the designated cache object

Returns:
the Cache implementation
Throws:
Exception

getDefaultTimeout

public int getDefaultTimeout()
get the application wide default cache expiry timeout

Returns:
timeout in seconds

getDefaultCache

public Cache getDefaultCache()
get the default application-wide cache

Returns:
cache object

addCacheMapping

public void addCacheMapping(String name,
                            CacheMapping mapping)
add cache mapping

Parameters:
name - unique name of the mapping
mapping - CacheMapping

getCacheMapping

public CacheMapping getCacheMapping(String name)
get cacheMapping given its name

Parameters:
name - name identifying the mapping
Returns:
CacheMapping

getCacheHelper

public CacheHelper getCacheHelper(String name)
get the helper by name

Parameters:
name - name of the cache-helper
Returns:
CacheHelper implementation

getCacheHelperByFilterName

public CacheHelper getCacheHelperByFilterName(String filterName)
get the helper by filter name

Parameters:
filterName - filter name
Returns:
CacheHelper implementation

addCacheManagerListener

public void addCacheManagerListener(CacheManagerListener listener)
add CacheManagerListener object

Parameters:
listener - CacheManagerListener object

removeCacheManagerListener

public void removeCacheManagerListener(CacheManagerListener listener)
remove CacheManagerListener object

Parameters:
listener - CacheManagerListener object

enable

public void enable()
enable the cache manager (and all the listeners)


disable

public void disable()
enable the cache manager (and all the listeners)


stop

public void stop()
          throws org.apache.catalina.LifecycleException
Stop this Context component. destroy all the caches created and flush/clear the cached content

Throws:
org.apache.catalina.LifecycleException - if a shutdown error occurs

Java EE 5 SDK

Submit a bug or feature

Copyright 2006 Sun Microsystems, Inc. All rights reserved.