Package jadex.commons
Class ObjectCache
- java.lang.Object
- 
- jadex.commons.ObjectCache
 
- 
- All Implemented Interfaces:
- java.io.Serializable
 
 public class ObjectCache extends java.lang.Object implements java.io.SerializableA cache for CachedObjects that reflect files. A cached object is loaded per filename (not the filename of the held object in the cache).- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.util.MapcacheThe expression caches for filename.protected java.lang.StringfilenameThe filename of the cache.protected booleanpersist_alwaysThe persist strategy (always or only on demand by manually calling persist).protected booleanpersist_singleThe flag indicating if cached objects are stored on disk themselves.
 - 
Constructor SummaryConstructors Constructor Description ObjectCache(java.lang.String filename)Create a new cache.ObjectCache(java.lang.String filename, boolean persist_always, boolean persist_single)Create a new cache.ObjectCache(java.lang.String filename, boolean persist_always, boolean persist_single, int max)Create a new cache.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(CachedObject co)Add a cached object.voidclear()Clear the cache.CachedObjectloadCachedObject(java.lang.String filename, long lastmodified)Load the cached file.static ObjectCacheloadObjectCache(java.lang.String filename)Load the model cache.voidpersist()Presist the cached object.voidremove(java.lang.String filename)Add a cached object.
 
- 
- 
- 
Field Detail- 
persist_alwaysprotected boolean persist_always The persist strategy (always or only on demand by manually calling persist).
 - 
persist_singleprotected boolean persist_single The flag indicating if cached objects are stored on disk themselves.
 - 
filenameprotected java.lang.String filename The filename of the cache.
 - 
cacheprotected java.util.Map cache The expression caches for filename.
 
- 
 - 
Constructor Detail- 
ObjectCachepublic ObjectCache(java.lang.String filename) Create a new cache.
 - 
ObjectCachepublic ObjectCache(java.lang.String filename, boolean persist_always, boolean persist_single)Create a new cache.
 - 
ObjectCachepublic ObjectCache(java.lang.String filename, boolean persist_always, boolean persist_single, int max)Create a new cache.
 
- 
 - 
Method Detail- 
loadCachedObjectpublic CachedObject loadCachedObject(java.lang.String filename, long lastmodified) Load the cached file.- Parameters:
- filename- The filename of the cached object.
- lastmodified- The last modified date important for the up-to-date check. -1 for do not check.
 
 - 
addpublic void add(CachedObject co) Add a cached object.- Parameters:
- co- The new object.
 
 - 
removepublic void remove(java.lang.String filename) Add a cached object.- Parameters:
- filename- The filename.
 
 - 
persistpublic void persist() throws java.io.IOExceptionPresist the cached object.- Throws:
- java.io.IOException
 
 - 
clearpublic void clear() Clear the cache.
 - 
loadObjectCachepublic static ObjectCache loadObjectCache(java.lang.String filename) Load the model cache.- Parameters:
- filename- The filename.
- Returns:
- The object cache.
 
 
- 
 
-