public class CacheManager extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CACHE_SEMTYPES_TABLE_NAME |
protected static java.lang.String |
cachePath |
static java.lang.String |
CACHETABLENAME |
static java.lang.String |
tmpPath |
Modifier | Constructor and Description |
---|---|
protected |
CacheManager()
Construct a new CacheManager
|
Modifier and Type | Method and Description |
---|---|
void |
addCacheListener(CacheListener listener)
add a CacheListener to listen for cache events
|
void |
addKAREntryHandler(KAREntryHandler keh) |
void |
clearCache()
clear the cache of all contents
|
int |
countDB()
debug method to count the contents of the table * @throws CacheException
|
java.util.Vector<CacheContent> |
getCachedContents() |
java.util.Vector<CacheContent> |
getCachedContents(java.lang.String type) |
java.util.Vector<KeplerLSID> |
getCachedLsids()
Return a complete list of KeplerLSIDs for everything that is in the
cache.
|
java.util.Vector<KeplerLSID> |
getCachedLsids(KeplerLSID lsid) |
java.util.List<KeplerLSID> |
getCachedLsidsForClass(java.lang.String className)
Get a list of LSIDs for a class name.
|
java.util.Iterator<CacheObjectInterface> |
getCacheObjectIterator()
return an iterator of all of the CacheObjectInterfaces in the cache
|
java.util.Iterator<CacheObjectInterface> |
getCacheObjectIterator(java.lang.String type) |
static java.lang.String |
getDatabaseSchemaName()
Get the name of the cache database schema.
|
java.lang.Long |
getHighestCachedLsidRevision(KeplerLSID lsid) |
CacheObject |
getHighestCacheObjectRevision(KeplerLSID anLsid)
Return the CacheObject that has the highest revision number and matches
the given LSID, return null if not found.
|
static CacheManager |
getInstance()
create a new singleton instance of CacheManager
|
java.util.Collection<KAREntryHandler> |
getKAREntryHandlers() |
CacheObjectInterface |
getObject(KeplerLSID lsid)
return the CacheObjectInterface with the specified lsid.
|
java.util.Vector<KeplerLSID> |
getSemanticTypesFor(KeplerLSID lsid)
Return a list of Semantic Types for the given LSID.
|
java.io.File |
getTempFile()
returns a temp file that is guaranteed to be around for one kepler
session but could be deleted if the cache gets too full.
|
void |
insertObject(CacheObjectInterface co)
insert a new CacheObjectInterface into the cache.
|
boolean |
isContained(KeplerLSID lsid)
return true of the given lsid has an associated object in the cache
|
void |
removeObject(KeplerLSID lsid)
remove the CacheObjectInterface with the specified lsid.
|
java.lang.String |
showDB()
debug method to show the contents of the table
|
static void |
shutdown()
Shutdown the cache manager.
|
void |
updateObject(CacheObjectInterface co)
update a CacheObjectInterface in the cache.
|
protected static final java.lang.String cachePath
public static final java.lang.String tmpPath
public static final java.lang.String CACHETABLENAME
public static final java.lang.String CACHE_SEMTYPES_TABLE_NAME
protected CacheManager() throws CacheException
CacheException
public static CacheManager getInstance() throws CacheException
CacheException
public static void shutdown()
public java.io.File getTempFile()
public void addKAREntryHandler(KAREntryHandler keh)
keh
- public java.util.Collection<KAREntryHandler> getKAREntryHandlers()
public void insertObject(CacheObjectInterface co) throws CacheException
co
- the cache object to insertCacheException
public void updateObject(CacheObjectInterface co) throws CacheException
CacheException
public void removeObject(KeplerLSID lsid) throws CacheException
lsid
- CacheException
public java.lang.String showDB() throws CacheException, java.sql.SQLException
CacheException,
- SQLExceptionCacheException
java.sql.SQLException
public int countDB() throws CacheException, java.sql.SQLException
CacheException
java.sql.SQLException
public CacheObjectInterface getObject(KeplerLSID lsid) throws CacheException
lsid
- CacheException
- when there is an issue with the cache.public java.util.Vector<CacheContent> getCachedContents()
public java.util.Vector<CacheContent> getCachedContents(java.lang.String type)
type
- public java.util.Vector<KeplerLSID> getCachedLsids()
public java.util.Vector<KeplerLSID> getCachedLsids(KeplerLSID lsid)
lsid
- public java.util.List<KeplerLSID> getCachedLsidsForClass(java.lang.String className) throws java.lang.Exception
java.lang.Exception
public java.lang.Long getHighestCachedLsidRevision(KeplerLSID lsid)
lsid
- public java.util.Vector<KeplerLSID> getSemanticTypesFor(KeplerLSID lsid)
lsid
- public java.util.Iterator<CacheObjectInterface> getCacheObjectIterator() throws CacheException
CacheException
public CacheObject getHighestCacheObjectRevision(KeplerLSID anLsid) throws CacheException
anLsid
- CacheException
public java.util.Iterator<CacheObjectInterface> getCacheObjectIterator(java.lang.String type) throws CacheException
type
- CacheException
public boolean isContained(KeplerLSID lsid) throws CacheException
lsid
- CacheException
public void clearCache() throws java.sql.SQLException, CacheException
java.sql.SQLException
CacheException
public void addCacheListener(CacheListener listener)
public static java.lang.String getDatabaseSchemaName()