com.streambase.sb.client

## Class StreamBaseAdminClient

- java.lang.Object
- - com.streambase.sb.client.BaseClient
  - - com.streambase.sb.client.StreamBaseAdminClient

- All Implemented Interfaces:
    AutoCloseable

      public class StreamBaseAdminClient
      extends BaseClient

  This class is used to send administrative commands to the StreamBase Server

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `StreamBaseAdminClient.ListConnectionArgument` Valid arguments for the listConnection command

  - ### Constructor Summary

    Constructors
    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.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    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)` Deprecated. Replaced with application fragments and HOCON configuration
    `String[]` | `addDeploy(File deployFile, String... options)` Deprecated. Replaced with application fragments and HOCON configuration
    `String[]` | `addDeploy(String deployText, String... args)` Deprecated. Replaced with application fragments and HOCON configuration
    `String` | `clearEvalCache(String containerName)` Clear evaluation cache
    `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)` Fast forward time
    `String` | `getEvalCacheContent(String containerName)` Get evaluation cache content
    `Constants.LeadershipStatus` | `getLeadershipStatus()` Deprecated. Legacy high-availability service, migrate to SB 10 high-availability service.
    `String` | `getMapperCacheContent(String containerName)` Get mapper cache contents
    `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.
    `String` | `getTargetTime()` Get target time
    `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[]` | `removeContainer(String containerName, String... args)` Remove the given container in the StreamBase server
    `String[]` | `restartContainer(String containerName)` Restart a container
    `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)` Deprecated. Legacy high-availability service, migrate to SB 10 high-availability service.
    `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.
    `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

    - ### Methods inherited from class com.streambase.sb.client.BaseClient

      `getSettings, getURI, getURIs, haModeOn, operatorStatus, status, status`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### StreamBaseAdminClient

          public StreamBaseAdminClient()
                                throws StreamBaseException

      Create a StreamBaseAdminClient. Uses the value of the "streambase.uri" property as the URI, or `StreamBaseURI.DEFAULT_URI` if this property is undefined.
      Throws:
        `StreamBaseException` - on connect error, malformed URI, etc.
      See Also:
        `StreamBaseURI`

    - #### StreamBaseAdminClient

          public StreamBaseAdminClient(StreamBaseURI uri)
                                throws StreamBaseException

      Create a StreamBaseAdminClient, connecting to the server at the provided URI.
      Parameters:
        `uri` - server address
      Throws:
        `StreamBaseException` - on connect error
      See Also:
        `StreamBaseURI`

    - #### StreamBaseAdminClient

          public StreamBaseAdminClient(String uri)
                                throws StreamBaseException

      Create a StreamBaseAdminClient.
      Parameters:
        `uri` - The uri to use of the form: sb://address:port. See `StreamBaseURI`
      Throws:
        `StreamBaseException` - on connect error, malformed URI, etc.
      See Also:
        `StreamBaseURI`

    - #### StreamBaseAdminClient

          public StreamBaseAdminClient(List<StreamBaseURI> uris)
                                throws StreamBaseException

      Create a StreamBaseAdminClient.
      Parameters:
        `uris` - a list of StreamBaseURIs. Note: The StreamBaseAdminClient only supports one URI in the list.
      Throws:
        `StreamBaseException` - on connect error, malformed URI, etc.
      See Also:
        `StreamBaseURI`

    - #### StreamBaseAdminClient

          public StreamBaseAdminClient(List<StreamBaseURI> uris,
                                       ClientSettings settings)
                                throws StreamBaseException

      Create a StreamBaseAdminClient.
      Parameters:
        `uris` - a list of StreamBaseURIs. Note: The StreamBaseAdminClient only supports one URI in the list.
        `settings` - client settings
      Throws:
        `StreamBaseException` - on connect error, malformed URI, etc.
      Since:
        7.1
      See Also:
        `StreamBaseURI`

  - ### Method Detail

    - #### close

          public void close()

      Close/shutdown the connection to the StreamBase server.
      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in class `BaseClient`

    - #### addDeploy

          @Deprecated
          public String[] addDeploy(String deployText,
                                                 String... args)
                                          throws StreamBaseException

      Deprecated. Replaced with application fragments and HOCON configuration
      Add the given deployment file to the server given the text of the file
      Parameters:
        `deployText` - String contents of a deployment configuration file (`.sbdeploy` file)
        `args` - a list of options for the command. Valid options include:
        [--verbose]
          returns a string indicating a succesful operation
        Refer to the `sbadmin` command and the documentation for additional details
      Returns:
        array of informational results from the server or empty array if no results
      Throws:
        `StreamBaseException`
      Since:
        7.0
      See Also:
        `StreamBaseAdminClient.addDeploy(File, String...)`

    - #### addDeploy

          @Deprecated
          public String[] addDeploy(byte[] deployText,
                                                 String... args)
                                          throws StreamBaseException

      Deprecated. Replaced with application fragments and HOCON configuration
      Add the given deployment file to the server given the byte content of the file.
      Parameters:
        `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:
        [--verbose]
          returns a string indicating a succesful operation
        Refer to the `sbadmin` command and the documentation for additional details
      Returns:
        array of informational results from the server or empty array if no results
      Throws:
        `StreamBaseException`
      Since:
        7.0
      See Also:
        `StreamBaseAdminClient.addDeploy(File, String...)`

    - #### addDeploy

          @Deprecated
          public String[] addDeploy(File deployFile,
                                                 String... options)
                                          throws StreamBaseException

      Deprecated. Replaced with application fragments and HOCON configuration
      Adds applications and containers defined in the given deployment or archive file to the StreamBase server.
      Parameters:
        `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:
        [--verbose]
          returns a string indicating a succesful operation
        Refer to the `sbadmin` command and the documentation for additional details
      Returns:
        array of informational results from the server or empty array if no results
      Throws:
        `StreamBaseException` - 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.
      Since:
        7.0

    - #### addContainer

          public String[] addContainer(String containerName,
                                       String applicationText,
                                       List<String> options)
                                throws StreamBaseException

      Add the given application to the given container in the StreamBase server
      Parameters:
        `containerName` - the container name to add the application under
        `applicationText` - 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.
      Returns:
        array of informational results from the server or empty array if no results
      Throws:
        `StreamBaseException` - thrown on typecheck and other errors
      Since:
        6.4 --parameter

    - #### addContainer

          public String[] addContainer(String containerName,
                                       byte[] application,
                                       List<String> options)
                                throws StreamBaseException

      Add the given application to the given container in the StreamBase server
      Parameters:
        `containerName` - the container name to add the application under
        `application` - 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:
        newContainer.newStream=oldContainer.oldStream
          sets up a cross-container connection. You may specify more than one of this option.
        --parameter=paramName=paramValue
          sets a module parameter (or overrides a default value) for this container's top level application. You may specify more than one of this option.
        --suspend
          sets the container to the suspended state when added
        --enqueue=STREAMSTATUS, --dequeue=STREAMSTATUS
          sets the enqueue or dequeue status for this container. STREAMSTATUS is one of ENABLED, DISABLED, DROP_TUPLES. You may specify each option at most once.
        --moduleSearch=DIR
          adds a directory for the server to locate modules in while adding this container. You may specify more than one of this option.
        --datadir=DIR
          sets the data directory for this container. You may specify this option only once.
        --traceStreamPattern=pattern, --traceFileBase=basefilename, --traceCompress, --traceOverwrite
          sets options for runtime tracing for this container. Please see the documentation for details on how to enable and configure runtime tracing
        [--verbose]
          returns a string indicating a successsful operation
        Refer to the `sbadmin` command and the documentation for additional details on container options.
      Returns:
        array of informational results from the server or empty array if no results
      Throws:
        `StreamBaseException` - thrown on typecheck and other errors
      Since:
        6.4 added additional tracing options, and the ability to set module parameters for the top-level container application

    - #### addContainer

          public String[] addContainer(String containerName,
                                       File application,
                                       List<String> options)
                                throws StreamBaseException

      Add the given application to the given container in the StreamBase server
      Parameters:
        `containerName` - the container name to add the application under
        `application` - 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 details
      Returns:
        array of informational results from the server or empty array if no results
      Throws:
        `StreamBaseException` - thrown on typecheck and other errors
      Since:
        6.2

    - #### getOperatorProperties

          public String[] getOperatorProperties(String operatorName)
                                         throws StreamBaseException

      For the given Operator, return its set of properties and their values.
      Parameters:
        `operatorName` - The operator whose properties are retrieved.
      Returns:
        array of results or empty array if no results
      Throws:
        `StreamBaseException`

    - #### getOperatorProperty

          public String getOperatorProperty(String operatorName,
                                            String propertyName)
                                     throws StreamBaseException

      Return the value of the given property on the given Operator.
      Parameters:
        `operatorName` - The operator whose property value is retrieved.
        `propertyName` - The property whose value is retrieved.
      Returns:
        the value of the operator property
      Throws:
        `StreamBaseException`

    - #### setOperatorProperty

          public void setOperatorProperty(String operatorName,
                                          String propertyName,
                                          String value)
                                   throws StreamBaseException

      On the given Operator, set the given property to the given value.
      Parameters:
        `operatorName` - The operator whose property value is set.
        `propertyName` - The property whose value is set.
        `value` - The value set.
      Throws:
        `StreamBaseException`

    - #### removeContainer

          public String[] removeContainer(String containerName,
                                          String... args)
                                   throws StreamBaseException

      Remove the given container in the StreamBase server
      Parameters:
        `containerName` - the containerName
        `args` - a list of options for the command. Valid options include:
        [--verbose]
          returns a string indicating a succesful operation
        Refer to the `sbadmin` command and the documentation for additional details
      Returns:
        array of informational results from the server or empty array if no results
      Throws:
        `StreamBaseException` - thrown on error

    - #### restartOperators

          public void restartOperators(List<String> operatorNames)
                                throws StreamBaseException

      Restart the given Operators on the StreamBase server. The Operators must currently be shut down.
      Parameters:
        `operatorNames` - names of operators to restart
      Throws:
        `StreamBaseException`

    - #### restartContainer

          public String[] restartContainer(String containerName)
                                    throws StreamBaseException

      Restart a container
      Parameters:
        `containerName` - Container name
      Returns:
        Results if any
      Throws:
        `StreamBaseException` - Error restarting container

    - #### fastForwardTime

          public void fastForwardTime(String msecs)
                               throws StreamBaseException

      Fast forward time
      Parameters:
        `msecs` - Forward by this number of milliseconds
      Throws:
        `StreamBaseException` - Error fast forwarding time

    - #### getTargetTime

          public String getTargetTime()
                               throws StreamBaseException

      Get target time
      Returns:
        Target time value
      Throws:
        `StreamBaseException` - Error getting target time

    - #### getEvalCacheContent

          public String getEvalCacheContent(String containerName)
                                     throws StreamBaseException

      Get evaluation cache content
      Parameters:
        `containerName` - Container name
      Returns:
        Cache contents
      Throws:
        `StreamBaseException` - Error accessing evaluation cache

    - #### clearEvalCache

          public String clearEvalCache(String containerName)
                                throws StreamBaseException

      Clear evaluation cache
      Parameters:
        `containerName` - Container name
      Returns:
        Results if any
      Throws:
        `StreamBaseException` - Error clearing evaluation cache

    - #### getMapperCacheContent

          public String getMapperCacheContent(String containerName)
                                       throws StreamBaseException

      Get mapper cache contents
      Parameters:
        `containerName` - Container name
      Returns:
        Cache contents
      Throws:
        `StreamBaseException` - Error accessing cache

    - #### resumeOperators

          public void resumeOperators(List<String> operatorNames)
                               throws StreamBaseException

      Resume the given Operators on the StreamBase server
      Parameters:
        `operatorNames` - names of operators to resume
      Throws:
        `StreamBaseException`

    - #### resume

          public void resume(String containerName)
                      throws StreamBaseException

      Resume a container in a StreamBase server
      Parameters:
        `containerName` - the name of the container
      Throws:
        `StreamBaseException`

    - #### shutdown

          public String shutdown()
                          throws StreamBaseException

      Shutdown a StreamBase server
      Returns:
        a message describing the outcome
      Throws:
        `StreamBaseException` - thrown on network or other errors

    - #### shutdown

          public String shutdown(String containerName)
                          throws StreamBaseException

      Shutdown a container within a StreamBase server
      Parameters:
        `containerName` - the name of the container
      Returns:
        a message describing the outcome
      Throws:
        `StreamBaseException` - thrown on network or other errors

    - #### shutdownOperators

          public void shutdownOperators(List<String> operatorNames)
                                 throws StreamBaseException

      Shut down the given Operators on the StreamBase server.
      Parameters:
        `operatorNames` - name of operators to shut down
      Throws:
        `StreamBaseException`

    - #### suspendOperators

          public void suspendOperators(List<String> operatorNames)
                                throws StreamBaseException

      Suspend (pause) the given Operators on the StreamBase Server
      Parameters:
        `operatorNames` - names of operators to suspend
      Throws:
        `StreamBaseException` - thrown on network or other errors

    - #### suspend

          public void suspend(String name)
                       throws StreamBaseException

      Suspend (pause) a container or operator within a StreamBase Server
      Parameters:
        `name` - the name of the container or operator
      Throws:
        `StreamBaseException` - thrown on network or other errors

    - #### drain

          public void drain()
                     throws StreamBaseException

      Drain a StreamBase Server Has no effect if the server is not running
      Throws:
        `StreamBaseException` - thrown on network or other errors

    - #### drain

          public void drain(String containerName)
                     throws StreamBaseException

      Drain a container within a StreamBase Server Has no effect if the server is not running
      Parameters:
        `containerName` - the name of the container
      Throws:
        `StreamBaseException` - thrown on network or other errors

    - #### listConnections

          public String[] listConnections(StreamBaseAdminClient.ListConnectionArgument... args)
                                   throws StreamBaseException

      Return an array of client connections
      Parameters:
        `args` - arguments for the command
      Returns:
        an array of client connections
      Throws:
        `StreamBaseException` - thrown on network or other errors

    - #### listEntities

          public String[] listEntities(String entityType,
                                       int flags)
                                throws StreamBaseException

      Return an array of entity names for the given entity type
      Parameters:
        `entityType` - the entity type to do the lookup
        `flags` - FULLY_QUALIFIED_NAMES and INCLUDE_MODULES flags
      Returns:
        an array of entity names for the given entity type
      Throws:
        `StreamBaseException` - thrown on network or other errors

    - #### killAllConnections

          public String[] killAllConnections()
                                      throws StreamBaseException

      Kill all of the connections on the server
      Returns:
        status of kill command
      Throws:
        `StreamBaseException`

    - #### killConnection

          public String[] killConnection(byte[] connectionId)
                                  throws StreamBaseException

      Kill the connection with the given connectionId
      Parameters:
        `connectionId` -
      Returns:
        status of kill command
      Throws:
        `StreamBaseException`

    - #### manageJdbcConnections

          public String[] manageJdbcConnections(List<String> args)
                                         throws StreamBaseException

      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)
      Parameters:
        `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.
      Returns:
        for `close`, one string containing the number of connections closed. for `count`, one string containing the number of open connections
      Throws:
        `StreamBaseException` - throw on network or other errors
      Since:
        7.2

    - #### setRuntimeParam

          public void setRuntimeParam(String paramName,
                                      String paramValue,
                                      String operator)
                               throws StreamBaseException

      Set a runtime parameter on one, or all, operators. If the operator name is null, the parameter is changed on all operators.
      Parameters:
        `paramName` - the runtime parameter name to modify
        `paramValue` - the new value
        `operator` - the target operator to notify for this parameter change, or null to notify all operators
      Throws:
        `StreamBaseException` - thrown on network or other errors

    - #### modifyContainer

          public String[] modifyContainer(String containerName,
                                          List<String> options)
                                   throws StreamBaseException

      Modifies the given container. Only one command may be issued per method invocation.
      Parameters:
        `containerName` - the container name to modify
        `options` - 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:
        [addConnection|removeConnection] destinationContainer.destinationStream=sourceContainer.sourceStream
          adds or removes an asynchronous container connection specified by this command's argument
        [addConnection|removeConnection] destinationContainer.destinationStream:=sourceContainer.sourceStream
          adds or removes a synchronous container connection specified by this command's argument
        [--enqueue=STREAMSTATUS|--dequeue=STREAMSTATUS]
          sets the enqueue or dequeue status for this container. STREAMSTATUS is one of ENABLED, DISABLED, DROP_TUPLES. You may only specify one option per invocation of this method.
        trace [--traceStreamPattern=pattern] [--traceFileBase=baseFilename] [--traceOverwrite] [--traceCompress] [true|false]
          Enables runtime tracing using the provided tracing options, or disable tracing for this container. The last argument must be one of `true` or `false`.
        --traceFileBase=basefilename
          Changes the trace filename prefix
        [--traceOverwrite|--traceCompress] [true|false]
          Enables or disables overwriting and compressing of trace files
        [--verbose]
          reports a successful modifyContainer call
        Refer to the `sbadmin` command and the documentation for additional details on container options.
      Returns:
        array of informational results from the server or empty array if no results
      Throws:
        `StreamBaseException` - thrown on errors
      Since:
        6.4 added tracing options

    - #### getLeadershipStatus

          @Deprecated
          public Constants.LeadershipStatus getLeadershipStatus()
                                                                      throws StreamBaseException

      Deprecated. Legacy high-availability service, migrate to SB 10 high-availability service.
      Get the leadership status of the server.

      This method is no longer supported since the StreamBase 10 platform release. Please consult the documentation.

      Returns:
        the server's leadership status
      Throws:
        `StreamBaseException`

    - #### setLeadershipStatus

          @Deprecated
          public void setLeadershipStatus(Constants.LeadershipStatus leadershipStatus)
                                                throws StreamBaseException

      Deprecated. Legacy high-availability service, migrate to SB 10 high-availability service.
      Set the leadership status of the server.

      This method is no longer supported since the StreamBase 10 platform release. Please consult the documentation.

      Parameters:
        `leadershipStatus` -
      Throws:
        `StreamBaseException`

Copyright © 2015–2018 Cloud Software Group, Inc.. All rights reserved.