public interface QueryListener
The query listener is called by the Query
to notify the listener of
internal changes in the query. In most cases the creator of the query is
interested in receiving the query results.
The updateState(QueryState)
method may be called at any time by the
query and is only for informational purposes. The query can switch the status
without request from the client back to QueryState.LOADING
for
example although the client did not request a change in parameters. The query
should however update the status only if necessary and use the state
QueryState.LOADING
as an indicator that data is being fetched from
the archive and that values still need to be updated. It should use
QueryState.COMPLETE
as an indicator that all data was fetched from
the archive. Data may still be updated in state QueryState.COMPLETE
.
The the query is closed (and only then) the query must set the status to
QueryState.DISCONNECTED
.
Before any data is transmitted the method
updateParameters(QueryParameters, Set)
must be called including the
actual parameters (although they might be the same as the requested
parameters) and including all provided value types. Further calls to
#updateData(int, Map, ValueInformation[])
must contain exactly these
value types. After updateParameters(QueryParameters, Set)
was called
all previously known data is considered invalid.
Calls to #updateData(int, Map, ValueInformation[])
will provide new
values. The call allows to split up data in packets. Queries should try to
provide data as early as possible but still should group data in chunks to
reduce update calls. The values must contain exactly the value types as
announces by the previous call to
updateParameters(QueryParameters, Set)
. All arrays sizes must have
the same length for each call and must not exceed the announces entry size.
There must be no calls the listener after the query was closed and the final
state change to QueryState.DISCONNECTED
was send.
Query
Modifier and Type | Method and Description |
---|---|
void |
updateData(int index,
Map<String,List<Double>> values,
List<ValueInformation> valueInformation)
Reports data update
|
void |
updateParameters(QueryParameters parameters,
Set<String> valueTypes)
Reports a change in parameters
|
void |
updateState(QueryState state)
Updates the state of the query
|
void updateState(QueryState state)
state
- the new statevoid updateParameters(QueryParameters parameters, Set<String> valueTypes)
parameters
- the new parameters, must not be null
valueTypes
- the new value types to expect, must not be null
or emptyvoid updateData(int index, Map<String,List<Double>> values, List<ValueInformation> valueInformation)
All arrays must have the same size.
index
- index from which the data update starts, must be greater or
equal to zero
and lower than the reported number of entriesvalues
- the values that are updates, must not be null
valueInformation
- the value information for the provided values. must not be
null