Class WatchdogActionServiceConnector
java.lang.Object
org.odpi.openmetadata.frameworks.connectors.Connector
org.odpi.openmetadata.frameworks.connectors.ConnectorBase
org.odpi.openmetadata.frameworks.openwatchdog.WatchdogActionServiceConnector
- All Implemented Interfaces:
AuditLoggingComponent
,SecureConnectorExtension
,VirtualConnectorExtension
,WatchdogActionService
- Direct Known Subclasses:
OpenMetadataNotificationService
public abstract class WatchdogActionServiceConnector
extends ConnectorBase
implements WatchdogActionService, AuditLoggingComponent
WatchdogActionServiceConnector describes a specific type of connector that is responsible for monitoring for
a specific notification type. Information about the notification type to support is passed in the watchdog context.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.odpi.openmetadata.frameworks.connectors.ConnectorBase
ConnectorBase.ProtectedConnection
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AuditLog
protected Connector
protected static com.fasterxml.jackson.databind.ObjectMapper
protected final PropertyHelper
protected String
protected WatchdogContext
Fields inherited from class org.odpi.openmetadata.frameworks.connectors.ConnectorBase
connectionBean, connectorInstanceId, messageFormatter, secretsStoreConnectorMap
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Free up any resources held since the connector is no longer needed.Return the component description that is used by this connector in the audit log.getJSONProperties
(Object properties) Convert the supplied properties object to a JSON String.protected WatchdogContext
Return the survey context for this watchdog action service.protected void
handleUnexpectedException
(String methodName, Exception error) Provide a common exception for unexpected errors.abstract void
This method is called each time a requested event is received from the open metadata repositories.void
setAuditLog
(AuditLog auditLog) Receive an audit log object that can be used to record audit log messages.void
setWatchdogActionServiceName
(String watchdogActionServiceName) Set up the watchdog action service name.void
setWatchdogContext
(WatchdogContext watchdogContext) Set up details of the notification type to monitor.void
start()
Indicates that the watchdog action service is completely configured and can begin processing.Methods inherited from class org.odpi.openmetadata.frameworks.connectors.ConnectorBase
combineConfigurationProperties, disconnectConnectors, equals, getArrayConfigurationProperty, getArrayConfigurationProperty, getArrayConfigurationProperty, getBooleanConfigurationProperty, getConnection, getConnectorInstanceId, getDateConfigurationProperty, getIntConfigurationProperty, getLongConfigurationProperty, getStringConfigurationProperty, getStringConfigurationProperty, getSuppliedPlaceholderProperties, hashCode, initialize, initializeEmbeddedConnectors, initializeSecretsStoreConnector, isActive, logExceptionRecord, logRecord, logRecord, throwMissingConfigurationProperty, throwMissingEndpointAddress, throwMissingResource, throwNoAsset, throwWrongTypeOfAsset, throwWrongTypeOfResource, throwWrongTypeOfRootSchema, toString
Methods inherited from class org.odpi.openmetadata.frameworks.connectors.Connector
clearStatisticProperty, clearStatisticTimestamp, getConnectorStatistics, getStatisticCounter, getStatisticProperty, getStatisticTimestamp, incrementStatisticCounter, initializeStatisticCounter, refreshStatistics, setStatisticProperty, setStatisticTimestamp
-
Field Details
-
propertyHelper
-
connector
-
objectMapper
protected static com.fasterxml.jackson.databind.ObjectMapper objectMapper -
watchdogActionServiceName
-
watchdogContext
-
auditLog
-
embeddedConnectors
-
-
Constructor Details
-
WatchdogActionServiceConnector
public WatchdogActionServiceConnector()
-
-
Method Details
-
setAuditLog
Receive an audit log object that can be used to record audit log messages. The caller has initialized it with the correct component description and log destinations.- Specified by:
setAuditLog
in interfaceAuditLoggingComponent
- Parameters:
auditLog
- audit log object
-
getConnectorComponentDescription
Return the component description that is used by this connector in the audit log.- Specified by:
getConnectorComponentDescription
in interfaceAuditLoggingComponent
- Returns:
- id, name, description, wiki page URL.
-
getJSONProperties
Convert the supplied properties object to a JSON String.- Parameters:
properties
- properties object- Returns:
- properties as a JSON String
- Throws:
PropertyServerException
- parsing error
-
setWatchdogContext
Set up details of the notification type to monitor.- Parameters:
watchdogContext
- information about the asset to analyze and the results of analysis of other watchdog action service request. Partial results from other watchdog action services run as part of the same watchdog action service request may also be stored in the newAnnotations list.
-
setWatchdogActionServiceName
Set up the watchdog action service name. This is used in error messages.- Parameters:
watchdogActionServiceName
- name of the watchdog action service
-
getWatchdogContext
Return the survey context for this watchdog action service. This is typically called after the disconnect() method is called. If called before disconnect(), it may only contain partial results.- Returns:
- survey context containing the results discovered (so far) by the watchdog action service.
- Throws:
UserNotAuthorizedException
- the service is no longer active
-
start
Indicates that the watchdog action service is completely configured and can begin processing. This is where the function of the watchdog action service is implemented. This is a standard method from the Open Connector Framework (OCF) so be sure to call super.start() in your version.- Overrides:
start
in classConnectorBase
- Throws:
ConnectorCheckedException
- there is a problem within the watchdog action service.UserNotAuthorizedException
- the service was disconnected before/during start
-
handleUnexpectedException
protected void handleUnexpectedException(String methodName, Exception error) throws ConnectorCheckedException Provide a common exception for unexpected errors.- Parameters:
methodName
- calling methoderror
- caught exception- Throws:
ConnectorCheckedException
- wrapped exception
-
processEvent
public abstract void processEvent(OpenMetadataOutTopicEvent event) throws GovernanceServiceException This method is called each time a requested event is received from the open metadata repositories. It is called for events received after this listener is registered until the watchdog governance service sets its status in the context as ACTIONED, INVALID, IGNORED or FAILED or it is stopped by an administrator shutting down the hosting server or this service explicitly.- Parameters:
event
- event containing details of a change to an open metadata element.- Throws:
GovernanceServiceException
- reports that the event can not be processed (this is logged but no other action is taken). The listener will continue to be called until the watchdog governance action service declares it is complete or administrator action shuts down the service.
-
disconnect
Free up any resources held since the connector is no longer needed.- Overrides:
disconnect
in classConnectorBase
- Throws:
ConnectorCheckedException
- there is a problem within the connector.
-