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

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
    • serverClient

      protected GovernanceContextClient serverClient
    • 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 serverClient, 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
      serverClient - 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
    • 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
    • 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 governance action on or after the start time.
      Parameters:
      engineActionGUID - unique identifier of potential governance action to run.
    • runGovernanceService

      public abstract GovernanceServiceHandler runGovernanceService(String engineActionGUID, String governanceRequestType, Date startDate, 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 return the handler (for disconnect processing).
      Parameters:
      engineActionGUID - unique identifier of the engine action
      governanceRequestType - governance request type to use when calling the governance engine
      startDate - date/time to start the 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
      Returns:
      service handler for this 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 governance engine.
    • publishWatchdogEvent

      public void publishWatchdogEvent(WatchdogGovernanceEvent watchdogGovernanceEvent) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Pass on the watchdog event to any governance service that supports them.
      Parameters:
      watchdogGovernanceEvent - element describing the changing metadata data.
      Throws:
      InvalidParameterException - Vital fields of the engine action are not filled out
      UserNotAuthorizedException - the governance service is not permitted to execute the engine action
      PropertyServerException - there is a problem communicating with the open metadata stores
    • terminate

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