Example usage for org.apache.hadoop.registry.client.types ServiceRecord getExternalEndpoint

List of usage examples for org.apache.hadoop.registry.client.types ServiceRecord getExternalEndpoint

Introduction

In this page you can find the example usage for org.apache.hadoop.registry.client.types ServiceRecord getExternalEndpoint.

Prototype

public Endpoint getExternalEndpoint(String api) 

Source Link

Document

Look up an external endpoint

Usage

From source file:org.apache.slider.client.ClientRegistryBinder.java

License:Apache License

/**
 * Get an endpont by API/*from w ww . j ava 2 s.co  m*/
 * @param record service record
 * @param api API
 * @param external flag to indicate this is an external record
 * @return the endpoint or null
 */
public static Endpoint getEndpoint(ServiceRecord record, String api, boolean external) {
    return external ? record.getExternalEndpoint(api) : record.getInternalEndpoint(api);
}

From source file:org.apache.slider.core.registry.retrieve.RegistryRetriever.java

License:Apache License

/**
 * Retrieve from a service by locating the
 * exported {@link CustomRegistryConstants#PUBLISHER_CONFIGURATIONS_API}
 * and working off it.//from   ww  w .jav  a 2 s .  c om
 * @param record service record
 * @throws RegistryIOException the address type of the endpoint does
 * not match that expected (i.e. not a list of URLs), missing endpoint...
 */
public RegistryRetriever(ServiceRecord record) throws RegistryIOException {
    Endpoint internal = record.getInternalEndpoint(CustomRegistryConstants.PUBLISHER_CONFIGURATIONS_API);
    String url = null;
    if (internal != null) {
        List<String> addresses = RegistryTypeUtils.retrieveAddressesUriType(internal);
        if (addresses != null && !addresses.isEmpty()) {
            url = addresses.get(0);
        }
    }
    internalConfigurationURL = url;
    Endpoint external = record.getExternalEndpoint(CustomRegistryConstants.PUBLISHER_CONFIGURATIONS_API);
    url = null;
    if (external != null) {
        List<String> addresses = RegistryTypeUtils.retrieveAddressesUriType(external);
        if (addresses != null && !addresses.isEmpty()) {
            url = addresses.get(0);
        }
    }
    externalConfigurationURL = url;

    internal = record.getInternalEndpoint(CustomRegistryConstants.PUBLISHER_EXPORTS_API);
    url = null;
    if (internal != null) {
        List<String> addresses = RegistryTypeUtils.retrieveAddressesUriType(internal);
        if (addresses != null && !addresses.isEmpty()) {
            url = addresses.get(0);
        }
    }
    internalExportsURL = url;
    external = record.getExternalEndpoint(CustomRegistryConstants.PUBLISHER_EXPORTS_API);
    url = null;
    if (external != null) {
        List<String> addresses = RegistryTypeUtils.retrieveAddressesUriType(external);
        if (addresses != null && !addresses.isEmpty()) {
            url = addresses.get(0);
        }
    }
    externalExportsURL = url;
}