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; }
@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); }
private boolean isServicePartitionWide(String serviceName) { return partition.getServices().get(serviceName) != null && partition.getServices().get(serviceName).getPartitionEndpoint() != null; }
/** * 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); }