Class OpenGovernanceClientBase
java.lang.Object
org.odpi.openmetadata.frameworks.governanceaction.client.OpenGovernanceClient
org.odpi.openmetadata.frameworkservices.gaf.client.OpenGovernanceClientBase
- All Implemented Interfaces:
GovernanceCompletionInterface
,SpecialGovernanceActionInterface
- Direct Known Subclasses:
GovernanceEngineClient
OpenGovernanceClientBase 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
FieldsModifier and TypeFieldDescriptionprotected GovernanceListenerManager
protected final InvalidParameterHandler
protected String
Fields inherited from class org.odpi.openmetadata.frameworks.governanceaction.client.OpenGovernanceClient
serverName, serverPlatformURLRoot, serviceURLMarker
-
Constructor Summary
ConstructorsConstructorDescriptionOpenGovernanceClientBase
(String serviceURLMarker, String serverName, String serverPlatformURLRoot) Create a new client with no authentication embedded in the HTTP request.OpenGovernanceClientBase
(String serviceURLMarker, String serverName, String serverPlatformURLRoot, String serverUserId, String serverPassword) Create a new client that passes userId and password in each HTTP request.OpenGovernanceClientBase
(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
Called during the disconnect processing of the watchdog governance action service.initiateGovernanceAction
(String userId, String qualifiedName, int domainIdentifier, String displayName, String description, List<String> requestSourceGUIDs, List<NewActionTarget> actionTargets, List<String> receivedGuards, Date startTime, String governanceEngineName, String requestType, Map<String, String> requestParameters, String processName, String requestSourceName, String originatorServiceName, String originatorEngineName) Create a governance action in the metadata store which will trigger the governance action service associated with the supplied request type.initiateGovernanceActionProcess
(String userId, String processQualifiedName, List<String> requestSourceGUIDs, List<NewActionTarget> actionTargets, Date startTime, Map<String, String> requestParameters, String originatorServiceName, String originatorEngineName) Using the named governance action process as a template, initiate a chain of governance actions.void
linkConsolidatedDuplicate
(String userId, String consolidatedElementGUID, int statusIdentifier, String steward, String stewardTypeName, String stewardPropertyName, String source, String notes, List<String> sourceElementGUIDs) Identify an element that acts as a consolidated version for a set of duplicate elements.void
linkElementsAsPeerDuplicates
(String userId, String metadataElement1GUID, String metadataElement2GUID, int statusIdentifier, String steward, String stewardTypeName, String stewardPropertyName, String source, String notes, boolean setKnownDuplicate) Link elements as peer duplicates.void
recordCompletionStatus
(String userId, String governanceActionGUID, 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, GovernanceActionStatus status, Date startDate, Date completionDate, String completionMessage) Update the status of a specific action target.Methods inherited from class org.odpi.openmetadata.frameworks.governanceaction.client.OpenGovernanceClient
toString
-
Field Details
-
governanceListenerManager
-
listenerId
-
invalidParameterHandler
-
-
Constructor Details
-
OpenGovernanceClientBase
public OpenGovernanceClientBase(String serviceURLMarker, String serverName, String serverPlatformURLRoot) 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 services- Throws:
InvalidParameterException
- there is a problem creating the client-side components to issue any REST API calls.
-
OpenGovernanceClientBase
public OpenGovernanceClientBase(String serviceURLMarker, String serverName, String serverPlatformURLRoot, String serverUserId, String serverPassword) 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 requests- Throws:
InvalidParameterException
- there is a problem creating the client-side components to issue any REST API calls.
-
OpenGovernanceClientBase
public OpenGovernanceClientBase(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
-
updateActionTargetStatus
public void updateActionTargetStatus(String userId, String actionTargetGUID, GovernanceActionStatus 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
- Specified by:
updateActionTargetStatus
in classOpenGovernanceClient
- 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 governanceActionGUID, 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
- Specified by:
recordCompletionStatus
in classOpenGovernanceClient
- Parameters:
userId
- caller's userIdgovernanceActionGUID
- 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
-
initiateGovernanceAction
public String initiateGovernanceAction(String userId, String qualifiedName, int domainIdentifier, String displayName, String description, List<String> requestSourceGUIDs, List<NewActionTarget> actionTargets, List<String> receivedGuards, Date startTime, String governanceEngineName, String requestType, Map<String, String> requestParameters, String processName, String requestSourceName, String originatorServiceName, String originatorEngineName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerExceptionCreate a governance action in the metadata store which will trigger the governance action service associated with the supplied request type. The governance action remains to act as a record of the actions taken for auditing.- Specified by:
initiateGovernanceAction
in interfaceSpecialGovernanceActionInterface
- Specified by:
initiateGovernanceAction
in classOpenGovernanceClient
- Parameters:
userId
- caller's userIdqualifiedName
- unique identifier to give this governance actiondomainIdentifier
- governance domain associated with this action (0=ALL)displayName
- display name for this actiondescription
- description for this actionrequestSourceGUIDs
- request source elements for the resulting governance action serviceactionTargets
- list of action target names to GUIDs for the resulting governance action servicereceivedGuards
- list of guards to initiate the governance actionstartTime
- future start time or null for "as soon as possible"governanceEngineName
- name of the governance engine that should execute the requestrequestType
- governance request type from the callerrequestParameters
- properties to pass to the governance action serviceprocessName
- name of the process that this action is a part ofrequestSourceName
- source of the requestoriginatorServiceName
- unique name of the requesting governance service (if initiated by a governance engine).originatorEngineName
- optional unique name of the requesting governance engine (if initiated by a governance engine).- Returns:
- unique identifier of the governance action
- Throws:
InvalidParameterException
- null qualified nameUserNotAuthorizedException
- this governance action service is not authorized to create a governance actionPropertyServerException
- there is a problem with the metadata store
-
initiateGovernanceActionProcess
public String initiateGovernanceActionProcess(String userId, String processQualifiedName, List<String> requestSourceGUIDs, List<NewActionTarget> actionTargets, Date startTime, Map<String, String> requestParameters, String originatorServiceName, String originatorEngineName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerExceptionUsing the named governance action process as a template, initiate a chain of governance actions.- Specified by:
initiateGovernanceActionProcess
in interfaceSpecialGovernanceActionInterface
- Specified by:
initiateGovernanceActionProcess
in classOpenGovernanceClient
- Parameters:
userId
- caller's userIdprocessQualifiedName
- unique name of the governance action process to userequestSourceGUIDs
- request source elements for the resulting governance action serviceactionTargets
- list of action target names to GUIDs for the resulting governance action servicestartTime
- future start time or null for "as soon as possible".requestParameters
- request properties to be passed to the first governance actionoriginatorServiceName
- unique name of the requesting governance service (if initiated by a governance engine).originatorEngineName
- optional unique name of the governance engine (if initiated by a governance engine).- Returns:
- unique identifier of the first governance action of the process
- Throws:
InvalidParameterException
- null or unrecognized qualified name of the processUserNotAuthorizedException
- this governance action service is not authorized to create a governance action processPropertyServerException
- there is a problem with the metadata store
-
linkElementsAsPeerDuplicates
public void linkElementsAsPeerDuplicates(String userId, String metadataElement1GUID, String metadataElement2GUID, int statusIdentifier, String steward, String stewardTypeName, String stewardPropertyName, String source, String notes, boolean setKnownDuplicate) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Link elements as peer duplicates. Create a simple relationship between two elements. If the relationship already exists, the properties are updated.- Specified by:
linkElementsAsPeerDuplicates
in interfaceSpecialGovernanceActionInterface
- Specified by:
linkElementsAsPeerDuplicates
in classOpenGovernanceClient
- Parameters:
userId
- caller's userIdmetadataElement1GUID
- unique identifier of the metadata element at end 1 of the relationshipmetadataElement2GUID
- unique identifier of the metadata element at end 2 of the relationshipstatusIdentifier
- what is the status of this relationship (negative means untrusted, 0 means unverified and positive means trusted)steward
- identifier of the stewardstewardTypeName
- type of element used to identify the stewardstewardPropertyName
- property name used to identify stewardsource
- source of the duplicate detection processingnotes
- notes for the stewardsetKnownDuplicate
- boolean flag indicating whether the KnownDuplicate classification should be set on the linked entities.- Throws:
InvalidParameterException
- the unique identifier's of the metadata elements are null or invalid in some way; the properties are not valid for this type of relationshipUserNotAuthorizedException
- the governance action service is not authorized to create this type of relationshipPropertyServerException
- there is a problem with the metadata store
-
linkConsolidatedDuplicate
public void linkConsolidatedDuplicate(String userId, String consolidatedElementGUID, int statusIdentifier, String steward, String stewardTypeName, String stewardPropertyName, String source, String notes, List<String> sourceElementGUIDs) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Identify an element that acts as a consolidated version for a set of duplicate elements. (The consolidated element is created using createMetadataElement.)- Specified by:
linkConsolidatedDuplicate
in interfaceSpecialGovernanceActionInterface
- Specified by:
linkConsolidatedDuplicate
in classOpenGovernanceClient
- Parameters:
userId
- caller's userIdconsolidatedElementGUID
- unique identifier of the metadata elementstatusIdentifier
- what is the status of this relationship (negative means untrusted, 0 means unverified and positive means trusted)steward
- identifier of the stewardstewardTypeName
- type of element used to identify the stewardstewardPropertyName
- property name used to identify stewardsource
- source of the duplicate detection processingnotes
- notes for the stewardsourceElementGUIDs
- List of the source elements that must be linked to the consolidated element. It is assumed that they already have the KnownDuplicateClassification.- Throws:
InvalidParameterException
- the unique identifier's of the metadata elements are null or invalid in some way; the properties are not valid for this type of relationshipUserNotAuthorizedException
- the governance action service is not authorized to create this type of relationshipPropertyServerException
- there is a problem with the metadata store
-
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 classOpenGovernanceClient
- 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 classOpenGovernanceClient
-