org.jboss.virtual.plugins.cache
Class MapVFSCache

java.lang.Object
  extended by org.jboss.virtual.plugins.cache.AbstractVFSCache
      extended by org.jboss.virtual.plugins.cache.IterableVFSCache
          extended by org.jboss.virtual.plugins.cache.MapVFSCache
All Implemented Interfaces:
CacheStatistics, VFSCache
Direct Known Subclasses:
SoftRefVFSCache, WeakRefVFSCache

public abstract class MapVFSCache
extends IterableVFSCache

Map vfs cache.

Author:
Ales Justin

Field Summary
 
Fields inherited from class org.jboss.virtual.plugins.cache.AbstractVFSCache
log
 
Constructor Summary
MapVFSCache()
           
 
Method Summary
protected  void check()
          Is cache valid.
protected abstract  Map<String,VFSContext> createMap()
          Create cache map.
 void flush()
          Flush the cache.
 Iterable<VFSContext> getCachedContexts()
          Get cached contexts.
protected  VFSContext getContext(String path)
          Get the cached context.
protected  Iterable<String> getKeys()
          Get cache keys.
protected  void putContext(String path, VFSContext context)
          Put vfs context and its path key into cache.
protected  void removeContext(String path, VFSContext context)
          Remove vfs context and its path key from cache.
 int size()
          Get cache size.
 void start()
          Start the cache.
 void stop()
          Stop the cache.
 
Methods inherited from class org.jboss.virtual.plugins.cache.IterableVFSCache
findContext
 
Methods inherited from class org.jboss.virtual.plugins.cache.AbstractVFSCache
findContext, lastInsert, putContext, readLock, readUnlock, removeContext, writeLock, writeUnlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapVFSCache

public MapVFSCache()
Method Detail

getCachedContexts

public Iterable<VFSContext> getCachedContexts()
Description copied from interface: CacheStatistics
Get cached contexts.

Returns:
the cached contexts

size

public int size()
Description copied from interface: CacheStatistics
Get cache size.

Returns:
the cache size

check

protected void check()
Description copied from class: AbstractVFSCache
Is cache valid.

Specified by:
check in class AbstractVFSCache

getKeys

protected Iterable<String> getKeys()
Description copied from class: IterableVFSCache
Get cache keys.

Specified by:
getKeys in class IterableVFSCache
Returns:
the cache keys

getContext

protected VFSContext getContext(String path)
Description copied from class: AbstractVFSCache
Get the cached context.

Specified by:
getContext in class AbstractVFSCache
Parameters:
path - the path to match
Returns:
cached context or null if not found

putContext

protected void putContext(String path,
                          VFSContext context)
Description copied from class: AbstractVFSCache
Put vfs context and its path key into cache.

Specified by:
putContext in class AbstractVFSCache
Parameters:
path - the context's path
context - the vfs context

removeContext

protected void removeContext(String path,
                             VFSContext context)
Description copied from class: AbstractVFSCache
Remove vfs context and its path key from cache.

Specified by:
removeContext in class AbstractVFSCache
Parameters:
path - the context's path
context - the vfs context

createMap

protected abstract Map<String,VFSContext> createMap()
Create cache map.

Returns:
cache map

start

public void start()
           throws Exception
Description copied from interface: VFSCache
Start the cache.

Throws:
Exception - for any error

stop

public void stop()
Description copied from interface: VFSCache
Stop the cache.


flush

public void flush()
Description copied from interface: VFSCache
Flush the cache.



Copyright © 2011 JBoss, A division of Red Hat, Inc. All Rights Reserved.