org.apache.jcs.admin
Class JCSAdminBean

java.lang.Object
  extended by org.apache.jcs.admin.JCSAdminBean

public class JCSAdminBean
extends Object

A servlet which provides HTTP access to JCS. Allows a summary of regions to be viewed, and removeAll to be run on individual regions or all regions. Also provides the ability to remove items (any number of key arguments can be provided with action 'remove'). Should be initialized with a properties file that provides at least a classpath resource loader.


Constructor Summary
JCSAdminBean()
          Default constructor
 
Method Summary
 LinkedList<CacheRegionInfo> buildCacheInfo()
          Builds up data on every region.
 LinkedList<CacheElementInfo> buildElementInfo(String cacheName)
          Builds up info about each element in a region.
 void clearAllRegions()
          Clears all regions in the cache.
 void clearRegion(String cacheName)
          Clears a particular cache region.
<K extends Serializable,V extends Serializable>
int
getByteCount(CompositeCache<K,V> cache)
          Tries to estimate how much data is in a region.
 void removeItem(String cacheName, String key)
          Removes a particular item from a particular region.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JCSAdminBean

public JCSAdminBean()
Default constructor

Method Detail

buildElementInfo

public LinkedList<CacheElementInfo> buildElementInfo(String cacheName)
                                              throws Exception
Builds up info about each element in a region.

Parameters:
cacheName -
Returns:
List of CacheElementInfo objects
Throws:
Exception

buildCacheInfo

public LinkedList<CacheRegionInfo> buildCacheInfo()
                                           throws Exception
Builds up data on every region.

Returns:
list of CacheRegionInfo objects
Throws:
Exception

getByteCount

public <K extends Serializable,V extends Serializable> int getByteCount(CompositeCache<K,V> cache)
Tries to estimate how much data is in a region. This is expensive. If there are any non serializable objects in the region or an error occurs, suppresses exceptions and returns 0.

Returns:
int The size of the region in bytes.

clearAllRegions

public void clearAllRegions()
                     throws IOException
Clears all regions in the cache.

If this class is running within a remote cache server, clears all regions via the RemoteCacheServer API, so that removes will be broadcast to client machines. Otherwise clears all regions in the cache directly via the usual cache API.

Throws:
IOException

clearRegion

public void clearRegion(String cacheName)
                 throws IOException
Clears a particular cache region.

If this class is running within a remote cache server, clears the region via the RemoteCacheServer API, so that removes will be broadcast to client machines. Otherwise clears the region directly via the usual cache API.

Throws:
IOException

removeItem

public void removeItem(String cacheName,
                       String key)
                throws IOException
Removes a particular item from a particular region.

If this class is running within a remote cache server, removes the item via the RemoteCacheServer API, so that removes will be broadcast to client machines. Otherwise clears the region directly via the usual cache API.

Parameters:
cacheName -
key -
Throws:
IOException


Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.