Class Endpoint

java.lang.Object
org.apache.hadoop.registry.client.types.Endpoint
All Implemented Interfaces:
Cloneable

@Public @Evolving public final class Endpoint extends Object implements 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 Details

    • api

      public String api
      API implemented at the end of the binding
    • addressType

      public String addressType
      Type of address. The standard types are defined in AddressTypes
    • protocolType

      public String protocolType
      Protocol type. Some standard types are defined in ProtocolTypes
    • addresses

      public List<Map<String,String>> addresses
      a list of address tuples —tuples whose format depends on the address type
  • Constructor Details

    • Endpoint

      public Endpoint()
      Create an empty instance.
    • Endpoint

      public Endpoint(Endpoint that)
      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 name
      addressType - address type
      protocolType - protocol type
      addrs - addresses
    • Endpoint

      public Endpoint(String api, String addressType, String protocolType)
      Build an endpoint with an empty address list
      Parameters:
      api - API name
      addressType - address type
      protocolType - protocol type
    • Endpoint

      public Endpoint(String api, String addressType, String protocolType, Map<String,String> addr)
      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 name
      addressType - address type
      protocolType - protocol type
      addr - address. May be null —in which case it is not added
    • Endpoint

      public Endpoint(String api, String addressType, String protocolType, Map<String,String>... addrs)
      Build an endpoint with a list of addresses
      Parameters:
      api - API name
      addressType - address type
      protocolType - protocol type
      addrs - addresses. Null elements will be skipped
    • Endpoint

      public Endpoint(String api, String protocolType, URI... uris)
      Build an endpoint from a list of URIs; each URI is ASCII-encoded and added to the list of addresses.
      Parameters:
      api - API name
      protocolType - protocol type
      uris - URIs to convert to a list of tup;les
  • Method Details