java.lang.Object
org.odpi.openmetadata.governanceservers.enginehostservices.admin.GovernanceEngineHandler
Direct Known Subclasses:
GovernanceActionEngineHandler, RepositoryGovernanceEngineHandler, SurveyActionEngineHandler

public abstract class GovernanceEngineHandler extends Object
The GovernanceEngineHandler is responsible for running governance services on demand. It is initialized with the configuration for the engine service it supports along with the clients to the metadata store where the definitions of the governance engine are managed.
  • Field Details

    • serverName

      protected String serverName
    • serverUserId

      protected String serverUserId
    • engineActionClient

      protected GovernanceContextClient engineActionClient
    • engineUserId

      protected String engineUserId
    • auditLog

      protected AuditLog auditLog
    • maxPageSize

      protected int maxPageSize
    • governanceEngineName

      protected String governanceEngineName
    • governanceEngineGUID

      protected String governanceEngineGUID
    • governanceEngineProperties

      protected GovernanceEngineProperties governanceEngineProperties
  • Constructor Details

    • GovernanceEngineHandler

      public GovernanceEngineHandler(EngineConfig engineConfig, String serverName, String serverUserId, String engineServiceName, GovernanceEngineConfigurationClient configurationClient, GovernanceContextClient engineActionClient, AuditLog auditLog, int maxPageSize)
      Create a client-side object for calling a governance engine.
      Parameters:
      engineConfig - the properties of the governance engine.
      serverName - the name of the engine host server where the governance engine is running
      serverUserId - user id for the server to use
      engineServiceName - name of the OMES that is supporting this governance engine
      configurationClient - client to retrieve the configuration
      engineActionClient - client to control the execution of engine action requests
      auditLog - logging destination
      maxPageSize - maximum number of results that can be returned in a single request
  • Method Details

    • getGovernanceEngineName

      public String getGovernanceEngineName()
      Return the governance Engine name - used for error logging.
      Returns:
      governance engine name
    • getGovernanceEngineElement

      public GovernanceEngineElement getGovernanceEngineElement()
      Return the governance engine element - used to determine if the governance engine is configured.
      Returns:
      governance engine element
    • getSummary

      public GovernanceEngineSummary getSummary()
      Return a summary of the governance engine
      Returns:
      governance engine summary
    • refreshConfig

      Request that the governance engine refresh its configuration by calling the metadata server. This request ensures that the latest configuration is in use.
      Throws:
      InvalidParameterException - one of the parameters is null or invalid.
      UserNotAuthorizedException - user id is not allowed to access configuration
      PropertyServerException - problem in configuration server
    • refreshServiceConfig

      public void refreshServiceConfig(String registeredGovernanceServiceGUID, String specificRequestType) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Request that the governance engine refreshes its configuration for a single governance service by calling the metadata server. This request just ensures that the latest configuration is in use.
      Parameters:
      registeredGovernanceServiceGUID - unique identifier of the GovernanceService entity
      specificRequestType - specific request type to refresh
      Throws:
      InvalidParameterException - one of the parameters is null or invalid.
      UserNotAuthorizedException - user id is not allowed to access configuration
      PropertyServerException - problem in configuration server
    • validateGovernanceEngineInitialized

      protected void validateGovernanceEngineInitialized(String expectedTypeName, String methodName) throws PropertyServerException
      Validate that the governance engine is initialized. This is signified by the setting of the governance engine properties.
      Parameters:
      expectedTypeName - type of governance engine supported by the calling engine service
      methodName - calling method
      Throws:
      PropertyServerException - governance engine is not initialized
    • restartServices

      public void restartServices(GovernanceEngineElement governanceEngineElement)
      Restart any services that were running when the engine host shut down.
      Parameters:
      governanceEngineElement - governance engine description
    • getServiceCache

      protected GovernanceServiceCache getServiceCache(String governanceRequestType)
      Retrieve the governance service for the requested type.
      Parameters:
      governanceRequestType - governance request type.
      Returns:
      governance service
    • executeEngineAction

      public void executeEngineAction(String engineActionGUID)
      Execute the requested engine action on or after the start time.
      Parameters:
      engineActionGUID - unique identifier of potential governance action to run.
    • runGovernanceService

      public abstract void runGovernanceService(String engineActionGUID, String governanceRequestType, String requesterUserId, Date requestedStartDate, Map<String,String> requestParameters, List<RequestSourceElement> requestSourceElements, List<ActionTargetElement> actionTargetElements) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Run an instance of a governance service in its own thread and register the handler (for disconnect processing).
      Parameters:
      engineActionGUID - unique identifier of the engine action
      governanceRequestType - governance request type to use when calling the governance engine
      requestedStartDate - date/time to start the governance service
      requesterUserId - original user requesting this governance service
      requestParameters - name-value properties to control the governance service
      requestSourceElements - metadata elements associated with the request to the governance service
      actionTargetElements - metadata elements that need to be worked on by the governance service
      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 governance engine.
    • restartGovernanceService

      public void restartGovernanceService(EngineActionElement engineActionElement)
      Restart an instance of a governance service in its own thread and register the handler (for disconnect processing). This can be overridden by an engine service if restart needs different logic to the first time a governance service starts for an engine action.
      Parameters:
      engineActionElement - details of the engine action
    • startServiceExecutionThread

      protected void startServiceExecutionThread(String engineActionGUID, GovernanceServiceHandler serviceToRun, String threadName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException
      Start the execution of the governance service on a new thread.
      Parameters:
      engineActionGUID - unique identifier of the engine action that initiated this request.
      serviceToRun - runnable packed with details of the governance service
      threadName - name of the thread for diagnostic purposes
      Throws:
      InvalidParameterException - error updating engine action status
      PropertyServerException - error updating engine action status
      UserNotAuthorizedException - error updating engine action status
    • terminate

      public void terminate()
      Confirms termination of the governance engine.