Package com.seeq.link.sdk
Class DatasourceConnectionV2Host
java.lang.Object
com.seeq.link.sdk.BaseConnection
com.seeq.link.sdk.DatasourceConnectionV2Host
- All Implemented Interfaces:
Connection
,DatasourceConnection
,DatasourceConnectionServiceV2
public class DatasourceConnectionV2Host
extends BaseConnection
implements DatasourceConnectionServiceV2
Hosts an
DatasourceConnectionV2
connection and acts as a bridge to the older DatasourceConnection
interface via the DatasourceConnectionServiceV2
interface.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.seeq.link.sdk.interfaces.Connection
Connection.ConnectionState, Connection.StateChangedEventArgs
Nested classes/interfaces inherited from interface com.seeq.link.sdk.interfaces.DatasourceConnectionServiceV2
DatasourceConnectionServiceV2.InterpolationMethod
-
Field Summary
FieldsFields inherited from class com.seeq.link.sdk.BaseConnection
lastException
-
Method Summary
Modifier and TypeMethodDescriptionprotected static List<com.seeq.model.ItemUpdateOutputV1>
batchMoveNodesToParentsJob
(org.slf4j.Logger log, com.seeq.api.TreesApi treesApi, com.seeq.api.JobsApi jobsApi, com.seeq.model.AssetTreeBatchInputV1 treeBatchInput) protected ErrorMessage.ErrorInfo
buildDataRequestErrorMessage
(Exception e, String requestType, String dataId, long start, long end) Given data-request-specific information, build an ErrorInfo message.protected ErrorMessage.ErrorInfo
buildErrorMessage
(ErrorMessage.ErrorCode errorCode, Exception e, String message) Given an error code, an optional exception, and an additional error message, build an ErrorInfo message.protected ErrorMessage.ErrorInfo
Given data-request-specific information, build an ErrorInfo message.protected ErrorMessage.ErrorInfo
Given data-request-specific information, build an ErrorInfo message.protected void
cancelRequest
(String requestId) Cancel a running request.protected void
cleanUpStaleItems
(String datasourceItemId, String syncToken, List<String> itemTypesFilter, String datasourceItemDataIdRegexFilter, String datasourceItemDataIdExcludeRegexFilter, String datasourceItemNameRegexFilter, String datasourceItemNameExcludeRegexFilter, String requestId) Call the Seeq Appserver to clean up (archive) any stale items in this datasource.com.seeq.link.sdk.BaseDatasourceConnection.ResponseWithDatumInfo<ConditionConnectionMessages.ConditionResponseMessage>
protected void
connect()
Connect to the server (implemented by derived classes).void
deleteDatasourceProperties
(List<String> additionalPropertiesToDelete) Deletes the specified properties from the datasourcevoid
destroy()
Disconnects from external systems and kills the monitoring thread.protected void
Disconnect from the server (implemented by derived classes).List<com.seeq.model.ItemUpdateOutputV1>
Writes the asset buffer to the Seeq application server.List<com.seeq.model.ItemUpdateOutputV1>
Writes the condition buffer to the Seeq application server.List<com.seeq.model.ItemUpdateOutputV1>
Writes the buffer of relationships to the Seeq application server.List<com.seeq.model.ItemUpdateOutputV1>
Writes the root asset buffer to the Seeq application server.List<com.seeq.model.ItemUpdateOutputV1>
Writes the scalar buffer to the Seeq application server.List<com.seeq.model.ItemUpdateOutputV1>
Writes the signal buffer to the Seeq application server.List<com.seeq.model.ItemUpdateOutputV1>
Writes the user group buffer to the Seeq application server.The connection ID used to connect to the server.Provides the current state of the connection to the external datasource.The current indexing requests's sync modecom.seeq.model.DatasourceOutputV1
Get information about the Seeq datasource this connection services.The human readable name of the type of data source this connection is to.The unique identifier of the data source this connection is to.A human readable name for the data source this connection is to.The indexing schedule for this connection, including the time and period of delay.The current state of indexing, including item counts and sync status.org.slf4j.Logger
getLog()
com.seeq.link.sdk.BaseDatasourceConnection.DatasourceAndCreationInfo
getOrCreateDatasource
(boolean storedInSeeq) Get information about a datasource with the specified identifier.com.seeq.link.sdk.BaseDatasourceConnection.DatasourceAndCreationInfo
getOrCreateDatasource
(boolean storedInSeeq, boolean enableCache) Get information about a datasource with the specified identifier.com.seeq.link.sdk.BaseDatasourceConnection.DatasourceAndCreationInfo
getOrCreateDatasource
(boolean storedInSeeq, boolean enableCache, List<com.seeq.model.ScalarPropertyV1> additionalProperties) Get information about a datasource with the specified identifier.The type(s) of data that this connection provides.protected void
handleConnectionMonitorException
(String methodName, Exception exception) void
Initializes a connection, attempting to connect if enabled.void
initializeExport
(ExportSamples exportInterface, ExportConnectionConfigV1 exportConfig) If the connector supports exporting from Seeq to the datasource, this method must be called during each connection's Initialize() method.boolean
Indicates whether metadata sync is supportedboolean
Indicates whether metadata sync can be triggered from outside the connector (from scheduler, or requested on demand from the UI)boolean
isLicensed
(String featureName) Checks the Seeq License for the required feature, logs the result, and returns true if the license includes the feature.boolean
Indicates whether pull requests are supportedorg.slf4j.Logger
log()
Prints diagnostic messages to the Seeq agent log file (and the console).protected void
logAndCountBadItems
(List<com.seeq.model.ItemUpdateOutputV1> items) void
metadataSync
(SyncMode syncMode) Sync metadata with the appserver.protected void
monitor()
A connector-specific test to ensure the connection is alive (implemented by derived classes).oAuth2AuthRequest
(OAuth2ConnectionMessages.OAuth2AuthRequestMessage oAuth2AuthRequest) oAuth2PreAuthRequest
(OAuth2ConnectionMessages.OAuth2PreAuthRequestMessage oAuth2PreAuthRequest) void
Handles messages intended for this connector.List<com.seeq.model.ItemUpdateOutputV1>
putAsset
(com.seeq.model.AssetInputV1 assetDefinition) Creates a new asset in the Seeq database.List<com.seeq.model.ItemUpdateOutputV1>
putAsset
(com.seeq.model.PutAssetInputV1 assetDefinition) Creates a new asset in the Seeq database.List<com.seeq.model.ItemUpdateOutputV1>
putCondition
(com.seeq.model.ConditionUpdateInputV1 conditionDefinition) Creates a new condition in the Seeq database or overwrites an existing item with the same DatasourceClass/DatasourceId/DataId if it already exists.List<com.seeq.model.ItemUpdateOutputV1>
putRelationship
(com.seeq.model.AssetTreeSingleInputV1 relationshipDefinition) Establishes a relationship in the Seeq database.List<com.seeq.model.ItemUpdateOutputV1>
putRootAsset
(com.seeq.model.AssetInputV1 assetDefinition) Creates a new asset in the Seeq database at the root of the asset tree.List<com.seeq.model.ItemUpdateOutputV1>
putRootAsset
(com.seeq.model.PutAssetInputV1 assetDefinition) Creates a new asset in the Seeq database at the root of the asset tree.List<com.seeq.model.ItemUpdateOutputV1>
putScalar
(com.seeq.model.PutScalarInputV1 scalarDefinition) Creates a new scalar in the Seeq database or overwrites an existing item with the same DatasourceClass/DatasourceId/DataId if it already exists.List<com.seeq.model.ItemUpdateOutputV1>
putScalar
(com.seeq.model.ScalarInputV1 scalarDefinition) Creates a new scalar in the Seeq database or overwrites an existing item with the same DatasourceClass/DatasourceId/DataId if it already exists.List<com.seeq.model.ItemUpdateOutputV1>
putSignal
(com.seeq.model.SignalWithIdInputV1 signalDefinition) Creates a new signal in the Seeq database or overwrites an existing item with the same DatasourceClass/DatasourceId/DataId if it already exists.List<com.seeq.model.ItemUpdateOutputV1>
putUserGroup
(com.seeq.model.UserGroupWithIdInputV1 userGroupDefinition) Creates a new user group in Seeq database or overwrites an existing user group with the same DatasourceClass/DatasourceId/DataId if it already exists.void
Called by an Agent when the agent has changed the connection's configuration (usually due to the indexing schedule being updated.protected void
protected void
sendSyncToken
(String datasourceItemId, String syncToken, String syncMode) Inform Appserver of the sync token for a sync about to take place.void
setConnectionState
(Connection.ConnectionState newState) Called by the connect/monitor/disconnect functions if the state of the connection changes.void
setConnectionStatusMessage
(String message) Called by the connect/monitor/disconnect functions to set a new connection status message.void
setCurrentIndexingRequestSyncMode
(SyncMode syncMode) Sets the current indexing requests's sync modevoid
Sets the datasource item DataId exclude Regex filter.void
Sets the datasource item DataId Regex filter.void
Sets the datasource item name exclude Regex filter.void
Sets the datasource item name Regex filter.void
setDatasourceItemTypeCleanupFilter
(List<String> itemTypeCleanupFilter) Sets the datasource item type cleanup filter.protected void
setSyncStatus
(SyncStatus syncStatus) Save the sync status to be sent to Appserver via the agent status API.void
setTransforms
(List<PropertyTransformer.Spec> transforms) Sets a list of transforms to apply to all indexed signals.com.seeq.link.sdk.BaseDatasourceConnection.ResponseWithDatumInfo<SignalConnectionMessages.SignalResponseMessage>
void
If called from theIndexingDatasourceConnection.index(SyncMode)
method, archiving will be skipped after indexing has finished.void
spawnMetadataSync
(SyncMode syncMode, Consumer<SyncResult> callback) Spawn a thread and runs metadataSync() on it.void
storeDatasourceProperties
(boolean storedInSeeq, List<com.seeq.model.ScalarPropertyV1> additionalProperties) Store the specified additional properties and storedInSeeq flag on the datasource.toString()
protected com.seeq.model.DatasourceOutputV1
updateExistingDatasource
(com.seeq.model.DatasourceOutputV1 datasource, boolean storedInSeeq, List<com.seeq.model.ScalarPropertyV1> additionalProperties) Updates an existing datasource in Seeq by changing its additional properties and storedInSeeq flagMethods inherited from class com.seeq.link.sdk.BaseConnection
disable, enable, getBackgroundThreads, getConnectionMessage, getLastException, getMaxReconnectDelay, getMinReconnectDelay, getMonitorPeriod, getState, getStateChangedEvent, setMaxReconnectDelay, setMinReconnectDelay, setMonitorPeriod, setState
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.seeq.link.sdk.interfaces.Connection
disable, enable, getConnectionMessage, getMaxReconnectDelay, getMinReconnectDelay, getMonitorPeriod, getState, getStateChangedEvent, setMaxReconnectDelay, setMinReconnectDelay, setMonitorPeriod
Methods inherited from interface com.seeq.link.sdk.interfaces.DatasourceConnectionServiceV2
disable, enable, getAgentService, getIndexingState
-
Field Details
-
services
-
-
Method Details
-
initialize
public void initialize()Description copied from interface:Connection
Initializes a connection, attempting to connect if enabled.- Specified by:
initialize
in interfaceConnection
- Specified by:
initialize
in classBaseConnection
-
isLicensed
Description copied from interface:DatasourceConnectionServiceV2
Checks the Seeq License for the required feature, logs the result, and returns true if the license includes the feature.- Specified by:
isLicensed
in interfaceDatasourceConnectionServiceV2
- Parameters:
featureName
- The feature for which the license is being checked- Returns:
- whether the License has been found to have the feature
-
destroy
public void destroy()Description copied from interface:Connection
Disconnects from external systems and kills the monitoring thread.- Specified by:
destroy
in interfaceConnection
-
setConnectionState
Description copied from interface:DatasourceConnectionServiceV2
Called by the connect/monitor/disconnect functions if the state of the connection changes.- Specified by:
setConnectionState
in interfaceDatasourceConnectionServiceV2
- Parameters:
newState
- The new state to which the connection is being transitioned.
-
setConnectionStatusMessage
Description copied from interface:DatasourceConnectionServiceV2
Called by the connect/monitor/disconnect functions to set a new connection status message.- Specified by:
setConnectionStatusMessage
in interfaceDatasourceConnectionServiceV2
- Parameters:
message
- The new status message.
-
handleConnectionMonitorException
- Overrides:
handleConnectionMonitorException
in classBaseConnection
-
getConnectionState
Description copied from interface:DatasourceConnectionServiceV2
Provides the current state of the connection to the external datasource.- Specified by:
getConnectionState
in interfaceDatasourceConnectionServiceV2
- Returns:
- the current state of the connection to the external datasource
-
getDatasource
public com.seeq.model.DatasourceOutputV1 getDatasource()Description copied from interface:DatasourceConnectionServiceV2
Get information about the Seeq datasource this connection services.- Specified by:
getDatasource
in interfaceDatasourceConnectionServiceV2
- Returns:
- Information about the datasource this connection services
-
skipArchiving
public void skipArchiving()Description copied from interface:DatasourceConnectionServiceV2
If called from theIndexingDatasourceConnection.index(SyncMode)
method, archiving will be skipped after indexing has finished. The default is that any items not present during aSyncMode.FULL
sync will be archived in Seeq; this skips that step.- Specified by:
skipArchiving
in interfaceDatasourceConnectionServiceV2
-
storeDatasourceProperties
public void storeDatasourceProperties(boolean storedInSeeq, List<com.seeq.model.ScalarPropertyV1> additionalProperties) Description copied from interface:DatasourceConnectionServiceV2
Store the specified additional properties and storedInSeeq flag on the datasource.- Specified by:
storeDatasourceProperties
in interfaceDatasourceConnectionServiceV2
- Parameters:
storedInSeeq
- Whether this datasource's data will be stored in Seeq (true) or a remote datasource (false).additionalProperties
- Additional properties that should be set on the datasource. The 'normal' datasource properties cannot be set with this parameter, only 'custom' properties.
-
deleteDatasourceProperties
Description copied from interface:DatasourceConnectionServiceV2
Deletes the specified properties from the datasource- Specified by:
deleteDatasourceProperties
in interfaceDatasourceConnectionServiceV2
- Parameters:
additionalPropertiesToDelete
- The names of the properties to delete. The 'normal' datasource properties cannot be deleted with this method, only 'custom' properties.
-
isPullDatasourceConnection
public boolean isPullDatasourceConnection()Description copied from interface:DatasourceConnection
Indicates whether pull requests are supported- Specified by:
isPullDatasourceConnection
in interfaceDatasourceConnection
- Returns:
- True, if pull requests are supported, false otherwise
-
isIndexingDatasourceConnection
public boolean isIndexingDatasourceConnection()Description copied from interface:DatasourceConnection
Indicates whether metadata sync is supported- Specified by:
isIndexingDatasourceConnection
in interfaceDatasourceConnection
- Returns:
- True, if metadata sync is supported, false otherwise
-
isIndexingScheduleSupported
public boolean isIndexingScheduleSupported()Description copied from interface:DatasourceConnection
Indicates whether metadata sync can be triggered from outside the connector (from scheduler, or requested on demand from the UI)- Specified by:
isIndexingScheduleSupported
in interfaceDatasourceConnection
- Returns:
- True, if metadata sync can be triggered from outside the connector, false otherwise
-
metadataSync
Description copied from interface:DatasourceConnection
Sync metadata with the appserver.- Specified by:
metadataSync
in interfaceDatasourceConnection
- Parameters:
syncMode
- Indicates whether to perform a full or incremental sync- Throws:
com.seeq.utilities.exception.OperationCanceledException
- Thrown when sync operation is interrupted by configuration reload or disabling.Exception
- Thrown when metadata sync fails for unexpected reasons and should be retried.
-
setTransforms
Description copied from interface:DatasourceConnectionServiceV2
Sets a list of transforms to apply to all indexed signals.- Specified by:
setTransforms
in interfaceDatasourceConnectionServiceV2
- Parameters:
transforms
- The list of transforms to apply to the signals.
-
putSignal
public List<com.seeq.model.ItemUpdateOutputV1> putSignal(com.seeq.model.SignalWithIdInputV1 signalDefinition) throws com.seeq.ApiException Description copied from interface:DatasourceConnectionServiceV2
Creates a new signal in the Seeq database or overwrites an existing item with the same DatasourceClass/DatasourceId/DataId if it already exists.- Specified by:
putSignal
in interfaceDatasourceConnectionServiceV2
- Parameters:
signalDefinition
- An Object describing the properties of the signal.- Returns:
- The list of items created in Seeq during this call. The return value will be null if the items are being queued into a batch.
- Throws:
com.seeq.ApiException
- If there is an error communicating with Seeq server, or Seeq server returns an error code during communication.
-
flushSignals
Description copied from interface:DatasourceConnectionServiceV2
Writes the signal buffer to the Seeq application server. This function should be called if it is important that the signals exist in the Seeq database before any other activity takes place.- Specified by:
flushSignals
in interfaceDatasourceConnectionServiceV2
- Returns:
- The list of items created in Seeq during this call.
- Throws:
com.seeq.ApiException
- If there is an error communicating with Seeq server, or Seeq server returns an error code during communication.
-
putUserGroup
public List<com.seeq.model.ItemUpdateOutputV1> putUserGroup(com.seeq.model.UserGroupWithIdInputV1 userGroupDefinition) throws com.seeq.ApiException Description copied from interface:DatasourceConnectionServiceV2
Creates a new user group in Seeq database or overwrites an existing user group with the same DatasourceClass/DatasourceId/DataId if it already exists.- Specified by:
putUserGroup
in interfaceDatasourceConnectionServiceV2
- Parameters:
userGroupDefinition
- An Object describing the properties of the user group- Returns:
- The list of items created in Seeq during this call. The return value will be null if the items are being queued into a batch.
- Throws:
com.seeq.ApiException
- If there is an error communicating with Seeq server, or Seeq server returns an error code during communication.
-
flushUserGroups
Description copied from interface:DatasourceConnectionServiceV2
Writes the user group buffer to the Seeq application server. This function should be called if it is important that the signals exist in the Seeq database before any other activity takes place.- Specified by:
flushUserGroups
in interfaceDatasourceConnectionServiceV2
- Returns:
- The list of items created in Seeq during this call.
- Throws:
com.seeq.ApiException
- If there is an error communicating with Seeq server, or Seeq server returns an error code during communication.
-
putCondition
public List<com.seeq.model.ItemUpdateOutputV1> putCondition(com.seeq.model.ConditionUpdateInputV1 conditionDefinition) throws com.seeq.ApiException Description copied from interface:DatasourceConnectionServiceV2
Creates a new condition in the Seeq database or overwrites an existing item with the same DatasourceClass/DatasourceId/DataId if it already exists.- Specified by:
putCondition
in interfaceDatasourceConnectionServiceV2
- Parameters:
conditionDefinition
- An Object describing the properties of the condition.- Returns:
- The list of items created in Seeq during this call. The return value will be null if the items are being queued into a batch.
- Throws:
com.seeq.ApiException
- If there is an error communicating with Seeq server, or Seeq server returns an error code during communication.
-
flushConditions
Description copied from interface:DatasourceConnectionServiceV2
Writes the condition buffer to the Seeq application server. This function should be called if it is important that the conditions exist in the Seeq database before any other activity takes place.- Specified by:
flushConditions
in interfaceDatasourceConnectionServiceV2
- Returns:
- The list of items created in Seeq during this call.
- Throws:
com.seeq.ApiException
- If there is an error communicating with Seeq server, or Seeq server returns an error code during communication.
-
putScalar
public List<com.seeq.model.ItemUpdateOutputV1> putScalar(com.seeq.model.PutScalarInputV1 scalarDefinition) throws com.seeq.ApiException Description copied from interface:DatasourceConnectionServiceV2
Creates a new scalar in the Seeq database or overwrites an existing item with the same DatasourceClass/DatasourceId/DataId if it already exists. Scalar values should be set in the Formula field of PutScalarInputV1, in a format that can be parsed by the Seeq Formula language. Units should be set in the UnitOfMeasure field as they will be parsed more permissively and applied to the Formula if they can be parsed to a Seeq standard unit. Unrecognized units in this field will result in a unitless Scalar, but unrecognized units in the Formula will lead to rejection of the Scalar.- Specified by:
putScalar
in interfaceDatasourceConnectionServiceV2
- Parameters:
scalarDefinition
- An Object describing the properties of the scalar.- Returns:
- The list of items created in Seeq during this call. The return value will be null if the items are being queued into a batch.
- Throws:
com.seeq.ApiException
- If there is an error communicating with Seeq server, or Seeq server returns an error code during communication.
-
putScalar
public List<com.seeq.model.ItemUpdateOutputV1> putScalar(com.seeq.model.ScalarInputV1 scalarDefinition) throws com.seeq.ApiException Description copied from interface:DatasourceConnectionServiceV2
Creates a new scalar in the Seeq database or overwrites an existing item with the same DatasourceClass/DatasourceId/DataId if it already exists. This method is deprecated - use PutScalarInputV1 as the argument instead, which enables use of previousDataId property. Scalar values should be set in the Formula field of PutScalarInputV1, in a format that can be parsed by the Seeq Formula language. Units should be set in the UnitOfMeasure field as they will be parsed more permissively and applied to the Formula if they can be parsed to a Seeq standard unit. Unrecognized units in this field will result in a unitless Scalar, but unrecognized units in the Formula will lead to rejection of the Scalar.- Specified by:
putScalar
in interfaceDatasourceConnectionServiceV2
- Parameters:
scalarDefinition
- An Object describing the properties of the scalar.- Returns:
- The list of items created in Seeq during this call. The return value will be null if the items are being queued into a batch.
- Throws:
com.seeq.ApiException
- If there is an error communicating with Seeq server, or Seeq server returns an error code during communication.
-
flushScalars
Description copied from interface:DatasourceConnectionServiceV2
Writes the scalar buffer to the Seeq application server. This function should be called if it is important that the scalars exist in the Seeq database before any other activity takes place.- Specified by:
flushScalars
in interfaceDatasourceConnectionServiceV2
- Returns:
- The list of items created in Seeq during this call.
- Throws:
com.seeq.ApiException
- If there is an error communicating with Seeq server, or Seeq server returns an error code during communication.
-
putAsset
public List<com.seeq.model.ItemUpdateOutputV1> putAsset(com.seeq.model.PutAssetInputV1 assetDefinition) throws com.seeq.ApiException Description copied from interface:DatasourceConnectionServiceV2
Creates a new asset in the Seeq database.- Specified by:
putAsset
in interfaceDatasourceConnectionServiceV2
- Parameters:
assetDefinition
- An Object describing the properties of the asset.- Returns:
- The list of items created in Seeq during this call. The return value will be null if the items are being queued into a batch.
- Throws:
com.seeq.ApiException
- If there is an error communicating with Seeq server, or Seeq server returns an error code during communication.
-
putAsset
public List<com.seeq.model.ItemUpdateOutputV1> putAsset(com.seeq.model.AssetInputV1 assetDefinition) throws com.seeq.ApiException Description copied from interface:DatasourceConnectionServiceV2
Creates a new asset in the Seeq database. This method is deprecated - use PutAssetInputV1 as the argument instead, which enables use of previousDataId property.- Specified by:
putAsset
in interfaceDatasourceConnectionServiceV2
- Parameters:
assetDefinition
- An Object describing the properties of the asset.- Returns:
- The list of items created in Seeq during this call. The return value will be null if the items are being queued into a batch.
- Throws:
com.seeq.ApiException
- If there is an error communicating with Seeq server, or Seeq server returns an error code during communication.
-
putRootAsset
public List<com.seeq.model.ItemUpdateOutputV1> putRootAsset(com.seeq.model.PutAssetInputV1 assetDefinition) throws com.seeq.ApiException Description copied from interface:DatasourceConnectionServiceV2
Creates a new asset in the Seeq database at the root of the asset tree.- Specified by:
putRootAsset
in interfaceDatasourceConnectionServiceV2
- Parameters:
assetDefinition
- An Object describing the properties of the root asset.- Returns:
- The list of items created in Seeq during this call. The return value will be null if the items are being queued into a batch.
- Throws:
com.seeq.ApiException
- If there is an error communicating with Seeq server, or Seeq server returns an error code during communication.
-
putRootAsset
public List<com.seeq.model.ItemUpdateOutputV1> putRootAsset(com.seeq.model.AssetInputV1 assetDefinition) throws com.seeq.ApiException Description copied from interface:DatasourceConnectionServiceV2
Creates a new asset in the Seeq database at the root of the asset tree. This method is deprecated - use PutAssetInputV1 as the argument instead, which enables use of previousDataId property.- Specified by:
putRootAsset
in interfaceDatasourceConnectionServiceV2
- Parameters:
assetDefinition
- An Object describing the properties of the root asset.- Returns:
- The list of items created in Seeq during this call. The return value will be null if the items are being queued into a batch.
- Throws:
com.seeq.ApiException
- If there is an error communicating with Seeq server, or Seeq server returns an error code during communication.
-
flushAssets
Description copied from interface:DatasourceConnectionServiceV2
Writes the asset buffer to the Seeq application server. This function should be called if it is important that the assets exist in the Seeq database before any other activity takes place.- Specified by:
flushAssets
in interfaceDatasourceConnectionServiceV2
- Returns:
- The list of items created in Seeq during this call.
- Throws:
com.seeq.ApiException
- If there is an error communicating with Seeq server, or Seeq server returns an error code during communication.
-
flushRootAssets
Description copied from interface:DatasourceConnectionServiceV2
Writes the root asset buffer to the Seeq application server. This function should be called if it is important that the root assets exist in the Seeq database before any other activity takes place.- Specified by:
flushRootAssets
in interfaceDatasourceConnectionServiceV2
- Returns:
- The list of items created in Seeq during this call.
- Throws:
com.seeq.ApiException
- If there is an error communicating with Seeq server, or Seeq server returns an error code during communication.
-
putRelationship
public List<com.seeq.model.ItemUpdateOutputV1> putRelationship(com.seeq.model.AssetTreeSingleInputV1 relationshipDefinition) throws com.seeq.ApiException Description copied from interface:DatasourceConnectionServiceV2
Establishes a relationship in the Seeq database.- Specified by:
putRelationship
in interfaceDatasourceConnectionServiceV2
- Parameters:
relationshipDefinition
- The relationship to create.- Returns:
- The list of items created in Seeq during this call. The return value will be null if the items are being queued into a batch.
- Throws:
com.seeq.ApiException
- If there is an error communicating with Seeq server, or Seeq server returns an error code during communication.
-
flushRelationships
Description copied from interface:DatasourceConnectionServiceV2
Writes the buffer of relationships to the Seeq application server. This function should be called if it is important that the relationships exist in the Seeq database before any other activity takes place.- Specified by:
flushRelationships
in interfaceDatasourceConnectionServiceV2
- Returns:
- The list of items created in Seeq during this call.
- Throws:
com.seeq.ApiException
- If there is an error communicating with Seeq server, or Seeq server returns an error code during communication.
-
connect
protected void connect()Description copied from class:BaseConnection
Connect to the server (implemented by derived classes).- Specified by:
connect
in classBaseConnection
-
monitor
protected void monitor()Description copied from class:BaseConnection
A connector-specific test to ensure the connection is alive (implemented by derived classes).- Specified by:
monitor
in classBaseConnection
-
disconnect
protected void disconnect()Description copied from class:BaseConnection
Disconnect from the server (implemented by derived classes).- Specified by:
disconnect
in classBaseConnection
-
log
public org.slf4j.Logger log()Description copied from interface:DatasourceConnectionServiceV2
Prints diagnostic messages to the Seeq agent log file (and the console). The logging facility used is Logback. The log file is in the Seeq data folder: "log/jvm-link/jvm-link.log". When using the Debugging Agent, logs are only sent to the debug console.- Specified by:
log
in interfaceDatasourceConnectionServiceV2
- Returns:
- logging interface
-
setDatasourceItemTypeCleanupFilter
Description copied from interface:DatasourceConnectionServiceV2
Sets the datasource item type cleanup filter. By default, the filter is set to null (meaning no filter is applied, all items are considered in cleaning up of stale items)- Specified by:
setDatasourceItemTypeCleanupFilter
in interfaceDatasourceConnectionServiceV2
- Parameters:
itemTypeCleanupFilter
- List of item types to be considered in datasource cleanup process
-
setDatasourceItemDataIdRegexFilter
Description copied from interface:DatasourceConnectionServiceV2
Sets the datasource item DataId Regex filter. When set, only items having the DataId matching the RegEx will be included in the cleanup process. By default, the filter is set to null (meaning that all items are considered in cleaning up of stale items).- Specified by:
setDatasourceItemDataIdRegexFilter
in interfaceDatasourceConnectionServiceV2
- Parameters:
regex
- the Regex to apply
-
setDatasourceItemDataIdExcludeRegexFilter
Description copied from interface:DatasourceConnectionServiceV2
Sets the datasource item DataId exclude Regex filter. When set, the items having the DataID matching the RegEx will be excluded from cleanup process. By default, the filter is set to null (meaning that all items are considered in cleaning up of stale items).- Specified by:
setDatasourceItemDataIdExcludeRegexFilter
in interfaceDatasourceConnectionServiceV2
- Parameters:
regex
- the Regex to apply
-
setDatasourceItemNameRegexFilter
Description copied from interface:DatasourceConnectionServiceV2
Sets the datasource item name Regex filter. When set, only items having the name matching the RegEx will be included in the cleanup process. By default, the filter is set to null (meaning that all items are considered in cleaning up of stale items).- Specified by:
setDatasourceItemNameRegexFilter
in interfaceDatasourceConnectionServiceV2
- Parameters:
regex
- the Regex to apply
-
setDatasourceItemNameExcludeRegexFilter
Description copied from interface:DatasourceConnectionServiceV2
Sets the datasource item name exclude Regex filter. When set, the items having the name matching the RegEx will be excluded from cleanup process. By default, the filter is set to null (meaning that all items are considered in cleaning up of stale items).- Specified by:
setDatasourceItemNameExcludeRegexFilter
in interfaceDatasourceConnectionServiceV2
- Parameters:
regex
- the Regex to apply
-
getLog
public org.slf4j.Logger getLog() -
signalRequest
public com.seeq.link.sdk.BaseDatasourceConnection.ResponseWithDatumInfo<SignalConnectionMessages.SignalResponseMessage> signalRequest(SignalConnectionMessages.SignalRequestMessage request) throws Exception - Throws:
Exception
-
conditionRequest
public com.seeq.link.sdk.BaseDatasourceConnection.ResponseWithDatumInfo<ConditionConnectionMessages.ConditionResponseMessage> conditionRequest(ConditionConnectionMessages.ConditionRequestMessage request) throws Exception - Throws:
Exception
-
calculationRequest
public ExternalCalculationMessages.ExternalCalculationResponseMessage calculationRequest(ExternalCalculationMessages.ExternalCalculationRequestMessage request) -
authRequest
public AuthConnectionMessages.AuthResponseMessage authRequest(AuthConnectionMessages.AuthRequestMessage request) -
oAuth2AuthRequest
public OAuth2ConnectionMessages.OAuth2AuthResponseMessage oAuth2AuthRequest(OAuth2ConnectionMessages.OAuth2AuthRequestMessage oAuth2AuthRequest) -
oAuth2PreAuthRequest
public OAuth2ConnectionMessages.OAuth2PreAuthResponseMessage oAuth2PreAuthRequest(OAuth2ConnectionMessages.OAuth2PreAuthRequestMessage oAuth2PreAuthRequest) -
saveConfig
public void saveConfig()Description copied from interface:DatasourceConnection
Called by an Agent when the agent has changed the connection's configuration (usually due to the indexing schedule being updated.- Specified by:
saveConfig
in interfaceDatasourceConnection
-
initializeExport
Description copied from interface:DatasourceConnectionServiceV2
If the connector supports exporting from Seeq to the datasource, this method must be called during each connection's Initialize() method.- Specified by:
initializeExport
in interfaceDatasourceConnectionServiceV2
- Parameters:
exportInterface
- The IExportSamples interface used to put samples in the external datasource.exportConfig
- The configuration that dictates how exporting takes place and what signals need to be created in the external system to receive the exported data.
-
getAgentService
-
getConnector
-
getDatasourceClass
Description copied from interface:DatasourceConnection
The human readable name of the type of data source this connection is to.- Specified by:
getDatasourceClass
in interfaceDatasourceConnection
- Returns:
- the datasource class
-
getDatasourceName
Description copied from interface:DatasourceConnection
A human readable name for the data source this connection is to.- Specified by:
getDatasourceName
in interfaceDatasourceConnection
- Returns:
- the datasource name
-
getDatasourceId
Description copied from interface:DatasourceConnection
The unique identifier of the data source this connection is to.- Specified by:
getDatasourceId
in interfaceDatasourceConnection
- Returns:
- the datasource ID
-
getServices
Description copied from interface:DatasourceConnection
The type(s) of data that this connection provides.- Specified by:
getServices
in interfaceDatasourceConnection
- Returns:
- the datasource service(s)
-
getConnectionId
Description copied from class:BaseConnection
The connection ID used to connect to the server.- Specified by:
getConnectionId
in interfaceDatasourceConnection
- Specified by:
getConnectionId
in classBaseConnection
- Returns:
- the connection ID
-
getIndexingSchedule
Description copied from interface:DatasourceConnection
The indexing schedule for this connection, including the time and period of delay.- Specified by:
getIndexingSchedule
in interfaceDatasourceConnection
- Returns:
- indexing schedule for this connection.
-
getCurrentIndexingRequestSyncMode
Description copied from interface:DatasourceConnection
The current indexing requests's sync mode- Specified by:
getCurrentIndexingRequestSyncMode
in interfaceDatasourceConnection
- Returns:
- the sync mode of the current indexing request
-
setCurrentIndexingRequestSyncMode
Description copied from interface:DatasourceConnection
Sets the current indexing requests's sync mode- Specified by:
setCurrentIndexingRequestSyncMode
in interfaceDatasourceConnection
- Parameters:
syncMode
- the new sync mode of the current indexing request
-
getIndexingState
Description copied from interface:DatasourceConnection
The current state of indexing, including item counts and sync status.- Specified by:
getIndexingState
in interfaceDatasourceConnection
- Returns:
- current state of indexing
-
toString
-
processMessage
Description copied from interface:DatasourceConnection
Handles messages intended for this connector.- Specified by:
processMessage
in interfaceDatasourceConnection
- Parameters:
data
- the data to be handled by the connection
-
sendMessage
-
spawnMetadataSync
Description copied from interface:DatasourceConnection
Spawn a thread and runs metadataSync() on it. This ensures the sync happens asynchronously and that there is only one sync at a time, per connection.- Specified by:
spawnMetadataSync
in interfaceDatasourceConnection
- Parameters:
syncMode
- Indicates whether to perform a full or incremental synccallback
- Callback that takes aSyncResult
to indicate success/failure/cancellation
-
getOrCreateDatasource
public com.seeq.link.sdk.BaseDatasourceConnection.DatasourceAndCreationInfo getOrCreateDatasource(boolean storedInSeeq) Get information about a datasource with the specified identifier. If the identifier matches an existing datasource, its information will be returned, otherwise a new datasource will be created and returned. If multiple datasources are found, or a single datasource cannot be created or retrieved, returns null.- Parameters:
storedInSeeq
- Whether this datasource's data will be stored in Seeq (true) or a remote datasource (false). If set to true, the datasource will also get default "Signal Location" and "Condition Location" properties, which determine where in Seeq those items are stored. These can be changed after datasource creation.- Returns:
- Information about the datasource and whether it was newly created
-
getOrCreateDatasource
public com.seeq.link.sdk.BaseDatasourceConnection.DatasourceAndCreationInfo getOrCreateDatasource(boolean storedInSeeq, boolean enableCache) Get information about a datasource with the specified identifier. If the identifier matches an existing datasource, its information will be returned, otherwise a new datasource will be created and returned. If multiple datasources are found, or a single datasource cannot be created or retrieved, returns null.- Parameters:
storedInSeeq
- Whether this datasource's data will be stored in Seeq (true) or a remote datasource (false). If set to true, the datasource will also get default "Signal Location" and "Condition Location" properties, which determine where in Seeq those items are stored. These can be changed after datasource creation.enableCache
- Whether this datasource's signal will be cached in Seeq.- Returns:
- Information about the datasource and whether it was newly created
-
getOrCreateDatasource
public com.seeq.link.sdk.BaseDatasourceConnection.DatasourceAndCreationInfo getOrCreateDatasource(boolean storedInSeeq, boolean enableCache, List<com.seeq.model.ScalarPropertyV1> additionalProperties) Get information about a datasource with the specified identifier. If the identifier matches an existing datasource, its information will be returned, otherwise a new datasource will be created and returned. If multiple datasources are found, or a single datasource cannot be created or retrieved, returns null.- Parameters:
storedInSeeq
- Whether this datasource's data will be stored in Seeq (true) or a remote datasource (false). If set to true, the datasource will also get default "Signal Location" and "Condition Location" properties, which determine where in Seeq those items are stored. These can be changed after datasource creation.enableCache
- Whether this datasource's signal will be cached in Seeq.additionalProperties
- Additional properties that should be set on the datasource. The 'normal' datasource properties cannot be set with this parameter, only 'custom' properties.- Returns:
- Information about the datasource and whether it was newly created
-
updateExistingDatasource
protected com.seeq.model.DatasourceOutputV1 updateExistingDatasource(com.seeq.model.DatasourceOutputV1 datasource, boolean storedInSeeq, List<com.seeq.model.ScalarPropertyV1> additionalProperties) Updates an existing datasource in Seeq by changing its additional properties and storedInSeeq flag- Parameters:
datasource
- the datasource to updatestoredInSeeq
- Whether this datasource's data will be stored in Seeq (true) or a remote datasource (false). If set to true, the datasource will also get default "Signal Location" and "Condition Location" properties, which determine where in Seeq those items are stored. These can be changed after datasource creation.additionalProperties
- Additional properties that should be set on the datasource. The 'normal' datasource properties cannot be set with this parameter, only 'custom' properties.- Returns:
- the datasource object retrieved from seeq after update or the same datasource object received as parameter if no update was necessary
-
buildErrorMessage
protected ErrorMessage.ErrorInfo buildErrorMessage(Exception e, SignalConnectionMessages.SignalRequestMessage request) Given data-request-specific information, build an ErrorInfo message.- Parameters:
e
- The exception.request
- The signal request.- Returns:
- An ErrorInfo message.
-
buildErrorMessage
protected ErrorMessage.ErrorInfo buildErrorMessage(Exception e, ConditionConnectionMessages.ConditionRequestMessage request) Given data-request-specific information, build an ErrorInfo message.- Parameters:
e
- The exception.request
- The condition request.- Returns:
- An ErrorInfo message.
-
buildDataRequestErrorMessage
protected ErrorMessage.ErrorInfo buildDataRequestErrorMessage(Exception e, String requestType, String dataId, long start, long end) Given data-request-specific information, build an ErrorInfo message.- Parameters:
e
- The exception.requestType
- The type of request the error pertains to, e.g. 'signal' or 'condition'.dataId
- The dataId requested.start
- The request start.end
- The request end.- Returns:
- An ErrorInfo message.
-
buildErrorMessage
protected ErrorMessage.ErrorInfo buildErrorMessage(ErrorMessage.ErrorCode errorCode, Exception e, String message) Given an error code, an optional exception, and an additional error message, build an ErrorInfo message.- Parameters:
errorCode
- An error code indicating the general class of the error.e
- The exception.message
- A message to add to the error message.- Returns:
- An ErrorInfo message.
-
setSyncStatus
protected void setSyncStatus(SyncStatus syncStatus) throws com.seeq.utilities.exception.OperationCanceledException Save the sync status to be sent to Appserver via the agent status API.- Parameters:
syncStatus
- The current sync status for this datasource.- Throws:
com.seeq.utilities.exception.OperationCanceledException
- Thrown if indexing is being canceled, often due to a configuration change
-
sendSyncToken
Inform Appserver of the sync token for a sync about to take place. Used to track progress.- Parameters:
datasourceItemId
- The item ID for the datasource representing this connection.syncToken
- The sync token on signals, assets, etc that are part of this sync.syncMode
- The sync mode (INCREMENTAL, FULL).
-
logAndCountBadItems
-
batchMoveNodesToParentsJob
protected static List<com.seeq.model.ItemUpdateOutputV1> batchMoveNodesToParentsJob(org.slf4j.Logger log, com.seeq.api.TreesApi treesApi, com.seeq.api.JobsApi jobsApi, com.seeq.model.AssetTreeBatchInputV1 treeBatchInput) -
cancelRequest
Cancel a running request. We use this to prevent a previous long-running clean-up request from overlapping with a subsequent metadata sync. Note: this shouldn't be necessary during normal operation. This is to guard from inconsistent data if an agent is restarted while the clean-up process continues to run on Appserver.- Parameters:
requestId
- The unique identifier that was provided when creating the request- Throws:
com.seeq.ApiException
- Thrown if request cannot be cancelled
-
cleanUpStaleItems
protected void cleanUpStaleItems(String datasourceItemId, String syncToken, List<String> itemTypesFilter, String datasourceItemDataIdRegexFilter, String datasourceItemDataIdExcludeRegexFilter, String datasourceItemNameRegexFilter, String datasourceItemNameExcludeRegexFilter, String requestId) throws com.seeq.ApiException Call the Seeq Appserver to clean up (archive) any stale items in this datasource.- Parameters:
datasourceItemId
- The datasource item ID to clean up stale items onsyncToken
- The sync token that specifies which items to preserveitemTypesFilter
- The list of item types on which cleanup will be done. When no filter is specified, all types of items will be included in the cleanup processdatasourceItemDataIdRegexFilter
- The datasource item DataId Regex filter. When set, only items having DataId matching the RegEx will be included in the cleanup process.datasourceItemDataIdExcludeRegexFilter
- The datasource item DataId exclude Regex filter. When set, the items having DataID matching the RegEx will be excluded from cleanup process.datasourceItemNameRegexFilter
- The datasource item name Regex filter. When set, only items having the name matching the RegEx will be included in the cleanup process.datasourceItemNameExcludeRegexFilter
- The datasource item name exclude Regex filter. When set, the items having the name matching the RegEx will be excluded from cleanup process.requestId
- A requestID to use for cancellation purposes- Throws:
com.seeq.ApiException
- Thrown if an unhandled Seeq API exception is thrown
-