public class WebPartners extends Object
Constructor and Description |
---|
WebPartners() |
WebPartners(RemoteContact remoteContact) |
Modifier and Type | Method and Description |
---|---|
RegistryPartner |
addNewPartner(String userId,
RegistryPartner partner,
String thisUrl)
Adds the registry instance specified by the url to the list of existing partners (if not already in there)
and sends a request to the remote instance that includes a security token that the remote instance
can use to communicate with this instance.
|
protected RegistryPartner |
createRemotePartnerObject(RegistryPartner newPartner,
String token) |
RegistryPartner |
get(String partnerId) |
RegistryPartner |
get(String token,
String url)
Retrieve a partner based on partner token and unique identifier
This is mostly intended to validate the token associated with url
|
List<RegistryPartner> |
getPartners()
Retrieves list of partners for this instance
|
protected RegistryPartner |
getThisInstanceWithNewApiKey()
Generates a new partner object representing this ICE instance
with a new API key
|
protected String |
getThisUri() |
protected RegistryPartner |
handleRemoteAddRequest(RegistryPartner request)
Handles requests from remote ice instances that will like to be in a WoR config with this instance
Serves the dual purpose of:
please add me as a partner to your list with token
add accepted; use this as the authorization token
|
protected boolean |
isInWebOfRegistries()
Checks if the web of registries admin config value has been set to enable this ICE instance
to join the web of registries configuration
|
protected boolean |
isValidUrl(String url)
Validates the url by pre-pending "https://" as the scheme
|
RegistryPartner |
processRemoteWebPartnerAdd(RegistryPartner newPartner)
Process a web partner add request from a remote instance
|
boolean |
remove(String userId,
long id) |
boolean |
removeRemotePartner(long id,
String url)
Delete the partner information specified by the url in the param
|
RegistryPartner |
update(String userId,
long id,
RegistryPartner partner) |
RegistryPartner |
updateAPIKey(String userId,
long id)
Refreshes the API key for the referenced partner
|
RegistryPartner |
updateRemoteAPIKey(String url,
RegistryPartner remotePartner)
Updates the api token of a remote partner using information sent by that partner
|
public WebPartners()
public WebPartners(RemoteContact remoteContact)
public RegistryPartner get(String partnerId)
public List<RegistryPartner> getPartners()
public RegistryPartner get(String token, String url)
token
- partner token generated by this ICE instance and sent to other instanceurl
- unique identifier for partner instancepublic RegistryPartner processRemoteWebPartnerAdd(RegistryPartner newPartner)
newPartner
- information about partner that should include an api token to be
used when contacting that partnerprotected RegistryPartner handleRemoteAddRequest(RegistryPartner request)
Note that the request is rejected if this ICE instance has not opted to be a member of web of registries
request
- partner request object containing all information needed with a validated urlprotected boolean isValidUrl(String url)
url
- without schemepublic boolean remove(String userId, long id)
public boolean removeRemotePartner(long id, String url)
id
- unique local identifier of the partner making request.url
- url of partner being deletedprotected String getThisUri()
public RegistryPartner updateAPIKey(String userId, long id)
userId
- identifier for user making request. Must have administrative privilegesid
- unique (local) identifier for remote partner whose API key is being refreshedPermissionException
- if user making request does not have administrative privilegesIllegalArgumentException
- if the partner identifier is invalid (cannot be used to retrieve a valid
partner)public RegistryPartner updateRemoteAPIKey(String url, RegistryPartner remotePartner)
url
- URL of partner making request. This is obtained from the old api keyremotePartner
- information sent by remote partnerpublic RegistryPartner update(String userId, long id, RegistryPartner partner)
public RegistryPartner addNewPartner(String userId, RegistryPartner partner, String thisUrl)
Information about the remote instance is still saved even when it cannot be communicated with. This allows a future communication attempt.
userId
- id of user performing action (must have admin privileges)partner
- registry partner object that contains unique uniform resource identifier & name for the registryprotected RegistryPartner getThisInstanceWithNewApiKey()
protected boolean isInWebOfRegistries()
protected RegistryPartner createRemotePartnerObject(RegistryPartner newPartner, String token)
Copyright © 2017. All rights reserved.