|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ISerializedContextStorage
This interface is used by ContextStore
for all storage-related logic. Any actual ContextStore storage back-end has to implement this interface.
The methods are basically the same as in IContextStorage
, but include (de)serialization flags. Payload serialization obviously plays a role in
storage-related program logic. On the other hand, serialization details should not be exposed to the regular ContextStore user (i.e. should not be part of
the public API).
However, it wouldn't suffice to encapsulate and hide serialization completely within the storage back-end by simply using IContextStorage as the internal interface (which does not expose any serialization flags etc.) in the ContextStore: in internal ContextStore logic, on different occasions it is necessary/convenient to obtain IContextEvents with either already deserialized or still serialized payload data; similarly, on different occasions it is necessary/convenient to store IContextEvents with either already serialized or still deserialized payload data.
Hence, a storage back-end has to account for the two possible forms of payload data and handle it accordingly. For this, it must have access to the
ISerializationHandler
, which is granted by setSerializer(ISerializationHandler)
.
As the ContextStore is responsible for assigning unique IDs to context events, it must be able to retrieve the last given ID during its initialization -- this capability also is to be provided by the storage back-end.
SerializedContextStorage
Method Summary | |
---|---|
ContextEvent[] |
load(boolean deserialize,
java.util.List<java.lang.Long> contextIds)
Loads several context events with the given IDs. |
ContextEvent |
load(boolean deserialize,
java.lang.Long contextId)
Loads a context event with the given ID. |
java.lang.Iterable<ContextEvent> |
loadLazy(boolean deserialize,
java.util.List<java.lang.Long> contextIds)
Lazy variant of load(boolean, List) , i.e. it loads one ContextEvent at a time during iteration. |
ContextEvent[] |
query(boolean deserialize,
java.lang.String query,
java.lang.Object... params)
Queries several context events. |
java.lang.Iterable<ContextEvent> |
queryLazy(boolean deserialize,
java.lang.String query,
java.lang.Object... params)
Lazy variant of query(boolean, String, Object...) , i.e. it loads one ContextEvent at a time during iteration. |
java.lang.Long |
retrieveLastID()
ContextStore uses the result of this method as the offset for its auto-incremented context event IDs. |
void |
setSerializer(ISerializationHandler serializer)
Grants access to the payload data serialization handler. |
void |
store(boolean serialize,
ContextEvent context)
Stores a context event object persistently. |
Methods inherited from interface com.sag.osami.api.context.IContextStorage |
---|
delete, delete, delete, load, load, loadLazy, query, queryLazy, store |
Method Detail |
---|
ContextEvent load(boolean deserialize, java.lang.Long contextId)
deserialize
- whether the payload data should remain serialized or should be deserializedcontextId
- ID of the context event
ContextEvent[] load(boolean deserialize, java.util.List<java.lang.Long> contextIds)
deserialize
- whether the payload data should remain serialized or should be deserializedcontextIds
- IDs of the context events
java.lang.Iterable<ContextEvent> loadLazy(boolean deserialize, java.util.List<java.lang.Long> contextIds) throws java.lang.UnsupportedOperationException
load(boolean, List)
, i.e. it loads one ContextEvent at a time during iteration. This operation is optional.
java.lang.UnsupportedOperationException
- if the underlying storage implementation does not support lazy queryingload(boolean, List)
ContextEvent[] query(boolean deserialize, java.lang.String query, java.lang.Object... params)
deserialize
- whether the payload data should remain serialized or should be deserializedquery
- 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());
java.lang.Iterable<ContextEvent> queryLazy(boolean deserialize, java.lang.String query, java.lang.Object... params) throws java.lang.UnsupportedOperationException
query(boolean, String, Object...)
, i.e. it loads one ContextEvent at a time during iteration. This operation is optional.
java.lang.UnsupportedOperationException
- if the underlying storage implementation does not support lazy queryingquery(boolean, String, Object...)
void store(boolean serialize, ContextEvent context)
serialize
- whether the payload data should be serialized or not (because it is already serialized)context
- context event object to be storedvoid setSerializer(ISerializationHandler serializer)
serializer
- payload data serialization handlerjava.lang.Long retrieveLastID()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |