java.lang.Object
org.odpi.openmetadata.governanceservers.enginehostservices.admin.GovernanceServiceHandler
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
GovernanceActionServiceHandler, RepositoryGovernanceServiceHandler, SurveyActionServiceHandler

public abstract class GovernanceServiceHandler extends Object implements Runnable
GovernanceServiceHandler provides the thread to run a governance service. A new instance is created for each request. The subclasses implement the run method.
  • Field Details

    • governanceEngineProperties

      protected final GovernanceEngineProperties governanceEngineProperties
    • governanceEngineGUID

      protected final String governanceEngineGUID
    • engineHostUserId

      protected final String engineHostUserId
    • governanceServiceGUID

      protected final String governanceServiceGUID
    • governanceServiceName

      protected final String governanceServiceName
    • governanceService

      protected final Connector governanceService
    • engineActionGUID

      protected final String engineActionGUID
    • serviceRequestType

      protected final String serviceRequestType
    • auditLog

      protected final AuditLog auditLog
  • Constructor Details

    • GovernanceServiceHandler

      protected GovernanceServiceHandler(GovernanceEngineProperties governanceEngineProperties, String governanceEngineGUID, String engineHostUserId, String engineActionGUID, GovernanceContextClient engineActionClient, String serviceRequestType, String governanceServiceGUID, String governanceServiceName, Connector governanceService, Date requestedStartDate, AuditLog auditLog)
      Constructor sets up the key parameters for running the governance action service. This call is made on the REST call's thread so the properties are just cached. The action happens in the run() method.
      Parameters:
      governanceEngineProperties - properties of the governance engine - used for message logging
      governanceEngineGUID - unique identifier of the governance engine - used for message logging
      engineHostUserId - userId for making updates to the governance actions
      engineActionGUID - unique identifier of the engine action that triggered this governance service
      engineActionClient - client for processing engine actions
      serviceRequestType - incoming request type
      governanceServiceGUID - unique identifier of the governance service
      governanceServiceName - name of this governance service - used for message logging
      governanceService - implementation of governance service
      requestedStartDate - date/time that the governance service should start executing
      auditLog - destination for log messages
  • Method Details

    • getGovernanceServiceName

      public String getGovernanceServiceName()
      Return the unique name of this governance service.
      Returns:
      string name
    • getGovernanceServiceGUID

      public String getGovernanceServiceGUID()
      Return the unique identifier of this governance service.
      Returns:
      string guid
    • getGovernanceEngineName

      public String getGovernanceEngineName()
      Return the unique name for the hosting governance engine.
      Returns:
      string name
    • waitForStartDate

      protected void waitForStartDate(String serverUserId) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException
      If the service request has a start time in the future, wait for the start time. Once the service is ready to run, its status is updated to IN_PROGRESS,
      Parameters:
      serverUserId - userId for this server
      Throws:
      InvalidParameterException - error updating engine action status
      PropertyServerException - error updating engine action status
      UserNotAuthorizedException - error updating engine action status
    • updateActionTargetStatus

      public void updateActionTargetStatus(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 service has to process name target elements, then setting the status on each individual target will show the progress of the governance action service.
      Parameters:
      actionTargetGUID - unique identifier of the action target relationship.
      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(CompletionStatus status, List<String> outputGuards, Map<String,String> requestParameters, 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.
      Parameters:
      status - completion status enum value
      outputGuards - optional guard strings for triggering subsequent action(s)
      requestParameters - properties to pass to the next governance action service
      newActionTargets - map 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
    • disconnect

      public void disconnect() throws ConnectorCheckedException
      Disconnect the governance action service. Called because the governance action service had set a completion status or the server is shutting down.
      Throws:
      ConnectorCheckedException - connector is in trouble