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
 
Fields inherited from interface org.jwarp.service.cache.ICacheService
SERVICE_TYPE
 
Fields inherited from interface org.jwarp.service.IService
SERVICE_STATUS_CREATED, SERVICE_STATUS_NOT_AVAILABLE, SERVICE_STATUS_READY, SERVICE_STATUS_RESUMING, SERVICE_STATUS_RUNNING, SERVICE_STATUS_STARTING, SERVICE_STATUS_STOPPED, SERVICE_STATUS_STOPPING, SERVICE_STATUS_SUSPENDED
 
Constructor Summary
CacheService()
           
CacheService(java.lang.String name)
           
 
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
 
Methods inherited from interface org.jwarp.common.IExceptionProvider
addExceptionListener, getExceptionListeners, removeAllExceptionListeners, removeExceptionListener
 

Field Detail

caches

java.util.Hashtable caches
Hashtable containing the several caches handled by this service
Constructor Detail

CacheService

public CacheService()

CacheService

public CacheService(java.lang.String name)
Method Detail

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 name
user - The user
Throws:
SecurityEception - If access was denied for/during the operation
NotFoundException - 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 name
user - The user
Throws:
SecurityEception - If access was denied for/during the operation
NotFoundException - 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 name
user - The user
Throws:
SecurityEception - If access was denied for/during the operation
InitializationException - 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 name
maxComponents - The maximum number of components until a cache update is triggered
maxTime - The maximum time an item is stored within the cache
minAccess - The minimun number of accesses during an update period so an object can stay within the cache
updateInterval - The update interval of the cache in seconds
user - The user
Throws:
SecurityEception - If access was denied for/during the operation
InitializationException - If a cache initialization error occurred or a cache with the same name is existing yet.

©   O R C A   S y s t e m s