org.aspectj.weaver.tools.cache
Class AbstractIndexedFileCacheBacking

java.lang.Object
  extended by org.aspectj.weaver.tools.cache.AbstractCacheBacking
      extended by org.aspectj.weaver.tools.cache.AbstractFileCacheBacking
          extended by org.aspectj.weaver.tools.cache.AbstractIndexedFileCacheBacking
All Implemented Interfaces:
CacheBacking
Direct Known Subclasses:
AsynchronousFileCacheBacking, DefaultFileCacheBacking

public abstract class AbstractIndexedFileCacheBacking
extends AbstractFileCacheBacking

Uses an index file to keep track of the cached entries


Nested Class Summary
static class AbstractIndexedFileCacheBacking.IndexEntry
          The default index entry in the index file
 
Field Summary
protected static AbstractIndexedFileCacheBacking.IndexEntry[] EMPTY_INDEX
           
protected static java.lang.String[] EMPTY_KEYS
           
static java.lang.String INDEX_FILE
          Default name of cache index file - assumed to contain AbstractIndexedFileCacheBacking.IndexEntry-s
 
Fields inherited from class org.aspectj.weaver.tools.cache.AbstractFileCacheBacking
WEAVED_CLASS_CACHE_DIR
 
Fields inherited from class org.aspectj.weaver.tools.cache.AbstractCacheBacking
logger
 
Constructor Summary
protected AbstractIndexedFileCacheBacking(java.io.File cacheDir)
           
 
Method Summary
static AbstractIndexedFileCacheBacking.IndexEntry createIndexEntry(CachedClassEntry classEntry, byte[] originalBytes)
           
protected abstract  java.util.Map<java.lang.String,AbstractIndexedFileCacheBacking.IndexEntry> getIndex()
           
 java.io.File getIndexFile()
           
 java.lang.String[] getKeys(java.lang.String regex)
          Return a list of keys which match the given regex.
protected  java.util.Map<java.lang.String,AbstractIndexedFileCacheBacking.IndexEntry> readIndex()
           
 AbstractIndexedFileCacheBacking.IndexEntry[] readIndex(java.io.File indexFile)
           
protected  java.util.Map<java.lang.String,AbstractIndexedFileCacheBacking.IndexEntry> readIndex(java.io.File cacheDir, java.io.File cacheFile)
           
protected  AbstractIndexedFileCacheBacking.IndexEntry resolveIndexMapEntry(java.io.File cacheDir, AbstractIndexedFileCacheBacking.IndexEntry ie)
           
protected  void writeIndex()
           
protected  void writeIndex(java.io.File file)
           
protected  void writeIndex(java.io.File indexFile, AbstractIndexedFileCacheBacking.IndexEntry... entries)
           
protected  void writeIndex(java.io.File indexFile, java.util.Collection<? extends AbstractIndexedFileCacheBacking.IndexEntry> entries)
           
protected  void writeIndex(java.io.File indexFile, java.util.Map<java.lang.String,? extends AbstractIndexedFileCacheBacking.IndexEntry> index)
           
 
Methods inherited from class org.aspectj.weaver.tools.cache.AbstractFileCacheBacking
close, close, delete, getCacheDirectory, writeClassBytes
 
Methods inherited from class org.aspectj.weaver.tools.cache.AbstractCacheBacking
crc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.aspectj.weaver.tools.cache.CacheBacking
clear, get, put, remove
 

Field Detail

INDEX_FILE

public static final java.lang.String INDEX_FILE
Default name of cache index file - assumed to contain AbstractIndexedFileCacheBacking.IndexEntry-s

See Also:
Constant Field Values

EMPTY_INDEX

protected static final AbstractIndexedFileCacheBacking.IndexEntry[] EMPTY_INDEX

EMPTY_KEYS

protected static final java.lang.String[] EMPTY_KEYS
Constructor Detail

AbstractIndexedFileCacheBacking

protected AbstractIndexedFileCacheBacking(java.io.File cacheDir)
Method Detail

getIndexFile

public java.io.File getIndexFile()

getKeys

public java.lang.String[] getKeys(java.lang.String regex)
Description copied from interface: CacheBacking
Return a list of keys which match the given regex.

Returns:

readIndex

protected java.util.Map<java.lang.String,AbstractIndexedFileCacheBacking.IndexEntry> readIndex()

writeIndex

protected void writeIndex()

writeIndex

protected void writeIndex(java.io.File file)

getIndex

protected abstract java.util.Map<java.lang.String,AbstractIndexedFileCacheBacking.IndexEntry> getIndex()

readIndex

protected java.util.Map<java.lang.String,AbstractIndexedFileCacheBacking.IndexEntry> readIndex(java.io.File cacheDir,
                                                                                               java.io.File cacheFile)

resolveIndexMapEntry

protected AbstractIndexedFileCacheBacking.IndexEntry resolveIndexMapEntry(java.io.File cacheDir,
                                                                          AbstractIndexedFileCacheBacking.IndexEntry ie)

readIndex

public AbstractIndexedFileCacheBacking.IndexEntry[] readIndex(java.io.File indexFile)

writeIndex

protected void writeIndex(java.io.File indexFile,
                          java.util.Map<java.lang.String,? extends AbstractIndexedFileCacheBacking.IndexEntry> index)
                   throws java.io.IOException
Throws:
java.io.IOException

writeIndex

protected void writeIndex(java.io.File indexFile,
                          AbstractIndexedFileCacheBacking.IndexEntry... entries)
                   throws java.io.IOException
Throws:
java.io.IOException

writeIndex

protected void writeIndex(java.io.File indexFile,
                          java.util.Collection<? extends AbstractIndexedFileCacheBacking.IndexEntry> entries)
                   throws java.io.IOException
Throws:
java.io.IOException

createIndexEntry

public static final AbstractIndexedFileCacheBacking.IndexEntry createIndexEntry(CachedClassEntry classEntry,
                                                                                byte[] originalBytes)