|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sag.osami.contextstore.storage.SerializedContextStorage
public abstract class SerializedContextStorage
This convenience implementation of an ISerializedContextStorage
provides trivial implementations for the public API methods which hide the
(de)serialization-flags (i.e. all methods from IContextStorage
), as well as a trivial setter method for the serialization handler. All public API
implementations simply call the corresponding (de)serialization-aware method, passing the appropriate flag.
Although it helps avoiding redundant, trivial code, it is not required to inherit from this class when implementing an own ContextStore storage.
Field Summary | |
---|---|
protected ISerializationHandler |
serializer
Reference to the serialization handler. |
Constructor Summary | |
---|---|
SerializedContextStorage()
|
Method Summary | |
---|---|
ContextEvent[] |
load(java.util.List<java.lang.Long> contextIds)
Loads several context events with the given IDs. |
ContextEvent |
load(java.lang.Long contextId)
Loads a context event with the given ID. |
java.lang.Iterable<ContextEvent> |
loadLazy(java.util.List<java.lang.Long> contextIds)
Lazy variant of IContextStorage.load(List) , i.e. it loads one ContextEvent at a time during iteration. |
ContextEvent[] |
query(java.lang.String query,
java.lang.Object... params)
Queries several context events. |
java.lang.Iterable<ContextEvent> |
queryLazy(java.lang.String query,
java.lang.Object... params)
Lazy variant of IContextStorage.query(String, Object...) , i.e. it loads one ContextEvent at a time during iteration. |
void |
setSerializer(ISerializationHandler serializer)
Grants access to the payload data serialization handler. |
void |
store(ContextEvent context)
Stores a context event object persistently. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.sag.osami.contextstore.storage.ISerializedContextStorage |
---|
load, load, loadLazy, query, queryLazy, retrieveLastID, store |
Methods inherited from interface com.sag.osami.api.context.IContextStorage |
---|
delete, delete, delete |
Field Detail |
---|
protected ISerializationHandler serializer
Constructor Detail |
---|
public SerializedContextStorage()
Method Detail |
---|
public void setSerializer(ISerializationHandler serializer)
ISerializedContextStorage
setSerializer
in interface ISerializedContextStorage
serializer
- payload data serialization handlerpublic void store(ContextEvent context)
IContextStorage
store
in interface IContextStorage
context
- context event object to be stored.public ContextEvent load(java.lang.Long contextId)
IContextStorage
load
in interface IContextStorage
contextId
- ID of the context event
public ContextEvent[] load(java.util.List<java.lang.Long> contextIds)
IContextStorage
load
in interface IContextStorage
contextIds
- IDs of the context events.
public java.lang.Iterable<ContextEvent> loadLazy(java.util.List<java.lang.Long> contextIds) throws java.lang.UnsupportedOperationException
IContextStorage
IContextStorage.load(List)
, i.e. it loads one ContextEvent at a time during iteration. This operation is optional.
loadLazy
in interface IContextStorage
contextIds
- IDs of the context events.
java.lang.UnsupportedOperationException
- if the underlying storage implementation does not support lazy queryingIContextStorage.load(List)
public ContextEvent[] query(java.lang.String query, java.lang.Object... params)
IContextStorage
query
in interface IContextStorage
query
- Its language/format depends on the actual storage management class.params
- Should be used for parameter binding à la JDBC:
query("SELECT * FROM contextstore WHERE type = ? AND timestamp >= ?", "someType", someDate.getTime());
public java.lang.Iterable<ContextEvent> queryLazy(java.lang.String query, java.lang.Object... params) throws java.lang.UnsupportedOperationException
IContextStorage
IContextStorage.query(String, Object...)
, i.e. it loads one ContextEvent at a time during iteration. This operation is optional.
queryLazy
in interface IContextStorage
query
- The context event query.params
- Parameters for the query.
java.lang.UnsupportedOperationException
- if the underlying storage implementation does not support lazy queryingIContextStorage.query(String, Object...)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |