Java Code Examples for org.apache.hadoop.registry.client.types.Endpoint#toString()

The following examples show how to use org.apache.hadoop.registry.client.types.Endpoint#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RegistryTypeUtils.java    From hadoop with Apache License 2.0 6 votes vote down vote up
/**
 * Get a single URI endpoint
 * @param epr endpoint
 * @return the uri of the first entry in the address list. Null if the endpoint
 * itself is null
 * @throws InvalidRecordException if the type is wrong, there are no addresses
 * or the payload ill-formatted
 */
public static List<String> retrieveAddressesUriType(Endpoint epr)
    throws InvalidRecordException {
  if (epr == null) {
    return null;
  }
  requireAddressType(ADDRESS_URI, epr);
  List<Map<String, String>> addresses = epr.addresses;
  if (addresses.size() < 1) {
    throw new InvalidRecordException(epr.toString(),
        "No addresses in endpoint");
  }
  List<String> results = new ArrayList<String>(addresses.size());
  for (Map<String, String> address : addresses) {
    results.add(getAddressField(address, ADDRESS_URI));
  }
  return results;
}
 
Example 2
Source File: RegistryTypeUtils.java    From big-c with Apache License 2.0 6 votes vote down vote up
/**
 * Get a single URI endpoint
 * @param epr endpoint
 * @return the uri of the first entry in the address list. Null if the endpoint
 * itself is null
 * @throws InvalidRecordException if the type is wrong, there are no addresses
 * or the payload ill-formatted
 */
public static List<String> retrieveAddressesUriType(Endpoint epr)
    throws InvalidRecordException {
  if (epr == null) {
    return null;
  }
  requireAddressType(ADDRESS_URI, epr);
  List<Map<String, String>> addresses = epr.addresses;
  if (addresses.size() < 1) {
    throw new InvalidRecordException(epr.toString(),
        "No addresses in endpoint");
  }
  List<String> results = new ArrayList<String>(addresses.size());
  for (Map<String, String> address : addresses) {
    results.add(getAddressField(address, ADDRESS_URI));
  }
  return results;
}
 
Example 3
Source File: RegistryTypeUtils.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Require a specific address type on an endpoint
 * @param required required type
 * @param epr endpoint
 * @throws InvalidRecordException if the type is wrong
 */
public static void requireAddressType(String required, Endpoint epr) throws
    InvalidRecordException {
  if (!required.equals(epr.addressType)) {
    throw new InvalidRecordException(
        epr.toString(),
        "Address type of " + epr.addressType
        + " does not match required type of "
        + required);
  }
}
 
Example 4
Source File: RegistryTypeUtils.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * Require a specific address type on an endpoint
 * @param required required type
 * @param epr endpoint
 * @throws InvalidRecordException if the type is wrong
 */
public static void requireAddressType(String required, Endpoint epr) throws
    InvalidRecordException {
  if (!required.equals(epr.addressType)) {
    throw new InvalidRecordException(
        epr.toString(),
        "Address type of " + epr.addressType
        + " does not match required type of "
        + required);
  }
}