org.dasein.persist
Class PersistentCache<T extends org.dasein.util.CachedItem>

java.lang.Object
  extended by org.dasein.persist.PersistentCache<T>
Direct Known Subclasses:
HandlerSocketCache, RelationalCache, RelationalHSCache, RiakCache

public abstract class PersistentCache<T extends org.dasein.util.CachedItem>
extends Object


Nested Class Summary
static class PersistentCache.EntityJoin
           
 
Constructor Summary
PersistentCache()
           
 
Method Summary
 void addJoinEntity(Class<? extends org.dasein.util.CachedItem> entity, String joinField, String localField)
           
 long count()
           
 long count(SearchTerm... terms)
           
abstract  T create(Transaction xaction, Map<String,Object> state)
           
 Collection<T> find(SearchTerm... terms)
           
abstract  Collection<T> find(SearchTerm[] terms, org.dasein.util.JiteratorFilter<T> filter, Boolean orderDesc, String... orderFields)
           
abstract  T get(Object keyValue)
           
protected  org.dasein.util.ConcurrentMultiCache<T> getCache()
           
static PersistentCache<? extends org.dasein.util.CachedItem> getCache(Class<? extends org.dasein.util.CachedItem> forClass, String primaryKey)
           
protected  PersistentCache.EntityJoin getJoin(Class<? extends org.dasein.util.CachedItem> entity)
           
 Map<Class<? extends org.dasein.util.CachedItem>,PersistentCache.EntityJoin> getJoins()
           
protected  String getKeyValue(Map<String,Object> map, Key key)
           
protected  String getKeyValue(T object)
           
protected  String getKeyValue(T object, Key key)
           
protected  Set<String> getKeyValues(int index, SearchTerm... forTerms)
           
 long getNewKeyValue()
           
protected  Key getPrimaryKey()
           
protected  String getPrimaryKeyField()
           
protected  Key[] getSecondaryKeys()
           
 Class<T> getTarget()
           
protected  void init(Class<T> cls, Key... keys)
           
protected  void initBase(Class<? extends org.dasein.util.CachedItem> c, Key... keys)
           
abstract  Collection<T> list()
           
 Collection<T> list(boolean orderDesc, String... orderFields)
           
protected  Key matchKeys(SearchTerm[] terms)
           
abstract  void remove(Transaction xaction, T item)
           
abstract  void update(Transaction xaction, T item, Map<String,Object> state)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistentCache

public PersistentCache()
Method Detail

getCache

public static PersistentCache<? extends org.dasein.util.CachedItem> getCache(Class<? extends org.dasein.util.CachedItem> forClass,
                                                                             String primaryKey)
                                                                      throws PersistenceException
Throws:
PersistenceException

addJoinEntity

public void addJoinEntity(Class<? extends org.dasein.util.CachedItem> entity,
                          String joinField,
                          String localField)

getJoin

protected PersistentCache.EntityJoin getJoin(Class<? extends org.dasein.util.CachedItem> entity)

getJoins

public Map<Class<? extends org.dasein.util.CachedItem>,PersistentCache.EntityJoin> getJoins()

initBase

protected final void initBase(Class<? extends org.dasein.util.CachedItem> c,
                              Key... keys)

init

protected void init(Class<T> cls,
                    Key... keys)

count

public long count()
           throws PersistenceException
Throws:
PersistenceException

count

public long count(SearchTerm... terms)
           throws PersistenceException
Throws:
PersistenceException

getCache

protected org.dasein.util.ConcurrentMultiCache<T> getCache()

create

public abstract T create(Transaction xaction,
                         Map<String,Object> state)
                                                     throws PersistenceException
Throws:
PersistenceException

find

public Collection<T> find(SearchTerm... terms)
                                                      throws PersistenceException
Throws:
PersistenceException

find

public abstract Collection<T> find(SearchTerm[] terms,
                                   org.dasein.util.JiteratorFilter<T> filter,
                                   Boolean orderDesc,
                                   String... orderFields)
                                                               throws PersistenceException
Throws:
PersistenceException

get

public abstract T get(Object keyValue)
                                                  throws PersistenceException
Throws:
PersistenceException

getKeyValue

protected String getKeyValue(T object)
                      throws PersistenceException
Throws:
PersistenceException

getKeyValue

protected String getKeyValue(T object,
                             Key key)
                      throws PersistenceException
Throws:
PersistenceException

getKeyValue

protected String getKeyValue(Map<String,Object> map,
                             Key key)
                      throws PersistenceException
Throws:
PersistenceException

getKeyValues

protected Set<String> getKeyValues(int index,
                                   SearchTerm... forTerms)

getPrimaryKey

protected Key getPrimaryKey()

getPrimaryKeyField

protected String getPrimaryKeyField()

getNewKeyValue

public long getNewKeyValue()
                    throws PersistenceException
Throws:
PersistenceException

getSecondaryKeys

protected Key[] getSecondaryKeys()

getTarget

public Class<T> getTarget()

list

public abstract Collection<T> list()
                                                               throws PersistenceException
Throws:
PersistenceException

list

public Collection<T> list(boolean orderDesc,
                          String... orderFields)
                                                      throws PersistenceException
Throws:
PersistenceException

matchKeys

protected Key matchKeys(SearchTerm[] terms)

remove

public abstract void remove(Transaction xaction,
                            T item)
                     throws PersistenceException
Throws:
PersistenceException

update

public abstract void update(Transaction xaction,
                            T item,
                            Map<String,Object> state)
                     throws PersistenceException
Throws:
PersistenceException


Copyright © 2011 enStratus Networks LLC. All Rights Reserved.