Class TransactionCache<V extends BasicTransaction>
- java.lang.Object
-
- edu.uiuc.ncsa.security.core.cache.CachedMapFacade<V>
-
- org.oa4mp.delegation.common.storage.transactions.TransactionCache<V>
-
- All Implemented Interfaces:
edu.uiuc.ncsa.security.core.Store<V>
,Map<edu.uiuc.ncsa.security.core.Identifier,V>
,TransactionStore<V>
public class TransactionCache<V extends BasicTransaction> extends edu.uiuc.ncsa.security.core.cache.CachedMapFacade<V> implements TransactionStore<V>
A cache. Set the backing store if you have one, otherwise this works perfectly well as an in-memory store.Usage
To front a transaction store, write the store separately then instantiate an instance of this, passing the frontend store as an argument. You may then use the store and all it's facilities (such as retention policies) as you see fit.Created by Jeff Gaynor
on Apr 27, 2010 at 4:27:10 PM
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TransactionCache.TransactionIndices<V extends BasicTransaction>
The indices for a transaction store.
-
Constructor Summary
Constructors Constructor Description TransactionCache()
TransactionCache(TransactionStore backingStore)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkDestroyed()
void
clear()
boolean
containsKey(Object key)
boolean
containsValue(Object value)
V
create()
boolean
destroy()
Set<Map.Entry<edu.uiuc.ncsa.security.core.Identifier,V>>
entrySet()
V
get(Object key)
V
get(AccessToken accessToken)
V
get(AuthorizationGrant tempCred)
V
get(Verifier verifier)
List<V>
getAll()
TransactionStore
getBackingStore()
protected V
getByKey(Object key, int action)
This is done as a switch statement to keep references to the cache up to date.V
getByProxyID(edu.uiuc.ncsa.security.core.Identifier proxyID)
edu.uiuc.ncsa.security.core.util.AbstractEnvironment
getEnvironment()
edu.uiuc.ncsa.security.storage.data.MapConverter
getMapConverter()
List<V>
getMostRecent(int n, List<String> attributes)
TransactionCache.TransactionIndices
getTransactionIndices()
edu.uiuc.ncsa.security.core.XMLConverter<V>
getXMLConverter()
boolean
init()
boolean
isDestroyed()
boolean
isEmpty()
Set<edu.uiuc.ncsa.security.core.Identifier>
keySet()
V
put(edu.uiuc.ncsa.security.core.Identifier key, V value)
void
put(V t)
void
putAll(Map m)
void
register(V transaction)
V
remove(Object key)
BasicTransaction
remove(URI identifier)
boolean
remove(List<edu.uiuc.ncsa.security.core.Identifiable> objects)
BasicTransaction
remove(BasicTransaction t)
void
save(V t)
List<V>
search(String key, String condition, boolean isRegEx)
List<V>
search(String key, String condition, boolean isRegEx, List<String> attr)
List<V>
search(String key, String condition, boolean isRegEx, List<String> attr, String dateField, Date before, Date after)
protected void
setDestroyed(boolean destroyed)
void
setEnvironment(edu.uiuc.ncsa.security.core.util.AbstractEnvironment environment)
int
size()
int
size(boolean includeVersions)
String
toString()
void
update(BasicTransaction t)
Collection<V>
values()
-
Methods inherited from class edu.uiuc.ncsa.security.core.cache.CachedMapFacade
getCache, getTheStore, hasStore, setCache, setTheStore
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Constructor Detail
-
TransactionCache
public TransactionCache(TransactionStore backingStore)
-
TransactionCache
public TransactionCache()
-
-
Method Detail
-
getMostRecent
public List<V> getMostRecent(int n, List<String> attributes)
- Specified by:
getMostRecent
in interfaceedu.uiuc.ncsa.security.core.Store<V extends BasicTransaction>
-
getBackingStore
public TransactionStore getBackingStore()
-
getXMLConverter
public edu.uiuc.ncsa.security.core.XMLConverter<V> getXMLConverter()
- Specified by:
getXMLConverter
in interfaceedu.uiuc.ncsa.security.core.Store<V extends BasicTransaction>
-
getTransactionIndices
public TransactionCache.TransactionIndices getTransactionIndices()
-
getEnvironment
public edu.uiuc.ncsa.security.core.util.AbstractEnvironment getEnvironment()
-
setEnvironment
public void setEnvironment(edu.uiuc.ncsa.security.core.util.AbstractEnvironment environment)
-
isDestroyed
public boolean isDestroyed()
-
setDestroyed
protected void setDestroyed(boolean destroyed)
-
destroy
public boolean destroy()
-
init
public boolean init()
-
put
public void put(V t)
-
checkDestroyed
protected void checkDestroyed()
-
size
public int size(boolean includeVersions)
- Specified by:
size
in interfaceedu.uiuc.ncsa.security.core.Store<V extends BasicTransaction>
-
getAll
public List<V> getAll()
- Specified by:
getAll
in interfaceedu.uiuc.ncsa.security.core.Store<V extends BasicTransaction>
-
update
public void update(BasicTransaction t)
- Specified by:
update
in interfaceedu.uiuc.ncsa.security.core.Store<V extends BasicTransaction>
-
getByKey
protected V getByKey(Object key, int action)
This is done as a switch statement to keep references to the cache up to date.- Parameters:
key
-action
-- Returns:
-
get
public V get(AuthorizationGrant tempCred)
- Specified by:
get
in interfaceTransactionStore<V extends BasicTransaction>
-
get
public V get(AccessToken accessToken)
- Specified by:
get
in interfaceTransactionStore<V extends BasicTransaction>
-
get
public V get(Verifier verifier)
- Specified by:
get
in interfaceTransactionStore<V extends BasicTransaction>
-
size
public int size()
- Specified by:
size
in interfaceMap<edu.uiuc.ncsa.security.core.Identifier,V extends BasicTransaction>
- Overrides:
size
in classedu.uiuc.ncsa.security.core.cache.CachedMapFacade<V extends BasicTransaction>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceMap<edu.uiuc.ncsa.security.core.Identifier,V extends BasicTransaction>
- Overrides:
isEmpty
in classedu.uiuc.ncsa.security.core.cache.CachedMapFacade<V extends BasicTransaction>
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey
in interfaceMap<edu.uiuc.ncsa.security.core.Identifier,V extends BasicTransaction>
- Overrides:
containsKey
in classedu.uiuc.ncsa.security.core.cache.CachedMapFacade<V extends BasicTransaction>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValue
in interfaceMap<edu.uiuc.ncsa.security.core.Identifier,V extends BasicTransaction>
- Overrides:
containsValue
in classedu.uiuc.ncsa.security.core.cache.CachedMapFacade<V extends BasicTransaction>
-
get
public V get(Object key)
- Specified by:
get
in interfaceMap<edu.uiuc.ncsa.security.core.Identifier,V extends BasicTransaction>
- Overrides:
get
in classedu.uiuc.ncsa.security.core.cache.CachedMapFacade<V extends BasicTransaction>
-
remove
public BasicTransaction remove(URI identifier)
-
create
public V create()
- Specified by:
create
in interfaceedu.uiuc.ncsa.security.core.Store<V extends BasicTransaction>
-
put
public V put(edu.uiuc.ncsa.security.core.Identifier key, V value)
- Specified by:
put
in interfaceMap<edu.uiuc.ncsa.security.core.Identifier,V extends BasicTransaction>
- Overrides:
put
in classedu.uiuc.ncsa.security.core.cache.CachedMapFacade<V extends BasicTransaction>
-
remove
public V remove(Object key)
- Specified by:
remove
in interfaceMap<edu.uiuc.ncsa.security.core.Identifier,V extends BasicTransaction>
- Overrides:
remove
in classedu.uiuc.ncsa.security.core.cache.CachedMapFacade<V extends BasicTransaction>
-
putAll
public void putAll(Map m)
- Specified by:
putAll
in interfaceMap<edu.uiuc.ncsa.security.core.Identifier,V extends BasicTransaction>
- Overrides:
putAll
in classedu.uiuc.ncsa.security.core.cache.CachedMapFacade<V extends BasicTransaction>
-
clear
public void clear()
- Specified by:
clear
in interfaceMap<edu.uiuc.ncsa.security.core.Identifier,V extends BasicTransaction>
- Overrides:
clear
in classedu.uiuc.ncsa.security.core.cache.CachedMapFacade<V extends BasicTransaction>
-
keySet
public Set<edu.uiuc.ncsa.security.core.Identifier> keySet()
- Specified by:
keySet
in interfaceMap<edu.uiuc.ncsa.security.core.Identifier,V extends BasicTransaction>
- Overrides:
keySet
in classedu.uiuc.ncsa.security.core.cache.CachedMapFacade<V extends BasicTransaction>
-
values
public Collection<V> values()
- Specified by:
values
in interfaceMap<edu.uiuc.ncsa.security.core.Identifier,V extends BasicTransaction>
- Overrides:
values
in classedu.uiuc.ncsa.security.core.cache.CachedMapFacade<V extends BasicTransaction>
-
entrySet
public Set<Map.Entry<edu.uiuc.ncsa.security.core.Identifier,V>> entrySet()
- Specified by:
entrySet
in interfaceMap<edu.uiuc.ncsa.security.core.Identifier,V extends BasicTransaction>
- Overrides:
entrySet
in classedu.uiuc.ncsa.security.core.cache.CachedMapFacade<V extends BasicTransaction>
-
save
public void save(V t)
- Specified by:
save
in interfaceedu.uiuc.ncsa.security.core.Store<V extends BasicTransaction>
-
remove
public BasicTransaction remove(BasicTransaction t)
-
register
public void register(V transaction)
- Specified by:
register
in interfaceedu.uiuc.ncsa.security.core.Store<V extends BasicTransaction>
-
search
public List<V> search(String key, String condition, boolean isRegEx)
- Specified by:
search
in interfaceedu.uiuc.ncsa.security.core.Store<V extends BasicTransaction>
-
search
public List<V> search(String key, String condition, boolean isRegEx, List<String> attr)
- Specified by:
search
in interfaceedu.uiuc.ncsa.security.core.Store<V extends BasicTransaction>
-
search
public List<V> search(String key, String condition, boolean isRegEx, List<String> attr, String dateField, Date before, Date after)
- Specified by:
search
in interfaceedu.uiuc.ncsa.security.core.Store<V extends BasicTransaction>
-
getMapConverter
public edu.uiuc.ncsa.security.storage.data.MapConverter getMapConverter()
- Specified by:
getMapConverter
in interfaceTransactionStore<V extends BasicTransaction>
-
remove
public boolean remove(List<edu.uiuc.ncsa.security.core.Identifiable> objects)
- Specified by:
remove
in interfaceedu.uiuc.ncsa.security.core.Store<V extends BasicTransaction>
-
getByProxyID
public V getByProxyID(edu.uiuc.ncsa.security.core.Identifier proxyID)
- Specified by:
getByProxyID
in interfaceTransactionStore<V extends BasicTransaction>
-
-