Class Endpoint
java.lang.Object
org.apache.hadoop.registry.client.types.Endpoint
- All Implemented Interfaces:
Cloneable
Description of a single service/component endpoint.
It is designed to be marshalled as JSON.
Every endpoint can have more than one address entry, such as a list of URLs to a replicated service, or a (hostname, port) pair. Each of these address entries is represented as a string list, as that is the only reliably marshallable form of a tuple JSON can represent.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEndpoint()Create an empty instance.Build an endpoint with an empty address listBuild an endpoint with a list of addressesBuild an endpoint with a single address entry.Build an endpoint with a list of addressesBuild an endpoint from a list of URIs; each URI is ASCII-encoded and added to the list of addresses.Create an endpoint from another endpoint. -
Method Summary
-
Field Details
-
api
API implemented at the end of the binding -
addressType
Type of address. The standard types are defined inAddressTypes -
protocolType
Protocol type. Some standard types are defined inProtocolTypes -
addresses
a list of address tuples —tuples whose format depends on the address type
-
-
Constructor Details
-
Endpoint
public Endpoint()Create an empty instance. -
Endpoint
Create an endpoint from another endpoint. This is a deep clone with a new list of addresses.- Parameters:
that- the endpoint to copy from
-
Endpoint
public Endpoint(String api, String addressType, String protocolType, List<Map<String, String>> addrs) Build an endpoint with a list of addresses- Parameters:
api- API nameaddressType- address typeprotocolType- protocol typeaddrs- addresses
-
Endpoint
Build an endpoint with an empty address list- Parameters:
api- API nameaddressType- address typeprotocolType- protocol type
-
Endpoint
Build an endpoint with a single address entry.This constructor is superfluous given the varags constructor is equivalent for a single element argument. However, type-erasure in java generics causes javac to warn about unchecked generic array creation. This constructor, which represents the common "one address" case, does not generate compile-time warnings.
- Parameters:
api- API nameaddressType- address typeprotocolType- protocol typeaddr- address. May be null —in which case it is not added
-
Endpoint
Build an endpoint with a list of addresses- Parameters:
api- API nameaddressType- address typeprotocolType- protocol typeaddrs- addresses. Null elements will be skipped
-
Endpoint
Build an endpoint from a list of URIs; each URI is ASCII-encoded and added to the list of addresses.- Parameters:
api- API nameprotocolType- protocol typeuris- URIs to convert to a list of tup;les
-
-
Method Details
-
toString
-
validate
public void validate()Validate the record by checking for null fields and other invalid conditions- Throws:
NullPointerException- if a field is null when it MUST be set.RuntimeException- on invalid entries
-
clone
Shallow clone: the lists of addresses are shared- Overrides:
clonein classObject- Returns:
- a cloned instance
- Throws:
CloneNotSupportedException
-