|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.norther.tammi.core.base.Adaptee org.norther.tammi.spray.media.DefaultMediaProvider org.norther.tammi.spray.media.DefaultCachedMediaProvider
public class DefaultCachedMediaProvider
A cached implementation of MediaProvider.
Field Summary |
---|
Fields inherited from class org.norther.tammi.core.base.Adaptee |
---|
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS |
Constructor Summary | |
---|---|
DefaultCachedMediaProvider()
Constructs a new provider. |
Method Summary | |
---|---|
void |
clearCached()
Clears all cached entries without notifying. |
void |
expireCached(long timestamp)
Expires all cached entries notifying them about expiration. |
void |
expireCachedResource(String path)
Expires a cached media content resource. |
void |
expireFraction(long timestamp,
float fraction)
Expires the specified fraction of cached entries notifying them about expiration. |
ConcurrentMap<String,Resource<?>> |
getCache(boolean... create)
Gets and optionally creates the cache. |
Resource<?> |
getCachedResource(String path)
Gets a cached media content resource. |
long |
getCheckInterval()
Gets the default interval of checking validity of cached resources. |
long |
getRefreshed()
Gets the last refresh timestamp. |
Resource<?> |
getResource(String path,
boolean localized,
ServletRequest request,
ServletResponse response,
FilterChain chain)
Gets the media content resource. |
ObjectName |
getSharedCacheName()
Gets the the shared cache of this client. |
int |
getSizeLimit()
Gets the default size limit for resources to be kept in the cache. |
boolean |
isCachingDisabled()
Checks whether the caching is disabled. |
void |
refresh()
Refreshes the MBean. |
void |
removeCache()
Removes the cache. |
void |
setCachedResource(String path,
Resource<?> res)
Sets a cached media content resource. |
void |
setCachedResource(String path,
Resource<?> res,
int freq)
Sets a cached media content resource with an expiration frequency. |
void |
setCachingDisabled(boolean flag)
Sets the caching disabled flag. |
void |
setCheckInterval(long msecs)
Sets the default interval of checking validity of cached resources. |
void |
setSharedCacheName(ObjectName cache)
Sets the shared cache of this client. |
void |
setSizeLimit(int limit)
Sets the default size limit for resources to be kept in the cache. |
Methods inherited from class org.norther.tammi.spray.media.DefaultMediaProvider |
---|
addMediaKey, addMediaKey, clearMediaKeys, getDefaultIndex, getDefaultIndex, getMediaKeys, removeMediaKey, setDefaultIndex, setMediaKeys |
Methods inherited from class org.norther.tammi.core.base.Adaptee |
---|
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, postmanaged, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unmanaged, unregister |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.norther.tammi.spray.media.MediaProvider |
---|
addMediaKey, addMediaKey, clearMediaKeys, getDefaultIndex, getMediaKeys, removeMediaKey, setDefaultIndex, setMediaKeys |
Constructor Detail |
---|
public DefaultCachedMediaProvider()
Method Detail |
---|
public boolean isCachingDisabled()
CacheClient
isCachingDisabled
in interface CacheClient<String,Resource<?>>
public void setCachingDisabled(boolean flag)
CacheClient
setCachingDisabled
in interface CacheClient<String,Resource<?>>
flag
- the caching disabled flag.public void expireCached(long timestamp)
CacheClient
expireCached
in interface CacheClient<String,Resource<?>>
timestamp
- the timestamp of the expiration.public void expireFraction(long timestamp, float fraction)
CacheClient
expireFraction
in interface CacheClient<String,Resource<?>>
timestamp
- the timestamp of the expiration.fraction
- the fraction of entries to expire (0.0..1.0).public void clearCached()
CacheClient
clearCached
in interface CacheClient<String,Resource<?>>
public ConcurrentMap<String,Resource<?>> getCache(boolean... create)
CacheClient
getCache
in interface CacheClient<String,Resource<?>>
create
- true to create a missing cache.
public void removeCache()
CacheClient
removeCache
in interface CacheClient<String,Resource<?>>
public ObjectName getSharedCacheName()
CacheClient
getSharedCacheName
in interface CacheClient<String,Resource<?>>
public void setSharedCacheName(ObjectName cache)
CacheClient
setSharedCacheName
in interface CacheClient<String,Resource<?>>
cache
- the object name of the shared cache or a query.public void refresh()
Refreshable
refresh
in interface Refreshable
public long getRefreshed()
Refreshable
getRefreshed
in interface Refreshable
public Resource<?> getResource(String path, boolean localized, ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ConstructionException, AccessDeniedException
MediaProvider
getResource
in interface MediaProvider
getResource
in class DefaultMediaProvider
path
- the content path.localized
- the localization option.request
- the servlet request.response
- the servlet response.chain
- the filter chain.
IOException
- on I/O errors.
ConstructionException
- on resource errors.
AccessDeniedException
- for access restrictions.public long getCheckInterval()
CachedMediaProvider
getCheckInterval
in interface CachedMediaProvider
public void setCheckInterval(long msecs)
CachedMediaProvider
setCheckInterval
in interface CachedMediaProvider
msecs
- the check interval in milliseconds (-1 = only once).public int getSizeLimit()
CachedMediaProvider
getSizeLimit
in interface CachedMediaProvider
public void setSizeLimit(int limit)
CachedMediaProvider
setSizeLimit
in interface CachedMediaProvider
limit
- a limit for a resource size in bytes (-1 = unlimited).public Resource<?> getCachedResource(String path)
CachedMediaProvider
getCachedResource
in interface CachedMediaProvider
path
- the content path.
public void setCachedResource(String path, Resource<?> res)
CachedMediaProvider
setCachedResource
in interface CachedMediaProvider
path
- the content path.res
- the cached resource.public void setCachedResource(String path, Resource<?> res, int freq)
CachedMediaProvider
setCachedResource
in interface CachedMediaProvider
path
- the content path.res
- the cached resource.freq
- the expiration frequency.public void expireCachedResource(String path)
CachedMediaProvider
expireCachedResource
in interface CachedMediaProvider
path
- the content path.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |