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
  • Constructor Details

  • Method Details

    • 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 - deployment file error
      Since:
      7.0
      See Also:
    • 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 - error adding deploy file
      Since:
      7.0
      See Also:
    • 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 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 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 - error getting properties
    • 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 - error getting properties
    • 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 - error setting properties
    • 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 - error restarting operators
    • 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 - error resuming operators
    • resume

      public void resume(String containerName) throws StreamBaseException
      Resume a container in a StreamBase server
      Parameters:
      containerName - the name of the container
      Throws:
      StreamBaseException - error resuming container
    • 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 - error shutting down operators
    • 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 - error killing connections
    • killConnection

      public String[] killConnection(byte[] connectionId) throws StreamBaseException
      Kill the connection with the given connectionId
      Parameters:
      connectionId - connection identifier
      Returns:
      status of kill command
      Throws:
      StreamBaseException - error killing connection
    • 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