Class GovernanceEngineHandler
java.lang.Object
org.odpi.openmetadata.governanceservers.enginehostservices.admin.GovernanceEngineHandler
- Direct Known Subclasses:
GovernanceActionEngineHandler
,RepositoryGovernanceEngineHandler
,SurveyActionEngineHandler
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 Summary
Modifier and TypeFieldDescriptionprotected AuditLog
protected final GovernanceConfigurationClient
protected GovernanceContextClient
protected String
protected String
protected String
protected GovernanceEngineProperties
protected int
protected String
protected String
-
Constructor Summary
ConstructorDescriptionGovernanceEngineHandler
(EngineConfig engineConfig, String serverName, String serverUserId, String engineServiceName, GovernanceConfigurationClient configurationClient, GovernanceContextClient engineActionClient, AuditLog auditLog, int maxPageSize) Create a client-side object for calling a governance engine. -
Method Summary
Modifier and TypeMethodDescriptionvoid
executeEngineAction
(String engineActionGUID) Execute the requested engine action on or after the start time.Return the governance engine element - used to determine if the governance engine is configured.Return the governance Engine name - used for error logging.protected GovernanceServiceCache
getServiceCache
(String governanceRequestType) Retrieve the governance service for the requested type.Return a summary of the governance enginevoid
Request that the governance engine refresh its configuration by calling the metadata server.void
refreshServiceConfig
(String registeredGovernanceServiceGUID, String specificRequestType) Request that the governance engine refreshes its configuration for a single governance service by calling the metadata server.void
restartGovernanceService
(EngineActionElement engineActionElement) Restart an instance of a governance service in its own thread and register the handler (for disconnect processing).void
restartServices
(GovernanceEngineElement governanceEngineElement) Restart any services that were running when the engine host shut down.abstract void
runGovernanceService
(String engineActionGUID, String governanceRequestType, String requesterUserId, Date requestedStartDate, Map<String, String> requestParameters, List<RequestSourceElement> requestSourceElements, List<ActionTargetElement> actionTargetElements) Run an instance of a governance service in its own thread and register the handler (for disconnect processing).protected void
startServiceExecutionThread
(String engineActionGUID, GovernanceServiceHandler serviceToRun, String threadName) Start the execution of the governance service on a new thread.void
Confirms termination of the governance engine.protected void
validateGovernanceEngineInitialized
(String expectedTypeName, String methodName) Validate that the governance engine is initialized.
-
Field Details
-
serverName
-
serverUserId
-
engineActionClient
-
engineUserId
-
auditLog
-
maxPageSize
protected int maxPageSize -
governanceEngineName
-
governanceEngineGUID
-
governanceEngineProperties
-
configurationClient
-
-
Constructor Details
-
GovernanceEngineHandler
public GovernanceEngineHandler(EngineConfig engineConfig, String serverName, String serverUserId, String engineServiceName, GovernanceConfigurationClient 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 runningserverUserId
- user id for the server to useengineServiceName
- name of the OMES that is supporting this governance engineconfigurationClient
- client to retrieve the configurationengineActionClient
- client to control the execution of engine action requestsauditLog
- logging destinationmaxPageSize
- maximum number of results that can be returned in a single request
-
-
Method Details
-
getGovernanceEngineName
Return the governance Engine name - used for error logging.- Returns:
- governance engine name
-
getGovernanceEngineElement
Return the governance engine element - used to determine if the governance engine is configured.- Returns:
- governance engine element
-
getSummary
Return a summary of the governance engine- Returns:
- governance engine summary
-
refreshConfig
public void refreshConfig() throws InvalidParameterException, UserNotAuthorizedException, PropertyServerExceptionRequest 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 configurationPropertyServerException
- 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 entityspecificRequestType
- specific request type to refresh- Throws:
InvalidParameterException
- one of the parameters is null or invalid.UserNotAuthorizedException
- user id is not allowed to access configurationPropertyServerException
- 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 servicemethodName
- calling method- Throws:
PropertyServerException
- governance engine is not initialized
-
restartServices
Restart any services that were running when the engine host shut down.- Parameters:
governanceEngineElement
- governance engine description
-
getServiceCache
Retrieve the governance service for the requested type.- Parameters:
governanceRequestType
- governance request type.- Returns:
- governance service
-
executeEngineAction
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, PropertyServerExceptionRun an instance of a governance service in its own thread and register the handler (for disconnect processing).- Parameters:
engineActionGUID
- unique identifier of the engine actiongovernanceRequestType
- governance request type to use when calling the governance enginerequestedStartDate
- date/time to start the governance servicerequesterUserId
- original user requesting this governance servicerequestParameters
- name-value properties to control the governance servicerequestSourceElements
- metadata elements associated with the request to the governance serviceactionTargetElements
- 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
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 servicethreadName
- name of the thread for diagnostic purposes- Throws:
InvalidParameterException
- error updating engine action statusPropertyServerException
- error updating engine action statusUserNotAuthorizedException
- error updating engine action status
-
terminate
public void terminate()Confirms termination of the governance engine.
-