public interface LiveViewConnection extends Closeable
Modifier and Type | Interface and Description |
---|---|
static class |
LiveViewConnection.TableProviderAPIHelper
Deprecated.
Use
TableAdminManager.TableProviderAPIHelper , instead |
Modifier and Type | Field and Description |
---|---|
static String |
CQS_INTERNAL_ID |
Modifier and Type | Method and Description |
---|---|
void |
addTableProvider(String id,
com.streambase.liveview.internal.protocol.jaxb.ExternalConnectionTypeType externalConnectionType,
String javaClassName,
com.streambase.liveview.internal.protocol.jaxb.ExternalServerConnectionType.Parameters parameters,
com.streambase.liveview.internal.protocol.jaxb.ExternalServerConnectionType.Mappings mappings,
int maxFailAttempts,
int waitSeconds)
Deprecated.
Use
TableAdminManager , instead
Connect to a TableProvider, which then allows for remote connections as if they were LiveView Tables. |
boolean |
checkPermission(LiveViewPermission permission)
Checks whether the authenticated user has the specified permission.
|
List<Boolean> |
checkPermissions(List<LiveViewPermission> permissions)
Checks whether the authenticated user has the specified permissions.
|
void |
close()
Closes all queries and open resources with the server.
|
void |
deleteRows(QueryConfig config)
Delete rows based on the supplied
QueryConfig . |
Query |
describeQuery(QueryConfig config)
Get information about a query, such as its result schema, without actually running it
|
SnapshotResult |
executeSnapshotQuery(QueryConfig config)
This method makes it easy to run a snapshot-only query where the results come back
in an object that can be iterated over to retrieve the snapshot tuples.
|
AlertManager |
getAlertManager() |
<T extends LiveViewServerCapability> |
getCapability(Class<T> typeOfCapability)
Returns the object that represents a capability of the connected server,
or throws NoSuchCapabilityException if the type of capability is not
supported by the server.
|
ClientController |
getClientController()
A ClientController is used to perform actions to control clients.
|
String |
getConnectionURI()
Retrieves the URI that was used to connect to the server
|
SendTupleInfo |
getSendTupleInfo(StreamBaseURI sbUri,
String targetInputStreamName,
String responseOutputStreamName)
Gets the schemas associated with streams, for the purposes of using SendTupleAction.
|
ServerUtilityDataProvider |
getServerUtilityDataProvider() |
Table |
getTable(String name)
Retrieve a specific table from the server
|
TableAdminManager |
getTableAdminManager()
Get the TableAdminManager, which provides an API to administer tables in the server.
|
<T extends LiveViewServerCapability> |
hasCapability(Class<T> typeOfCapability)
Returns true if the connected server supports the given type of capability.
|
boolean |
isConnected()
A polling method to check if the connection with the server is still valid.
|
List<Table> |
listTables()
Lists the available tables for querying
|
List<Table> |
listTables(boolean includeSystemTables)
List the available tables for querying
|
Query |
registerQuery(QueryConfig config,
QueryListener listener)
Registers a new query on the server based on the
QueryConfig and sends query events
to the specified QueryListener . |
void |
registerTableListListener(TableListListener listener,
boolean includeSnapshot)
If you want to be informed of changes to the Table List, then register a Listener with this
method.
|
void |
removeTableProvider(String id)
Deprecated.
Use
TableAdminManager , instead |
Tuple |
sendTupleAction(StreamBaseURI sbUri,
String targetInputStreamName,
Tuple tuple,
String responseOutputStreamName,
Schema expectedResponseSchema,
long timeout,
TimeUnit unit)
Sends a tuple to an existing StreamBase application.
|
static final String CQS_INTERNAL_ID
List<Table> listTables() throws LiveViewException
LiveViewException
- if table list cannot be retrievedList<Table> listTables(boolean includeSystemTables) throws LiveViewException
includeSystemTables
- - if true, system tables are included in the listLiveViewException
- if table list cannot be retrievedvoid registerTableListListener(TableListListener listener, boolean includeSnapshot) throws LiveViewException
listener
- includeSnapshot
- if true, your listener will get current snapshot data (plus changes); if false, only changes.LiveViewException
Table getTable(String name) throws LiveViewException
name
- name of the table to retrieveLiveViewException
- if the table does not exists or another server side error occurs.void close()
close
in interface AutoCloseable
close
in interface Closeable
boolean isConnected()
<T extends LiveViewServerCapability> boolean hasCapability(Class<T> typeOfCapability)
typeOfCapability
- Class that represents a capability<T extends LiveViewServerCapability> T getCapability(Class<T> typeOfCapability) throws NoSuchCapabilityException, LiveViewException
typeOfCapability
- Class that represents a capabilityNoSuchCapabilityException
- if the type of capability is not supported by the serverLiveViewException
- if the LiveViewConnection is not currently connected.Query registerQuery(QueryConfig config, QueryListener listener)
QueryConfig
and sends query events
to the specified QueryListener
.
Depending on the query configuration the server will return snapshot only data
or snapshot followed by continuous updates.config
- the configuration of the querylistener
- specifies the listener that will receive the query eventsQuery describeQuery(QueryConfig config) throws LiveViewException
config
- the configuration of queryQuery
with information about the given configuration. The query is already closed; callers
do not need to call Query.close()
on the return value.LiveViewException
- if there is a problem with the query configuration or another server exception occursvoid deleteRows(QueryConfig config) throws LiveViewException
QueryConfig
.
The issuer of this delete does not know how many rows were removed,
or when the delete completes. Only a subset of the QueryConfig
options are valid for deleteRows, you may set:
deleteRows is effectively a snapshot query where the results of the
query is the data to be deleted.config
- the configuration of the queryLiveViewException
- if there is a problem with the query configuration or another server exception occursSnapshotResult executeSnapshotQuery(QueryConfig config) throws LiveViewException
LiveViewQueryType
setting in QueryConfig will be ignored because this method is always
LiveViewQueryType.SNAPSHOT
This method returns as soon as the query is successfully regiestered, but before the data has arrived.
However, the SnapshotResult that is returned will block appropriately in its next and hasNext methods,
so you can immediately start using it as if it were an iterator.config
- the configuration of the queryLiveViewException
- if there is a problem with the query configuration or another server exception occursString getConnectionURI()
TableAdminManager getTableAdminManager() throws LiveViewException
LiveViewException
void addTableProvider(String id, com.streambase.liveview.internal.protocol.jaxb.ExternalConnectionTypeType externalConnectionType, String javaClassName, com.streambase.liveview.internal.protocol.jaxb.ExternalServerConnectionType.Parameters parameters, com.streambase.liveview.internal.protocol.jaxb.ExternalServerConnectionType.Mappings mappings, int maxFailAttempts, int waitSeconds) throws LiveViewException
TableAdminManager
, instead
Connect to a TableProvider, which then allows for remote connections as if they were LiveView Tables.id
- must be unique on the LiveView server.externalConnectionType
- one of CEP_QUERY_TABLES, LIVE_VIEW, CUSTOM_TABLE_PROVIDER ExternalConnectionTypeType
javaClassName
- The className of a class which implements com.streambase.liveview.server.table.TableProvider. Only used if type is CUSTOM_TABLE_PROVIDER.parameters
- key-value pairs that are specific to your TableGenerator. Use utility function TableProviderAPIHelper#addMapping(Mappings, String, String)
to create and extend.mappings
- Table name selector and mapping definitions. Use utility function TableProviderAPIHelper#addParameter(Parameters, String, String)
to create and extend.maxFailAttempts
- Maximum failures before giving up. Anything < 1 for infinite attemptswaitSeconds
- Time to wait after a failure before trying. Anything < 1 becomes the default of 120 seconds.LiveViewException
LiveViewConnection.TableProviderAPIHelper
void removeTableProvider(String id) throws LiveViewException
TableAdminManager
, insteadLiveViewException
ClientController getClientController() throws LiveViewException
ClientController
LiveViewException
AlertManager getAlertManager() throws LiveViewException
LiveViewException
ServerUtilityDataProvider getServerUtilityDataProvider()
SendTupleInfo getSendTupleInfo(StreamBaseURI sbUri, String targetInputStreamName, String responseOutputStreamName) throws LiveViewException
sbUri
- (Optional) URI of the StreamBase server. The LV server's current SB server will be used if null.targetInputStreamName
- The pathname of the input stream to which to send the tupleresponseOutputStreamName
- (Optional) pathname of OutputStream to listen for a responseLiveViewException
Tuple sendTupleAction(StreamBaseURI sbUri, String targetInputStreamName, Tuple tuple, String responseOutputStreamName, Schema expectedResponseSchema, long timeout, TimeUnit unit) throws LiveViewException
sbUri
- (Optional) URI of the StreamBase server. The LV server's current SB server will be used if null.targetInputStreamName
- The pathname of the input stream to which to send the tupletuple
- The tuple to sendresponseOutputStreamName
- (Optional) pathname of OutputStream to listen for a responseexpectedResponseSchema
- (Optional) The schema that the response is expected to have, likely retrieved via getSendTupleInfotimeout
- Maximum time to wait for response. Valid range is 50 - 120000 MILLISECONDSunit
- (Optional) units for the timeout. If null, TimeUnit.MILLISECONDS
will be assumed.LiveViewException
List<Boolean> checkPermissions(List<LiveViewPermission> permissions) throws LiveViewException
permissions
- a list of permissions to check forLiveViewException
boolean checkPermission(LiveViewPermission permission) throws LiveViewException
permission
- a single permission to check forLiveViewException