Class MetadataHighwayServicesClient
java.lang.Object
org.odpi.openmetadata.repositoryservices.clients.MetadataHighwayServicesClient
- All Implemented Interfaces:
AuditLoggingComponent
The MetadataHighwayServicesClient supports the OMRS Metadata Highway REST API.
Requests to this client are translated one-for-one to requests to the metadata highway service since
the OMRS REST API has a one-to-one correspondence with the metadata highway API.
The URLs for the REST APIs are of this form:
- restURLroot - serverURLroot + "/servers/" + serverName
- rootServiceNameInURL - "/open-metadata/repository-services"
- userIdInURL - optional - "/users/{0}"
- operationSpecificURL - operation specific part of the URL
-
Field Summary
-
Constructor Summary
ConstructorDescriptionMetadataHighwayServicesClient
(String serverName, String restURLRoot) Create a new client with no authentication embedded in the HTTP request.MetadataHighwayServicesClient
(String serverName, String restURLRoot, String userId, String password) Create a new client that passes userId and password in each HTTP request. -
Method Summary
Modifier and TypeMethodDescriptionboolean
connectToCohort
(String userId, String cohortName) A new server needs to register the metadataCollectionId for its metadata repository with the other servers in the open metadata repository.boolean
disconnectFromCohort
(String userId, String cohortName) Disconnect communications from a specific cohort.getCohortDescriptions
(String userId) Returns the descriptions of all cohorts the server is a member of.Return the component description that is used by this connector in the audit log.getLocalRegistration
(String userId, String cohortName) Returns the registration of the local server in the specified cohort.getRemoteRegistrations
(String userId, String cohortName) Returns the remote member registrations seen by the local server in the specified cohort.void
setAuditLog
(AuditLog auditLog) Receive an audit log object that can be used to record audit log messages.boolean
unregisterFromCohort
(String userId, String cohortName) Unregister from a specific cohort and disconnect from cohort communications.
-
Field Details
-
auditLog
-
-
Constructor Details
-
MetadataHighwayServicesClient
public MetadataHighwayServicesClient(String serverName, String restURLRoot) throws InvalidParameterException Create a new client with no authentication embedded in the HTTP request.- Parameters:
serverName
- the name of the remote serverrestURLRoot
- the network address of the server running the repository services. This is of the form serverURLroot + "/servers/" + serverName.- Throws:
InvalidParameterException
- bad input parameters
-
MetadataHighwayServicesClient
public MetadataHighwayServicesClient(String serverName, String restURLRoot, String userId, String password) 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:
serverName
- the name of the remote serverrestURLRoot
- the network address of the server running the repository services. This is of the form serverURLroot + "/servers/" + serverName.userId
- caller's userId embedded in all HTTP requestspassword
- caller's userId embedded in all HTTP requests- Throws:
InvalidParameterException
- bad input parameters
-
-
Method Details
-
setAuditLog
Receive an audit log object that can be used to record audit log messages. The caller has initialized it with the correct component description and log destinations.- Specified by:
setAuditLog
in interfaceAuditLoggingComponent
- Parameters:
auditLog
- audit log object
-
getConnectorComponentDescription
Return the component description that is used by this connector in the audit log.- Specified by:
getConnectorComponentDescription
in interfaceAuditLoggingComponent
- Returns:
- id, name, description, wiki page URL.
-
getCohortDescriptions
public List<CohortDescription> getCohortDescriptions(String userId) throws InvalidParameterException, RepositoryErrorException, UserNotAuthorizedException Returns the descriptions of all cohorts the server is a member of.- Parameters:
userId
- calling user- Returns:
- List of CohortDescription object describing cohorts
- Throws:
InvalidParameterException
- one of the supplied parameters caused a problemRepositoryErrorException
- there is a problem communicating with the remote server.UserNotAuthorizedException
- the user is not authorized to perform the operation requested
-
getLocalRegistration
public MemberRegistration getLocalRegistration(String userId, String cohortName) throws InvalidParameterException, RepositoryErrorException, UserNotAuthorizedException Returns the registration of the local server in the specified cohort.- Parameters:
userId
- calling usercohortName
- the name of the cohort- Returns:
- MemberRegistration local registration
- Throws:
InvalidParameterException
- one of the supplied parameters caused a problemRepositoryErrorException
- there is a problem communicating with the remote server.UserNotAuthorizedException
- the user is not authorized to perform the operation requested
-
connectToCohort
public boolean connectToCohort(String userId, String cohortName) throws InvalidParameterException, RepositoryErrorException, UserNotAuthorizedException A new server needs to register the metadataCollectionId for its metadata repository with the other servers in the open metadata repository. It only needs to do this once and uses a timestamp to record that the registration event has been sent. If the server has already registered in the past, it sends a reregistration request.- Parameters:
userId
- calling usercohortName
- name of cohort- Returns:
- boolean to indicate that the request has been issued. If false it is likely that the cohort name is not known
- Throws:
InvalidParameterException
- one of the supplied parameters caused a problemRepositoryErrorException
- there is a problem communicating with the remote server.UserNotAuthorizedException
- the user is not authorized to perform the operation requested
-
getRemoteRegistrations
public List<MemberRegistration> getRemoteRegistrations(String userId, String cohortName) throws InvalidParameterException, RepositoryErrorException, UserNotAuthorizedException Returns the remote member registrations seen by the local server in the specified cohort.- Parameters:
userId
- calling usercohortName
- the name of the cohort- Returns:
- MemberRegistration local registration
- Throws:
InvalidParameterException
- one of the supplied parameters caused a problemRepositoryErrorException
- there is a problem communicating with the remote server.UserNotAuthorizedException
- the user is not authorized to perform the operation requested
-
disconnectFromCohort
public boolean disconnectFromCohort(String userId, String cohortName) throws InvalidParameterException, RepositoryErrorException, UserNotAuthorizedException Disconnect communications from a specific cohort.- Parameters:
userId
- calling usercohortName
- name of cohort- Returns:
- boolean flag to indicate success.
- Throws:
InvalidParameterException
- one of the supplied parameters caused a problemRepositoryErrorException
- there is a problem communicating with the remote server.UserNotAuthorizedException
- the user is not authorized to perform the operation requested
-
unregisterFromCohort
public boolean unregisterFromCohort(String userId, String cohortName) throws InvalidParameterException, RepositoryErrorException, UserNotAuthorizedException Unregister from a specific cohort and disconnect from cohort communications.- Parameters:
userId
- calling usercohortName
- name of cohort- Returns:
- boolean flag to indicate success.
- Throws:
InvalidParameterException
- one of the supplied parameters caused a problemRepositoryErrorException
- there is a problem communicating with the remote server.UserNotAuthorizedException
- the user is not authorized to perform the operation requested
-