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

    • propertyHelper

      protected final PropertyHelper propertyHelper
    • connector

      protected Connector connector
    • objectMapper

      protected static com.fasterxml.jackson.databind.ObjectMapper objectMapper
    • watchdogActionServiceName

      protected String watchdogActionServiceName
    • watchdogContext

      protected WatchdogContext watchdogContext
    • auditLog

      protected AuditLog auditLog
    • embeddedConnectors

      protected List<Connector> embeddedConnectors
  • Constructor Details

    • WatchdogActionServiceConnector

      public WatchdogActionServiceConnector()
  • Method Details

    • setAuditLog

      public void setAuditLog(AuditLog auditLog)
      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 interface AuditLoggingComponent
      Parameters:
      auditLog - audit log object
    • getConnectorComponentDescription

      public ComponentDescription getConnectorComponentDescription()
      Return the component description that is used by this connector in the audit log.
      Specified by:
      getConnectorComponentDescription in interface AuditLoggingComponent
      Returns:
      id, name, description, wiki page URL.
    • getJSONProperties

      public String getJSONProperties(Object properties) throws PropertyServerException
      Convert the supplied properties object to a JSON String.
      Parameters:
      properties - properties object
      Returns:
      properties as a JSON String
      Throws:
      PropertyServerException - parsing error
    • setWatchdogContext

      public void setWatchdogContext(WatchdogContext watchdogContext)
      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

      public void setWatchdogActionServiceName(String watchdogActionServiceName)
      Set up the watchdog action service name. This is used in error messages.
      Parameters:
      watchdogActionServiceName - name of the watchdog action service
    • getWatchdogContext

      protected WatchdogContext getWatchdogContext() throws UserNotAuthorizedException
      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 class ConnectorBase
      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 method
      error - 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

      public void disconnect() throws ConnectorCheckedException
      Free up any resources held since the connector is no longer needed.
      Overrides:
      disconnect in class ConnectorBase
      Throws:
      ConnectorCheckedException - there is a problem within the connector.