|
LEONARDI Application Composer - 8.9.0.40 by W4 S.A. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectleon.data.LyCache
public abstract class LyCache
This class s an abstract class that implements the generic behavior of a memory cache for instances of objects managed by a LyDataSource. Basically, it only keeps in memory used objects (using strong references).
This class is both used for storing logical or physical objects.
The cache has an associated class that gives information about stored objects. This associated class implements LyClass interface (for logical objects, this is an instance of LyClassInfo).
Caches keeps several tables :
In the current version, basic cache implementations are provided. More sophisticated ones will be implemented in future versions.
LyDataSource
,
LyClass
,
LyClassInfo
,
LyInfoCache
,
LyObjectId
Nested Class Summary | |
---|---|
static class |
LyCache.Result
Result types. |
Field Summary | |
---|---|
static java.lang.String |
__VERSION
File version. |
static int |
NB_UNKNOWN_OBJECTS
Number of unknown objects references kept. |
Constructor Summary | |
---|---|
LyCache(LyClass cacheClass,
LyInfoCache policy)
Constructor of a cache of objects related to a given class description. |
Method Summary | |
---|---|
abstract void |
allowLoaded(boolean allowLoaded)
Setter for the allow loaded attribute. |
void |
clearUnknownIdsCache()
Clear the cache from all its unknown ids. |
boolean |
contains(LyObjectId objectId)
Check if an object is in the cache. |
boolean |
contains(java.lang.Object object)
Check if an object is in the cache. |
LyClass |
getCacheClass()
Retrieves the class associated to this cache. |
int |
getCount(LyFilter filter)
Return the number of objects within this cache that match the given filter If needed, depending on the cache policy, objects that are not in the cache when the method is called may be loaded in it. |
LyEnvironment |
getEnvironment()
Gets environment of the cache. |
java.lang.Object |
getObject(LyObjectId id)
Gets an object in this cache by its identifier. |
abstract LyObject |
getObjectFromPeer(java.lang.Object peer)
Gets an object from its physical representation (peer). |
LyObjectList |
getObjectList(boolean sorted)
Get list of objects found in this cache. |
java.util.Vector<java.lang.Object> |
getObjects()
Get list of objects found in this cache. |
LyCache.Result |
getObjects(LyFilter filter,
LySimpleObjectList list)
Adds objects to the given object list that match the specified filter. |
LyInfoCache |
getPolicy()
Gets cache policy of this cache. |
abstract int |
getSize(LyFilter filter)
Return the number of objects within this cache that match the given filter (all objects of the cache if filter is null). |
abstract boolean |
isEmpty()
Tests if this cache is empty or not (contains no object). |
boolean |
isLoaded()
Tests whether this cache is completely loaded or not. |
boolean |
rehash(java.lang.Object object,
LyObjectId oldObjectId)
This method recomputes the association between an object and its objectId. |
void |
setLoaded(boolean loaded)
Marks this cache as loaded or not. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String __VERSION
public static int NB_UNKNOWN_OBJECTS
Constructor Detail |
---|
public LyCache(LyClass cacheClass, LyInfoCache policy)
cacheClass
- Class description of objects stored in the cache.policy
- Description of th epolicy of thsi cache.Method Detail |
---|
public abstract LyObject getObjectFromPeer(java.lang.Object peer)
peer
- Physical representation of the searched object.
java.lang.IllegalStateException
- If this cache is not a cache that keep logical objects.public abstract int getSize(LyFilter filter)
filter
- Filter used for selecting objects. If filter is null, the total is returned.
public abstract boolean isEmpty()
public abstract void allowLoaded(boolean allowLoaded)
allowLoaded
- the value of the allowLoaded attributepublic LyInfoCache getPolicy()
public java.lang.Object getObject(LyObjectId id) throws LyNoSuchObjectException
id
- Object identifier.
LyNoSuchObjectException
- If no object of this cache has this identifier and if
the given id has not been registered in unknown ids
list.public boolean contains(java.lang.Object object)
object
- Object to check.
public boolean contains(LyObjectId objectId)
objectId
- Object to check.
public int getCount(LyFilter filter)
filter
- Filter used for selecting objects. If filter is null, the total is returned.
public LyCache.Result getObjects(LyFilter filter, LySimpleObjectList list)
filter
- Filter to select objects.list
- List where results are added.
Result.TOTAL can only be returned when the cache is loaded.
public final LyClass getCacheClass()
public java.util.Vector<java.lang.Object> getObjects()
public LyObjectList getObjectList(boolean sorted)
sorted
- True if the requiered list must be sorted.
public boolean isLoaded()
public void setLoaded(boolean loaded)
loaded
- True to mark the cache loaded, false otherwise.public LyEnvironment getEnvironment()
public boolean rehash(java.lang.Object object, LyObjectId oldObjectId)
object
- The objectoldObjectId
- The old value of the objectId of the specified object
public void clearUnknownIdsCache()
|
(c) January 2013 - W4 S.A. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |