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, connectorInstanceId, connectorName, connectorUserId, contextEventHandler, defaultDeleteMethod, egeriaRelease, externalSourceGUID, externalSourceName, generateIntegrationReport, governanceDefinitionClient, localServerName, localServerURL, 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.Return the list of elements that this watchdog action service should work on.Return the completion status provided by the watchdog action service.getDisplayName(OpenMetadataRootProperties properties) Return the display name from the properties - defaults to qualified name - or Unknown if not present.getDisplayName(ElementProperties properties) Return the display name from the properties - defaults to qualified name - or Unknown if not present.Return the unique identifier of the engine action that triggered this 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.Return the notification types that are attached to the engine action.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.voidnotifySubscribers(String notificationTypeGUID, Map<String, ClassificationProperties> initialClassifications, NotificationProperties firstNotificationProperties, NotificationProperties subsequentNotificationProperties, NotificationProperties lastNotificationProperties, Map<String, String> requestParameters, List<NewActionTarget> actionTargets) Create a notification/action for the subscribers.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=trueMethods 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, getClassificationExplorerClient, getClassificationExplorerClient, getCollectionClient, getCollectionClient, getCommentClient, getCommunityClient, getConceptModelElementClient, getConnectionClient, getConnectorGUID, getConnectorInstanceId, getConnectorName, getConnectorTypeClient, getContactDetailsClient, getContextEventClient, getContributionRecordClient, getDataFieldClient, getDataStructureClient, getDataValueSpecificationClient, getDesignPatternClient, getEgeriaRelease, getEndpointClient, getExternalIdClient, getExternalReferenceClient, getFileClassifier, getGlossaryTermClient, getGovernanceDefinitionClient, getGovernanceDefinitionClient, getInformalTagClient, getInformationSupplyChainClient, getLikeClient, getLineageClient, getLocalServerName, getLocalServerURL, getLocalServiceName, getLocationClient, getMaxPageSize, getMetadataAccessServer, getMetadataAccessServerPlatformURLRoot, getMetadataRepositoryCohortClient, getMultiLanguageClient, getMyUserId, getNetworkClient, getNoteLogClient, getOpenMetadataStore, getOpenMetadataTypesClient, getOperatingPlatformClient, getPerspectiveClient, getProductManagerClient, getProjectClient, getPropertyFacetClient, getRatingClient, getRequestId, getSchemaAttributeClient, getSchemaAttributeClient, getSchemaTypeClient, getSchemaTypeClient, getSearchKeywordClient, getSkillClient, getSoftwareCapabilityClient, getSoftwareCapabilityClient, getSolutionComponentClient, getSolutionPortClient, getSpecificationPropertyClient, getStorageVolumeClient, getTemplateClient, getUserIdentityClient, getValidMetadataValuesClient, getValidValueDefinitionClient, getValidValueDefinitionClient, isTypeOf, isTypeOf, openToDo, openToDo, publishReport, registerContextEvent, registerDirectoryListener, registerDirectoryTreeListener, reportElementCreation, reportElementDelete, reportElementUpdate, setActiveReportPublishing, setLocalServerURL, 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
-
getDisplayName
Return the display name from the properties - defaults to qualified name - or Unknown if not present.- Parameters:
properties- properties of the resource- Returns:
- display name
-
getDisplayName
Return the display name from the properties - defaults to qualified name - or Unknown if not present.- Parameters:
properties- properties of the resource- Returns:
- display name
-
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, UserNotAuthorizedExceptionReturn the notification types that are attached to the engine action.- Returns:
- list of notification types
- Throws:
InvalidParameterException- the action target guid is not recognizedPropertyServerException- problem accessing the property serverUserNotAuthorizedException- security access problem
-
getEngineActionGUID
Return the unique identifier of the engine action that triggered this watchdog action service.
A watchdog is given the notification types it is responsible for as action targets of this engine action, and more can be attached to it while the watchdog is running. A watchdog that wants to react to that - rather than waiting until its next refresh - needs to recognise an event about its own engine action, which means knowing this identifier.- Returns:
- string guid
-
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).
-
notifySubscribers
public void notifySubscribers(String notificationTypeGUID, Map<String, ClassificationProperties> initialClassifications, NotificationProperties firstNotificationProperties, NotificationProperties subsequentNotificationProperties, NotificationProperties lastNotificationProperties, Map<String, throws InvalidParameterException, UserNotAuthorizedException, PropertyServerExceptionString> requestParameters, List<NewActionTarget> actionTargets) Create a notification/action for the subscribers. This method determines if the subscriber is eligible to receive the notification. It also determines if this is the first notification for the subscriber, or later one, since it affects the notification properties.- Parameters:
notificationTypeGUID- unique identifier of the cause for the action to be raisedinitialClassifications- classification to add to the actionfirstNotificationProperties- properties for the first notification sent to this subscriber by this governance service instancesubsequentNotificationProperties- properties for a follow-on notification sent to this subscriber by this governance service instancelastNotificationProperties- properties for the last notification sent to this subscriber by this governance service instancerequestParameters- properties to pass to the next governance serviceactionTargets- the list of elements that should be acted upon - attached to notification (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
-
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.
-