Class OpenGovernanceClient

java.lang.Object
org.odpi.openmetadata.frameworks.governanceaction.client.OpenGovernanceClient
All Implemented Interfaces:
GovernanceCompletionInterface, SpecialGovernanceActionInterface
Direct Known Subclasses:
OpenGovernanceClientBase

public abstract class OpenGovernanceClient extends Object implements GovernanceCompletionInterface, SpecialGovernanceActionInterface
OpenGovernanceClient provides services to support the governance context. It is implemented by a metadata repository provider. In Egeria, this class is implemented partly by the GAF metadata management services and partly by the Governance Action OMES running in the engine host OMAG Server.
  • Field Details

    • serverName

      protected final String serverName
    • serviceURLMarker

      protected final String serviceURLMarker
    • serverPlatformURLRoot

      protected final String serverPlatformURLRoot
  • Constructor Details

    • OpenGovernanceClient

      public OpenGovernanceClient(String serviceURLMarker, String serverName, String serverPlatformURLRoot)
      Create a new client with no authentication embedded in the HTTP request.
      Parameters:
      serviceURLMarker - the identifier of the access service (for example asset-owner for the Asset Owner OMAS)
      serverName - name of the server to connect to
      serverPlatformURLRoot - the network address of the server running the OMAS REST services
  • Method Details

    • updateActionTargetStatus

      public abstract void updateActionTargetStatus(String userId, String actionTargetGUID, GovernanceActionStatus status, Date startDate, Date completionDate, String completionMessage) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Update the status of a specific action target. By default, these values are derived from the values for the governance action service. However, if the governance action service has to process name target elements, then setting the status on each individual target will show the progress of the governance action service.
      Specified by:
      updateActionTargetStatus in interface GovernanceCompletionInterface
      Parameters:
      userId - caller's userId
      actionTargetGUID - unique identifier of the governance action service.
      status - status enum to show its progress
      startDate - date/time that the governance action service started processing the target
      completionDate - date/time that the governance process completed processing this target.
      completionMessage - message to describe completion results or reasons for failure
      Throws:
      InvalidParameterException - the action target GUID is not recognized
      UserNotAuthorizedException - the governance action service is not authorized to update the action target properties
      PropertyServerException - there is a problem connecting to the metadata store
    • recordCompletionStatus

      public abstract void recordCompletionStatus(String userId, String governanceActionGUID, Map<String,String> requestParameters, CompletionStatus status, List<String> outputGuards, List<NewActionTarget> newActionTargets, String completionMessage) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Declare that all the processing for the governance action service is finished and the status of the work.
      Specified by:
      recordCompletionStatus in interface GovernanceCompletionInterface
      Parameters:
      userId - caller's userId
      governanceActionGUID - unique identifier of the governance action
      requestParameters - request properties from the caller (will be passed onto any follow-on actions)
      status - completion status enum value
      outputGuards - optional guard strings for triggering subsequent action(s)
      newActionTargets - list of action target names to GUIDs for the resulting governance action service
      completionMessage - message to describe completion results or reasons for failure
      Throws:
      InvalidParameterException - the completion status is null
      UserNotAuthorizedException - the governance action service is not authorized to update the governance action service status
      PropertyServerException - there is a problem connecting to the metadata store
    • initiateGovernanceAction

      public abstract String initiateGovernanceAction(String userId, String qualifiedName, int domainIdentifier, String displayName, String description, List<String> requestSourceGUIDs, List<NewActionTarget> actionTargets, List<String> receivedGuards, Date startTime, String governanceEngineName, String requestType, Map<String,String> requestParameters, String processName, String requestSourceName, String originatorServiceName, String originatorEngineName) 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.
      Specified by:
      initiateGovernanceAction in interface SpecialGovernanceActionInterface
      Parameters:
      userId - caller's userId
      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 - list of action target names to GUIDs for the resulting governance action service
      receivedGuards - list of guards to initiate the governance action
      startTime - future start time or null for "as soon as possible"
      governanceEngineName - name of the governance engine that should execute the request
      requestType - governance request type from the caller
      requestParameters - properties to pass to the governance action service
      processName - name of the process that this action is a part of
      requestSourceName - source of the request
      originatorServiceName - unique name of the requesting governance service (if initiated by a governance engine).
      originatorEngineName - optional unique name of the requesting governance engine (if initiated by a governance engine).
      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 abstract String initiateGovernanceActionProcess(String userId, String processQualifiedName, List<String> requestSourceGUIDs, List<NewActionTarget> actionTargets, Date startTime, Map<String,String> requestParameters, String originatorServiceName, String originatorEngineName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Using the named governance action process as a template, initiate a chain of governance actions.
      Specified by:
      initiateGovernanceActionProcess in interface SpecialGovernanceActionInterface
      Parameters:
      userId - caller's userId
      processQualifiedName - unique name of the governance action process to use
      requestSourceGUIDs - request source elements for the resulting governance action service
      actionTargets - list of action target names to GUIDs for the resulting governance action service
      startTime - future start time or null for "as soon as possible".
      requestParameters - request properties to be passed to the first governance action
      originatorServiceName - unique name of the requesting governance service (if initiated by a governance engine).
      originatorEngineName - optional unique name of the governance engine (if initiated by a governance engine).
      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
    • linkElementsAsPeerDuplicates

      public abstract void linkElementsAsPeerDuplicates(String userId, String metadataElement1GUID, String metadataElement2GUID, int statusIdentifier, String steward, String stewardTypeName, String stewardPropertyName, String source, String notes, boolean setKnownDuplicate) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Link elements as peer duplicates. Create a simple relationship between two elements. If the relationship already exists, the properties are updated.
      Specified by:
      linkElementsAsPeerDuplicates in interface SpecialGovernanceActionInterface
      Parameters:
      userId - caller's userId
      metadataElement1GUID - unique identifier of the metadata element at end 1 of the relationship
      metadataElement2GUID - unique identifier of the metadata element at end 2 of the relationship
      statusIdentifier - what is the status of this relationship (negative means untrusted, 0 means unverified and positive means trusted)
      steward - identifier of the steward
      stewardTypeName - type of element used to identify the steward
      stewardPropertyName - property name used to identify steward
      source - source of the duplicate detection processing
      notes - notes for the steward
      setKnownDuplicate - boolean flag indicating whether the KnownDuplicate classification should be set on the linked entities.
      Throws:
      InvalidParameterException - the unique identifier's of the metadata elements are null or invalid in some way; the properties are not valid for this type of relationship
      UserNotAuthorizedException - the governance action service is not authorized to create this type of relationship
      PropertyServerException - there is a problem with the metadata store
    • linkConsolidatedDuplicate

      public abstract void linkConsolidatedDuplicate(String userId, String consolidatedElementGUID, int statusIdentifier, String steward, String stewardTypeName, String stewardPropertyName, String source, String notes, List<String> sourceElementGUIDs) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Identify an element that acts as a consolidated version for a set of duplicate elements. (The consolidated element is created using createMetadataElement.)
      Specified by:
      linkConsolidatedDuplicate in interface SpecialGovernanceActionInterface
      Parameters:
      userId - caller's userId
      consolidatedElementGUID - unique identifier of the metadata element
      statusIdentifier - what is the status of this relationship (negative means untrusted, 0 means unverified and positive means trusted)
      steward - identifier of the steward
      stewardTypeName - type of element used to identify the steward
      stewardPropertyName - property name used to identify steward
      source - source of the duplicate detection processing
      notes - notes for the steward
      sourceElementGUIDs - List of the source elements that must be linked to the consolidated element. It is assumed that they already have the KnownDuplicateClassification.
      Throws:
      InvalidParameterException - the unique identifier's of the metadata elements are null or invalid in some way; the properties are not valid for this type of relationship
      UserNotAuthorizedException - the governance action service is not authorized to create this type of relationship
      PropertyServerException - there is a problem with the metadata store
    • registerListener

      public abstract 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.
      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 to watch for
      Throws:
      InvalidParameterException - one or more of the type names are unrecognized
    • disconnectListener

      public abstract void disconnectListener()
      Unregister the listener from the event infrastructure.
    • toString

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