@InterfaceAudience.Public @InterfaceStability.Evolving public class RegistryTypeUtils extends Object
| Constructor and Description |
|---|
RegistryTypeUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getAddressField(Map<String,String> address,
String field)
Get a specific field from an address -raising an exception if
the field is not present
|
static Map<String,String> |
hostnamePortPair(InetSocketAddress address)
Create a (hostname, port) address pair
|
static Map<String,String> |
hostnamePortPair(String hostname,
int port)
Create a (hostname, port) address pair
|
static Endpoint |
inetAddrEndpoint(String api,
String protocolType,
String hostname,
int port)
Create an internet address endpoint from a list of URIs
|
static Endpoint |
ipcEndpoint(String api,
InetSocketAddress address)
Create an IPC endpoint
|
static Map<String,String> |
map(String key,
String val)
Create a single entry map
|
static void |
requireAddressType(String required,
Endpoint epr)
Require a specific address type on an endpoint
|
static Endpoint |
restEndpoint(String api,
URI... uris)
Create a REST endpoint from a list of URIs
|
static List<String> |
retrieveAddressesUriType(Endpoint epr)
Get a single URI endpoint
|
static List<URL> |
retrieveAddressURLs(Endpoint epr)
Get the address URLs.
|
static Map<String,String> |
uri(String uri)
Create a URI
|
static Endpoint |
urlEndpoint(String api,
String protocolType,
URI... uris)
Create a URL endpoint from a list of URIs
|
static void |
validateEndpoint(String path,
Endpoint endpoint)
Validate the endpoint by checking for null fields and other invalid
conditions
|
static void |
validateServiceRecord(String path,
ServiceRecord record)
Validate the record by checking for null fields and other invalid
conditions
|
static Endpoint |
webEndpoint(String api,
URI... uris)
Create a Web UI endpoint from a list of URIs
|
public static Endpoint urlEndpoint(String api, String protocolType, URI... uris)
api - implemented APIprotocolType - protocol typeuris - URIspublic static Endpoint restEndpoint(String api, URI... uris)
api - implemented APIuris - URIspublic static Endpoint webEndpoint(String api, URI... uris)
api - implemented APIuris - URIspublic static Endpoint inetAddrEndpoint(String api, String protocolType, String hostname, int port)
api - implemented APIprotocolType - protocol typehostname - hostname/FQDNport - portpublic static Endpoint ipcEndpoint(String api, InetSocketAddress address)
api - APIaddress - the address as a tuple of (hostname, port)public static Map<String,String> map(String key, String val)
key - map entry keyval - map entry valuepublic static Map<String,String> uri(String uri)
uri - valuepublic static Map<String,String> hostnamePortPair(String hostname, int port)
hostname - hostnameport - portpublic static Map<String,String> hostnamePortPair(InetSocketAddress address)
address - socket address whose hostname and port are used for the
generated address.public static void requireAddressType(String required, Endpoint epr) throws InvalidRecordException
required - required typeepr - endpointInvalidRecordException - if the type is wrongpublic static List<String> retrieveAddressesUriType(Endpoint epr) throws InvalidRecordException
epr - endpointInvalidRecordException - if the type is wrong, there are no addresses
or the payload ill-formattedpublic static String getAddressField(Map<String,String> address, String field) throws InvalidRecordException
address - address to queryfield - field to resolveInvalidRecordException - if the field did not resolvepublic static List<URL> retrieveAddressURLs(Endpoint epr) throws InvalidRecordException, MalformedURLException
epr - endpointInvalidRecordException - if the type is wrong, there are no addresses
or the payload ill-formattedMalformedURLException - address can't be turned into a URLpublic static void validateServiceRecord(String path, ServiceRecord record) throws InvalidRecordException
path - path for exceptionsrecord - record to validate. May be nullInvalidRecordException - on invalid entriespublic static void validateEndpoint(String path, Endpoint endpoint) throws InvalidRecordException
path - path for exceptionsendpoint - endpoint to validate. May be nullInvalidRecordException - on invalid entriesCopyright © 2022 Apache Software Foundation. All rights reserved.