|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.hadoop.registry.client.binding.RegistryTypeUtils
@InterfaceAudience.Public @InterfaceStability.Evolving public class RegistryTypeUtils
Static methods to work with registry types —primarily endpoints and the list representation of addresses.
Constructor Summary | |
---|---|
RegistryTypeUtils()
|
Method Summary | |
---|---|
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RegistryTypeUtils()
Method Detail |
---|
public static Endpoint urlEndpoint(String api, String protocolType, URI... uris)
api
- implemented APIprotocolType
- protocol typeuris
- URIs
public static Endpoint restEndpoint(String api, URI... uris)
api
- implemented APIuris
- URIs
public static Endpoint webEndpoint(String api, URI... uris)
api
- implemented APIuris
- URIs
public static Endpoint inetAddrEndpoint(String api, String protocolType, String hostname, int port)
api
- implemented APIprotocolType
- protocol typehostname
- hostname/FQDNport
- port
public 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 value
public static Map<String,String> uri(String uri)
uri
- value
public static Map<String,String> hostnamePortPair(String hostname, int port)
hostname
- hostnameport
- port
public 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
- endpoint
InvalidRecordException
- if the type is wrongpublic static List<String> retrieveAddressesUriType(Endpoint epr) throws InvalidRecordException
epr
- endpoint
InvalidRecordException
- 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 resolve
InvalidRecordException
- if the field did not resolvepublic static List<URL> retrieveAddressURLs(Endpoint epr) throws InvalidRecordException, MalformedURLException
epr
- endpoint
InvalidRecordException
- if the type is wrong, there are no addresses
or the payload ill-formatted
MalformedURLException
- 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 null
InvalidRecordException
- on invalid entriespublic static void validateEndpoint(String path, Endpoint endpoint) throws InvalidRecordException
path
- path for exceptionsendpoint
- endpoint to validate. May be null
InvalidRecordException
- on invalid entries
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |