Class DynamoDBStore<V extends Identifiable>
- java.lang.Object
-
- edu.uiuc.ncsa.security.storage.dynamodb.DynamoDBStore<V>
-
- All Implemented Interfaces:
Store<V>
,Map<Identifier,V>
public class DynamoDBStore<V extends Identifiable> extends Object implements Store<V>
Created by Jeff Gaynor
on 4/22/24 at 12:59 PM
-
-
Field Summary
-
Fields inherited from interface edu.uiuc.ncsa.security.core.Store
VERSION_TAG
-
-
Constructor Summary
Constructors Constructor Description DynamoDBStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
boolean
containsKey(Object o)
boolean
containsValue(Object o)
V
create()
Create a new object of the given type.Set<Map.Entry<Identifier,V>>
entrySet()
V
get(Object o)
List<V>
getAll()
Method to get every element in the store.List<V>
getMostRecent(int n, List<String> attributes)
XMLConverter<V>
getXMLConverter()
boolean
isEmpty()
Set<Identifier>
keySet()
V
put(Identifier identifier, V v)
void
putAll(Map<? extends Identifier,? extends V> map)
void
register(V value)
Almost Identical to put(K,V) but since the object should have an identifier, passing along the key is redundant.V
remove(Object o)
boolean
remove(List<Identifiable> objects)
Removes a list of identifiable object from the store by ID.void
save(V value)
Saves an object.List<V>
search(String key, String condition, boolean isRegEx)
Allows for searching via a reg ex.List<V>
search(String key, String condition, boolean isRegEx, List<String> attr)
Return a subset of all the attributes.List<V>
search(String key, String condition, boolean isRegEx, List<String> attr, String dateField, Date before, Date after)
int
size()
int
size(boolean includeVersions)
void
update(V value)
Update an existing object.Collection<V>
values()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Method Detail
-
create
public V create()
Description copied from interface:Store
Create a new object of the given type. This is not in the store until it is registered. Attempts to update the object should throw an exception. Note that this allows for a separation of creation semantics. Some objects require specific initialization before saving- Specified by:
create
in interfaceStore<V extends Identifiable>
- Returns:
-
update
public void update(V value)
Description copied from interface:Store
Update an existing object. AnUnregisteredObjectException
is thrown if the object has not been saved first.- Specified by:
update
in interfaceStore<V extends Identifiable>
-
register
public void register(V value)
Description copied from interface:Store
Almost Identical to put(K,V) but since the object should have an identifier, passing along the key is redundant. This persists the object in the store. Note that this returns void since the contract assumes that this is not registered. If the object is registered an exception should be thrown. Generally use save(V).- Specified by:
register
in interfaceStore<V extends Identifiable>
-
save
public void save(V value)
Description copied from interface:Store
Saves an object. This bridges the gap between SQL stores update and insert commands. Implementations should check if the object already exists in the store and issue an appropriate call.- Specified by:
save
in interfaceStore<V extends Identifiable>
-
getAll
public List<V> getAll()
Description copied from interface:Store
Method to get every element in the store. This is useful for command line interfaces. Note that this might be very expensive.- Specified by:
getAll
in interfaceStore<V extends Identifiable>
- Returns:
-
getXMLConverter
public XMLConverter<V> getXMLConverter()
- Specified by:
getXMLConverter
in interfaceStore<V extends Identifiable>
-
search
public List<V> search(String key, String condition, boolean isRegEx)
Description copied from interface:Store
Allows for searching via a reg ex. Note that this may be very expensive for certain stores!- Specified by:
search
in interfaceStore<V extends Identifiable>
- Returns:
-
search
public List<V> search(String key, String condition, boolean isRegEx, List<String> attr)
Description copied from interface:Store
Return a subset of all the attributes. For non-SQL stores performance may be slow.- Specified by:
search
in interfaceStore<V extends Identifiable>
- Returns:
-
search
public List<V> search(String key, String condition, boolean isRegEx, List<String> attr, String dateField, Date before, Date after)
- Specified by:
search
in interfaceStore<V extends Identifiable>
-
size
public int size(boolean includeVersions)
- Specified by:
size
in interfaceStore<V extends Identifiable>
-
remove
public boolean remove(List<Identifiable> objects)
Description copied from interface:Store
Removes a list of identifiable object from the store by ID.- Specified by:
remove
in interfaceStore<V extends Identifiable>
- Returns:
-
getMostRecent
public List<V> getMostRecent(int n, List<String> attributes)
- Specified by:
getMostRecent
in interfaceStore<V extends Identifiable>
-
size
public int size()
- Specified by:
size
in interfaceMap<Identifier,V extends Identifiable>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceMap<Identifier,V extends Identifiable>
-
containsKey
public boolean containsKey(Object o)
- Specified by:
containsKey
in interfaceMap<Identifier,V extends Identifiable>
-
containsValue
public boolean containsValue(Object o)
- Specified by:
containsValue
in interfaceMap<Identifier,V extends Identifiable>
-
get
public V get(Object o)
- Specified by:
get
in interfaceMap<Identifier,V extends Identifiable>
-
put
public V put(Identifier identifier, V v)
- Specified by:
put
in interfaceMap<Identifier,V extends Identifiable>
-
remove
public V remove(Object o)
- Specified by:
remove
in interfaceMap<Identifier,V extends Identifiable>
-
putAll
public void putAll(Map<? extends Identifier,? extends V> map)
- Specified by:
putAll
in interfaceMap<Identifier,V extends Identifiable>
-
clear
public void clear()
- Specified by:
clear
in interfaceMap<Identifier,V extends Identifiable>
-
keySet
public Set<Identifier> keySet()
- Specified by:
keySet
in interfaceMap<Identifier,V extends Identifiable>
-
values
public Collection<V> values()
- Specified by:
values
in interfaceMap<Identifier,V extends Identifiable>
-
entrySet
public Set<Map.Entry<Identifier,V>> entrySet()
- Specified by:
entrySet
in interfaceMap<Identifier,V extends Identifiable>
-
-