com.sag.osami.api.context
Interface IContextQuery

All Known Subinterfaces:
IContextStore, ISerializedContextReceiver
All Known Implementing Classes:
ContextStore

public interface IContextQuery

This interface allows querying context events from the ContextStore database. The query syntax depends on the actual storage implementation of the ContextStore. Up to now two implementations are shipped: a JDBC-based and an Android/SQLite-based. Hence, queries are to be supplied in SQL (refer to official documentation of the used database).

For details regarding the table structure etc., see the actual storage implementation class (e.g. JDBCStorage or AndroidStorage).

OSGi notice: In OSGi environments, the ContextStore is registered as a service for this interface.


Method Summary
 ContextEvent[] query(java.lang.String query, java.lang.Object... params)
          This method allows you to perform a query on the ContextStore database to get contexts with the specified properties
 java.lang.Iterable<ContextEvent> queryLazy(java.lang.String query, java.lang.Object... params)
          Lazy variant of query(String, Object...), i.e. it loads one ContextEvent at a time during iteration.
 

Method Detail

query

ContextEvent[] query(java.lang.String query,
                     java.lang.Object... params)
This method allows you to perform a query on the ContextStore database to get contexts with the specified properties

Parameters:
query - the query to be executed
params - parameters which may occur in the query (e.g., using the ? syntax) and are bound accordingly (so escaping, quoting etc. is unnecessary)
Returns:
an array of IContextEvent[]s (which is empty if no contexts were found)

queryLazy

java.lang.Iterable<ContextEvent> queryLazy(java.lang.String query,
                                           java.lang.Object... params)
                                           throws java.lang.UnsupportedOperationException
Lazy variant of query(String, Object...), i.e. it loads one ContextEvent at a time during iteration. This operation is optional.

Throws:
java.lang.UnsupportedOperationException - if the underlying storage implementation does not support lazy querying
See Also:
query(String, Object...)