Class MetadataHighwayServicesClient
- java.lang.Object
-
- org.odpi.openmetadata.repositoryservices.clients.MetadataHighwayServicesClient
-
- All Implemented Interfaces:
AuditLoggingComponent
public class MetadataHighwayServicesClient extends Object implements 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
-
-
Constructor Summary
Constructors Constructor Description MetadataHighwayServicesClient(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanconnectToCohort(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.booleandisconnectFromCohort(String userId, String cohortName)Disconnect communications from a specific cohort.List<CohortDescription>getCohortDescriptions(String userId)Returns the descriptions of all cohorts the server is a member of.ComponentDescriptiongetConnectorComponentDescription()Return the component description that is used by this connector in the audit log.MemberRegistrationgetLocalRegistration(String userId, String cohortName)Returns the registration of the local server in the specified cohort.List<MemberRegistration>getRemoteRegistrations(String userId, String cohortName)Returns the remote member registrations seen by the local server in the specified cohort.voidsetAuditLog(AuditLog auditLog)Receive an audit log object that can be used to record audit log messages.booleanunregisterFromCohort(String userId, String cohortName)Unregister from a specific cohort and disconnect from cohort communications.
-
-
-
Field Detail
-
auditLog
protected AuditLog auditLog
-
-
Constructor Detail
-
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 Detail
-
setAuditLog
public void setAuditLog(AuditLog auditLog)
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:
setAuditLogin interfaceAuditLoggingComponent- Parameters:
auditLog- audit log object
-
getConnectorComponentDescription
public ComponentDescription getConnectorComponentDescription()
Return the component description that is used by this connector in the audit log.- Specified by:
getConnectorComponentDescriptionin 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
-
-