|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openanzo.common.rdb.layout.NodeLayoutCacheProxy<T>
T - Type of Value being storedpublic class NodeLayoutCacheProxy<T extends org.openrdf.model.Value>
Wraps and caches the data accessed by a INodeLayout object. *
| Constructor Summary | |
|---|---|
NodeLayoutCacheProxy(INodeLayout<T> base,
java.util.Map<java.lang.Long,T> byIdCache,
java.util.Map<T,java.lang.Long> byNodeCache)
Create NodeLayoutCacheProxy for the given base layout. |
|
| Method Summary | |
|---|---|
T |
cache(java.lang.Long id,
java.lang.String value,
java.lang.Long modifierId)
Create object from provided ID and value and cache result |
void |
clearCache()
Clear all cached objects and IDs |
void |
clearUncommittedCache()
Clear any uncommitted cache entries |
void |
commitUncommittedCache()
Commit any uncommitted cache entries |
T |
convert(java.lang.String value,
java.lang.Long modifierId)
Convert raw value from database into Node of appropriate type |
java.lang.Long |
fetchId(T n)
Fetches a node's ID from the database |
T |
fetchValue(java.lang.Long id)
Fetches a nodes value from the database based on its long identifier and NodeType. |
T |
getIfCached(java.lang.Long id)
Get the Object for this ID, if already cached |
java.lang.Long |
getIfCached(T value)
Get the ID for this Object, if already cached |
NodeType |
getType()
|
boolean |
isCached(java.lang.Long id)
Return true if an Object with this ID is already cached |
boolean |
isCached(T n)
Return true if a ID for this Object is already cached |
java.util.Map<java.lang.Long,T> |
resolveStoredIds(java.util.Set<java.lang.Long> ids)
This method will determine which IDs in a list of given Ids are already stored in the database. |
java.util.Map<T,java.lang.Long> |
resolveStoredNodes(java.util.Set<T> nodes,
boolean storeUnresolvedNodes)
This method will determine which nodes in a list of given nodes are already stored in the database. |
java.lang.Long |
store(T n)
Stores a node in the database |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NodeLayoutCacheProxy(INodeLayout<T> base,
java.util.Map<java.lang.Long,T> byIdCache,
java.util.Map<T,java.lang.Long> byNodeCache)
base - Base layout to add caching layer ontobyIdCache - ID cache for this layoutbyNodeCache - Node cache for this layout| Method Detail |
|---|
public void clearCache()
ILayoutCache
clearCache in interface ILayoutCache<T extends org.openrdf.model.Value>
public T cache(java.lang.Long id,
java.lang.String value,
java.lang.Long modifierId)
ILayoutCache
cache in interface ILayoutCache<T extends org.openrdf.model.Value>id - ID of nodevalue - String value of nodemodifierId - modifierId for literals
public java.lang.Long store(T n)
INodeLayout
store in interface INodeLayout<T extends org.openrdf.model.Value>n - The node to be stored
public void commitUncommittedCache()
ILayoutCache
commitUncommittedCache in interface ILayoutCache<T extends org.openrdf.model.Value>public void clearUncommittedCache()
ILayoutCache
clearUncommittedCache in interface ILayoutCache<T extends org.openrdf.model.Value>public boolean isCached(T n)
ILayoutCache
isCached in interface ILayoutCache<T extends org.openrdf.model.Value>n - object to check
public boolean isCached(java.lang.Long id)
ILayoutCache
isCached in interface ILayoutCache<T extends org.openrdf.model.Value>id - id to check
public java.lang.Long getIfCached(T value)
ILayoutCache
getIfCached in interface ILayoutCache<T extends org.openrdf.model.Value>value - object to find cached ID
public T getIfCached(java.lang.Long id)
ILayoutCache
getIfCached in interface ILayoutCache<T extends org.openrdf.model.Value>id - id of Object to retrieve
public java.lang.Long fetchId(T n)
INodeLayout
fetchId in interface INodeLayout<T extends org.openrdf.model.Value>n - The node who's ID is to be found
public T fetchValue(java.lang.Long id)
INodeLayout
fetchValue in interface INodeLayout<T extends org.openrdf.model.Value>id - The ID of the node to be found
public java.util.Map<T,java.lang.Long> resolveStoredNodes(java.util.Set<T> nodes,
boolean storeUnresolvedNodes)
INodeLayout
resolveStoredNodes in interface INodeLayout<T extends org.openrdf.model.Value>nodes - The nodes which need to be resolved to whether they are already stored or need to be stored.storeUnresolvedNodes - Store nodes that are not already stored
public java.util.Map<java.lang.Long,T> resolveStoredIds(java.util.Set<java.lang.Long> ids)
INodeLayout
resolveStoredIds in interface INodeLayout<T extends org.openrdf.model.Value>ids - The ids which need to be resolved to whether they are already stored.
public NodeType getType()
getType in interface INodeLayout<T extends org.openrdf.model.Value>
public T convert(java.lang.String value,
java.lang.Long modifierId)
INodeLayout
convert in interface INodeLayout<T extends org.openrdf.model.Value>value - raw value of node from databasemodifierId - for literal values
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||