org.jwarp.service.cache
Class CacheService
java.lang.Object
|
+--org.jwarp.service.AService
|
+--org.jwarp.service.cache.CacheService
- All Implemented Interfaces:
- ICacheService, IConfigurable, IExceptionProvider, IReferenceable, IService
- public class CacheService
- extends AService
- implements ICacheService
Abstract interface for the default cache service.
|
Field Summary |
(package private) java.util.Hashtable |
caches
Hashtable containing the several caches handled by this service |
| Fields inherited from class org.jwarp.service.AService |
context, createdDate, dependencies, emptyProperties, exceptionListeners, log, resumedDate, serviceName, serviceStatus, serviceType, startedDate, stoppedDate, suspendedDate, systemTicket |
|
Method Summary |
void |
configure(org.jdom.Element config)
Pass the Configuration to the Configurable
class. |
ICache |
createCache(java.lang.String cacheID,
int maxComponents,
int maxTime,
int minAccess,
int updateInterval,
ITicket user)
Creates a new cache. |
ICache |
createCache(java.lang.String cacheID,
ITicket user)
Creates a new cache. |
ICache |
getCache(java.lang.String cacheID,
ITicket user)
Returns the caches internal implementatino. |
java.util.Iterator |
getCacheNames(ITicket user)
Get an iterator with the names of all currently running cache instances. |
ICache |
removeCache(java.lang.String cacheID,
ITicket user)
Updates the cache. |
| Methods inherited from class org.jwarp.service.AService |
addExceptionListener, checkContext, createLogFromXML, getContext, getCreationDate, getDependencies, getExceptionListeners, getLog, getLogLevel, getName, getReference, getResumedDate, getShutDownDate, getStartDate, getStatus, getSuspendedDate, getType, removeAllExceptionListeners, removeExceptionListener, resume, sendExceptionEvent, setContext, setDependencies, setLogLevel, setName, shutdown, start, suspend |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.jwarp.service.IService |
checkContext, getDependencies, getLogLevel, getName, getStatus, getType, resume, setContext, setDependencies, setLogLevel, shutdown, start, suspend |
caches
java.util.Hashtable caches
- Hashtable containing the several caches handled by this service
CacheService
public CacheService()
CacheService
public CacheService(java.lang.String name)
configure
public void configure(org.jdom.Element config)
throws ConfigurationException
- Description copied from interface:
IConfigurable
- Pass the
Configuration to the Configurable
class. This method must always be called after the constructor and before any other method.
- Specified by:
configure in interface IConfigurable- Overrides:
configure in class AService
- Following copied from interface:
org.jwarp.service.configuration.IConfigurable
- Parameters:
configuration - the class configurations.
getCache
public ICache getCache(java.lang.String cacheID,
ITicket user)
throws java.lang.SecurityException,
NotFoundException
- Returns the caches internal implementatino. On the internal implementation further
settings can be changes such as the interval date, the cache's size etc.
- Specified by:
getCache in interface ICacheService
- Parameters:
cacheID - The cache's nameuser - The user- Throws:
SecurityEception - If access was denied for/during the operationNotFoundException - If a cache with the given cacheID could not be located.
getCacheNames
public java.util.Iterator getCacheNames(ITicket user)
- Get an iterator with the names of all currently running cache instances.
- Specified by:
getCacheNames in interface ICacheService
- Returns:
- The names of the current caches
removeCache
public ICache removeCache(java.lang.String cacheID,
ITicket user)
throws java.lang.SecurityException
- Updates the cache. This is typically called by a thread running independently.
- Specified by:
removeCache in interface ICacheService
- Parameters:
cacheID - The cache's nameuser - The user- Throws:
SecurityEception - If access was denied for/during the operationNotFoundException - If a cache with the given cacheID could not be located.
createCache
public ICache createCache(java.lang.String cacheID,
ITicket user)
throws java.lang.SecurityException,
InitializationException
- Creates a new cache.
- Specified by:
createCache in interface ICacheService
- Parameters:
cacheID - The new cache's nameuser - The user- Throws:
SecurityEception - If access was denied for/during the operationInitializationException - If a cache initialization error occurred or a cache with
the same name is existing yet.
createCache
public ICache createCache(java.lang.String cacheID,
int maxComponents,
int maxTime,
int minAccess,
int updateInterval,
ITicket user)
throws java.lang.SecurityException,
InitializationException
- Creates a new cache.
- Specified by:
createCache in interface ICacheService
- Parameters:
cacheID - The new cache's namemaxComponents - The maximum number of components until a cache update is triggeredmaxTime - The maximum time an item is stored within the cacheminAccess - The minimun number of accesses during an update period so an object can stay within the cacheupdateInterval - The update interval of the cache in secondsuser - The user- Throws:
SecurityEception - If access was denied for/during the operationInitializationException - If a cache initialization error occurred or a cache with
the same name is existing yet.