Class WatchdogContext
java.lang.Object
org.odpi.openmetadata.frameworks.openmetadata.connectorcontext.ConnectorContextBase
org.odpi.openmetadata.frameworks.openwatchdog.WatchdogContext
- All Implemented Interfaces:
WatchDogEventInterface
WatchdogContext provides a watchdog action service with access to information about
the survey request along with access to the open metadata repository interfaces.
-
Field Summary
Fields inherited from class org.odpi.openmetadata.frameworks.openmetadata.connectorcontext.ConnectorContextBase
connectorActivityReportWriter, connectorGUID, connectorId, connectorName, connectorUserId, defaultDeleteMethod, externalSourceGUID, externalSourceName, fileClassifier, generateIntegrationReport, governanceDefinitionClient, localServerName, localServiceName, maxPageSize, openMetadataClient, openMetadataStore, propertyHelper
-
Constructor Summary
ConstructorsConstructorDescriptionWatchdogContext
(String localServerName, String localServiceName, String externalSourceGUID, String externalSourceName, String connectorId, String connectorName, String connectorUserId, String connectorGUID, boolean generateIntegrationReport, OpenMetadataClient openMetadataClient, OpenGovernanceClient openGovernanceClient, GovernanceCompletionInterface governanceCompletionClient, WatchDogEventInterface watchdogEventClient, AuditLog auditLog, int maxPageSize, DeleteMethod deleteMethod, String engineActionGUID, String notificationTypeGUID, String requestType, Map<String, String> requestParameters, List<ActionTargetElement> actionTargetElements, String watchdogActionServiceName, String requesterUserId) Constructor sets up the key parameters for using the context. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Unregister the listener permanently from the event infrastructure.Return the list of elements that this governance action service should work on.Return the completion status provided by the watchdog action service.Return the unique identifier of the asset being discovered.getNotificationProperties
(MessageDefinition notificationDescription) Convert the message definitions into properties for a notification.Return the unique identifier of the asset being discovered.Return details of notification type to monitor along with its linked resources and subscribers, the actions it has caused and any additional context.Return the unique identifier of the asset being discovered.Return the requester user identifier.Return the properties that hold the parameters used to drive this watchdog action service.Return the request type that was used to start this watchdog action service.Return the watchdog action service.void
notifySubscriber
(String subscriberGUID, NotificationProperties notificationProperties, Map<String, String> requestParameters, List<NewActionTarget> newActionTargets) Create a notification/action for one of the subscribers.void
notifySubscribers
(NotificationProperties notificationProperties, Map<String, String> requestParameters, List<NewActionTarget> newActionTargets) Create a notification/action for each of the subscribers.void
recordCompletionStatus
(CompletionStatus status, List<String> outputGuards, Map<String, String> newRequestParameters, List<NewActionTarget> newActionTargets, String completionMessage) Declare that all the processing for the governance action service is finished and the status of the work.void
recordCompletionStatus
(CompletionStatus status, List<String> outputGuards, Map<String, String> newRequestParameters, List<NewActionTarget> newActionTargets, AuditLogMessageDefinition completionMessage) Declare that all the processing for the governance service is finished and the status of the work.void
registerListener
(WatchdogGovernanceListener listener, List<OpenMetadataEventType> interestingEventTypes, List<String> interestingMetadataTypes, String specificInstance) Register a listener to receive events about changes to metadata elements in the open metadata store.toString()
Standard toString method.Methods inherited from class org.odpi.openmetadata.frameworks.openmetadata.connectorcontext.ConnectorContextBase
createIncidentReport, disconnect, getActorProfileClient, getActorRoleClient, getAnchorGUID, getAnchorGUID, getAssetClient, getAssetClient, getConnectionClient, getConnectorId, getConnectorName, getConnectorTypeClient, getEndpointClient, getFileClassifier, getGlossaryClient, getGlossaryTermClient, getGovernanceDefinitionClient, getGovernanceDefinitionClient, getLocalServerName, getLocalServiceName, getMaxPageSize, getMultiLanguageClient, getMyUserId, getOpenMetadataStore, getSchemaAttributeClient, getSchemaAttributeClient, getSchemaTypeClient, getSchemaTypeClient, getSoftwareCapabilityClient, getSoftwareCapabilityClient, getValidMetadataValuesClient, getValidValueDefinitionClient, isTypeOf, isTypeOf, openToDo, openToDo, publishReport, registerContextEvent, registerDirectoryListener, registerDirectoryTreeListener, registerFileListener, reportElementCreation, reportElementDelete, reportElementUpdate, setActiveReportPublishing, startRecording, unregisterDirectoryListener, unregisterDirectoryTreeListener, unregisterFileListener, validateIsActive
-
Constructor Details
-
WatchdogContext
public WatchdogContext(String localServerName, String localServiceName, String externalSourceGUID, String externalSourceName, String connectorId, String connectorName, String connectorUserId, String connectorGUID, boolean generateIntegrationReport, OpenMetadataClient openMetadataClient, OpenGovernanceClient openGovernanceClient, GovernanceCompletionInterface governanceCompletionClient, WatchDogEventInterface watchdogEventClient, AuditLog auditLog, int maxPageSize, DeleteMethod deleteMethod, String engineActionGUID, String notificationTypeGUID, String requestType, Map<String, String> requestParameters, List<ActionTargetElement> actionTargetElements, String watchdogActionServiceName, String requesterUserId) Constructor sets up the key parameters for using the context.- Parameters:
localServerName
- name of local serverlocalServiceName
- name of the service to callexternalSourceGUID
- metadata collection unique idexternalSourceName
- metadata collection unique nameconnectorId
- id of this connector instanceconnectorName
- name of this connector instanceconnectorUserId
- userId to use when issuing open metadata requestsconnectorGUID
- unique identifier of the connector element that describes this connector in the open metadata store(s)generateIntegrationReport
- should the context generate an integration report?openMetadataClient
- client to access open metadata storeopenGovernanceClient
- client to the open governance services for use by the governance action servicegovernanceCompletionClient
- client to the open governance services for use by the governance action servicewatchdogEventClient
- client to the open governance services for use by the governance action serviceauditLog
- logging destinationmaxPageSize
- max number of resultsdeleteMethod
- default delete methodengineActionGUID
- unique identifier of the engine action that triggered this governance servicenotificationTypeGUID
- unique identifier of the notification type to processrequestType
- request type used to initiate the watchdog action servicerequestParameters
- name-value properties to control the watchdog action serviceactionTargetElements
- metadata elements that need to be worked on by the governance action servicewatchdogActionServiceName
- name of the running servicerequesterUserId
- original user requesting this governance service
-
-
Method Details
-
getNotificationTypeGUID
Return the unique identifier of the asset being discovered.- Returns:
- string guid
- Throws:
UserNotAuthorizedException
- exception thrown if connector is no longer active
-
getNotificationType
public OpenMetadataRootElement getNotificationType() throws UserNotAuthorizedException, InvalidParameterException, PropertyServerExceptionReturn details of notification type to monitor along with its linked resources and subscribers, the actions it has caused and any additional context.- Returns:
- string guid
- Throws:
InvalidParameterException
- an invalid property has been passedUserNotAuthorizedException
- the user is not authorized or the connector is not activePropertyServerException
- there is a problem communicating with the metadata server (or it has a logic error).
-
registerListener
public void registerListener(WatchdogGovernanceListener listener, List<OpenMetadataEventType> interestingEventTypes, List<String> interestingMetadataTypes, String specificInstance) throws InvalidParameterException Register a listener to receive events about changes to metadata elements in the open metadata store. There can be only one registered listener. If this method is called more than once, the new parameters replace the existing parameters. This means the watchdog governance action service can change the listener and the parameters that control the types of events received while it is running.
The types of events passed to the listener are controlled by the combination of the interesting event types and the interesting metadata types. That is an event is only passed to the listener if it matches both the interesting event types and the interesting metadata types.
If specific instance, interestingEventTypes or interestingMetadataTypes are null, it defaults to "any". If the listener parameter is null, no more events are passed to the listener. The type name specified in the interestingMetadataTypes refers to the subject of the event - so it is the type of the metadata element for metadata element types, the type of the relationship for related elements events and the name of the classification for classification events.- Specified by:
registerListener
in interfaceWatchDogEventInterface
- Parameters:
listener
- listener object to receive eventsinterestingEventTypes
- types of events that should be passed to the listenerinterestingMetadataTypes
- types of elements that are the subject of the interesting event typesspecificInstance
- unique identifier of a specific instance (metadata element or relationship) to watch for- Throws:
InvalidParameterException
- one or more of the type names are unrecognized
-
disconnectListener
public void disconnectListener()Unregister the listener permanently from the event infrastructure.- Specified by:
disconnectListener
in interfaceWatchDogEventInterface
-
getNotificationProperties
Convert the message definitions into properties for a notification. This includes setting the qualified name and status.- Parameters:
notificationDescription
- description of the notification- Returns:
- notification properties
-
getMonitoredResources
public List<OpenMetadataRootElement> getMonitoredResources() throws UserNotAuthorizedException, InvalidParameterException, PropertyServerExceptionReturn the unique identifier of the asset being discovered.- Returns:
- string guid
- Throws:
InvalidParameterException
- an invalid property has been passedUserNotAuthorizedException
- the user is not authorized or the connector is not activePropertyServerException
- there is a problem communicating with the metadata server (or it has a logic error).
-
getNotificationSubscribers
public List<OpenMetadataRootElement> getNotificationSubscribers() throws UserNotAuthorizedException, InvalidParameterException, PropertyServerExceptionReturn the unique identifier of the asset being discovered.- Returns:
- string guid
- Throws:
InvalidParameterException
- an invalid property has been passedUserNotAuthorizedException
- the user is not authorized or the connector is not activePropertyServerException
- there is a problem communicating with the metadata server (or it has a logic error).
-
notifySubscriber
public void notifySubscriber(String subscriberGUID, NotificationProperties notificationProperties, Map<String, String> requestParameters, List<NewActionTarget> newActionTargets) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerExceptionCreate a notification/action for one of the subscribers.- Parameters:
subscriberGUID
- unique identifier of the subscribernotificationProperties
- properties for the notificationrequestParameters
- properties to pass to the next governance servicenewActionTargets
- map of action target names to GUIDs for the resulting governance action service- Throws:
InvalidParameterException
- the completion status is nullUserNotAuthorizedException
- the governance action service is not authorized to update the governance action service statusPropertyServerException
- there is a problem connecting to the metadata store
-
notifySubscribers
public void notifySubscribers(NotificationProperties notificationProperties, Map<String, String> requestParameters, List<NewActionTarget> newActionTargets) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerExceptionCreate a notification/action for each of the subscribers.- Parameters:
notificationProperties
- properties for the notificationrequestParameters
- properties to pass to the next governance servicenewActionTargets
- map of action target names to GUIDs for the resulting governance action service- Throws:
InvalidParameterException
- the completion status is nullUserNotAuthorizedException
- the governance action service is not authorized to update the governance action service statusPropertyServerException
- there is a problem connecting to the metadata store
-
getRequestType
Return the request type that was used to start this watchdog action service.- Returns:
- AdditionalProperties object storing the analysis parameters
- Throws:
UserNotAuthorizedException
- exception thrown if connector is no longer active
-
getRequestParameters
Return the properties that hold the parameters used to drive this watchdog action service.- Returns:
- AdditionalProperties object storing the analysis parameters
- Throws:
UserNotAuthorizedException
- exception thrown if connector is no longer active
-
getActionTargetElements
Return the list of elements that this governance action service should work on.- Returns:
- cached list of action target metadata elements
-
getRequesterUserId
Return the requester user identifier.- Returns:
- userId
-
recordCompletionStatus
public void recordCompletionStatus(CompletionStatus status, List<String> outputGuards, Map<String, String> newRequestParameters, List<NewActionTarget> newActionTargets, AuditLogMessageDefinition completionMessage) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerExceptionDeclare that all the processing for the governance service is finished and the status of the work.- Parameters:
status
- completion status enum valueoutputGuards
- optional guard strings for triggering subsequent action(s)newRequestParameters
- properties to pass to the next governance servicenewActionTargets
- map of action target names to GUIDs for the resulting governance action servicecompletionMessage
- message to describe completion results or reasons for failure- Throws:
InvalidParameterException
- the completion status is nullUserNotAuthorizedException
- the governance action service is not authorized to update the governance action service statusPropertyServerException
- there is a problem connecting to the metadata store
-
recordCompletionStatus
public void recordCompletionStatus(CompletionStatus status, List<String> outputGuards, Map<String, String> newRequestParameters, List<NewActionTarget> newActionTargets, String completionMessage) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerExceptionDeclare that all the processing for the governance action service is finished and the status of the work.- Parameters:
status
- completion status enum valueoutputGuards
- optional guard strings for triggering subsequent action(s)newRequestParameters
- additional request parameters. These override/augment any request parameters defined for the next invoked servicenewActionTargets
- list of action target names to GUIDs for the resulting governance action servicecompletionMessage
- message to describe completion results or reasons for failure- Throws:
InvalidParameterException
- the completion status is nullUserNotAuthorizedException
- the governance action service is not authorized to update the governance action service completion statusPropertyServerException
- there is a problem connecting to the metadata store
-
getWatchdogActionServiceName
Return the watchdog action service.- Returns:
- qualified name
-
getCompletionStatus
Return the completion status provided by the watchdog action service.- Returns:
- enum
-
toString
Standard toString method.
-