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.
  • Field Details

  • Method Details

    • initialize

      public void initialize()
      Description copied from interface: Connection
      Initializes a connection, attempting to connect if enabled.
      Specified by:
      initialize in interface Connection
      Specified by:
      initialize in class BaseConnection
    • isLicensed

      public boolean isLicensed(String featureName)
      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 interface DatasourceConnectionServiceV2
      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 interface Connection
    • setConnectionState

      public void setConnectionState(Connection.ConnectionState newState)
      Description copied from interface: DatasourceConnectionServiceV2
      Called by the connect/monitor/disconnect functions if the state of the connection changes.
      Specified by:
      setConnectionState in interface DatasourceConnectionServiceV2
      Parameters:
      newState - The new state to which the connection is being transitioned.
    • setConnectionStatusMessage

      public void setConnectionStatusMessage(String message)
      Description copied from interface: DatasourceConnectionServiceV2
      Called by the connect/monitor/disconnect functions to set a new connection status message.
      Specified by:
      setConnectionStatusMessage in interface DatasourceConnectionServiceV2
      Parameters:
      message - The new status message.
    • handleConnectionMonitorException

      protected void handleConnectionMonitorException(String methodName, Exception exception)
      Overrides:
      handleConnectionMonitorException in class BaseConnection
    • getConnectionState

      public Connection.ConnectionState getConnectionState()
      Description copied from interface: DatasourceConnectionServiceV2
      Provides the current state of the connection to the external datasource.
      Specified by:
      getConnectionState in interface DatasourceConnectionServiceV2
      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 interface DatasourceConnectionServiceV2
      Returns:
      Information about the datasource this connection services
    • skipArchiving

      public void skipArchiving()
      Description copied from interface: DatasourceConnectionServiceV2
      If called from the IndexingDatasourceConnection.index(SyncMode) method, archiving will be skipped after indexing has finished. The default is that any items not present during a SyncMode.FULL sync will be archived in Seeq; this skips that step.
      Specified by:
      skipArchiving in interface DatasourceConnectionServiceV2
    • 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 interface DatasourceConnectionServiceV2
      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

      public void deleteDatasourceProperties(List<String> additionalPropertiesToDelete)
      Description copied from interface: DatasourceConnectionServiceV2
      Deletes the specified properties from the datasource
      Specified by:
      deleteDatasourceProperties in interface DatasourceConnectionServiceV2
      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 interface DatasourceConnection
      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 interface DatasourceConnection
      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 interface DatasourceConnection
      Returns:
      True, if metadata sync can be triggered from outside the connector, false otherwise
    • metadataSync

      public void metadataSync(SyncMode syncMode) throws Exception
      Description copied from interface: DatasourceConnection
      Sync metadata with the appserver.
      Specified by:
      metadataSync in interface DatasourceConnection
      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

      public void setTransforms(List<PropertyTransformer.Spec> transforms)
      Description copied from interface: DatasourceConnectionServiceV2
      Sets a list of transforms to apply to all indexed signals.
      Specified by:
      setTransforms in interface DatasourceConnectionServiceV2
      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 interface DatasourceConnectionServiceV2
      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

      public List<com.seeq.model.ItemUpdateOutputV1> flushSignals() throws com.seeq.ApiException
      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 interface DatasourceConnectionServiceV2
      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 interface DatasourceConnectionServiceV2
      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

      public List<com.seeq.model.ItemUpdateOutputV1> flushUserGroups() throws com.seeq.ApiException
      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 interface DatasourceConnectionServiceV2
      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 interface DatasourceConnectionServiceV2
      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

      public List<com.seeq.model.ItemUpdateOutputV1> flushConditions() throws com.seeq.ApiException
      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 interface DatasourceConnectionServiceV2
      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 interface DatasourceConnectionServiceV2
      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 interface DatasourceConnectionServiceV2
      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

      public List<com.seeq.model.ItemUpdateOutputV1> flushScalars() throws com.seeq.ApiException
      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 interface DatasourceConnectionServiceV2
      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 interface DatasourceConnectionServiceV2
      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 interface DatasourceConnectionServiceV2
      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 interface DatasourceConnectionServiceV2
      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 interface DatasourceConnectionServiceV2
      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

      public List<com.seeq.model.ItemUpdateOutputV1> flushAssets() throws com.seeq.ApiException
      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 interface DatasourceConnectionServiceV2
      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

      public List<com.seeq.model.ItemUpdateOutputV1> flushRootAssets() throws com.seeq.ApiException
      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 interface DatasourceConnectionServiceV2
      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 interface DatasourceConnectionServiceV2
      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

      public List<com.seeq.model.ItemUpdateOutputV1> flushRelationships() throws com.seeq.ApiException
      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 interface DatasourceConnectionServiceV2
      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 class BaseConnection
    • 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 class BaseConnection
    • disconnect

      protected void disconnect()
      Description copied from class: BaseConnection
      Disconnect from the server (implemented by derived classes).
      Specified by:
      disconnect in class BaseConnection
    • 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 interface DatasourceConnectionServiceV2
      Returns:
      logging interface
    • setDatasourceItemTypeCleanupFilter

      public void setDatasourceItemTypeCleanupFilter(List<String> itemTypeCleanupFilter)
      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 interface DatasourceConnectionServiceV2
      Parameters:
      itemTypeCleanupFilter - List of item types to be considered in datasource cleanup process
    • setDatasourceItemDataIdRegexFilter

      public void setDatasourceItemDataIdRegexFilter(String regex)
      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 interface DatasourceConnectionServiceV2
      Parameters:
      regex - the Regex to apply
    • setDatasourceItemDataIdExcludeRegexFilter

      public void setDatasourceItemDataIdExcludeRegexFilter(String regex)
      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 interface DatasourceConnectionServiceV2
      Parameters:
      regex - the Regex to apply
    • setDatasourceItemNameRegexFilter

      public void setDatasourceItemNameRegexFilter(String regex)
      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 interface DatasourceConnectionServiceV2
      Parameters:
      regex - the Regex to apply
    • setDatasourceItemNameExcludeRegexFilter

      public void setDatasourceItemNameExcludeRegexFilter(String regex)
      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 interface DatasourceConnectionServiceV2
      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

    • authRequest

    • oAuth2AuthRequest

    • 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 interface DatasourceConnection
    • initializeExport

      public void initializeExport(ExportSamples exportInterface, ExportConnectionConfigV1 exportConfig)
      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 interface DatasourceConnectionServiceV2
      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

      public AgentService getAgentService()
    • getConnector

      public ConnectorV2Host getConnector()
    • getDatasourceClass

      public String getDatasourceClass()
      Description copied from interface: DatasourceConnection
      The human readable name of the type of data source this connection is to.
      Specified by:
      getDatasourceClass in interface DatasourceConnection
      Returns:
      the datasource class
    • getDatasourceName

      public String getDatasourceName()
      Description copied from interface: DatasourceConnection
      A human readable name for the data source this connection is to.
      Specified by:
      getDatasourceName in interface DatasourceConnection
      Returns:
      the datasource name
    • getDatasourceId

      public String getDatasourceId()
      Description copied from interface: DatasourceConnection
      The unique identifier of the data source this connection is to.
      Specified by:
      getDatasourceId in interface DatasourceConnection
      Returns:
      the datasource ID
    • getServices

      public AgentMessages.DatasourceService[] getServices()
      Description copied from interface: DatasourceConnection
      The type(s) of data that this connection provides.
      Specified by:
      getServices in interface DatasourceConnection
      Returns:
      the datasource service(s)
    • getConnectionId

      public String getConnectionId()
      Description copied from class: BaseConnection
      The connection ID used to connect to the server.
      Specified by:
      getConnectionId in interface DatasourceConnection
      Specified by:
      getConnectionId in class BaseConnection
      Returns:
      the connection ID
    • getIndexingSchedule

      public IndexingSchedule getIndexingSchedule()
      Description copied from interface: DatasourceConnection
      The indexing schedule for this connection, including the time and period of delay.
      Specified by:
      getIndexingSchedule in interface DatasourceConnection
      Returns:
      indexing schedule for this connection.
    • getCurrentIndexingRequestSyncMode

      public SyncMode getCurrentIndexingRequestSyncMode()
      Description copied from interface: DatasourceConnection
      The current indexing requests's sync mode
      Specified by:
      getCurrentIndexingRequestSyncMode in interface DatasourceConnection
      Returns:
      the sync mode of the current indexing request
    • setCurrentIndexingRequestSyncMode

      public void setCurrentIndexingRequestSyncMode(SyncMode syncMode)
      Description copied from interface: DatasourceConnection
      Sets the current indexing requests's sync mode
      Specified by:
      setCurrentIndexingRequestSyncMode in interface DatasourceConnection
      Parameters:
      syncMode - the new sync mode of the current indexing request
    • getIndexingState

      public IndexingState getIndexingState()
      Description copied from interface: DatasourceConnection
      The current state of indexing, including item counts and sync status.
      Specified by:
      getIndexingState in interface DatasourceConnection
      Returns:
      current state of indexing
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • processMessage

      public void processMessage(AgentMessages.DataDocument data)
      Description copied from interface: DatasourceConnection
      Handles messages intended for this connector.
      Specified by:
      processMessage in interface DatasourceConnection
      Parameters:
      data - the data to be handled by the connection
    • sendMessage

      protected void sendMessage(AgentMessages.DataDocument data)
    • spawnMetadataSync

      public void spawnMetadataSync(SyncMode syncMode, Consumer<SyncResult> callback)
      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 interface DatasourceConnection
      Parameters:
      syncMode - Indicates whether to perform a full or incremental sync
      callback - Callback that takes a SyncResult 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 update
      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.
      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

      Given data-request-specific information, build an ErrorInfo message.
      Parameters:
      e - The exception.
      request - The signal request.
      Returns:
      An ErrorInfo message.
    • buildErrorMessage

      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

      protected void sendSyncToken(String datasourceItemId, String syncToken, String syncMode)
      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

      protected void logAndCountBadItems(List<com.seeq.model.ItemUpdateOutputV1> items)
    • 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

      protected void cancelRequest(String requestId) throws com.seeq.ApiException
      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 on
      syncToken - The sync token that specifies which items to preserve
      itemTypesFilter - 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 process
      datasourceItemDataIdRegexFilter - 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