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 Summary
ConstructorDescriptionTableProviderControlImpl
(String id, TableProvider provider, TableProviderManager manager, com.streambase.liveview.internal.protocol.jaxb.ExternalServerConnectionType externalServerConnection, int failedRetryAttempts) -
Method Summary
Modifier and TypeMethodDescriptionvoid
This will set the failedRetryCount to zero.void
Delete the table with this ID.void
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.(package private) void
doShutdown
(boolean restart) double
Get the first parameter with this key, interpreted as an double.com.streambase.liveview.internal.protocol.jaxb.ExternalServerConnectionType
int
getId()
int
Get the first parameter with this key, interpreted as an integer.getKeys()
Get all the keys that were specified.getMultivalue
(String parameterKey) For keys that might appear more than once, this will return all of the values for that key.Get the first parameter with this key, trimmed.com.streambase.liveview.server.table.CatalogedTable
Find the Table with this ID.This will match the name against the selector.Collection<com.streambase.liveview.server.table.CatalogedTable>
Get a collection of all the CatalogedTables that belong to your TableProvider.long
void
insert
(com.streambase.liveview.server.table.CatalogedTable catalogedTable) Insert this Table.locateFile
(String filename, boolean required) This will attempt to locate a file within the project.check and remap a name.void
setEnabled
(String tableId, boolean enabled) Change the enabled state of an existing table.void
setStartThread
(Thread thread) void
setStatus
(TableProviderStatus status) void
Shut down the associated TableProvider.void
update
(com.streambase.liveview.server.table.CatalogedTable catalogedTable) Update this Table.void
upsert
(com.streambase.liveview.server.table.CatalogedTable catalogedTable) Insert or Update the Table, depending on whether or not it already exists.
-
Constructor Details
-
TableProviderControlImpl
public TableProviderControlImpl(String id, TableProvider provider, TableProviderManager manager, com.streambase.liveview.internal.protocol.jaxb.ExternalServerConnectionType externalServerConnection, int failedRetryAttempts)
-
-
Method Details
-
setEnabled
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 interfaceTableProviderControl
- 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
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 interfaceTableProviderControl
- Parameters:
remappedName
- The ID by which the table is saved (i.e. the remapped name)- Returns:
- null if no Table has that name.
-
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 interfaceTableProviderControl
- 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 interfaceTableProviderControl
- 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 interfaceTableProviderControl
- 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 interfaceTableProviderControl
- 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
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 interfaceTableProviderControl
-
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 interfaceTableProviderControl
-
getProvider
-
getId
-
getStatus
-
setStatus
-
getWakeup
public long getWakeup() -
getFailedRetryAttempts
public int getFailedRetryAttempts() -
getExternalServerConnection
public com.streambase.liveview.internal.protocol.jaxb.ExternalServerConnectionType getExternalServerConnection() -
getString
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 interfaceTableProviderParameters
- Returns:
- String value of the first parameter with that key, or the defaultValue if there weren't any.
-
getInt
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 interfaceTableProviderParameters
- 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
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 interfaceTableProviderParameters
- 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
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 interfaceTableProviderParameters
- Returns:
- a list, possibly empty, of all values that had that key, in the order that they existed in the Parameters.
-
getKeys
Description copied from interface:TableProviderParameters
Get all the keys that were specified.- Specified by:
getKeys
in interfaceTableProviderParameters
- Returns:
-
remap
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 interfaceTableNameMapper
- Parameters:
name
- the name to be remapped- Returns:
- null for no match or the remapped name.
-
getTableFilteredAliases
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 interfaceTableNameMapper
- Parameters:
name
- is the name to be remapped and be wrapped inTablePropertiesConfigurationWrapper
- 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 interfaceTableProviderControl
-
setStartThread
-
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 interfaceTableProviderControl
-
locateFile
Description copied from interface:TableProviderControl
This will attempt to locate a file within the project.- Specified by:
locateFile
in interfaceTableProviderControl
- Parameters:
filename
- indicates a file in the LiveView projectrequired
- 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.
-