|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.amazonaws.regions.RegionUtils
public class RegionUtils
Utilities for working with regions.
Constructor Summary | |
---|---|
RegionUtils()
|
Method Summary | |
---|---|
static Region |
getRegion(String regionName)
Returns the region with the id given, if it exists. |
static Region |
getRegionByEndpoint(String endpoint)
Searches through all known regions to find one with any service at the specified endpoint. |
static RegionMetadata |
getRegionMetadata()
Returns the current set of region metadata for this process, initializing it if it has not yet been explicitly initialized before. |
static List<Region> |
getRegions()
Returns a list of the available AWS regions. |
static List<Region> |
getRegionsForService(String serviceAbbreviation)
Returns a list of the regions that support the service given. |
protected static String |
getSource()
For test purposes. |
static void |
init()
Deprecated. in favor of initialize() |
static void |
initialize()
Initializes the region metadata by loading from the default hierarchy of region metadata locations. |
static void |
initializeFromFile(File file)
Initializes the region metadata singleton from an XML file on disk. |
static void |
initializeFromResource(Class<?> clazz,
String name)
Initializes the region metadata singleton from the given resource. |
static void |
initializeFromResource(ClassLoader classLoader,
String name)
Initializes the region metadata singleton from the given resource. |
static void |
initializeFromResource(String name)
Initializes the region metadata singleton from an XML file stored as a resource of the classloader used to load the RegionUtils class. |
static void |
initializeFromURI(URI uri)
Loads a set of region metadata by downloading an XML file from the given URI and parsing it. |
static void |
initializeFromURI(URI uri,
ClientConfiguration config)
Loads a set of region metadata by downloading an XML file from the given URI and parsing it. |
static void |
initializeWithMetadata(RegionMetadata metadata)
Directly sets the singleton RegionMetadata instance. |
static RegionMetadata |
loadMetadataFromFile(File file)
Loads a set of region metadata from an XML file on disk. |
static RegionMetadata |
loadMetadataFromInputStream(InputStream stream)
Loads a set of region metadata from an arbitrary InputStream
containing an XML file. |
static RegionMetadata |
loadMetadataFromResource(Class<?> clazz,
String name)
Loads a set of region metadata from an XML file stored as a resource of the classloader used to load the given class. |
static RegionMetadata |
loadMetadataFromResource(ClassLoader classLoader,
String name)
Loads a set of region metadata from an XML file stored as a resource of the given classloader. |
static RegionMetadata |
loadMetadataFromResource(String name)
Loads a set of region metadata from an XML file stored as a resource of the classloader used to load the RegionUtils class. |
static RegionMetadata |
loadMetadataFromURI(URI uri)
Loads a set of region metadata by downloading an XML file from the given URI and parsing it. |
static RegionMetadata |
loadMetadataFromURI(URI uri,
ClientConfiguration config)
Loads a set of region metadata by downloading an XML file from the given URI and parsing it. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RegionUtils()
Method Detail |
---|
protected static String getSource()
public static RegionMetadata getRegionMetadata()
public static List<Region> getRegions()
public static List<Region> getRegionsForService(String serviceAbbreviation)
ServiceAbbreviations
public static Region getRegion(String regionName)
public static Region getRegionByEndpoint(String endpoint)
endpoint
- The endpoint for any service residing in the desired region.
IllegalArgumentException
- If the given URL is malformed, or if the one of the service
URLs on record is malformed.public static RegionMetadata loadMetadataFromURI(URI uri) throws IOException
uri
- the uri of the XML file to parse
IOException
- on error fetching or parsing the XML filepublic static RegionMetadata loadMetadataFromURI(URI uri, ClientConfiguration config) throws IOException
uri
- the uri of the XML file to parseconfig
- configuration for the HTTP client to use to fetch the file
IOException
- on error fetching or parsing the XML filepublic static RegionMetadata loadMetadataFromFile(File file) throws IOException
file
- the file to load from
IOException
- on error opening or reading from the filepublic static RegionMetadata loadMetadataFromResource(String name) throws IOException
name
- the path of the resource, relative to the RegionUtils class
IOException
- if the resource is not found or cannot be parsedpublic static RegionMetadata loadMetadataFromResource(Class<?> clazz, String name) throws IOException
clazz
- the class to use as a base for the resourcename
- the path to the resource, relative to the given class
IOException
- if the resource is not found or cannot be parsedpublic static RegionMetadata loadMetadataFromResource(ClassLoader classLoader, String name) throws IOException
classLoader
- the class loader to load the resource fromname
- the path to the resource
IOException
- if the resource is not found or cannot be parsedpublic static RegionMetadata loadMetadataFromInputStream(InputStream stream) throws IOException
InputStream
containing an XML file.
stream
- the stream to load from
IOException
- on error reading from the stream@Deprecated public static void init()
initialize()
It's deprecated to signal that it no longer has any possibility of
retrieving a newer set of metadata than was previously loaded. If you
are simply wanting to reinitialize from the bundled region metadata,
call initialize
. If you want to maintain your own remote
copy of the region metadata and periodically refresh it at runtime,
call initializeFromURI
.
public static void initialize()
public static void initializeFromURI(URI uri)
uri
- the uri of the XML file to parse
AmazonClientException
- on errorpublic static void initializeFromURI(URI uri, ClientConfiguration config)
uri
- the uri of the XML file to parseconfig
- configuration for the HTTP client to use to fetch the file
AmazonClientException
- on errorpublic static void initializeFromFile(File file)
file
- the file to load from
AmazonClientException
- on error opening or reading from the filepublic static void initializeFromResource(String name)
name
- the path of the resource, relative to the RegionUtils class
AmazonClientException
- on errorpublic static void initializeFromResource(Class<?> clazz, String name)
clazz
- the class to use as a base for the resourcename
- the path to the resource, relative to the given class
AmazonClientException
- on errorpublic static void initializeFromResource(ClassLoader classLoader, String name)
classLoader
- the class loader to use to load the resourcename
- the path to the resource
AmazonClientException
- on errorpublic static void initializeWithMetadata(RegionMetadata metadata)
RegionMetadata
instance.
metadata
- the new region metadata object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |