コード例 #1
0
 private String getEndpointString(String serviceName, Endpoint endpoint) {
   return endpoint == null
       ? null
       : endpoint
           .getHostName()
           .replace(SERVICE, serviceName)
           .replace(REGION, region)
           .replace(DNS_SUFFIX, partition.getDnsSuffix());
 }
コード例 #2
0
 @Override
 public Collection<String> getAvailableEndpoints() {
   final List<String> endpoints = new ArrayList<String>();
   for (String service : partition.getServices().keySet()) {
     if (isServiceSupported(service)) {
       endpoints.add(getServiceEndpoint(service));
     }
   }
   return Collections.unmodifiableCollection(endpoints);
 }
コード例 #3
0
  private Endpoint computeEndpoint(String serviceName) {

    Service service = partition.getServices().get(serviceName);

    if (service != null) {
      if (service.getEndpoints().containsKey(region)) {

        Endpoint merged =
            Endpoint.merge(
                partition.getDefaults(),
                Endpoint.merge(service.getDefaults(), service.getEndpoints().get(region)));

        return merged;

      } else if (service.isPartitionWideEndpointAvailable() && !service.isRegionalized()) {
        // partition doesn't have any information about a service.

        Endpoint merged =
            Endpoint.merge(
                partition.getDefaults(),
                Endpoint.merge(
                    service.getDefaults(),
                    service.getEndpoints().get(service.getPartitionEndpoint())));

        return merged;

      } else {
        if (partition.getDefaults() != null && partition.getDefaults().getHostName() != null) {
          return partition.getDefaults();
        }
      }
    }
    return null;
  }
コード例 #4
0
 @Override
 public String getPartition() {
   return partition.getPartition();
 }
コード例 #5
0
 @Override
 public String getDomain() {
   return partition.getDnsSuffix();
 }
コード例 #6
0
 private boolean isServicePartitionWide(String serviceName) {
   return partition.getServices().get(serviceName) != null
       && partition.getServices().get(serviceName).getPartitionEndpoint() != null;
 }
コード例 #7
0
 /**
  * This method returns true only if the metadata for the service contains the given region in the
  * list of supported regions.
  */
 private boolean isServiceSupportedInRegion(String serviceName) {
   return partition.getServices().get(serviceName) != null
       && partition.getServices().get(serviceName).getEndpoints().containsKey(region);
 }