Package com.streambase.liveview.client
Class QueryListenerWrapper
java.lang.Object
com.streambase.liveview.client.QueryListenerWrapper
- All Implemented Interfaces:
Query,QueryListener,Closeable,AutoCloseable,EventListener
This class is used by LiveViewMultiConnectionImpl to wrap BOTH the queryListener that the
user passes in to an execQuery, AND the Query that is passed back to him.
We need the former so that we can intercept the close command that comes from the
server going down -- we don't actually close the query, we just save it so that it can be
failed over to a new server.
We need to wrap the Query so that we can intercept with the client calls close on his own.
In that case, we want to actually close the query, plus we want to remove this query from
our list of ones that need to be reconnected to any new server.
-
Constructor Summary
ConstructorsConstructorDescriptionQueryListenerWrapper(com.streambase.liveview.client.internal.ws.LiveViewMultiConnectionImpl liveViewMultiConnectionImpl, QueryConfig config, QueryListener qListener) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the client and server resources associated with this Query.voiddeleteBegin(BeginDeleteEvent event) Event to indicate the start of delete query.voiddeleteEnd(EndDeleteEvent event) Event to indicate the delete query is complete.voidEvent when an exception occurs during the query.Returns a QueryConfig object that contains fully parsed pieces like table, predicate, groupByExprs, etc. as well as the query string.Returns a list describing the fields of the tuples that will be returned by this Query.Returns a list of fields describing the primary key for this table.shortThis will match the queryId on the events.Getter for theSchemafor the query.booleanisOpen()If this is false, either you've already gotten a QueryClosed event or you're about to get one.voidqueryClosed(QueryClosedEvent event) Event when a query being listened to is closed.voidsetRealQuery(Query realQuery) voidSetter for theSchemafor the query.voidsnapshotBegin(BeginSnapshotEvent event) Event to indicate the start of the result snapshot.voidsnapshotEnd(EndSnapshotEvent event) Event to indicate the query snapshot is complete.voidtupleAdded(TupleAddedEvent event) Event when a new tuple is added to the result.voidtupleRemoved(TupleRemovedEvent event) Event when an existing tuple is removed from the result.voidtupleUpdated(TupleUpdatedEvent event) Event when an existing tuple in the result is updated.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.streambase.liveview.client.QueryListener
aggMarkBegin, aggMarkEnd
-
Constructor Details
-
QueryListenerWrapper
public QueryListenerWrapper(com.streambase.liveview.client.internal.ws.LiveViewMultiConnectionImpl liveViewMultiConnectionImpl, QueryConfig config, QueryListener qListener) - Parameters:
liveViewMultiConnectionImpl-config-qListener-
-
-
Method Details
-
getConfig
Description copied from interface:QueryReturns a QueryConfig object that contains fully parsed pieces like table, predicate, groupByExprs, etc. as well as the query string. -
tupleAdded
Description copied from interface:QueryListenerEvent when a new tuple is added to the result.- Specified by:
tupleAddedin interfaceQueryListener- Parameters:
event- add event
-
tupleUpdated
Description copied from interface:QueryListenerEvent when an existing tuple in the result is updated.- Specified by:
tupleUpdatedin interfaceQueryListener- Parameters:
event- update event
-
tupleRemoved
Description copied from interface:QueryListenerEvent when an existing tuple is removed from the result.- Specified by:
tupleRemovedin interfaceQueryListener- Parameters:
event- remove event
-
snapshotBegin
Description copied from interface:QueryListenerEvent to indicate the start of the result snapshot. This is the first method called when a query starts returning results, but this method is also called to indicate a reset (a complete restart of the query.)- Specified by:
snapshotBeginin interfaceQueryListener- Parameters:
event- snapshot begin
-
snapshotEnd
Description copied from interface:QueryListenerEvent to indicate the query snapshot is complete.- Specified by:
snapshotEndin interfaceQueryListener- Parameters:
event- snapshot end
-
deleteBegin
Description copied from interface:QueryListenerEvent to indicate the start of delete query.- Specified by:
deleteBeginin interfaceQueryListener- Parameters:
event- delete begin
-
deleteEnd
Description copied from interface:QueryListenerEvent to indicate the delete query is complete.- Specified by:
deleteEndin interfaceQueryListener- Parameters:
event- delete end
-
exceptionRaised
Description copied from interface:QueryListenerEvent when an exception occurs during the query. Since 1.3, reaching the row limit is considered an exception.- Specified by:
exceptionRaisedin interfaceQueryListener- Parameters:
event- exception event
-
queryClosed
Description copied from interface:QueryListenerEvent when a query being listened to is closed.- Specified by:
queryClosedin interfaceQueryListener- Parameters:
event- query closed event
-
getFields
Description copied from interface:QueryReturns a list describing the fields of the tuples that will be returned by this Query. An empty list may be returned if the result fields are unknown. -
getKeyFields
Description copied from interface:QueryReturns a list of fields describing the primary key for this table. These fields will come from the same schema as getFields, which come from the schema used to create tuples when they arrive, so they will be suitable for calling getXxx against the tuple.- Specified by:
getKeyFieldsin interfaceQuery- Returns:
- The fields describing the key of the tuples returned, or null if the key is simply a Long that is not part of the data record.
-
close
public void close()Description copied from interface:QueryCloses the client and server resources associated with this Query. This call may block while it connects to the server to unregister the query. -
isOpen
-
getQueryId
public short getQueryId()Description copied from interface:QueryThis will match the queryId on the events.- Specified by:
getQueryIdin interfaceQuery- Returns:
- the query ID for the query.
-
getRealQuery
-
setRealQuery
- Parameters:
realQuery- the realQuery to set
-
getSchema
-
setSchema
-