org.jclouds.apis.internal
Class BaseApiMetadata

java.lang.Object
  extended by org.jclouds.apis.internal.BaseApiMetadata
All Implemented Interfaces:
Serializable, ApiMetadata
Direct Known Subclasses:
BaseRestApiMetadata

public abstract class BaseApiMetadata
extends Object
implements ApiMetadata

The BaseApiMetadata class is an abstraction of ApiMetadata to be extended by those implementing ApiMetadata. (Note: This class must be abstract to allow ServiceLoader to work properly.

Author:
Jeremy Whitlock , Adrian Cole
See Also:
Serialized Form

Nested Class Summary
static class BaseApiMetadata.Builder
           
 
Field Summary
protected  com.google.common.base.Optional<String> buildVersion
           
protected  com.google.common.reflect.TypeToken<? extends Context> context
           
protected  com.google.common.base.Optional<String> credentialName
           
protected  com.google.common.base.Optional<String> defaultCredential
           
protected  com.google.common.base.Optional<String> defaultEndpoint
           
protected  com.google.common.base.Optional<String> defaultIdentity
           
protected  Set<Class<? extends com.google.inject.Module>> defaultModules
           
protected  Properties defaultProperties
           
protected  URI documentation
           
protected  String endpointName
           
protected  String id
           
protected  String identityName
           
protected  String name
           
protected  String version
           
protected  Set<com.google.common.reflect.TypeToken<? extends View>> views
           
 
Constructor Summary
protected BaseApiMetadata(BaseApiMetadata.Builder builder)
           
  BaseApiMetadata(String id, String name, Set<com.google.common.reflect.TypeToken<? extends View>> views, String endpointName, String identityName, com.google.common.base.Optional<String> credentialName, String version, com.google.common.base.Optional<String> buildVersion, com.google.common.base.Optional<String> defaultEndpoint, com.google.common.base.Optional<String> defaultIdentity, com.google.common.base.Optional<String> defaultCredential, Properties defaultProperties, URI documentation, com.google.common.reflect.TypeToken<? extends Context> context, Set<Class<? extends com.google.inject.Module>> defaultModules)
           
 
Method Summary
static Properties defaultProperties()
           
 boolean equals(Object o)
           
 com.google.common.base.Optional<String> getBuildVersion()
          Explicitly identifies the build that the server jclouds connects to is running.
 com.google.common.reflect.TypeToken<? extends Context> getContext()
          
 com.google.common.base.Optional<String> getCredentialName()
          Note: if the api doesn't need a credential, this will return absent.
 com.google.common.base.Optional<String> getDefaultCredential()
          Explicitly sets the secret, which when combined with the identity, will create an authenticated subject or session
 com.google.common.base.Optional<String> getDefaultEndpoint()
          Explicitly identifies the most top-level endpoint to a service provider.
 com.google.common.base.Optional<String> getDefaultIdentity()
          Explicitly identifies the login identity into a provider
 Set<Class<? extends com.google.inject.Module>> getDefaultModules()
          Modules that configure dependency injection for this context
 Properties getDefaultProperties()
          Configuration Properties used when creating connections to this api
 URI getDocumentation()
          
 String getEndpointName()
          The endpointName helps the user supply the correct data when prompted.
 String getId()
          
 String getIdentityName()
          
 String getName()
          
 String getVersion()
          Explicitly identifies the version of an api.
 Set<com.google.common.reflect.TypeToken<? extends View>> getViews()
          
 int hashCode()
           
protected  com.google.common.base.Objects.ToStringHelper string()
           
 BaseApiMetadata.Builder toBuilder()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected final String id

name

protected final String name

views

protected final Set<com.google.common.reflect.TypeToken<? extends View>> views

endpointName

protected final String endpointName

identityName

protected final String identityName

credentialName

protected final com.google.common.base.Optional<String> credentialName

version

protected final String version

buildVersion

protected final com.google.common.base.Optional<String> buildVersion

defaultEndpoint

protected final com.google.common.base.Optional<String> defaultEndpoint

defaultIdentity

protected final com.google.common.base.Optional<String> defaultIdentity

defaultCredential

protected final com.google.common.base.Optional<String> defaultCredential

defaultProperties

protected final Properties defaultProperties

documentation

protected final URI documentation

context

protected final com.google.common.reflect.TypeToken<? extends Context> context

defaultModules

protected final Set<Class<? extends com.google.inject.Module>> defaultModules
Constructor Detail

BaseApiMetadata

protected BaseApiMetadata(BaseApiMetadata.Builder builder)

BaseApiMetadata

public BaseApiMetadata(String id,
                       String name,
                       Set<com.google.common.reflect.TypeToken<? extends View>> views,
                       String endpointName,
                       String identityName,
                       com.google.common.base.Optional<String> credentialName,
                       String version,
                       com.google.common.base.Optional<String> buildVersion,
                       com.google.common.base.Optional<String> defaultEndpoint,
                       com.google.common.base.Optional<String> defaultIdentity,
                       com.google.common.base.Optional<String> defaultCredential,
                       Properties defaultProperties,
                       URI documentation,
                       com.google.common.reflect.TypeToken<? extends Context> context,
                       Set<Class<? extends com.google.inject.Module>> defaultModules)
Method Detail

defaultProperties

public static Properties defaultProperties()

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

string

protected com.google.common.base.Objects.ToStringHelper string()

getId

public String getId()

Specified by:
getId in interface ApiMetadata
Returns:
the api's unique identifier (ex. vcloud, virtualbox)

getName

public String getName()

Specified by:
getName in interface ApiMetadata
Returns:
the name (display name) of the api (ex. EC2 Base API)

getViews

public Set<com.google.common.reflect.TypeToken<? extends View>> getViews()

Specified by:
getViews in interface ApiMetadata
Returns:
types of contexts this can be transformed into, for example BlobStoreContext

getEndpointName

public String getEndpointName()
The endpointName helps the user supply the correct data when prompted.

For example, on OpenStack APIs, this could be: Keystone url
For file-based apis, this could be: Path of byon.yaml

Default: "https endpoint"

Specified by:
getEndpointName in interface ApiMetadata
Returns:
the name (display name) of an endpoint to this api (ex. Keystone url, vCloud Director URL).

getIdentityName

public String getIdentityName()

Specified by:
getIdentityName in interface ApiMetadata
Returns:
the name (display name) of an identity on this api (ex. user, email, account, apikey, tenantId:username)

getCredentialName

public com.google.common.base.Optional<String> getCredentialName()
Note: if the api doesn't need a credential, this will return absent.

Specified by:
getCredentialName in interface ApiMetadata
Returns:
the name (display name) of a credential on this api, if it is required (ex. password, secret, rsaKey)

getVersion

public String getVersion()
Explicitly identifies the version of an api.

Specified by:
getVersion in interface ApiMetadata

getBuildVersion

public com.google.common.base.Optional<String> getBuildVersion()
Explicitly identifies the build that the server jclouds connects to is running. For example, for virtualbox, the api version may be 4.1.8 while the build version is 4.1.8r75467. Or a vcloud endpoint may be api version 1.0 while the build is 1.5.0.0.124312

Specified by:
getBuildVersion in interface ApiMetadata

getDefaultEndpoint

public com.google.common.base.Optional<String> getDefaultEndpoint()
Explicitly identifies the most top-level endpoint to a service provider. This helps differentiate two providers of the same api, or a different environments providing the same api.

note

The type of endpoint is String as we permit endpoints that require variable expansion. ex.
 https://${jclouds.identity}.blob.core.windows.net
 

Specified by:
getDefaultEndpoint in interface ApiMetadata
Returns:
the api's default endpoint, if known.

getDefaultIdentity

public com.google.common.base.Optional<String> getDefaultIdentity()
Explicitly identifies the login identity into a provider

Specified by:
getDefaultIdentity in interface ApiMetadata
Returns:
the login identity into a provider, if known.

getDefaultCredential

public com.google.common.base.Optional<String> getDefaultCredential()
Explicitly sets the secret, which when combined with the identity, will create an authenticated subject or session

Specified by:
getDefaultCredential in interface ApiMetadata
Returns:
the api's default credential, if known.
See Also:
ApiMetadata.getDefaultIdentity(), ApiMetadata.getCredentialName()

getDefaultProperties

public Properties getDefaultProperties()
Configuration Properties used when creating connections to this api

Specified by:
getDefaultProperties in interface ApiMetadata
Returns:
properties used to create connections to this api

getDocumentation

public URI getDocumentation()

Specified by:
getDocumentation in interface ApiMetadata
Returns:
the url for the API documentation related to this service

getContext

public com.google.common.reflect.TypeToken<? extends Context> getContext()

Specified by:
getContext in interface ApiMetadata
Returns:
the primary context of this api, for example RestContext<EC2Client, EC2AsyncClient>

getDefaultModules

public Set<Class<? extends com.google.inject.Module>> getDefaultModules()
Modules that configure dependency injection for this context

Specified by:
getDefaultModules in interface ApiMetadata
Returns:
modules that configure dependency injection for this context

toBuilder

public BaseApiMetadata.Builder toBuilder()
Specified by:
toBuilder in interface ApiMetadata
See Also:
ApiMetadata.Builder


Copyright © 2009-2013 jclouds. All Rights Reserved.