public class StreamBaseAdminClient extends 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(List<StreamBaseURI> uris)
Create a StreamBaseAdminClient.
|
StreamBaseAdminClient(List<StreamBaseURI> uris,
ClientSettings settings)
Create a StreamBaseAdminClient.
|
StreamBaseAdminClient(StreamBaseURI uri)
Create a StreamBaseAdminClient, connecting to the server at the provided URI.
|
StreamBaseAdminClient(String uri)
Create a StreamBaseAdminClient.
|
Modifier and Type | Method and Description |
---|---|
String[] |
addContainer(String containerName,
byte[] application,
List<String> options)
Add the given application to the given container in the StreamBase server
|
String[] |
addContainer(String containerName,
File application,
List<String> options)
Add the given application to the given container in the StreamBase server
|
String[] |
addContainer(String containerName,
String applicationText,
List<String> options)
Add the given application to the given container in the StreamBase server
|
String[] |
addDeploy(byte[] deployText,
String... args)
Add the given deployment file to the server given the byte content of the file.
|
String[] |
addDeploy(File deployFile,
String... options)
Adds applications and containers defined in the given deployment or archive file to the StreamBase server.
|
String[] |
addDeploy(String deployText,
String... args)
Add the given deployment file to the server given the text of the file
|
String |
clearEvalCache(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(String containerName)
Drain a container within a StreamBase Server
Has no effect if the server is not running
|
void |
fastForwardTime(String msecs) |
String |
getEvalCacheContent(String containerName) |
Constants.LeadershipStatus |
getLeadershipStatus()
Get the leadership status of the server.
|
String |
getMapperCacheContent(String containerName) |
String[] |
getOperatorProperties(String operatorName)
For the given Operator, return its set of properties and their values.
|
String |
getOperatorProperty(String operatorName,
String propertyName)
Return the value of the given property on the given Operator.
|
ClientSettings |
getSettings()
Return the settings for this client
|
String |
getTargetTime() |
StreamBaseURI |
getURI()
Return the URI used by this Client.
|
List<StreamBaseURI> |
getURIs()
get all of the URI's for this client
|
protected boolean |
haModeOn()
is HA mode on
|
String[] |
killAllConnections()
Kill all of the connections on the server
|
String[] |
killConnection(byte[] connectionId)
Kill the connection with the given connectionId
|
String[] |
listConnections(StreamBaseAdminClient.ListConnectionArgument... args)
Return an array of client connections
|
String[] |
listEntities(String entityType,
int flags)
Return an array of entity names for the given entity type
|
String[] |
manageJdbcConnections(List<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)
|
String[] |
modifyContainer(String containerName,
List<String> options)
Modifies the given container.
|
String[] |
operatorStatus(String containerName)
Return the status of all the operators in the specified container
|
String[] |
removeContainer(String containerName,
String... args)
Remove the given container in the StreamBase server
|
String[] |
restartContainer(String containerName) |
void |
restartOperators(List<String> operatorNames)
Restart the given Operators on the StreamBase server.
|
void |
resume(String containerName)
Resume a container in a StreamBase server
|
void |
resumeOperators(List<String> operatorNames)
Resume the given Operators on the StreamBase server
|
void |
setLeadershipStatus(Constants.LeadershipStatus leadershipStatus)
Set the leadership status of the server.
|
void |
setOperatorProperty(String operatorName,
String propertyName,
String value)
On the given Operator, set the given property to the given value.
|
void |
setRuntimeParam(String paramName,
String paramValue,
String operator)
Set a runtime parameter on one, or all, operators.
|
String |
shutdown()
Shutdown a StreamBase server
|
String |
shutdown(String containerName)
Shutdown a container within a StreamBase server
|
void |
shutdownOperators(List<String> operatorNames)
Shut down the given Operators on the StreamBase server.
|
String[] |
status()
Return the status of the StreamBase Server
|
String[] |
status(boolean verbose)
Return the status of the StreamBase Server
|
void |
suspend(String name)
Suspend (pause) a container or operator within a StreamBase Server
|
void |
suspendOperators(List<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(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(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(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 AutoCloseable
public String[] addDeploy(String deployText, 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 String[] addDeploy(byte[] deployText, 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 String[] addDeploy(File deployFile, 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 String[] addContainer(String containerName, String applicationText, List<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 String[] addContainer(String containerName, byte[] application, List<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 String[] addContainer(String containerName, File application, List<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 String[] getOperatorProperties(String operatorName) throws StreamBaseException
operatorName
- The operator whose properties are retrieved.StreamBaseException
public String getOperatorProperty(String operatorName, String propertyName) throws StreamBaseException
operatorName
- The operator whose property value is retrieved.propertyName
- The property whose value is retrieved.StreamBaseException
public void setOperatorProperty(String operatorName, String propertyName, 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 String[] removeContainer(String containerName, 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(List<String> operatorNames) throws StreamBaseException
StreamBaseException
public String[] restartContainer(String containerName) throws StreamBaseException
StreamBaseException
public void fastForwardTime(String msecs) throws StreamBaseException
StreamBaseException
public String getTargetTime() throws StreamBaseException
StreamBaseException
public String getEvalCacheContent(String containerName) throws StreamBaseException
StreamBaseException
public String clearEvalCache(String containerName) throws StreamBaseException
StreamBaseException
public String getMapperCacheContent(String containerName) throws StreamBaseException
StreamBaseException
public void resumeOperators(List<String> operatorNames) throws StreamBaseException
StreamBaseException
public void resume(String containerName) throws StreamBaseException
containerName
- the name of the containerStreamBaseException
public String shutdown() throws StreamBaseException
StreamBaseException
- thrown on network or other errorspublic String shutdown(String containerName) throws StreamBaseException
containerName
- the name of the containerStreamBaseException
- thrown on network or other errorspublic void shutdownOperators(List<String> operatorNames) throws StreamBaseException
StreamBaseException
public void suspendOperators(List<String> operatorNames) throws StreamBaseException
StreamBaseException
- thrown on network or other errorspublic void suspend(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(String containerName) throws StreamBaseException
containerName
- the name of the containerStreamBaseException
- thrown on network or other errorspublic String[] listConnections(StreamBaseAdminClient.ListConnectionArgument... args) throws StreamBaseException
args
- arguments for the commandStreamBaseException
- thrown on network or other errorspublic String[] listEntities(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 String[] killAllConnections() throws StreamBaseException
StreamBaseException
public String[] killConnection(byte[] connectionId) throws StreamBaseException
connectionId
- StreamBaseException
public String[] manageJdbcConnections(List<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(String paramName, String paramValue, 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 String[] modifyContainer(String containerName, List<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 String[] status() throws StreamBaseException
StreamBaseException
- thrown on network and other errorspublic String[] status(boolean verbose) throws StreamBaseException
verbose
- return a verbose statusStreamBaseException
- thrown on network and other errorspublic String[] operatorStatus(String containerName) throws StreamBaseException
containerName
- the name of the containerStreamBaseException
public StreamBaseURI getURI()
public List<StreamBaseURI> getURIs()