Getting Started
Quick Start Guides
- Amazon Web Services
- Elastic Block Store Models
- Azure Storage Service
- BlueLock vCloud
- Cloud Sigma
- Eucalyptus
- File System
- Go Grid
- HP Cloud Services
- IBM Developer Cloud
- OpenStack
- Rackspace
- RimuHosting
- Terremark eCloud
- Terremark vCloud Express
Release Notes
- 1.5.0-alpha.6
- 1.5.0-alpha.5
- 1.5.0-alpha.4
- 1.5.0-alpha.3
- 1.5.0-alpha.2
- 1.5.0-alpha.1
- 1.4.0
- 1.4.0-rc.3
- 1.4.0-rc.2
- 1.4.0-rc.1
- 1.3.1
- 1.3.0
- 1.3.0-rc-2
- 1.3.0-rc-1
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.1
- 1.1.0
Maven Sites and Javadocs
- HEAD (Javadoc)
- latest release (Javadoc) permalink
- 1.5.0-alpha.6 (Javadoc)
- 1.5.0-alpha.5 (Javadoc)
- 1.5.0-alpha.4 (Javadoc)
- 1.5.0-alpha.3 (Javadoc)
- 1.5.0-alpha.2 (Javadoc)
- 1.5.0-alpha.1 (Javadoc)
- 1.4.0 (Javadoc)
- 1.4.0-rc.3 (Javadoc)
- 1.4.0-rc.2 (Javadoc)
- 1.4.0-rc.1 (Javadoc)
- 1.3.1 (Javadoc)
- 1.3.0 (Javadoc)
- 1.3.0-rc-2 (Javadoc)
- 1.3.0-rc-1 (Javadoc)
- 1.2.2 (Javadoc)
- 1.2.1 (Javadoc)
- 1.2.0 (Javadoc)
- 1.1.1 (Javadoc)
- 1.1.0 (Javadoc)
User Guides
- Using Blob Store API
- Using Compute API and Tools
- Google App Engine
- VMWare vCloud
- Terremark
- File System Provider
- Init Builder
- Using jclouds with Apache Karaf
- Using EC2
- Using Maven
Samples & Examples
FAQs
Reference
- jclouds Rationale and Design
- Location Metadata Design
- Compute API Design
- Columnar Data Design
- jclouds API
- jclouds OAuth Integration
- Using jclouds with Apache Felix OSGi Container
- Pool Design
- Load Balancer Design
- Logging in jclouds
- VMWare Integration Approach & Design
- Supported Providers
- Apps that use jclouds
- Using Provider Metadata
Developer Resources
- Contributing to jclouds
- Provider Testing
- Contributing to Documentation
- Using Eclipse
- jclouds Continuous Integration
- Provider Metadata
Old versions
Release Notes
- 1.0.0
- 1.0 Beta 8
- 1.0 Beta 7
Maven Sites and Javadocs
Using Provider Metadata
In the ProviderMetadata wiki page we learned how to implement [Provider Meta Data|ProviderMetadata]. Now let's see how we might consume [Provider Meta Data|ProviderMetadata] to make our lives easier. We'll start with the basics on how to obtain [Provider Meta Data|ProviderMetadata] based on id or type.
Finding Provider Meta Data Based on Type or ID
For all basic usage, you will rely on using the org.jclouds.providers.Providers class. This class exposes static helper methods to obtain [Provider Meta Data|ProviderMetadata] based on many of things the most basic of is by id. To find an exact [Provider Meta Data|ProviderMetadata] implementation based on its identifier, you'd use something like this:
...
// Retrieves the Amazon Elastic Compute Cloud (EC2) ProviderMetadata by its id
ProviderMetadata awsEC2 = Providers.withId("aws-ec2");
...
Pretty simple stuff. What if you wanted a list of all compute types?
Well, org.jclouds.providers.Providers has a getType(String) method that will let you look items up by their "type",
which corresponds to a public static final string exposed from the org.jclouds.providers.ProviderMetadata class.
For all known types there is also a helper method on org.jclouds.providers.Providers that you can use instead.
Below is a code sample with both usage examples:
...
// Retrieve ProviderMetadata for all compute providers (manual way)
Iterable<ProviderMetadata> mcProviders = Providers.ofType(ProviderMetadata.COMPUTE_TYPE);
// Retrieve ProviderMetadata for all compute providers (helper way)
Iterable<ProviderMetadata hcProviders = Providers.allCompute()
...
As you can easy, [Provider Meta Data|ProviderMetadata] has made things pretty simple when it comes to findings providers based on a
particular type or id. What about when you want to find things based on geo-location?
Well, org.jclouds.providers.Providers helps with that too.
Finding [Provider Meta Data|ProviderMetadata] Based on ISO 3166 Code
As with the example above, we'll resort to using org.jclouds.providers.Providers to find [Provider Meta Data|ProviderMetadata] based on
ISO 3166 code(s).
The first example is easy, give me all providers that are in the US-CA location:
...
Iterable<ProviderMetadata> usCAProviders = Providers.boundedByIso3166Code("US-CA");
...
Oh? You only wanted blobstore providers in US-CA? Here you go:
...
Iterable<ProviderMetadata> usCABlobStoreProviders = Providers.boundedByIso3166Code("US-CA", ProviderMetadata.BLOBSTORE_TYPE);
...
Ah, that's better. Now, what if you wanted to find all US providers?
Don't worry, you don't have to maintain a list of US ISO 3166 codes, you'd just use something like this:
...
Iterable<ProviderMetadata> usProviders = Providers.boundedByIso3166Code("US");
...
As you can see, [Provider Meta Data|ProviderMetadata] has made things very, very simple when it comes to
locating things based on geo-location. What? You want to find providers based on a reference provider?
Well, we have that documented next.
Finding [Provider Meta Data|ProviderMetadata] Based on Relativity to Another Provider
Locating by type, id and ISO 3166 code have been demonstrated above and they are pretty straight forward.
One last basic way to find [Provider Meta Data|ProviderMetadata] is based on similar hosting locations or
being able to find "collocated" providers. Let's do this based on the AWS EC2 example above.
Let's find all providers that are in regions/locations that AWS EC2 supports ("US-VA", "US-CA", "IE", "SG", "JP-13"):
...
ProviderMetadata awsEC2 = Providers.withId("aws-ec2");
Iterable<ProviderMetadata> collocatedProviders = Providers.collocatedWith(awsEC2):
...
Yup, all providers that are in the the same locations AWS EC2 is would had been returned.
Huh? You didn't mention before that you only wanted blobstore providers.
Well, good for you [Provider Meta Data|ProviderMetadata] has you covered:
...
ProviderMetadata awsEC2 = Providers.withId("aws-ec2");
Iterable<ProviderMetadata> collocatedBlobstoreProviders = Providers.collocatedWith(awsEC2, ProviderMetadata.BLOBSTORE_TYPE):
...
Summary
As you can see by the examples above, using Jclouds' [Provider Meta Data|ProviderMetadata] (introduced in Jclouds 1.0.0) makes finding
[Provider Meta Data|ProviderMetadata] extremely easy.
All of these examples should have all of us "cloud fluffers", a term I never heard before talking to Adrian,
dreaming of auto-populated drop down lists for our UIs, simple wizards and other things that
[Provider Meta Data|ProviderMetadata] makes available.
[Provider Meta Data|ProviderMetadata] is still a moving target so to stay up to date, click one of the ProviderMetadata links in this
wiki page to see exactly what provider metadata is available.