Class GovernanceContextClientBase
java.lang.Object
org.odpi.openmetadata.frameworkservices.gaf.client.OpenGovernanceClientBase
org.odpi.openmetadata.frameworkservices.gaf.client.GovernanceContextClientBase
- All Implemented Interfaces:
ActionControlInterface
,DuplicateManagementInterface
,GovernanceActionProcessInterface
,GovernanceActionTypeInterface
,GovernanceCompletionInterface
,WatchDogEventInterface
- Direct Known Subclasses:
GovernanceContextClient
,GovernanceContextClient
public class GovernanceContextClientBase
extends OpenGovernanceClientBase
implements GovernanceCompletionInterface, WatchDogEventInterface
GovernanceContextClientBase sits in the governance context of a governance action service when it is running in the engine host OMAG server.
It is however shared by all the governance action services running in an engine service so that we only need one connector to the topic
listener for the watchdog governance services.
-
Field Summary
Modifier and TypeFieldDescriptionprotected GovernanceListenerManager
Manages registered listenersprotected String
Fields inherited from class org.odpi.openmetadata.frameworkservices.gaf.client.OpenGovernanceClientBase
invalidParameterHandler, nullRequestBody, serverName, serverPlatformURLRoot, serviceURLMarker
-
Constructor Summary
ConstructorDescriptionGovernanceContextClientBase
(String serviceURLMarker, String serverName, String serverPlatformURLRoot, int maxPageSize) Create a new client with no authentication embedded in the HTTP request.GovernanceContextClientBase
(String serviceURLMarker, String serverName, String serverPlatformURLRoot, String serverUserId, String serverPassword, int maxPageSize) Create a new client that passes userId and password in each HTTP request.GovernanceContextClientBase
(String serviceURLMarker, String serverName, String serverPlatformURLRoot, GAFRESTClient restClient, int maxPageSize) Create a new client that passes userId and password in each HTTP request. -
Method Summary
Modifier and TypeMethodDescriptionvoid
claimEngineAction
(String userId, String engineActionGUID) Request that execution of a governance action is allocated to the caller.void
Called during the disconnect processing of the watchdog governance action service.getActiveClaimedEngineActions
(String userId, String governanceEngineGUID, int startFrom, int pageSize) Retrieve the engine actions that are still in process and that have been claimed by this caller's userId.void
recordCompletionStatus
(String userId, String engineActionGUID, Map<String, String> requestParameters, CompletionStatus status, List<String> outputGuards, List<NewActionTarget> newActionTargets, String completionMessage) Declare that all the processing for the governance action service is finished and the status of the work.void
registerListener
(WatchdogGovernanceListener listener, List<WatchdogEventType> interestingEventTypes, List<String> interestingMetadataTypes, String specificInstance) Register a listener to receive events about changes to metadata elements in the open metadata store.void
setListenerManager
(GovernanceListenerManager governanceListenerManager, String listenerId) Set up the listener manager.void
updateActionTargetStatus
(String userId, String actionTargetGUID, EngineActionStatus status, Date startDate, Date completionDate, String completionMessage) Update the status of a specific action target.void
updateEngineActionStatus
(String userId, String engineActionGUID, EngineActionStatus engineActionStatus) Update the status of the governance action - providing the caller is permitted.Methods inherited from class org.odpi.openmetadata.frameworkservices.gaf.client.OpenGovernanceClientBase
cancelEngineAction, createGovernanceActionProcess, createGovernanceActionProcessStep, createGovernanceActionType, findEngineActions, findGovernanceActionProcesses, findGovernanceActionProcessSteps, findGovernanceActionTypes, getActiveEngineActions, getEngineAction, getEngineActions, getEngineActionsByName, getFirstActionProcessStep, getGovernanceActionProcessByGUID, getGovernanceActionProcessesByName, getGovernanceActionProcessGraph, getGovernanceActionProcessStepByGUID, getGovernanceActionProcessStepsByName, getGovernanceActionTypeByGUID, getGovernanceActionTypesByName, getNextGovernanceActionProcessSteps, initiateEngineAction, initiateGovernanceActionProcess, initiateGovernanceActionType, linkConsolidatedDuplicate, linkElementsAsPeerDuplicates, publishGovernanceActionProcess, removeFirstActionProcessStep, removeGovernanceActionProcess, removeGovernanceActionProcessStep, removeGovernanceActionType, removeNextActionProcessStep, setupFirstActionProcessStep, setupNextActionProcessStep, updateGovernanceActionProcess, updateGovernanceActionProcessStep, updateGovernanceActionType, updateNextActionProcessStep, withdrawGovernanceActionProcess
-
Field Details
-
governanceListenerManager
Manages registered listeners -
listenerId
-
-
Constructor Details
-
GovernanceContextClientBase
public GovernanceContextClientBase(String serviceURLMarker, String serverName, String serverPlatformURLRoot, int maxPageSize) throws InvalidParameterException Create a new client with no authentication embedded in the HTTP request.- Parameters:
serviceURLMarker
- the identifier of the access service (for example asset-owner for the Asset Owner OMAS)serverName
- name of the server to connect toserverPlatformURLRoot
- the network address of the server running the OMAS REST servicesmaxPageSize
- pre-initialized parameter limit- Throws:
InvalidParameterException
- there is a problem creating the client-side components to issue any REST API calls.
-
GovernanceContextClientBase
public GovernanceContextClientBase(String serviceURLMarker, String serverName, String serverPlatformURLRoot, String serverUserId, String serverPassword, int maxPageSize) throws InvalidParameterException Create a new client that passes userId and password in each HTTP request. This is the userId/password of the calling server. The end user's userId is sent on each request.- Parameters:
serviceURLMarker
- the identifier of the access service (for example asset-owner for the Asset Owner OMAS)serverName
- name of the server to connect toserverPlatformURLRoot
- the network address of the server running the OMAS REST servicesserverUserId
- caller's userId embedded in all HTTP requestsserverPassword
- caller's password embedded in all HTTP requestsmaxPageSize
- pre-initialized parameter limit- Throws:
InvalidParameterException
- there is a problem creating the client-side components to issue any REST API calls.
-
GovernanceContextClientBase
public GovernanceContextClientBase(String serviceURLMarker, String serverName, String serverPlatformURLRoot, GAFRESTClient restClient, int maxPageSize) throws InvalidParameterException Create a new client that passes userId and password in each HTTP request. This is the userId/password of the calling server. The end user's userId is sent on each request.- Parameters:
serviceURLMarker
- the identifier of the access service (for example asset-owner for the Asset Owner OMAS)serverName
- name of the server to connect toserverPlatformURLRoot
- the network address of the server running the OMAS REST servicesrestClient
- pre-initialized REST clientmaxPageSize
- pre-initialized parameter limit- Throws:
InvalidParameterException
- there is a problem with the information about the remote OMAS
-
-
Method Details
-
setListenerManager
public void setListenerManager(GovernanceListenerManager governanceListenerManager, String listenerId) Set up the listener manager.- Parameters:
governanceListenerManager
- aggregates listeners from governance serviceslistenerId
- identifier used to maintain topic event pointer in event manager
-
registerListener
public void registerListener(WatchdogGovernanceListener listener, List<WatchdogEventType> interestingEventTypes, List<String> interestingMetadataTypes, String specificInstance) throws InvalidParameterException Register a listener to receive events about changes to metadata elements in the open metadata store. There can be only one registered listener. If this method is called more than once, the new parameters replace the existing parameters. This means the watchdog governance action service can change the listener and the parameters that control the types of events received while it is running.
The types of events passed to the listener are controlled by the combination of the interesting event types and the interesting metadata types. That is an event is only passed to the listener if it matches both the interesting event types and the interesting metadata types.
If specific instance, interestingEventTypes or interestingMetadataTypes are null, it defaults to "any". If the listener parameter is null, no more events are passed to the listener.- Specified by:
registerListener
in interfaceWatchDogEventInterface
- Parameters:
listener
- listener object to receive eventsinterestingEventTypes
- types of events that should be passed to the listenerinterestingMetadataTypes
- types of elements that are the subject of the interesting event typesspecificInstance
- unique identifier of a specific instance to watch for- Throws:
InvalidParameterException
- one or more of the type names are unrecognized
-
disconnectListener
public void disconnectListener()Called during the disconnect processing of the watchdog governance action service.- Specified by:
disconnectListener
in interfaceWatchDogEventInterface
-
updateEngineActionStatus
public void updateEngineActionStatus(String userId, String engineActionGUID, EngineActionStatus engineActionStatus) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Update the status of the governance action - providing the caller is permitted.- Specified by:
updateEngineActionStatus
in interfaceGovernanceCompletionInterface
- Parameters:
userId
- identifier of calling userengineActionGUID
- identifier of the governance action requestengineActionStatus
- new status enum- 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 metadata store.
-
claimEngineAction
public void claimEngineAction(String userId, String engineActionGUID) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Request that execution of a governance action is allocated to the caller.- Specified by:
claimEngineAction
in interfaceGovernanceCompletionInterface
- Parameters:
userId
- identifier of calling userengineActionGUID
- identifier of the governance action 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 metadata store.
-
getActiveClaimedEngineActions
public List<EngineActionElement> getActiveClaimedEngineActions(String userId, String governanceEngineGUID, int startFrom, int pageSize) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Retrieve the engine actions that are still in process and that have been claimed by this caller's userId. This call is used when the caller restarts.- Specified by:
getActiveClaimedEngineActions
in interfaceGovernanceCompletionInterface
- Parameters:
userId
- userId of callergovernanceEngineGUID
- unique identifier of governance enginestartFrom
- starting from elementpageSize
- maximum elements to return- Returns:
- list of governance action elements
- 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 metadata store.
-
updateActionTargetStatus
public void updateActionTargetStatus(String userId, 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 action service has to process name target elements, then setting the status on each individual target will show the progress of the governance action service.- Specified by:
updateActionTargetStatus
in interfaceGovernanceCompletionInterface
- Parameters:
userId
- caller's userIdactionTargetGUID
- unique identifier of the governance action service.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(String userId, String engineActionGUID, Map<String, String> requestParameters, CompletionStatus status, List<String> outputGuards, 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.- Specified by:
recordCompletionStatus
in interfaceGovernanceCompletionInterface
- Parameters:
userId
- caller's userIdengineActionGUID
- unique identifier of the governance action to updaterequestParameters
- request properties from the caller (will be passed onto any follow-on actions)status
- completion status enum valueoutputGuards
- optional guard strings for triggering subsequent action(s)newActionTargets
- list 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
-