public class StreamBaseAdminClient
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
StreamBaseAdminClient.ListConnectionArgument
Valid arguments for the listConnection command
|
Constructor and Description |
---|
StreamBaseAdminClient()
Create a StreamBaseAdminClient.
|
StreamBaseAdminClient(java.util.List<StreamBaseURI> uris)
Create a StreamBaseAdminClient.
|
StreamBaseAdminClient(java.util.List<StreamBaseURI> uris,
ClientSettings settings)
Create a StreamBaseAdminClient.
|
StreamBaseAdminClient(StreamBaseURI uri)
Create a StreamBaseAdminClient, connecting to the server at the provided URI.
|
StreamBaseAdminClient(java.lang.String uri)
Create a StreamBaseAdminClient.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String[] |
addContainer(java.lang.String containerName,
byte[] application,
java.util.List<java.lang.String> options)
Add the given application to the given container in the StreamBase server
|
java.lang.String[] |
addContainer(java.lang.String containerName,
java.io.File application,
java.util.List<java.lang.String> options)
Add the given application to the given container in the StreamBase server
|
java.lang.String[] |
addContainer(java.lang.String containerName,
java.lang.String applicationText,
java.util.List<java.lang.String> options)
Add the given application to the given container in the StreamBase server
|
java.lang.String[] |
addDeploy(byte[] deployText,
java.lang.String... args)
Add the given deployment file to the server given the byte content of the file.
|
java.lang.String[] |
addDeploy(java.io.File deployFile,
java.lang.String... options)
Adds applications and containers defined in the given deployment or archive file to the StreamBase server.
|
java.lang.String[] |
addDeploy(java.lang.String deployText,
java.lang.String... args)
Add the given deployment file to the server given the text of the file
|
java.lang.String |
clearEvalCache(java.lang.String containerName) |
void |
close()
Close/shutdown the connection to the StreamBase server.
|
void |
drain()
Drain a StreamBase Server
Has no effect if the server is not running
|
void |
drain(java.lang.String containerName)
Drain a container within a StreamBase Server
Has no effect if the server is not running
|
void |
fastForwardTime(java.lang.String msecs) |
java.lang.String |
getEvalCacheContent(java.lang.String containerName) |
Constants.LeadershipStatus |
getLeadershipStatus()
Get the leadership status of the server.
|
java.lang.String |
getMapperCacheContent(java.lang.String containerName) |
java.lang.String[] |
getOperatorProperties(java.lang.String operatorName)
For the given Operator, return its set of properties and their values.
|
java.lang.String |
getOperatorProperty(java.lang.String operatorName,
java.lang.String propertyName)
Return the value of the given property on the given Operator.
|
ClientSettings |
getSettings()
Return the settings for this client
|
java.lang.String |
getTargetTime() |
StreamBaseURI |
getURI()
Return the URI used by this Client.
|
java.util.List<StreamBaseURI> |
getURIs()
get all of the URI's for this client
|
protected boolean |
haModeOn()
is HA mode on
|
java.lang.String[] |
killAllConnections()
Kill all of the connections on the server
|
java.lang.String[] |
killConnection(byte[] connectionId)
Kill the connection with the given connectionId
|
java.lang.String[] |
listConnections(StreamBaseAdminClient.ListConnectionArgument... args)
Return an array of client connections
|
java.lang.String[] |
listEntities(java.lang.String entityType,
int flags)
Return an array of entity names for the given entity type
|
java.lang.String[] |
manageJdbcConnections(java.util.List<java.lang.String> args)
Manage JDBC connections:
count [name]Count the open JDBC connections to the named data source (or all data sources if ommitted)
close [name]Close any open JDBC connections to the named data source (or all data sources if ommitted)
|
java.lang.String[] |
modifyContainer(java.lang.String containerName,
java.util.List<java.lang.String> options)
Modifies the given container.
|
java.lang.String[] |
operatorStatus(java.lang.String containerName)
Return the status of all the operators in the specified container
|
java.lang.String[] |
removeContainer(java.lang.String containerName,
java.lang.String... args)
Remove the given container in the StreamBase server
|
java.lang.String[] |
restartContainer(java.lang.String containerName) |
void |
restartOperators(java.util.List<java.lang.String> operatorNames)
Restart the given Operators on the StreamBase server.
|
void |
resume(java.lang.String containerName)
Resume a container in a StreamBase server
|
void |
resumeOperators(java.util.List<java.lang.String> operatorNames)
Resume the given Operators on the StreamBase server
|
void |
setLeadershipStatus(Constants.LeadershipStatus leadershipStatus)
Set the leadership status of the server.
|
void |
setOperatorProperty(java.lang.String operatorName,
java.lang.String propertyName,
java.lang.String value)
On the given Operator, set the given property to the given value.
|
void |
setRuntimeParam(java.lang.String paramName,
java.lang.String paramValue,
java.lang.String operator)
Set a runtime parameter on one, or all, operators.
|
java.lang.String |
shutdown()
Shutdown a StreamBase server
|
java.lang.String |
shutdown(java.lang.String containerName)
Shutdown a container within a StreamBase server
|
void |
shutdownOperators(java.util.List<java.lang.String> operatorNames)
Shut down the given Operators on the StreamBase server.
|
java.lang.String[] |
status()
Return the status of the StreamBase Server
|
java.lang.String[] |
status(boolean verbose)
Return the status of the StreamBase Server
|
void |
suspend(java.lang.String name)
Suspend (pause) a container or operator within a StreamBase Server
|
void |
suspendOperators(java.util.List<java.lang.String> operatorNames)
Suspend (pause) the given Operators on the StreamBase Server
|
public StreamBaseAdminClient() throws StreamBaseException
StreamBaseURI.DEFAULT_URI
if this property is undefined.StreamBaseException
- on connect error, malformed URI, etc.StreamBaseURI
public StreamBaseAdminClient(StreamBaseURI uri) throws StreamBaseException
StreamBaseException
- on connect errorStreamBaseURI
public StreamBaseAdminClient(java.lang.String uri) throws StreamBaseException
uri
- The uri to use of the form: sb://address:port. See StreamBaseURI
StreamBaseException
- on connect error, malformed URI, etc.StreamBaseURI
public StreamBaseAdminClient(java.util.List<StreamBaseURI> uris) throws StreamBaseException
uris
- a list of StreamBaseURIs. Note: The StreamBaseAdminClient only supports one URI in the list.StreamBaseException
- on connect error, malformed URI, etc.StreamBaseURI
public StreamBaseAdminClient(java.util.List<StreamBaseURI> uris, ClientSettings settings) throws StreamBaseException
uris
- a list of StreamBaseURIs. Note: The StreamBaseAdminClient only supports one URI in the list.settings
- client settingsStreamBaseException
- on connect error, malformed URI, etc.StreamBaseURI
public void close()
close
in interface java.lang.AutoCloseable
public java.lang.String[] addDeploy(java.lang.String deployText, java.lang.String... args) throws StreamBaseException
deployText
- String contents of a deployment configuration file (.sbdeploy
file)args
- a list of options for the command. Valid options include:
sbadmin
command and the documentation for additional detailsStreamBaseException
StreamBaseAdminClient.addDeploy(File, String...)
public java.lang.String[] addDeploy(byte[] deployText, java.lang.String... args) throws StreamBaseException
deployText
- byte contents of a file that specifies a deployment configuration: a .sbdeploy
(StreamBase Deployment)
file or a .sbar
(StreamBase Archive) file. If it is a StreamBase Archive file, the file must have been created by running sbargen
on an .sbdeploy
file.args
- a list of options for the command. Valid options include:
sbadmin
command and the documentation for additional detailsStreamBaseException
StreamBaseAdminClient.addDeploy(File, String...)
public java.lang.String[] addDeploy(java.io.File deployFile, java.lang.String... options) throws StreamBaseException
deployFile
- File that specifies a deployment configuration: a .sbdeploy
(StreamBase Deployment)
file or a .sbar
(StreamBase Archive) file. If it is a StreamBase Archive file, the file must have been created by running sbargen
on an .sbdeploy
file.options
- a list of options for the added command. Valid options include:
sbadmin
command and the documentation for additional detailsStreamBaseException
- if the deployment file is invalid, any of the containers that would be added is invalid,
or there is a name collision that prevents a container from being added.public java.lang.String[] addContainer(java.lang.String containerName, java.lang.String applicationText, java.util.List<java.lang.String> options) throws StreamBaseException
containerName
- the container name to add the application underapplicationText
- contents of an application: xml from an EventFlow application, or StreamSQL text. The character set is assumed UTF-8.options
- List of options for the added container. See StreamBaseAdminClient.addContainer(String, byte[], List)
for details.StreamBaseException
- thrown on typecheck and other errorspublic java.lang.String[] addContainer(java.lang.String containerName, byte[] application, java.util.List<java.lang.String> options) throws StreamBaseException
containerName
- the container name to add the application underapplication
- contents of an application: binary content from a .sbar
file, xml from an EventFlow application, or StreamSQL text. The character set is assumed UTF-8.options
- a list of options for the added container. Valid options include:
sbadmin
command and the documentation for additional details on container options.StreamBaseException
- thrown on typecheck and other errorspublic java.lang.String[] addContainer(java.lang.String containerName, java.io.File application, java.util.List<java.lang.String> options) throws StreamBaseException
containerName
- the container name to add the application underapplication
- File that specifies an application: a .sbar
file, an EventFlow application, or a StreamSQL application text.options
- List of options for the added container. See StreamBaseAdminClient.addContainer(String, byte[], List)
for detailsStreamBaseException
- thrown on typecheck and other errorspublic java.lang.String[] getOperatorProperties(java.lang.String operatorName) throws StreamBaseException
operatorName
- The operator whose properties are retrieved.StreamBaseException
public java.lang.String getOperatorProperty(java.lang.String operatorName, java.lang.String propertyName) throws StreamBaseException
operatorName
- The operator whose property value is retrieved.propertyName
- The property whose value is retrieved.StreamBaseException
public void setOperatorProperty(java.lang.String operatorName, java.lang.String propertyName, java.lang.String value) throws StreamBaseException
operatorName
- The operator whose property value is set.propertyName
- The property whose value is set.value
- The value set.StreamBaseException
public java.lang.String[] removeContainer(java.lang.String containerName, java.lang.String... args) throws StreamBaseException
containerName
- the containerNameargs
- a list of options for the command. Valid options include:
sbadmin
command and the documentation for additional detailsStreamBaseException
- thrown on errorpublic void restartOperators(java.util.List<java.lang.String> operatorNames) throws StreamBaseException
StreamBaseException
public java.lang.String[] restartContainer(java.lang.String containerName) throws StreamBaseException
StreamBaseException
public void fastForwardTime(java.lang.String msecs) throws StreamBaseException
StreamBaseException
public java.lang.String getTargetTime() throws StreamBaseException
StreamBaseException
public java.lang.String getEvalCacheContent(java.lang.String containerName) throws StreamBaseException
StreamBaseException
public java.lang.String clearEvalCache(java.lang.String containerName) throws StreamBaseException
StreamBaseException
public java.lang.String getMapperCacheContent(java.lang.String containerName) throws StreamBaseException
StreamBaseException
public void resumeOperators(java.util.List<java.lang.String> operatorNames) throws StreamBaseException
StreamBaseException
public void resume(java.lang.String containerName) throws StreamBaseException
containerName
- the name of the containerStreamBaseException
public java.lang.String shutdown() throws StreamBaseException
StreamBaseException
- thrown on network or other errorspublic java.lang.String shutdown(java.lang.String containerName) throws StreamBaseException
containerName
- the name of the containerStreamBaseException
- thrown on network or other errorspublic void shutdownOperators(java.util.List<java.lang.String> operatorNames) throws StreamBaseException
StreamBaseException
public void suspendOperators(java.util.List<java.lang.String> operatorNames) throws StreamBaseException
StreamBaseException
- thrown on network or other errorspublic void suspend(java.lang.String name) throws StreamBaseException
name
- the name of the container or operatorStreamBaseException
- thrown on network or other errorspublic void drain() throws StreamBaseException
StreamBaseException
- thrown on network or other errorspublic void drain(java.lang.String containerName) throws StreamBaseException
containerName
- the name of the containerStreamBaseException
- thrown on network or other errorspublic java.lang.String[] listConnections(StreamBaseAdminClient.ListConnectionArgument... args) throws StreamBaseException
args
- arguments for the commandStreamBaseException
- thrown on network or other errorspublic java.lang.String[] listEntities(java.lang.String entityType, int flags) throws StreamBaseException
entityType
- the entity type to do the lookupflags
- FULLY_QUALIFIED_NAMES and INCLUDE_MODULES flagsStreamBaseException
- thrown on network or other errorspublic java.lang.String[] killAllConnections() throws StreamBaseException
StreamBaseException
public java.lang.String[] killConnection(byte[] connectionId) throws StreamBaseException
connectionId
- StreamBaseException
public java.lang.String[] manageJdbcConnections(java.util.List<java.lang.String> args) throws StreamBaseException
args
- a list that must contain at least one command string (close
or count
),
and may contain an optional second argument string (the name of a data source). When no argument string is given,
the command will apply to all data sources.close
, one string containing the number of connections closed.
for count
, one string containing the number of open connectionsStreamBaseException
- throw on network or other errorspublic void setRuntimeParam(java.lang.String paramName, java.lang.String paramValue, java.lang.String operator) throws StreamBaseException
paramName
- the runtime parameter name to modifyparamValue
- the new valueoperator
- the target operator to notify for this parameter change, or null to notify all operatorsStreamBaseException
- thrown on network or other errorspublic java.lang.String[] modifyContainer(java.lang.String containerName, java.util.List<java.lang.String> options) throws StreamBaseException
containerName
- the container name to modifyoptions
- a modify command String as the first entry, and any arguments required by that command as subsequent String entries. Valid modify commands and arguments are:
true
or false
.sbadmin
command and the documentation for additional details on container options.StreamBaseException
- thrown on errorspublic Constants.LeadershipStatus getLeadershipStatus() throws StreamBaseException
StreamBaseException
public void setLeadershipStatus(Constants.LeadershipStatus leadershipStatus) throws StreamBaseException
leadershipStatus
- StreamBaseException
protected boolean haModeOn()
public ClientSettings getSettings()
public java.lang.String[] status() throws StreamBaseException
StreamBaseException
- thrown on network and other errorspublic java.lang.String[] status(boolean verbose) throws StreamBaseException
verbose
- return a verbose statusStreamBaseException
- thrown on network and other errorspublic java.lang.String[] operatorStatus(java.lang.String containerName) throws StreamBaseException
containerName
- the name of the containerStreamBaseException
public StreamBaseURI getURI()
public java.util.List<StreamBaseURI> getURIs()