Class WatchdogContext
java.lang.Object
org.odpi.openmetadata.frameworks.openmetadata.connectorcontext.ConnectorContextBase
org.odpi.openmetadata.frameworks.openwatchdog.WatchdogContext
WatchdogContext provides a watchdog action service with access to information about
the watchdog request along with access to the open metadata repository interfaces.
-
Field Summary
Fields inherited from class org.odpi.openmetadata.frameworks.openmetadata.connectorcontext.ConnectorContextBase
assetClient, assetHandler, connectorActivityReportWriter, connectorGUID, connectorId, connectorName, connectorUserId, contextEventHandler, defaultDeleteMethod, egeriaRelease, externalSourceGUID, externalSourceName, fileClassifier, generateIntegrationReport, governanceDefinitionClient, localServerName, localServiceName, maxPageSize, openMetadataClient, openMetadataStore, openMetadataTypesClient, 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 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 TypeMethodDescriptionvoidUnregister the listener permanently from the event infrastructure.voiddismissSubscriber(String notificationTypeGUID, String subscriberGUID, long notificationCount, Map<String, ClassificationProperties> initialClassifications, NotificationProperties notificationProperties, Map<String, String> requestParameters, List<NewActionTarget> newActionTargets) Create a notification/action for one of the subscribers.voiddismissSubscribers(String notificationTypeGUID, long notificationCount, Map<String, ClassificationProperties> initialClassifications, NotificationProperties lastNotificationProperties, Map<String, String> requestParameters, List<NewActionTarget> newActionTargets, long minimumNotificationInterval) Create a notification/action for each subscriber indicating that the subscription is complete because the notification type is no longer valid.Return the list of elements that this watchdog action service should work on.Return the completion status provided by the watchdog action service.intgetIntRequestParameter(String requestParameterName, int defaultValue) Return an integer request parameter the default value is used if the request parameter is not provided.getMonitoredResources(String notificationTypeGUID) Return the elements that are linked to the notification type as monitored resources.getNotificationProperties(MessageDefinition notificationDescription, String notificationTypeGUID, long notificationCount) Convert the message definitions into properties for a notification.getNotificationSubscribers(String notificationTypeGUID) Return the elements that are linked to the notification type as a subscriber.getNotificationType(String notificationTypeGUID) Return details of the notification type to monitor along with its linked resources and subscribers, the actions it has caused and any additional context.Extract the notification types to process from the action targets.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.voidnotifyMonitoringSubscribers(String notificationTypeGUID, long notificationCount, Map<String, ClassificationProperties> initialClassifications, NotificationProperties nextNotificationProperties, Map<String, String> requestParameters, List<NewActionTarget> newActionTargets, long minimumNotificationInterval) Create a notification/action for each subscriber of a notification type that is monitoring one or more resources.voidnotifyOneTimeSubscribers(String notificationTypeGUID, long notificationCount, Map<String, ClassificationProperties> initialClassifications, NotificationProperties firstNotificationProperties, Map<String, String> requestParameters, List<NewActionTarget> newActionTargets) Create a notification/action for each subscriber.voidnotifyPeriodicSubscribers(String notificationTypeGUID, long notificationCount, Map<String, ClassificationProperties> initialClassifications, NotificationProperties periodicNotificationProperties, Map<String, String> requestParameters, List<NewActionTarget> newActionTargets, long minimumNotificationInterval) Create a notification/action for each subscriber because enough time has passed since the last notification was sent.voidrecordCompletionStatus(CompletionStatus status, List<String> outputGuards, Map<String, String> newRequestParameters, List<NewActionTarget> newActionTargets, String completionMessage) Declare that all the processing for the watchdog action service is finished and the status of the work.voidrecordCompletionStatus(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.voidregisterListener(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.voidupdateNotificationType(String notificationTypeGUID, NotificationTypeProperties notificationTypeProperties) Update the supplied properties in the governance definition - mergeUpdate=truevoidwelcomeMonitoringSubscribers(String notificationTypeGUID, long notificationCount, Map<String, ClassificationProperties> initialClassifications, NotificationProperties firstNotificationProperties, Map<String, String> requestParameters, List<NewActionTarget> newActionTargets, long minimumNotificationInterval) Create a notification/action for each subscriber.voidwelcomeSubscriber(String notificationTypeGUID, String subscriberGUID, long notificationCount, Map<String, ClassificationProperties> initialClassifications, NotificationProperties notificationProperties, Map<String, String> requestParameters, List<NewActionTarget> newActionTargets, long minimumNotificationInterval, ActivityStatus newSubscriberStatus) Create the first notification/action for one of the subscribers.Methods inherited from class org.odpi.openmetadata.frameworks.openmetadata.connectorcontext.ConnectorContextBase
createGovernanceActionProcess, createIncidentReport, createNoteLogEntry, createProcessFromGovernanceActionType, disconnect, getActorProfileClient, getActorProfileClient, getActorRoleClient, getActorRoleClient, getAnchorGUID, getAnchorGUID, getAnnotationClient, getAnnotationClient, getAssetClient, getAssetClient, getClassificationManagerClient, getClassificationManagerClient, getCollectionClient, getCollectionClient, getCommentClient, getCommunityClient, getConnectionClient, getConnectorGUID, getConnectorId, getConnectorName, getConnectorTypeClient, getContactDetailsClient, getContextEventClient, getContributionRecordClient, getDataClassClient, getDataFieldClient, getDataStructureClient, getEgeriaRelease, getEndpointClient, getExternalIdClient, getExternalReferenceClient, getFileClassifier, getGlossaryTermClient, getGovernanceDefinitionClient, getGovernanceDefinitionClient, getInformalTagClient, getLikeClient, getLineageClient, getLocalServerName, getLocalServiceName, getLocationClient, getMaxPageSize, getMetadataAccessServer, getMetadataAccessServerPlatformURLRoot, getMetadataRepositoryCohortClient, getMultiLanguageClient, getMyUserId, getNoteLogClient, getOpenMetadataStore, getOpenMetadataTypesClient, getProjectClient, getPropertyFacetClient, getRatingClient, getSchemaAttributeClient, getSchemaAttributeClient, getSchemaTypeClient, getSchemaTypeClient, getSearchKeywordClient, getSoftwareCapabilityClient, getSoftwareCapabilityClient, getSolutionComponentClient, getSpecificationPropertyClient, getTemplateClient, getUserIdentityClient, getValidMetadataValuesClient, getValidValueDefinitionClient, getValidValueDefinitionClient, isTypeOf, isTypeOf, openToDo, openToDo, publishReport, registerContextEvent, registerDirectoryListener, registerDirectoryTreeListener, reportElementCreation, reportElementDelete, reportElementUpdate, setActiveReportPublishing, startRecording, unregisterDirectoryListener, unregisterDirectoryTreeListener, 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 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 servicerequestType- 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
-
getNotificationType
public OpenMetadataRootElement getNotificationType(String notificationTypeGUID) throws UserNotAuthorizedException, InvalidParameterException, PropertyServerException Return details of the notification type to monitor along with its linked resources and subscribers, the actions it has caused and any additional context.- Parameters:
notificationTypeGUID- unique identifier of the notification type to process- Returns:
- root element
- Throws:
InvalidParameterException- an invalid property has been passedUserNotAuthorizedException- the user is not authorized or the connector is not activePropertyServerException- a problem communicating with the metadata server (or it has a logic error).
-
updateNotificationType
public void updateNotificationType(String notificationTypeGUID, NotificationTypeProperties notificationTypeProperties) throws UserNotAuthorizedException, InvalidParameterException, PropertyServerException Update the supplied properties in the governance definition - mergeUpdate=true- Parameters:
notificationTypeGUID- unique identifier of the notification type to processnotificationTypeProperties- new properties for the notification type- Throws:
InvalidParameterException- an invalid property has been passedUserNotAuthorizedException- the user is not authorized or the connector is not activePropertyServerException- a problem communicating with the metadata server (or it has a logic error).
-
getIntRequestParameter
Return an integer request parameter the default value is used if the request parameter is not provided.- Parameters:
requestParameterName- name of the request parameterdefaultValue- value to ues if the request parameter is not set- Returns:
- int
-
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 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.- 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. -
getNotificationTypesFromActionTargets
public List<ActionTargetElement> getNotificationTypesFromActionTargets() throws InvalidParameterException, PropertyServerException, UserNotAuthorizedExceptionExtract the notification types to process from the action targets.- Returns:
- list of notification types or null
- Throws:
InvalidParameterException- problem updating action target statusUserNotAuthorizedException- problem updating action target statusPropertyServerException- problem updating action target status
-
getNotificationProperties
public NotificationProperties getNotificationProperties(MessageDefinition notificationDescription, String notificationTypeGUID, long notificationCount) Convert the message definitions into properties for a notification. This includes setting the qualified name and status.- Parameters:
notificationDescription- description of the notificationnotificationTypeGUID- unique identifier of the notification type to processnotificationCount- count of notifications sent by this notification type - used to generate unique qualified names- Returns:
- notification properties
-
getMonitoredResources
public List<OpenMetadataRootElement> getMonitoredResources(String notificationTypeGUID) throws UserNotAuthorizedException, InvalidParameterException, PropertyServerException Return the elements that are linked to the notification type as monitored resources.- Parameters:
notificationTypeGUID- unique identifier of the notification type to process- Returns:
- list of root elements
- Throws:
InvalidParameterException- an invalid property has been passedUserNotAuthorizedException- the user is not authorized or the connector is not activePropertyServerException- a problem communicating with the metadata server (or it has a logic error).
-
getNotificationSubscribers
public List<OpenMetadataRootElement> getNotificationSubscribers(String notificationTypeGUID) throws UserNotAuthorizedException, InvalidParameterException, PropertyServerException Return the elements that are linked to the notification type as a subscriber.- Parameters:
notificationTypeGUID- unique identifier of the notification type to process- Returns:
- list of root elements
- Throws:
InvalidParameterException- an invalid property has been passedUserNotAuthorizedException- the user is not authorized or the connector is not activePropertyServerException- a problem communicating with the metadata server (or it has a logic error).
-
welcomeSubscriber
public void welcomeSubscriber(String notificationTypeGUID, String subscriberGUID, long notificationCount, Map<String, ClassificationProperties> initialClassifications, NotificationProperties notificationProperties, Map<String, throws InvalidParameterException, UserNotAuthorizedException, PropertyServerExceptionString> requestParameters, List<NewActionTarget> newActionTargets, long minimumNotificationInterval, ActivityStatus newSubscriberStatus) Create the first notification/action for one of the subscribers.- Parameters:
notificationTypeGUID- unique identifier of the notification type to processsubscriberGUID- unique identifier of the subscribernotificationCount- count of notifications sent by this notification type - used to generate unique qualified namesinitialClassifications- classification to add to the actionnotificationProperties- properties for the notificationrequestParameters- properties to pass to the next governance servicenewActionTargets- map of action target names to GUIDs for the resulting governance action serviceminimumNotificationInterval- minimum time between notificationsnewSubscriberStatus- set the subscriber relationship to this value after a successful notification; null means leave it alone- Throws:
InvalidParameterException- one of the parameters is invalidUserNotAuthorizedException- the watchdog action service is not authorized to continuePropertyServerException- a problem connecting to the metadata store
-
welcomeMonitoringSubscribers
public void welcomeMonitoringSubscribers(String notificationTypeGUID, long notificationCount, Map<String, ClassificationProperties> initialClassifications, NotificationProperties firstNotificationProperties, Map<String, throws InvalidParameterException, UserNotAuthorizedException, PropertyServerExceptionString> requestParameters, List<NewActionTarget> newActionTargets, long minimumNotificationInterval) Create a notification/action for each subscriber.- Parameters:
notificationTypeGUID- unique identifier of the notification type to processnotificationCount- count of notifications sent for this notification type - used to create unique qualified NamesinitialClassifications- classification to add to the actionfirstNotificationProperties- properties for the first notification sent to this subscriber by this governance service instancerequestParameters- properties to pass to the next governance servicenewActionTargets- map of action target names to GUIDs for the resulting engine actionminimumNotificationInterval- minimum time between notifications- Throws:
InvalidParameterException- one of the parameters is invalidUserNotAuthorizedException- the watchdog action service is not authorized to continuePropertyServerException- a problem connecting to the metadata store
-
notifyMonitoringSubscribers
public void notifyMonitoringSubscribers(String notificationTypeGUID, long notificationCount, Map<String, ClassificationProperties> initialClassifications, NotificationProperties nextNotificationProperties, Map<String, throws InvalidParameterException, UserNotAuthorizedException, PropertyServerExceptionString> requestParameters, List<NewActionTarget> newActionTargets, long minimumNotificationInterval) Create a notification/action for each subscriber of a notification type that is monitoring one or more resources.- Parameters:
notificationTypeGUID- unique identifier of the notification type to processnotificationCount- count of notifications sent for this notification type - used to create unique qualified NamesinitialClassifications- classification to add to the actionnextNotificationProperties- properties for a follow on notification sent to this subscriber by this governance service instancerequestParameters- properties to pass to the next governance servicenewActionTargets- map of action target names to GUIDs for the resulting engine actionminimumNotificationInterval- minimum time between notifications- Throws:
InvalidParameterException- one of the parameters is invalidUserNotAuthorizedException- the watchdog action service is not authorized to continuePropertyServerException- a problem connecting to the metadata store
-
notifyPeriodicSubscribers
public void notifyPeriodicSubscribers(String notificationTypeGUID, long notificationCount, Map<String, ClassificationProperties> initialClassifications, NotificationProperties periodicNotificationProperties, Map<String, throws InvalidParameterException, UserNotAuthorizedException, PropertyServerExceptionString> requestParameters, List<NewActionTarget> newActionTargets, long minimumNotificationInterval) Create a notification/action for each subscriber because enough time has passed since the last notification was sent.- Parameters:
notificationTypeGUID- unique identifier of the notification type to processnotificationCount- count of notifications sent for this notification type - used to create unique qualified NamesinitialClassifications- classification to add to the actionperiodicNotificationProperties- properties for a notification sent to this subscriber by this governance service instancerequestParameters- properties to pass to the next governance servicenewActionTargets- map of action target names to GUIDs for the resulting engine actionminimumNotificationInterval- minimum time between notifications- Throws:
InvalidParameterException- one of the parameters is invalidUserNotAuthorizedException- the watchdog action service is not authorized to continuePropertyServerException- a problem connecting to the metadata store
-
notifyOneTimeSubscribers
public void notifyOneTimeSubscribers(String notificationTypeGUID, long notificationCount, Map<String, ClassificationProperties> initialClassifications, NotificationProperties firstNotificationProperties, Map<String, throws InvalidParameterException, UserNotAuthorizedException, PropertyServerExceptionString> requestParameters, List<NewActionTarget> newActionTargets) Create a notification/action for each subscriber.- Parameters:
notificationTypeGUID- unique identifier of the notification type to processnotificationCount- count of notifications sent for this notification type - used to create unique qualified NamesinitialClassifications- classification to add to the actionfirstNotificationProperties- properties for the first notification sent to this subscriber by this governance service instancerequestParameters- properties to pass to the next governance servicenewActionTargets- map of action target names to GUIDs for the resulting engine action- Throws:
InvalidParameterException- one of the parameters is invalidUserNotAuthorizedException- the watchdog action service is not authorized to continuePropertyServerException- a problem connecting to the metadata store
-
dismissSubscribers
public void dismissSubscribers(String notificationTypeGUID, long notificationCount, Map<String, ClassificationProperties> initialClassifications, NotificationProperties lastNotificationProperties, Map<String, throws InvalidParameterException, UserNotAuthorizedException, PropertyServerExceptionString> requestParameters, List<NewActionTarget> newActionTargets, long minimumNotificationInterval) Create a notification/action for each subscriber indicating that the subscription is complete because the notification type is no longer valid.- Parameters:
notificationTypeGUID- unique identifier of the notification type to processnotificationCount- count of notifications sent for this notification type - used to create unique qualified NamesinitialClassifications- classification to add to the actionlastNotificationProperties- properties for the last notification sent to this subscriber by this governance service instancerequestParameters- properties to pass to the next governance servicenewActionTargets- map of action target names to GUIDs for the resulting engine actionminimumNotificationInterval- minimum time between notifications- Throws:
InvalidParameterException- one of the parameters is invalidUserNotAuthorizedException- the watchdog action service is not authorized to continuePropertyServerException- a problem connecting to the metadata store
-
dismissSubscriber
public void dismissSubscriber(String notificationTypeGUID, String subscriberGUID, long notificationCount, Map<String, ClassificationProperties> initialClassifications, NotificationProperties notificationProperties, Map<String, throws InvalidParameterException, UserNotAuthorizedException, PropertyServerExceptionString> requestParameters, List<NewActionTarget> newActionTargets) Create a notification/action for one of the subscribers.- Parameters:
notificationTypeGUID- unique identifier of the notification type to processsubscriberGUID- unique identifier of the subscribernotificationCount- number of notifications sent to this subscriber by this governance serviceinitialClassifications- classification to add to the actionnotificationProperties- 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- one of the parameters is invalidUserNotAuthorizedException- the watchdog action service is not authorized to continuePropertyServerException- 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 the 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 watchdog 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- 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 watchdog 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- 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.
-