SunONE Application Server v8.0 PE

com.sun.appserv.web.cache
Class CacheManager

java.lang.Object
  extended bycom.sun.appserv.web.cache.CacheManager

public class CacheManager
extends java.lang.Object


Field Summary
static java.lang.String CACHE_MANAGER_ATTR_NAME
           
static java.lang.String DEFAULT_CACHE_CLASSNAME
           
static int DEFAULT_CACHE_MAX_ENTRIES
           
static int DEFAULT_CACHE_TIMEOUT
           
 
Constructor Summary
CacheManager()
          default constructor
 
Method Summary
 void addCacheHelperDef(java.lang.String name, java.util.HashMap helperDef)
          add a CacheHelper definition
 void addCacheManagerListener(CacheManagerListener listener)
          add CacheManagerListener object
 void addCacheMapping(java.lang.String name, CacheMapping mapping)
          add cache mapping
 void addProperty(java.lang.String name, java.lang.String value)
          add generic property
 com.sun.appserv.util.cache.Cache createCache()
          create the designated cache object
 com.sun.appserv.util.cache.Cache createCache(int cacacity, java.lang.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)
 java.lang.String getCacheClassName()
          get the underlying cache name
 CacheHelper getCacheHelper(java.lang.String name)
          get the helper by name
 CacheHelper getCacheHelperByFilterName(java.lang.String filterName)
          get the helper by name
 CacheMapping getCacheMapping(java.lang.String name)
          get cacheMapping given its name
 com.sun.appserv.util.cache.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(java.util.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 java.lang.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 java.lang.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(java.lang.String name,
                        java.lang.String value)
add generic property

Parameters:
name - named property
value - value

addCacheHelperDef

public void addCacheHelperDef(java.lang.String name,
                              java.util.HashMap helperDef)
add a CacheHelper definition


setDefaultHelperProps

public void setDefaultHelperProps(java.util.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 LifecycleException
Start this Context component.

Throws:
LifecycleException - if a startup error occurs

getCacheClassName

public java.lang.String getCacheClassName()
get the underlying cache name

Returns:
the cacheClassName

createCache

public com.sun.appserv.util.cache.Cache createCache()
                                             throws java.lang.Exception
create the designated cache object

Throws:
java.lang.Exception

createCache

public com.sun.appserv.util.cache.Cache createCache(int cacacity,
                                                    java.lang.String className)
                                             throws java.lang.Exception
create the designated cache object

Throws:
java.lang.Exception

getDefaultTimeout

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


getDefaultCache

public com.sun.appserv.util.cache.Cache getDefaultCache()
get the default application-wide cache


addCacheMapping

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

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

getCacheMapping

public CacheMapping getCacheMapping(java.lang.String name)
get cacheMapping given its name

Parameters:
name - name identifying the mapping

getCacheHelper

public CacheHelper getCacheHelper(java.lang.String name)
get the helper by name

Parameters:
name - name of the cache-helper

getCacheHelperByFilterName

public CacheHelper getCacheHelperByFilterName(java.lang.String filterName)
get the helper by name


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 LifecycleException
Stop this Context component. destroy all the caches created and flush/clear the cached content

Throws:
LifecycleException - if a shutdown error occurs

SunONE Application Server v8.0 PE

Submit a bug or feature

Copyright 2003 Sun Microsystems, Inc. All rights reserved.