Package edu.uiuc.ncsa.security.core
Interface Store<V extends Identifiable>
-
- All Superinterfaces:
Map<Identifier,V>
- All Known Subinterfaces:
JSONStore<V>
,SASClientStore<V>
- All Known Implementing Classes:
AggregateStore
,CachedMapFacade
,ClientMemoryStore
,DynamoDBStore
,FileStore
,FSClientStore
,IndexedStreamStore
,MemoryStore
,MonitoredFileStore
,MonitoredMemoryStore
,MonitoredSQLStore
,SASSQLStore
,SQLStore
,TestMemStore
public interface Store<V extends Identifiable> extends Map<Identifier,V>
Interface for stores. This models a specific case, where there is a primary key, which can be represented with anIdentifier
so that this is logically also a map. Each row corresponds to (usually) one java object. What the map interface lacks is concepts for CRUD (create, retrieve, update, delete) and this interface adds those.Usage
A very large number of practical database programming issues fall into this case and the interfaces and basic classes in this package make setting up and managing them extremely simple. This interface comes with a variety of basic implementations, such as an in-memory store, a file store (which emulates having an index on disk) as well as support for SQL databases.Created by Jeff Gaynor
on Mar 12, 2010 at 10:21:39 AM
-
-
Field Summary
Fields Modifier and Type Field Description static String
VERSION_TAG
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description V
create()
Create a new object of the given type.List<V>
getAll()
Method to get every element in the store.List<V>
getMostRecent(int n, List<String> attributes)
XMLConverter<V>
getXMLConverter()
void
register(V value)
Almost Identical to put(K,V) but since the object should have an identifier, passing along the key is redundant.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(boolean includeVersions)
void
update(V value)
Update an existing object.-
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
-
-
-
Field Detail
-
VERSION_TAG
static final String VERSION_TAG
- See Also:
- Constant Field Values
-
-
Method Detail
-
create
V create()
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- Returns:
-
update
void update(V value)
Update an existing object. AnUnregisteredObjectException
is thrown if the object has not been saved first.- Parameters:
value
-
-
register
void register(V value)
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).- Parameters:
value
-
-
save
void save(V value)
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.- Parameters:
value
-
-
getAll
List<V> getAll()
Method to get every element in the store. This is useful for command line interfaces. Note that this might be very expensive.- Returns:
-
getXMLConverter
XMLConverter<V> getXMLConverter()
-
search
List<V> search(String key, String condition, boolean isRegEx)
Allows for searching via a reg ex. Note that this may be very expensive for certain stores!- Parameters:
key
-condition
-isRegEx
-- Returns:
-
search
List<V> search(String key, String condition, boolean isRegEx, List<String> attr)
Return a subset of all the attributes. For non-SQL stores performance may be slow.- Parameters:
key
-condition
-isRegEx
-attr
-- Returns:
-
search
List<V> search(String key, String condition, boolean isRegEx, List<String> attr, String dateField, Date before, Date after)
-
size
int size(boolean includeVersions)
-
remove
boolean remove(List<Identifiable> objects)
Removes a list of identifiable object from the store by ID.- Parameters:
objects
-- Returns:
-
-