Class WatchdogGovernanceContext


  • public class WatchdogGovernanceContext
    extends GovernanceContext
    WatchdogGovernanceContext provides the watchdog governance action service with access to information about the request, open metadata store, the ability to register a listener to receive governance events and initiate new governance activity.
    • Constructor Detail

      • WatchdogGovernanceContext

        public WatchdogGovernanceContext​(String userId,
                                         String governanceActionGUID,
                                         String requestType,
                                         Map<String,​String> requestParameters,
                                         List<RequestSourceElement> requestSourceElements,
                                         List<ActionTargetElement> actionTargetElements,
                                         OpenMetadataClient openMetadataStore)
        Constructor sets up the key parameters for processing the request to the governance action service.
        Parameters:
        userId - calling user
        governanceActionGUID - unique identifier of the governance action that triggered this governance service
        requestType - unique identifier of the asset that the annotations should be attached to
        requestParameters - name-value properties to control the governance action service
        requestSourceElements - metadata elements associated with the request to the governance action service
        actionTargetElements - metadata elements that need to be worked on by the governance action service
        openMetadataStore - client to the metadata store for use by the governance action service
    • Method Detail

      • registerListener

        public void registerListener​(WatchdogGovernanceListener listener,
                                     List<WatchdogEventType> 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.
        Parameters:
        listener - listener object to receive events
        interestingEventTypes - types of events that should be passed to the listener
        interestingMetadataTypes - types of elements that are the subject of the interesting event types
        specificInstance - unique identifier of a specific instance (metadata element or relationship) to watch for
        Throws:
        InvalidParameterException - one or more of the type names are unrecognized
      • initiateGovernanceAction

        public String initiateGovernanceAction​(String qualifiedName,
                                               int domainIdentifier,
                                               String displayName,
                                               String description,
                                               List<String> requestSourceGUIDs,
                                               List<NewActionTarget> actionTargets,
                                               Date startTime,
                                               String governanceEngineName,
                                               String requestType,
                                               Map<String,​String> requestParameters)
                                        throws InvalidParameterException,
                                               UserNotAuthorizedException,
                                               PropertyServerException
        Create a governance action in the metadata store which will trigger the governance action service associated with the supplied request type. The governance action remains to act as a record of the actions taken for auditing.
        Parameters:
        qualifiedName - unique identifier to give this governance action
        domainIdentifier - governance domain associated with this action (0=ALL)
        displayName - display name for this action
        description - description for this action
        requestSourceGUIDs - request source elements for the resulting governance action service
        actionTargets - map of action target names to GUIDs for the resulting governance action service
        startTime - future start time or null for "as soon as possible".
        governanceEngineName - name of the governance engine to run the request
        requestType - request type to identify the governance action service to run
        requestParameters - properties to pass to the governance action service
        Returns:
        unique identifier of the governance action
        Throws:
        InvalidParameterException - null qualified name
        UserNotAuthorizedException - this governance action service is not authorized to create a governance action
        PropertyServerException - there is a problem with the metadata store
      • initiateGovernanceActionProcess

        public String initiateGovernanceActionProcess​(String processQualifiedName,
                                                      Map<String,​String> requestParameters,
                                                      List<String> requestSourceGUIDs,
                                                      List<NewActionTarget> actionTargets,
                                                      Date startTime)
                                               throws InvalidParameterException,
                                                      UserNotAuthorizedException,
                                                      PropertyServerException
        Using the named governance action process as a template, initiate a chain of governance actions.
        Parameters:
        processQualifiedName - unique name of the governance action process to use
        requestParameters - request parameters to pass to the governance actions called in the governance action process
        requestSourceGUIDs - request source elements for the resulting governance action service
        actionTargets - map of action target names to GUIDs for the resulting governance action service
        startTime - future start time or null for "as soon as possible".
        Returns:
        unique identifier of the first governance action of the process
        Throws:
        InvalidParameterException - null or unrecognized qualified name of the process
        UserNotAuthorizedException - this governance action service is not authorized to create a governance action process
        PropertyServerException - there is a problem with the metadata store
      • createIncidentReport

        public String createIncidentReport​(String qualifiedName,
                                           int domainIdentifier,
                                           String background,
                                           List<IncidentImpactedElement> impactedResources,
                                           List<IncidentDependency> previousIncidents,
                                           Map<String,​Integer> incidentClassifiers,
                                           Map<String,​String> additionalProperties)
                                    throws InvalidParameterException,
                                           UserNotAuthorizedException,
                                           PropertyServerException
        Create an incident report to capture the situation detected by this governance action service. This incident report will be processed by other governance activities.
        Parameters:
        qualifiedName - unique identifier to give this new incident report
        domainIdentifier - governance domain associated with this action (0=ALL)
        background - description of the situation
        impactedResources - details of the resources impacted by this situation
        previousIncidents - links to previous incident reports covering this situation
        incidentClassifiers - initial classifiers for the incident report
        additionalProperties - additional arbitrary properties for the incident reports
        Returns:
        unique identifier of the resulting incident report
        Throws:
        InvalidParameterException - null or non-unique qualified name for the incident report
        UserNotAuthorizedException - this governance action service is not authorized to create a incident report
        PropertyServerException - there is a problem with the metadata store
      • toString

        public String toString()
        Standard toString method.
        Overrides:
        toString in class GovernanceContext
        Returns:
        print out of variables in a JSON-style