Class GovernanceServiceHandler
java.lang.Object
org.odpi.openmetadata.governanceservers.enginehostservices.admin.GovernanceServiceHandler
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
GovernanceActionServiceHandler
,RepositoryGovernanceServiceHandler
,SurveyActionServiceHandler
GovernanceServiceHandler provides the thread to run a governance service. A new instance is created for each request.
The subclasses implement the run method.
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
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. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Disconnect the governance action service.Return the unique name for the hosting governance engine.Return the unique identifier of this governance service.Return the unique name of this governance service.void
recordCompletionStatus
(CompletionStatus status, List<String> outputGuards, Map<String, String> requestParameters, List<NewActionTarget> newActionTargets, String completionMessage) Declare that all the processing for the governance action service is finished and the status of the work.void
updateActionTargetStatus
(String actionTargetGUID, EngineActionStatus status, Date startDate, Date completionDate, String completionMessage) Update the status of a specific action target.protected void
waitForStartDate
(String serverUserId) If the service request has a start time in the future, wait for the start time.
-
Field Details
-
governanceEngineProperties
-
governanceEngineGUID
-
engineHostUserId
-
governanceServiceGUID
-
governanceServiceName
-
governanceService
-
engineActionGUID
-
serviceRequestType
-
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 logginggovernanceEngineGUID
- unique identifier of the governance engine - used for message loggingengineHostUserId
- userId for making updates to the governance actionsengineActionGUID
- unique identifier of the engine action that triggered this governance serviceengineActionClient
- client for processing engine actionsserviceRequestType
- incoming request typegovernanceServiceGUID
- unique identifier of the governance servicegovernanceServiceName
- name of this governance service - used for message logginggovernanceService
- implementation of governance servicerequestedStartDate
- date/time that the governance service should start executingauditLog
- destination for log messages
-
-
Method Details
-
getGovernanceServiceName
Return the unique name of this governance service.- Returns:
- string name
-
getGovernanceServiceGUID
Return the unique identifier of this governance service.- Returns:
- string guid
-
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 statusPropertyServerException
- error updating engine action statusUserNotAuthorizedException
- 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 progressstartDate
- date/time that the governance action service started processing the targetcompletionDate
- 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 recognizedUserNotAuthorizedException
- the governance action service is not authorized to update the action target propertiesPropertyServerException
- 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, PropertyServerExceptionDeclare that all the processing for the governance action service is finished and the status of the work.- Parameters:
status
- completion status enum valueoutputGuards
- optional guard strings for triggering subsequent action(s)requestParameters
- properties to pass to the next governance action servicenewActionTargets
- map of action target names to GUIDs for the resulting governance action servicecompletionMessage
- message to describe completion results or reasons for failure- Throws:
InvalidParameterException
- the completion status is nullUserNotAuthorizedException
- the governance action service is not authorized to update the governance action service statusPropertyServerException
- there is a problem connecting to the metadata store
-
disconnect
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
-