Class HAAdmin

java.lang.Object
com.streambase.sb.client.HAAdmin
All Implemented Interfaces:
Admin

class HAAdmin extends Object implements Admin
Interface describes the admin commands that pass from the client to the stream base server.

Currently, the lowest implementation layer uses XMLRPC for the protocol.

  • Constructor Details

  • Method Details

    • isHA

      public boolean isHA()
      Description copied from interface: Admin
      Are we in HA mode
      Specified by:
      isHA in interface Admin
      Returns:
      return if in HA mode
    • getByteOrder

      public ByteOrder getByteOrder(long timeoutMS) throws StreamBaseException
      Description copied from interface: Admin
      What is the byte order of the server?
      Specified by:
      getByteOrder in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      Returns:
      byte order of the server
      Throws:
      StreamBaseException
    • modifyApplication

      public void modifyApplication(long timeoutMS, byte[] application) throws StreamBaseException
      Modify the StreamBase Server with the given StreamBase application.
      Parameters:
      timeoutMS - timeout in milliseconds
      application - the application
      Throws:
      StreamBaseException - thrown on typecheck and other errors
    • typecheck

      public StreamProperties[] typecheck(long timeoutMS, String application, boolean full) throws StreamBaseException
      Description copied from interface: Admin
      Typecheck (validate) the given StreamBase Application. Return a list of StreamProperties for that Application
      Specified by:
      typecheck in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      application - contents of an application. Text sbapp or ssql.
      full - do a full typecheck
      Returns:
      array of StreamProperties for the StreamBase application
      Throws:
      StreamBaseException - on network or typecheck error
    • shutdown

      public String shutdown(long timeoutMS, String containerName) throws StreamBaseException
      Description copied from interface: Admin
      Shutdown a StreamBase container or if empty the whole server
      Specified by:
      shutdown in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      containerName - optional containerName
      Returns:
      message describing the shutdown outcome
      Throws:
      StreamBaseException - thrown on network or other errors
    • shutdownOperators

      public void shutdownOperators(long timeoutMS, List<String> operatorNames) throws StreamBaseException
      Description copied from interface: Admin
      Shut down the given Operators on the StreamBase server.
      Specified by:
      shutdownOperators in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      operatorNames - The Operators to shut down
      Throws:
      StreamBaseException - throws on network or other errors
    • restartOperators

      public void restartOperators(long timeoutMS, List<String> operatorNames) throws StreamBaseException
      Description copied from interface: Admin
      Restart the given Operators on the StreamBase server. The Operators must currently be shut down.
      Specified by:
      restartOperators in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      operatorNames - The Operators to shut down
      Throws:
      StreamBaseException - throws on network or other errors
    • suspendOperators

      public void suspendOperators(long timeoutMS, List<String> operatorNames) throws StreamBaseException
      Description copied from interface: Admin
      Suspend the given Operators on the StreamBase Server
      Specified by:
      suspendOperators in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      operatorNames - the operators to suspend
      Throws:
      StreamBaseException - thrown on network or other errors
    • suspend

      public void suspend(long timeoutMS, String name) throws StreamBaseException
      Suspend (pause) a StreamBase container or operator
      Specified by:
      suspend in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      name - container or operator name
      Throws:
      StreamBaseException - thrown on network or other errors
    • resumeOperators

      public void resumeOperators(long timeoutMS, List<String> operatorsNames) throws StreamBaseException
      Description copied from interface: Admin
      Resume the given Operators on the StreamBase server
      Specified by:
      resumeOperators in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      operatorsNames - the operators to suspend
      Throws:
      StreamBaseException
    • resume

      public void resume(long timeoutMS, String containerName) throws StreamBaseException
      Description copied from interface: Admin
      Resume a paused StreamBase container of if empty the whole Server
      Specified by:
      resume in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      containerName - optional containerName
      Throws:
      StreamBaseException
    • describe

      public String describe(long timeoutMS, String entityName) throws StreamBaseException
      Description copied from interface: Admin
      Return an XML description of a StreamBase entity
      Specified by:
      describe in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      entityName - the name of the entity to describe
      Returns:
      an XML description of a StreamBase entity
      Throws:
      StreamBaseException - thrown on network or other errors
    • checkLicense

      public boolean checkLicense(long timeoutMS, String featureName) throws StreamBaseException
      Description copied from interface: Admin
      Return true if a license for the specified feature is available and false otherwise.
      Specified by:
      checkLicense in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      featureName - the name of the licensed feature
      Returns:
      true if a license for the specified feature is available and false otherwise
      Throws:
      StreamBaseException - thrown on network or other errors
    • getStreamProperties

      public StreamProperties getStreamProperties(long timeoutMS, String streamName, CaptureTransformStrategy strategy) throws StreamBaseException
      Description copied from interface: Admin
      Return the StreamProperties for the given name.
      Specified by:
      getStreamProperties in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      streamName - the stream name to lookup
      strategy - the CaptureTransformStrategy to use if the target stream has capture fields.
      Returns:
      The StreamProperties object for the given name
      Throws:
      StreamBaseException - thrown on network or other errors
    • getStreamProperties

      public StreamProperties getStreamProperties(long timeoutMS, String streamName) throws StreamBaseException
      Description copied from interface: Admin
      Return the StreamProperties for the given name. Uses CaptureTransformStrategy.FLATTEN
      Specified by:
      getStreamProperties in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      streamName - the stream name to lookup
      Returns:
      The StreamProperties object for the given name
      Throws:
      StreamBaseException - thrown on network or other errors
    • getStreamPropertiesByHash

      public StreamProperties getStreamPropertiesByHash(long timeoutMS, byte[] hash) throws StreamBaseException
      Description copied from interface: Admin
      Return the StreamProperties for the given hash
      Specified by:
      getStreamPropertiesByHash in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      hash - The Hash to lookup
      Returns:
      The StreamProperties object for the given name
      Throws:
      StreamBaseException - thrown on network or other errors
    • listEntities

      public String[] listEntities(long timeoutMS, String entityType, int flags, CaptureTransformStrategy strategy) throws StreamBaseException
      Description copied from interface: Admin
      Return an array of entity names for the given entity type
      Specified by:
      listEntities in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      entityType - the entity type to do the lookup
      flags - FULLY_QUALIFIED_NAMES and INCLUDE_MODULES flags
      strategy - the capture transform strategy
      Returns:
      an array of entity names for the given entity type
      Throws:
      StreamBaseException - thrown on network or other errors
    • getSchemaByHash

      public Schema getSchemaByHash(long timeoutMS, byte[] hash) throws StreamBaseException
      Description copied from interface: Admin
      Return the Schema object for the given hash value
      Specified by:
      getSchemaByHash in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      hash - a byte array that contains a hash value
      Returns:
      The Schema object associated with the given hash value
      Throws:
      StreamBaseException - thrown on network or other errors
    • getSchemaByName

      public Schema getSchemaByName(long timeoutMS, String schemaName) throws StreamBaseException
      Description copied from interface: Admin
      Return the Schema object for the given name
      Specified by:
      getSchemaByName in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      schemaName - the name of the Schema to lookup
      Returns:
      the Schema for the given name
      Throws:
      StreamBaseException - thrown on network or other errors
    • drain

      public void drain(long timeoutMS, String containerName) throws StreamBaseException
      Description copied from interface: Admin
      Drain a StreamBase container or if empty the entire Server
      Specified by:
      drain in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      containerName - optional containerName
      Throws:
      StreamBaseException - thrown on network or other errors
    • getOperatorProperties

      public String[] getOperatorProperties(long timeoutMS, String operatorName) throws StreamBaseException
      Description copied from interface: Admin
      For the given Operator, return its set of properties and their values.
      Specified by:
      getOperatorProperties in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      operatorName - The operator whose properties are retrieved.
      Returns:
      set of operator properties and values
      Throws:
      StreamBaseException
    • getOperatorProperty

      public String getOperatorProperty(long timeoutMS, String operatorName, String propertyName) throws StreamBaseException
      Description copied from interface: Admin
      Return the value of the given property on the given Operator.
      Specified by:
      getOperatorProperty in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      operatorName - The operator whose property value is retrieved.
      propertyName - The property whose value is retrieved.
      Returns:
      set of operator properties and values
      Throws:
      StreamBaseException
    • setOperatorProperty

      public void setOperatorProperty(long timeoutMS, String operatorName, String propertyName, String value) throws StreamBaseException
      Description copied from interface: Admin
      On the given Operator, set the given property to the given value.
      Specified by:
      setOperatorProperty in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      operatorName - The operator whose property value is set.
      propertyName - The property whose value is set.
      value - The value set.
      Throws:
      StreamBaseException
    • operatorStatus

      public String[] operatorStatus(long timeoutMS, String containerName) throws StreamBaseException
      Description copied from interface: Admin
      Return the status of each Operator present in the StreamBase server.
      Specified by:
      operatorStatus in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      containerName - name of the container
      Returns:
      An array of Strings, each String hold the status of an Operator present in the server.
      Throws:
      StreamBaseException
    • status

      public String[] status(long timeoutMS, boolean verbose) throws StreamBaseException
      Description copied from interface: Admin
      Return the status of the StreamBase Server
      Specified by:
      status in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      verbose - return a verbose status
      Returns:
      the status
      Throws:
      StreamBaseException - thrown on network and other errors
    • subscribe

      public SubscriptionEntry subscribe(long timeoutMS, SubscriptionEntry subscription, List<TupleConnections.StreamTupleConnection> connections) throws StreamBaseException
      Description copied from interface: Admin
      Subscribe to an output stream.
      Specified by:
      subscribe in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      subscription - a SubscriptionEntry describing the desired subscription. Contains the StreamProperties of the desired stream, an optional predicate, and an optional logical stream to associate with the predicate.
      connections - the list of tupleconnections on which to subscribe to
      Returns:
      a subscription entry
      Throws:
      StreamBaseException - server errors, or network errors.
    • unsubscribe

      public void unsubscribe(long timeoutMS, StreamProperties props, String logicalstream, List<TupleConnections.StreamTupleConnection> connections) throws StreamBaseException
      Description copied from interface: Admin
      UnSubscribe to an output stream.
      Specified by:
      unsubscribe in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      props - the stream
      logicalstream - name of the logical stream
      connections - the list of tupleconnections on which to subscribe to
      Throws:
      StreamBaseException - server errors, or network errors.
    • listConnections

      public String[] listConnections(long timeoutMS, StreamBaseAdminClient.ListConnectionArgument... args) throws StreamBaseException
      Description copied from interface: Admin
      Return an array of client connections
      Specified by:
      listConnections in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      args - arguments for the command
      Returns:
      an array of client connections
      Throws:
      StreamBaseException - thrown on network or other errors
    • internalCommand

      public String[] internalCommand(long timeoutMS, String... args) throws StreamBaseException
      Description copied from interface: Admin
      run an internal command
      Specified by:
      internalCommand in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      args - the arguments for the command
      Returns:
      the results of the command
      Throws:
      StreamBaseException - thrown on network or other errors
    • enqueue

      public void enqueue(long timeoutMS, StreamProperties props, Collection<String> tuples) throws StreamBaseException
      Description copied from interface: Admin
      Enqueue a list of CSV encoded tuples using connectionless XMLRPC
      Specified by:
      enqueue in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      props - StreamProperties for stream
      tuples - list of tuples
      Throws:
      StreamBaseException
    • setRuntimeParam

      public void setRuntimeParam(long timeoutMS, String paramName, String paramValue, String operator) throws StreamBaseException
      Description copied from interface: Admin
      set the given runtime param
      Specified by:
      setRuntimeParam in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      paramName - the name of the param
      paramValue - the value of the command
      operator - the operator for the param
      Throws:
      StreamBaseException
    • addContainer

      public String[] addContainer(long timeoutMS, String containerName, byte[] application, List<String> containerStreamMappings) throws StreamBaseException
      Description copied from interface: Admin
      Add the given application to the given container in the StreamBaseServer
      Specified by:
      addContainer in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      containerName - the containerName
      application - contents of an application. Text sbapp, ssql or binary contents of a jar file
      containerStreamMappings - stream mappings between containers. Each member of the list should contain a mapping. For example: newContainer.newStream=oldContainer.oldStream
      Returns:
      results if any
      Throws:
      StreamBaseException - thrown on typecheck and other errors
    • addDeploy

      public String[] addDeploy(long timeoutMS, byte[] deploy, List<String> args) throws StreamBaseException
      Description copied from interface: Admin
      Add the given deploy file to the server. This will add all containers and all container connections defined in the deploy file. At that point, they are treated as any other container or container connection, and may be manipulated by modifyContainer and removeContainer. The given bytes may either be UTF-8 XML that conforms to the deploy file xsd, or a StreamBase Archive that was produced by running the sbargen command on an XML deploy file.
      Specified by:
      addDeploy in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      deploy - contents of deploy file. XML text or binary contents of an sbar file made from a deploy file.
      args - command arguments
      Returns:
      results if any
      Throws:
      StreamBaseException - thrown on typecheck and other errors
    • restartContainer

      public String[] restartContainer(long timeoutMS, String containerName) throws StreamBaseException
      Description copied from interface: Admin
      Restart the given container
      Specified by:
      restartContainer in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      containerName - the name of the container to restart
      Returns:
      results if any
      Throws:
      StreamBaseException
    • removeContainer

      public String[] removeContainer(long timeoutMS, String containerName, List<String> args) throws StreamBaseException
      Description copied from interface: Admin
      Remove the given container in the StreamBaseServer
      Specified by:
      removeContainer in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      containerName - the containerName
      args - command arguments
      Returns:
      results if any
      Throws:
      StreamBaseException - thrown on typecheck and other errors
    • modifyContainer

      public String[] modifyContainer(long timeoutMS, String containerName, List<String> args) throws StreamBaseException
      Description copied from interface: Admin
      Modify the given container
      Specified by:
      modifyContainer in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      args - list of arguments
      Returns:
      results if any
      Throws:
      StreamBaseException
    • killConnection

      public String[] killConnection(long timeoutMS, byte[] connectionId) throws StreamBaseException
      Description copied from interface: Admin
      Kill the connection with the given connectionId
      Specified by:
      killConnection in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      Returns:
      status of kill command
      Throws:
      StreamBaseException
    • killAllConnections

      public String[] killAllConnections(long timeoutMS) throws StreamBaseException
      Description copied from interface: Admin
      Kill all of the connections on the server
      Specified by:
      killAllConnections in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      Returns:
      status of kill command
      Throws:
      StreamBaseException
    • manageJdbcConnections

      public String[] manageJdbcConnections(long timeoutMS, List<String> args) throws StreamBaseException
      Description copied from interface: Admin
      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)
      Specified by:
      manageJdbcConnections in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      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
    • addExceptions

      public static List<Throwable> addExceptions(List<Throwable> exceptions, Throwable current)
      add the given exception to the list of exceptions
      Parameters:
      exceptions - list of possibly exceptions (possibly null)
      current - exception to add
      Returns:
      list of exceptions
    • processExceptions

      public static StreamBaseException processExceptions(String message, List<Throwable> exceptions, String baseUri, Class<?> exceptionsCheck)
      Look through the exceptions; if we have one that isn't an XMLRPCException then throw that one otherwise bundle them all up into a list exception.
      Parameters:
      message - the message to use when throwing a new exception
      exceptions - the list of exceptions from the call
      baseUri - base URI
      exceptionsCheck - the list of exceptions to check against
      Returns:
      a meaningful exception
    • setConnectionID

      public void setConnectionID(com.streambase.sb.util.ByteString _connectionid)
      Description copied from interface: Admin
      Set the Connection ID
      Specified by:
      setConnectionID in interface Admin
    • getConnectionID

      public com.streambase.sb.util.ByteString getConnectionID()
      Description copied from interface: Admin
      Return the connection id (which may be null)
      Specified by:
      getConnectionID in interface Admin
      Returns:
      connection id (which may be null)
    • createBaseURIString

      public static String createBaseURIString(Collection<StreamBaseURI> uris)
      Create a URI string of baseURI's from a list of uris
      Parameters:
      uris - URI list to convert
      Returns:
      a base URI string
    • getDynamicVariables

      public Tuple getDynamicVariables(long timeoutMS, com.streambase.sb.util.Path modulePath) throws StreamBaseException
      Description copied from interface: Admin
      Return the current value of the dynamic variables in the given module, as a Tuple of field name to Java value.
      Specified by:
      getDynamicVariables in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      modulePath - the path to the module
      Returns:
      a Tuple of all the module's dynamic variables. The field names are the names of the dynamic variables, and the values are their current values.
      Throws:
      StreamBaseException - on nonexistence of the path, network, if the module contains no dynamic variables, or other errors.
    • setDynamicVariable

      public void setDynamicVariable(long timeoutMS, com.streambase.sb.util.Path dynamicVariablePath, Object value) throws StreamBaseException
      Description copied from interface: Admin
      Set the value of the given dynamic variable to the given value.
      Specified by:
      setDynamicVariable in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      dynamicVariablePath - the path to the dynamic variable
      value - the value to set the variable to
      Throws:
      StreamBaseException
    • fastForwardTime

      public void fastForwardTime(long timeout, Object value) throws StreamBaseException
      Description copied from interface: Admin
      Number of milliseconds to jump forward in time. Note that if you specify a negative number for msecs, the behavior could vary depending on the TimeService implementation. (no guaranteed what could happen!)
      Specified by:
      fastForwardTime in interface Admin
      Parameters:
      timeout - Timeout in milliseconds to wait for completion
      value - number of milliseconds to jump forward in time
      Throws:
      StreamBaseException - Error forwarding time
    • getEvalCacheContent

      public String getEvalCacheContent(long timeout, String containerName) throws StreamBaseException
      Description copied from interface: Admin
      Get evaluation cache content
      Specified by:
      getEvalCacheContent in interface Admin
      Parameters:
      timeout - Timeout in milliseconds to wait for completion
      containerName - Container name
      Returns:
      Cache contents
      Throws:
      StreamBaseException - Error reading cache
    • getTargetTime

      public String getTargetTime(long timeout) throws StreamBaseException
      Description copied from interface: Admin
      Get target time
      Specified by:
      getTargetTime in interface Admin
      Parameters:
      timeout - Timeout in milliseconds to wait for completion
      Returns:
      Target time
      Throws:
      StreamBaseException - Error getting time
    • getDynamicVariableField

      public Schema.Field getDynamicVariableField(long timeoutMS, com.streambase.sb.util.Path dynamicVariablePath) throws StreamBaseException
      Specified by:
      getDynamicVariableField in interface Admin
      Parameters:
      timeoutMS - the timeout in milliseconds to wait for the command to complete
      Returns:
      a dynamic variable field
      Throws:
      StreamBaseException
    • readTable

      public List<Tuple> readTable(long timeoutMS, String tablePath, int rowLimit, String predicate) throws StreamBaseException
      Description copied from interface: Admin
      Return rows from the table.
      Specified by:
      readTable in interface Admin
      Parameters:
      timeoutMS - timeout in milliseconds
      tablePath - Path to the table.
      rowLimit - Limit on number of rows to return, or -1 for all rows.
      Returns:
      A list of rows from the table.
      Throws:
      StreamBaseException - If the connection is not valid or the server cannot be contacted.
    • clearEvalCache

      public String clearEvalCache(long timeoutMS, String containerName) throws StreamBaseException
      Description copied from interface: Admin
      Clear evaluation cache
      Specified by:
      clearEvalCache in interface Admin
      Parameters:
      timeoutMS - Timeout in milliseconds to wait for completion
      containerName - Container name
      Returns:
      Cache contents
      Throws:
      StreamBaseException - Error clearing cache
    • getMapperCacheContent

      public String getMapperCacheContent(long timeoutMS, String containerName) throws StreamBaseException
      Description copied from interface: Admin
      Get mapper cache content
      Specified by:
      getMapperCacheContent in interface Admin
      Parameters:
      timeoutMS - Timeout in milliseconds to wait for completion
      containerName - Container name
      Returns:
      Cache contents
      Throws:
      StreamBaseException - Error reading cache
    • getNamesForContainer

      public Map<Integer,String> getNamesForContainer(long timeoutMS, int id) throws StreamBaseException
      Description copied from interface: Admin
      Return a map of id and names for the given container id.
      Specified by:
      getNamesForContainer in interface Admin
      Returns:
      a map of id and names for the given container id
      Throws:
      StreamBaseException