Class GovernanceContextClientBase

java.lang.Object
org.odpi.openmetadata.frameworkservices.gaf.client.OpenGovernanceClientBase
org.odpi.openmetadata.frameworkservices.gaf.client.GovernanceContextClientBase
All Implemented Interfaces:
ActionControlInterface, DuplicateManagementInterface, GovernanceActionProcessInterface, GovernanceActionTypeInterface, GovernanceCompletionInterface, WatchDogEventInterface
Direct Known Subclasses:
GovernanceContextClient, GovernanceContextClient

public class GovernanceContextClientBase extends OpenGovernanceClientBase implements GovernanceCompletionInterface, WatchDogEventInterface
GovernanceContextClientBase sits in the governance context of a governance action service when it is running in the engine host OMAG server. It is however shared by all the governance action services running in an engine service so that we only need one connector to the topic listener for the watchdog governance services.
  • Field Details

    • governanceListenerManager

      protected GovernanceListenerManager governanceListenerManager
      Manages registered listeners
    • listenerId

      protected String listenerId
  • Constructor Details

    • GovernanceContextClientBase

      public GovernanceContextClientBase(String serviceURLMarker, String serverName, String serverPlatformURLRoot, int maxPageSize) throws InvalidParameterException
      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
      maxPageSize - pre-initialized parameter limit
      Throws:
      InvalidParameterException - there is a problem creating the client-side components to issue any REST API calls.
    • GovernanceContextClientBase

      public GovernanceContextClientBase(String serviceURLMarker, String serverName, String serverPlatformURLRoot, String serverUserId, String serverPassword, int maxPageSize) throws InvalidParameterException
      Create a new client that passes userId and password in each HTTP request. This is the userId/password of the calling server. The end user's userId is sent on each 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
      serverUserId - caller's userId embedded in all HTTP requests
      serverPassword - caller's password embedded in all HTTP requests
      maxPageSize - pre-initialized parameter limit
      Throws:
      InvalidParameterException - there is a problem creating the client-side components to issue any REST API calls.
    • GovernanceContextClientBase

      public GovernanceContextClientBase(String serviceURLMarker, String serverName, String serverPlatformURLRoot, GAFRESTClient restClient, int maxPageSize) throws InvalidParameterException
      Create a new client that passes userId and password in each HTTP request. This is the userId/password of the calling server. The end user's userId is sent on each 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
      restClient - pre-initialized REST client
      maxPageSize - pre-initialized parameter limit
      Throws:
      InvalidParameterException - there is a problem with the information about the remote OMAS
  • Method Details

    • setListenerManager

      public void setListenerManager(GovernanceListenerManager governanceListenerManager, String listenerId)
      Set up the listener manager.
      Parameters:
      governanceListenerManager - aggregates listeners from governance services
      listenerId - identifier used to maintain topic event pointer in event manager
    • 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.
      Specified by:
      registerListener in interface WatchDogEventInterface
      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 void disconnectListener()
      Called during the disconnect processing of the watchdog governance action service.
      Specified by:
      disconnectListener in interface WatchDogEventInterface
    • updateEngineActionStatus

      public void updateEngineActionStatus(String userId, String engineActionGUID, EngineActionStatus engineActionStatus) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Update the status of the governance action - providing the caller is permitted.
      Specified by:
      updateEngineActionStatus in interface GovernanceCompletionInterface
      Parameters:
      userId - identifier of calling user
      engineActionGUID - identifier of the governance action request
      engineActionStatus - new status enum
      Throws:
      InvalidParameterException - one of the parameters is null or invalid.
      UserNotAuthorizedException - user not authorized to issue this request.
      PropertyServerException - there was a problem detected by the metadata store.
    • claimEngineAction

      public void claimEngineAction(String userId, String engineActionGUID) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Request that execution of a governance action is allocated to the caller.
      Specified by:
      claimEngineAction in interface GovernanceCompletionInterface
      Parameters:
      userId - identifier of calling user
      engineActionGUID - identifier of the governance action request.
      Throws:
      InvalidParameterException - one of the parameters is null or invalid.
      UserNotAuthorizedException - user not authorized to issue this request.
      PropertyServerException - there was a problem detected by the metadata store.
    • getActiveClaimedEngineActions

      public List<EngineActionElement> getActiveClaimedEngineActions(String userId, String governanceEngineGUID, int startFrom, int pageSize) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Retrieve the engine actions that are still in process and that have been claimed by this caller's userId. This call is used when the caller restarts.
      Specified by:
      getActiveClaimedEngineActions in interface GovernanceCompletionInterface
      Parameters:
      userId - userId of caller
      governanceEngineGUID - unique identifier of governance engine
      startFrom - starting from element
      pageSize - maximum elements to return
      Returns:
      list of governance action elements
      Throws:
      InvalidParameterException - one of the parameters is null or invalid.
      UserNotAuthorizedException - user not authorized to issue this request.
      PropertyServerException - there was a problem detected by the metadata store.
    • updateActionTargetStatus

      public void updateActionTargetStatus(String userId, String actionTargetGUID, EngineActionStatus 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 void recordCompletionStatus(String userId, String engineActionGUID, 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
      engineActionGUID - unique identifier of the governance action to update
      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