Class TableProviderControlImpl

java.lang.Object
com.streambase.liveview.server.table.plugin.TableProviderControlImpl
All Implemented Interfaces:
TableNameMapper, TableProviderControl, TableProviderParameters

public class TableProviderControlImpl extends Object implements TableProviderControl, TableNameMapper, TableProviderParameters
  • Constructor Details

    • TableProviderControlImpl

      public TableProviderControlImpl(String id, TableProvider provider, TableProviderManager manager, com.streambase.liveview.internal.protocol.jaxb.ExternalServerConnectionType externalServerConnection, int failedRetryAttempts)
  • Method Details

    • setEnabled

      public void setEnabled(String tableId, boolean enabled) throws LiveViewException
      Description copied from interface: TableProviderControl
      Change the enabled state of an existing table. This is a shortcut over update when you only need to enable or disable the Table. However, it will not update anything else in the Table.
      Specified by:
      setEnabled in interface TableProviderControl
      Parameters:
      tableId - The ID of the Table to change.
      enabled - The new state to change it to.
      Throws:
      LiveViewException - if attempting to set a table that does not exist enabled. (Setting a non-existant table disabled is ignored.)
    • getTable

      public com.streambase.liveview.server.table.CatalogedTable getTable(String remappedName)
      Description copied from interface: TableProviderControl
      Find the Table with this ID. If one doesn't exist, then it will return null.
      Specified by:
      getTable in interface TableProviderControl
      Parameters:
      remappedName - The ID by which the table is saved (i.e. the remapped name)
      Returns:
      null if no Table has that name.
    • getTables

      public Collection<com.streambase.liveview.server.table.CatalogedTable> getTables()
      Description copied from interface: TableProviderControl
      Get a collection of all the CatalogedTables that belong to your TableProvider. This list it returns is a copy of the real list, so it will not reflect any changes you might make.
      Specified by:
      getTables in interface TableProviderControl
      Returns:
      all the CatalogedTables that belong to your TableProvider
    • insert

      public void insert(com.streambase.liveview.server.table.CatalogedTable catalogedTable)
      Description copied from interface: TableProviderControl
      Insert this Table. It is an error if a Table with that ID already exists.
      Specified by:
      insert in interface TableProviderControl
      Parameters:
      catalogedTable - The Table to insert. Note that the catalogedTable will be copied so further changes to it will not affect anything until you update or upsert.
    • upsert

      public void upsert(com.streambase.liveview.server.table.CatalogedTable catalogedTable)
      Description copied from interface: TableProviderControl
      Insert or Update the Table, depending on whether or not it already exists.
      Specified by:
      upsert in interface TableProviderControl
      Parameters:
      catalogedTable - The Table to insert. Note that the catalogedTable will be copied so further changes to it will not affect anything until you update or upsert.
    • update

      public void update(com.streambase.liveview.server.table.CatalogedTable catalogedTable)
      Description copied from interface: TableProviderControl
      Update this Table. It is an error if a Table with that ID does not already exist.
      Specified by:
      update in interface TableProviderControl
      Parameters:
      catalogedTable - The Table to insert. Note that the catalogedTable will be copied so further changes to it will not affect anything until you update or upsert.
    • delete

      public void delete(String remappedName)
      Description copied from interface: TableProviderControl
      Delete the table with this ID. It is an error if a Table with that ID does not already exist.
      Specified by:
      delete in interface TableProviderControl
    • shutMeDown

      public void shutMeDown()
      Description copied from interface: TableProviderControl
      Shut down the associated TableProvider. This is called by the TableProvider upon his learning that his back end is no longer available. These steps will happen on your behalf: - Your tables will all be marked as disabled (which will prevent new queries) - All your active QueryListeners will be closed. This will cause your table's removeListener method to be called. - Your shutdown method will be called - (If you haven't already done so) all your tables will be removed from the Table List (as if you had called delete on them). - If requested in the LVConf or service call, after the specified delay a new instance of your TableProvider will be started up again with the same arguments.
      Specified by:
      shutMeDown in interface TableProviderControl
    • getProvider

      public TableProvider getProvider()
    • getId

      public String getId()
    • getStatus

      public TableProviderStatus getStatus()
    • setStatus

      public void setStatus(TableProviderStatus status)
    • getWakeup

      public long getWakeup()
    • getFailedRetryAttempts

      public int getFailedRetryAttempts()
    • getExternalServerConnection

      public com.streambase.liveview.internal.protocol.jaxb.ExternalServerConnectionType getExternalServerConnection()
    • getString

      public String getString(String parameterKey, String defaultValue)
      Description copied from interface: TableProviderParameters
      Get the first parameter with this key, trimmed. Note that if the value exists but is empty, it will return the empty string, not the defaultValue.
      Specified by:
      getString in interface TableProviderParameters
      Returns:
      String value of the first parameter with that key, or the defaultValue if there weren't any.
    • getInt

      public int getInt(String parameterKey, int defaultValue)
      Description copied from interface: TableProviderParameters
      Get the first parameter with this key, interpreted as an integer. If the parameter does not exist, or if it can't be interpreted as an integer, return the defaultValue
      Specified by:
      getInt in interface TableProviderParameters
      Returns:
      int value of the first parameter with that key, or the defaultValue if there weren't any or if it isn't an int.
    • getDouble

      public double getDouble(String parameterKey, double defaultValue)
      Description copied from interface: TableProviderParameters
      Get the first parameter with this key, interpreted as an double. If the parameter does not exist, or if it can't be interpreted as a double, return the defaultValue
      Specified by:
      getDouble in interface TableProviderParameters
      Returns:
      double value of the first parameter with that key, or the defaultValue if there weren't any or if it isn't a double.
    • getMultivalue

      public List<String> getMultivalue(String parameterKey)
      Description copied from interface: TableProviderParameters
      For keys that might appear more than once, this will return all of the values for that key.
      Specified by:
      getMultivalue in interface TableProviderParameters
      Returns:
      a list, possibly empty, of all values that had that key, in the order that they existed in the Parameters.
    • getKeys

      public Set<String> getKeys()
      Description copied from interface: TableProviderParameters
      Get all the keys that were specified.
      Specified by:
      getKeys in interface TableProviderParameters
      Returns:
    • remap

      public String remap(String name)
      Description copied from interface: TableNameMapper
      check and remap a name. This will match the name against the selectors. Returns null if none matched, or the remapped string if one did. Note that having no mappings (either because mappings is null or empty) is legitimate, and implies a mapping of (.*) to %s (i.e. everything passes and maps to itself).
      Specified by:
      remap in interface TableNameMapper
      Parameters:
      name - the name to be remapped
      Returns:
      null for no match or the remapped name.
    • getTableFilteredAliases

      public TablePropertiesConfigurationWrapper getTableFilteredAliases(String name)
      Description copied from interface: TableNameMapper
      This will match the name against the selector. Returns null if none matched, or TablePropertiesConfigurationWrapper instance with re-mapped string if one did. Note that having no mappings (either because mappings is null or empty) is legitimate, and implies a mapping of (.*) to %s (i.e. everything passes and maps to itself).
      Specified by:
      getTableFilteredAliases in interface TableNameMapper
      Parameters:
      name - is the name to be remapped and be wrapped in TablePropertiesConfigurationWrapper
      Returns:
      null for no match or TablePropertiesConfigurationWrapper with remapped name and a list of FilteredAlias instances for this table name
    • clearRetryCount

      public void clearRetryCount()
      Description copied from interface: TableProviderControl
      This will set the failedRetryCount to zero. The failedRetryCount is compared to the MaxRetryCount value that was set by the user in the LVConf (or the web service). This method will be called automatically if your start() method returns normally. However, if you keep the start thread and use it to poll your server (which you are welcome to do), then you should call this method yourself once you've successfully connected.
      Specified by:
      clearRetryCount in interface TableProviderControl
    • setStartThread

      public void setStartThread(Thread thread)
    • doShutdown

      void doShutdown(boolean restart)
    • disableAllAndRestart

      public void disableAllAndRestart()
      Description copied from interface: TableProviderControl
      When a condition arises where the table provider is unable to service any of tables, but it does not wish to have its tables removed from the system. This method will mark the providers tables as disabled and schedule a restart, if the provider has been so configured. The table provider is responsible for closing any active queries if it can no longer service them.
      Specified by:
      disableAllAndRestart in interface TableProviderControl
    • locateFile

      public File locateFile(String filename, boolean required) throws LiveViewException
      Description copied from interface: TableProviderControl
      This will attempt to locate a file within the project.
      Specified by:
      locateFile in interface TableProviderControl
      Parameters:
      filename - indicates a file in the LiveView project
      required - if true, this method will throw an exception if the file can't be found.
      Returns:
      reference to the actual file, or null if it could not be found (or filename was empty) and required was false.
      Throws:
      LiveViewException - thrown if the required flag was true and either filename was empty or it couldn't find the file.