Package com.seeq.link.sdk
Class ConnectorV2Host
java.lang.Object
com.seeq.link.sdk.ConnectorV2Host
- All Implemented Interfaces:
Connector
,ConnectorServiceV2
Hosts an IConnectorV2-based connector and acts as a bridge to the older IConnector interface via the
IConnectorServiceV2 interface.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addConnection
(DatasourceConnectionV2 connection) Must be used when connections are established to external systems.void
destroy()
Performs cleanup of a connector as necessary, removing all connections and releasing all resources.static AgentMessages.DatasourceService[]
determineServices
(DatasourceConnectionV2 connection) Retrieves the agent service that can be used to access the REST API directly, among other things.Get all the connections that this connector has made.Event for state changes of the connector's connection(s).getName()
The name of the connector, as determined by the connector.void
initialize
(AgentService agentService) Initializes a connector with the agent service interface it will use to communicate to Seeq Server.loadConfig
(ConfigObject[] supportedObjects) Reads the configuration object from disk from the expected location (configuration/link within the data folder).org.slf4j.Logger
log()
Prints diagnostic messages to the Seeq agent log file (and the console).boolean
processMessage
(String destinationConnectorInstanceId, AgentMessages.DataDocument document) Called by an Agent when a data document is received from Seeq Server.void
Called by a connection when it wants its configuration saved.void
saveConfig
(ConfigObject configObject) Writes the configuration object to disk in the expected location (configuration/link within the data folder).void
setConnectorDeveloperName
(String connectorDeveloperName) This should be called by Connectors in the beginning of initialize() to set the developer's name.void
setConnectorDeveloperSupportUrl
(String connectorDeveloperSupportUrl) This should be called by Connectors in the beginning of initialize() to set the developer's support URL.
-
Constructor Details
-
ConnectorV2Host
-
-
Method Details
-
log
public org.slf4j.Logger log()Description copied from interface:ConnectorServiceV2
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 interfaceConnectorServiceV2
- Returns:
- logging facility
-
getName
Description copied from interface:Connector
The name of the connector, as determined by the connector. This String may contain a unique identifier for the external database that is being connected to. -
getConnections
Description copied from interface:Connector
Get all the connections that this connector has made.- Specified by:
getConnections
in interfaceConnector
- Returns:
- A Collection of connections.
-
getConnectionStateChangedEvent
Description copied from interface:Connector
Event for state changes of the connector's connection(s).- Specified by:
getConnectionStateChangedEvent
in interfaceConnector
- Returns:
- the state changed event
-
determineServices
public static AgentMessages.DatasourceService[] determineServices(DatasourceConnectionV2 connection) -
addConnection
Description copied from interface:ConnectorServiceV2
Must be used when connections are established to external systems. Note: This function is used even if connections are disabled.- Specified by:
addConnection
in interfaceConnectorServiceV2
- Parameters:
connection
- The connection being established.
-
getAgentService
Description copied from interface:ConnectorServiceV2
Retrieves the agent service that can be used to access the REST API directly, among other things.- Specified by:
getAgentService
in interfaceConnectorServiceV2
- Returns:
- The agent service.
-
initialize
Description copied from interface:Connector
Initializes a connector with the agent service interface it will use to communicate to Seeq Server. The implementation of this function can choose to automatically establish connections based on a global registry (like the PI "Known Servers Table").- Specified by:
initialize
in interfaceConnector
- Parameters:
agentService
- The agent that is hosting this connector.- Throws:
Exception
- Thrown if connector had an issue initializing.
-
destroy
public void destroy()Description copied from interface:Connector
Performs cleanup of a connector as necessary, removing all connections and releasing all resources. -
processMessage
public boolean processMessage(String destinationConnectorInstanceId, AgentMessages.DataDocument document) Description copied from interface:Connector
Called by an Agent when a data document is received from Seeq Server. It is the connector's responsibility to determine whether to handle the document.- Specified by:
processMessage
in interfaceConnector
- Parameters:
destinationConnectorInstanceId
- A connector-specific identifier used to route the message within the connector.document
- The message payload.- Returns:
- true if the message was processed by the connector, false if it was ignored
-
loadConfig
Description copied from interface:ConnectorServiceV2
Reads the configuration object from disk from the expected location (configuration/link within the data folder).- Specified by:
loadConfig
in interfaceConnectorServiceV2
- Parameters:
supportedObjects
- An array of object types to try loading. If the config file is not present, or none of the class types could successfully serialize the JSON, then the first item in the array is returned. This serves as mechanism for providing the "default" config object class.- Returns:
- The serialized config object, or the first item in
supportedObjects
. - Throws:
IOException
- Thrown if there is a problem reading the configuration file
-
saveConfig
public void saveConfig()Description copied from interface:Connector
Called by a connection when it wants its configuration saved.- Specified by:
saveConfig
in interfaceConnector
-
saveConfig
Description copied from interface:ConnectorServiceV2
Writes the configuration object to disk in the expected location (configuration/link within the data folder).- Specified by:
saveConfig
in interfaceConnectorServiceV2
- Parameters:
configObject
- The configuration object to write
-
setConnectorDeveloperName
Description copied from interface:ConnectorServiceV2
This should be called by Connectors in the beginning of initialize() to set the developer's name. This name is displayed in the user interface so users know who to contact when they need support.- Specified by:
setConnectorDeveloperName
in interfaceConnectorServiceV2
-
setConnectorDeveloperSupportUrl
Description copied from interface:ConnectorServiceV2
This should be called by Connectors in the beginning of initialize() to set the developer's support URL. This URL is displayed in the user interface so users know who to contact when they need support.- Specified by:
setConnectorDeveloperSupportUrl
in interfaceConnectorServiceV2
-
getConnectorDeveloperName
- Specified by:
getConnectorDeveloperName
in interfaceConnectorServiceV2
- Returns:
- the name of the connector's developer, as set by setConnectorDeveloperName().
-
getConnectorDeveloperSupportUrl
- Specified by:
getConnectorDeveloperSupportUrl
in interfaceConnectorServiceV2
- Returns:
- the support URL of the connector's developer, as set by setConnectorDeveloperSupportUrl().
-