com.streambase.liveview.client

## 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

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `TableAdminManager.TableProviderAPIHelper` Utility methods for working with the TableProviderAPI

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addTableProvider(String id, ExternalConnectionTypeType externalConnectionType, String javaClassName, ExternalServerConnectionType.Parameters parameters, ExternalServerConnectionType.Mappings mappings, int maxFailAttempts, int waitSeconds)` Connect to a TableProvider, which then allows for remote connections to behave as if they were LiveView Tables.
    `void` | `createAggregateTable(String tablename, String descripton, QueryConfig aggregateQuery, List<List<String>> indices)` Create a table that is based on an aggregate query against an existing table.
    `void` | `createTable(String tableName, String description, Schema schema, List<List<String>> indices)` Create a table on the server without any LVConf which represents it.
    `void` | `createTable(String tableName, String description, Schema schema, String... primaryKeyFields)` Convenience form of the previous method, used if there is only a primary key.
    `void` | `createTable(String tableName, String description, String schema, List<List<String>> indices)` Create a table on the server without any LVConf which represents it.
    `void` | `createTable(String tableName, String description, String schema, String... primaryKeyFields)` Convenience form of the previous method, used if there is only a primary key.
    `void` | `createTable(TableConfig tableConfig)` Create a table using a TableConfig
    `TableConfig` | `createTableConfig(String tablename)` Create a TableConfig for making tables with more advanced features
    `Map<String,DynamicTableState>` | `dropTables(long duration, TimeUnit timeUnit, String... tables)` Returns a Map, where the key is tableName and the value is DynamicTableState `DynamicTableState`.
    `void` | `dropTables(String... tables)` This will drop the tables in the list.
    `boolean` | `isValidFieldName(String name)` Checks whether or not the name is a valid field name to be used by createTable.
    `void` | `removeTableProvider(String id)` Disconnect a previously-connected TableProvider
    `Map<String,DynamicTableState>` | `startTables(long duration, TimeUnit timeUnit, String... tables)` Returns a Map, where the key is tableName and the value is DynamicTableState `DynamicTableState`.
    `void` | `startTables(String... tables)` This will start all the tables in the list AND any applications or elements upon which they depend.

- - ### Method Detail

    - #### 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, 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` - : 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` - : List of tables to start.
      Returns:
        returns the Map 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, 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` - : 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:` - A TimeUnit is mainly used to inform this method how a given timing parameter(duration) should be interpreted. e.g.:TimeUnit.MILLISECONDS
        `tables` - : List of tables to drop.
      Returns:
        returns the Map 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,
                                ExternalConnectionTypeType externalConnectionType,
                                String javaClassName,
                                ExternalServerConnectionType.Parameters parameters,
                                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 `TableProviderAPIHelper#addMapping(Mappings, String, String)` to create and extend.
        `mappings` - Table name selector and mapping definitions. Use utility function `TableProviderAPIHelper#addParameter(Parameters, 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
      See Also:
        `LiveViewConnection.TableProviderAPIHelper`

    - #### 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

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