Interface TableAdminManager


public interface TableAdminManager
TableAdminManager is used to start and stop tables and table providers on the server. Tables can be created, started, and dropped only if they have no complex connections to applications or Publishers, but it is possible to obtain TablePublishers to a table after it is created. It is possible to create new Aggregation-based tables, which are tables that represent an aggregate query against an existing table. TableProvider is an interface that clients can implement and represents their own plug-in to LiveView. By implementing this interface and it's associated classes, the client can create objects on the server that act as LiveView Tables, fetching the data from their own back-end and feeding it to LiveView clients through the normal LiveView channels. LiveView clients made with any of the client API's (Java, JavaScript, and .NET), which includes LiveView DeskTop, will not know that the table is different from any LiveView table, excepting the query language used for such tables is the native language of back-end. Use this method to start one of these TableProviders on the server. LiveView comes with two standard instances of this plug-in, one that presents StreamBase QueryTables on any running StreamBase server as LiveView Tables, and another that presents LiveView Tables from another LiveView Server as if they are tables on this server. In addition, there is available a plug-in that presents ActiveSpaces Spaces as if they are LiveView tables. Note that TableProviders can also be started by making an LVConf that uses the external-connection element. That is exactly equivalent to starting one through this method, except that it will be already available when the server starts.
Since:
LiveView 2.1
  • Method Details

    • startTables

      void startTables(String... tables) throws LiveViewException
      This will start all the tables in the list AND any applications or elements upon which they depend. The LVConf files that define these tables and applications must already be on the server.
      Parameters:
      tables -
      Throws:
      LiveViewException
    • dropTables

      void dropTables(String... tables) throws LiveViewException
      This will drop the tables in the list. It will also drop any tables that are dependent on any of these.
      Parameters:
      tables -
      Throws:
      LiveViewException
    • startTables

      Map<String,DynamicTableState> startTables(long duration, TimeUnit timeUnit, String... tables)
      Returns a Map<String, DynamicTableState>, where the key is tableName and the value is DynamicTableState DynamicTableState. Will return when either timeoutMS has been reached or all tables are started/entered in error state.
      Parameters:
      duration - a timeToWait before returning; if all tables started/entered in error state before duration is completed, the module returns otherwise waits till the specified duration ends; duration = 0 or any value less than 0 uses the system property 'liveview.tablestart.idletime.ms'.
      timeUnit - a TimeUnit is mainly used to inform this method how a given timing parameter(duration) should be interpreted. e.g.:TimeUnit.MILLISECONDS
      tables - the List of tables to start.
      Returns:
      returns the Map<String,DynamicTableState> with table names as the key and DynamicTableState DynamicTableState holding the state of table on timeout; also returns if each table is either started/entered in error state.
    • dropTables

      Map<String,DynamicTableState> dropTables(long duration, TimeUnit timeUnit, String... tables)
      Returns a Map<String, DynamicTableState>, where the key is tableName and the value is DynamicTableState DynamicTableState. Will return when either timeoutMS has been reached or all tables are dropped/entered in error state.
      Parameters:
      duration - the timeToWait before returning; if all tables dropped/entered in error state before duration is completed, the module returns otherwise waits till the specified duration ends; duration = 0 or any value less than 0 uses the system property 'liveview.tabledrop.idletime.ms'.
      timeUnit - the TimeUnit is mainly used to inform this method how a given timing parameter(duration) should be interpreted. e.g.:TimeUnit.MILLISECONDS
      tables - the list of tables to drop.
      Returns:
      returns the Map<String,DynamicTableState> with table names as the key and DynamicTableState DynamicTableState holding the state of table on timeout; also returns if each table is either dropped/entered in error state.
    • createTable

      void createTable(String tableName, String description, Schema schema, List<List<String>> indices) throws LiveViewException
      Create a table on the server without any LVConf which represents it. This can only be published to with a client publisher, it will not have any connections to existing tables or applications. It can be stopped with unloadTables.
      Parameters:
      tableName -
      description -
      schema - Defines the columns in the table
      indices - Each index is a list of field names; the first index in the list is the primary key, and the rest are secondary keys
      Throws:
      LiveViewException
    • createTable

      void createTable(String tableName, String description, Schema schema, String... primaryKeyFields) throws LiveViewException
      Convenience form of the previous method, used if there is only a primary key. Create a table on the server without any LVConf which represents it. This can only be published to with a client publisher, it will not have any connections to existing tables or applications. It can be stopped with unloadTables.
      Parameters:
      tableName -
      description -
      schema - Defines the columns in the table
      primaryKeyFields - The only key is the primary key.
      Throws:
      LiveViewException
    • createTable

      void createTable(String tableName, String description, String schema, List<List<String>> indices) throws LiveViewException
      Create a table on the server without any LVConf which represents it. This can only be published to with a client publisher, it will not have any connections to existing tables or applications. It can be stopped with unloadTables.
      Parameters:
      tableName -
      description -
      schema - Defines the columns in the table
      indices - Each index is a list of field names; the first index in the list is the primary key, and the rest are secondary keys
      Throws:
      LiveViewException
    • createTable

      void createTable(String tableName, String description, String schema, String... primaryKeyFields) throws LiveViewException
      Convenience form of the previous method, used if there is only a primary key. Create a table on the server without any LVConf which represents it. This can only be published to with a client publisher, it will not have any connections to existing tables or applications. It can be stopped with unloadTables.
      Parameters:
      tableName -
      description -
      schema - Defines the columns in the table
      primaryKeyFields - The only key is the primary key.
      Throws:
      LiveViewException
    • createAggregateTable

      void createAggregateTable(String tablename, String descripton, QueryConfig aggregateQuery, List<List<String>> indices) throws LiveViewException
      Create a table that is based on an aggregate query against an existing table.
      Parameters:
      tablename -
      descripton -
      aggregateQuery - The query against an existing table which will provide the source of data for this new one
      indices - Each index is a list of field names; the first index in the list is the primary key, and the rest are secondary keys. Primary key must match the group-by of the query, or the aliased version of the group-by of the query.
      Throws:
      LiveViewException
    • createTableConfig

      TableConfig createTableConfig(String tablename)
      Create a TableConfig for making tables with more advanced features
      Parameters:
      tablename -
      Returns:
      TableConfig with the tablename set.
      Since:
      2.1.4
    • createTable

      void createTable(TableConfig tableConfig) throws LiveViewException
      Create a table using a TableConfig
      Parameters:
      tableConfig -
      Throws:
      LiveViewException
      Since:
      2.1.4
    • isValidFieldName

      boolean isValidFieldName(String name)
      Checks whether or not the name is a valid field name to be used by createTable. Excluded names are those that start with underscore or CQS, as well as those that are reserved words in the expression language.
      Parameters:
      name -
      Returns:
      true if this is a valid field name.
    • addTableProvider

      void addTableProvider(String id, com.streambase.liveview.internal.protocol.jaxb.ExternalConnectionTypeType externalConnectionType, String javaClassName, com.streambase.liveview.internal.protocol.jaxb.ExternalServerConnectionType.Parameters parameters, com.streambase.liveview.internal.protocol.jaxb.ExternalServerConnectionType.Mappings mappings, int maxFailAttempts, int waitSeconds) throws LiveViewException
      Connect to a TableProvider, which then allows for remote connections to behave as if they were LiveView Tables. TableProvider is an interface that clients can implement and represents their own plug-in to LiveView. By implementing this interface and its associated classes, the client can create objects on the server that act as LiveView Tables, fetching the data from their own back-end and feeding it to LiveView clients through the normal LiveView channels. LiveView clients made with any of the client API's (Java, JavaScript, and .NET), which includes LiveView DeskTop, will not know that the table is any different from any LIveView table. Use this method to start one of these TableProviders on the server. LiveView comes with two standard instances of this plug-in, one that presents StreamBase QueryTables on any running StreamBase Server as LiveView Tables, and another that presents LiveView Tables from another LiveView Server as if they are tables on this server. In addition, there is available a plug-in that presents ActiveSpaces Spaces as if they are LiveView tables. Note that TableProviders can also be started by making an LVConf that uses the external-connection element. That is exactly equivalent to starting one through this method, except that it will be already available when the server starts.
      Parameters:
      id - must be unique on the LiveView server.
      externalConnectionType - one of CEP_QUERY_TABLES, LIVE_VIEW, CUSTOM_TABLE_PROVIDER ExternalConnectionTypeType
      javaClassName - The className of a class that implements com.streambase.liveview.server.table.TableProvider. Only used if type is CUSTOM_TABLE_PROVIDER.
      parameters - key-value pairs that are specific to your TableProvider. Use utility function TableAdminManager.TableProviderAPIHelper.addParameter(Parameters, String, String) to create and extend.
      mappings - Table name selector and mapping definitions. Use utility function TableAdminManager.TableProviderAPIHelper.addMapping(Mappings, String, String) to create and extend.
      maxFailAttempts - Maximum failures before giving up. Anything less than 1 for infinite attempts.
      waitSeconds - Time to wait after a failure before trying. Anything less than 1 becomes the default of 120 seconds.
      Throws:
      LiveViewException
      Since:
      LiveView 1.6
    • removeTableProvider

      void removeTableProvider(String id) throws LiveViewException
      Disconnect a previously-connected TableProvider
      Parameters:
      id - The exact id of the TableProvider.
      Throws:
      LiveViewException
      Since:
      LiveView 1.6