org.dasein.cloud
Class ProviderContext

java.lang.Object
  extended by org.dasein.cloud.ProviderContext
All Implemented Interfaces:
Serializable

public class ProviderContext
extends Object
implements Serializable

The contextual information necessary for making calls to a cloud provider. Each provider requires a provider context in order to connect to the target cloud account and perform operations within the cloud. This context includes the account number, operational region, and any number of authentication keys.

Author:
George Reese @ enStratus (http://www.enstratus.com)
See Also:
Serialized Form

Constructor Summary
ProviderContext()
          Constructs a new, empty provider context for managing the provider context information.
ProviderContext(String accountNumber, String inRegionId)
          Constructs a new provider context for the specified account number in the specified region.
 
Method Summary
 void clear()
          Clears out all keys being stored by this provider.
static void clear(byte[]... keys)
          Helper method for clearing out credentials with random data.
 byte[] getAccessPrivate()
          The private access key is the primary authentication password for web services calls.
 byte[] getAccessPublic()
          The public access key is the primary authentication user ID for web services calls.
 String getAccountNumber()
           
 String getCloudName()
          Provides the name of the cloud being accessed through this API.
 Properties getCustomProperties()
          Provides any properties specific to the underlying Dasein Cloud implementation that will help it interact with thge underlying cloud.
 String getEndpoint()
          Provides the endpoint through which cloud API calls are routed.
 String getProviderName()
          Provides the name of the organization providing cloud services.
 String getRegionId()
           
 byte[] getStoragePrivate()
          The storage private key is the private key used for cloud storage access.
 byte[] getStoragePublic()
          The storage public key is the public key used for cloud storage access.
 void setAccessKeys(byte[] publicKey, byte[] privateKey)
          Establishes the access key values.
 void setAccessPrivate(byte[] accessPrivate)
          Sets the private access key.
 void setAccessPublic(byte[] accessPublic)
          Sets the public access key.
 void setAccountNumber(String accountNumber)
          Sets the account number for this provider context.
 void setCloudName(String name)
          Sets the name of the cloud supported by this context.
 void setCustomProperties(Properties properties)
          Establishes any custom properties for use by the Dasein Cloud implementation.
 void setEndpoint(String endpoint)
          Sets the cloud endpoint for the provider context.
 void setProviderName(String name)
          Sets the name of the organization providing cloud services.
 void setRegionId(String regionId)
          Sets the region context for this provider context.
 void setStorageKeys(byte[] publicKey, byte[] privateKey)
          Sets the storage keypair for this provider context.
 void setStoragePrivate(byte[] storagePrivate)
          Sets the storage private key.
 void setStoragePublic(byte[] storagePublic)
          Sets the storage public key value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProviderContext

public ProviderContext()
Constructs a new, empty provider context for managing the provider context information.


ProviderContext

public ProviderContext(String accountNumber,
                       String inRegionId)
Constructs a new provider context for the specified account number in the specified region.

Parameters:
accountNumber - the account number for the account in the cloud
inRegionId - the region to be referenced by this provider context
Method Detail

clear

public static void clear(byte[]... keys)
Helper method for clearing out credentials with random data.

Parameters:
keys - a list of credentials to fill with random data

clear

public void clear()
Clears out all keys being stored by this provider. The keys are overwritten with random data. If these keys were set from instance variables in other objects, this method will result in some peculiar side-effects.


getAccessPrivate

public byte[] getAccessPrivate()
The private access key is the primary authentication password for web services calls. In this AWS world, this is your access secret key.

Returns:
the private access key for the cloud provider

getAccessPublic

public byte[] getAccessPublic()
The public access key is the primary authentication user ID for web services calls. In the AWS world, this is your access public key.

Returns:
the public access key for the cloud provider

getAccountNumber

public String getAccountNumber()
Returns:
the account number that identifies the account to the cloud provider independent of context

getCloudName

public String getCloudName()
Provides the name of the cloud being accessed through this API. For a multi-cloud provider or a multi-cloud implementation of Dasein Cloud, it is useful to have the cloud name configurable.

Returns:
the name of the underlying cloud

getCustomProperties

public Properties getCustomProperties()
Provides any properties specific to the underlying Dasein Cloud implementation that will help it interact with thge underlying cloud.

Returns:
any custom properties supporting cloud connectivity

getEndpoint

public String getEndpoint()
Provides the endpoint through which cloud API calls are routed. This is typically configured for private clouds or cloud APIs that support more than one cloud.

Returns:
the cloud API host

getProviderName

public String getProviderName()
Provides the name of the organization providing cloud services. This value is configurable for multi-provider APIs like the AWS/Eucalyptus APIs.

Returns:
the name of the organization providing the underlying cloud

getRegionId

public String getRegionId()
Returns:
the cloud's unique identified for the region in which this context is operating

getStoragePrivate

public byte[] getStoragePrivate()
The storage private key is the private key used for cloud storage access. The AWS world has no direct analog to this value, but it is used to represent the AWS private key.

Returns:
the private key for cloud storage services

getStoragePublic

public byte[] getStoragePublic()
The storage public key is the public key used for cloud storage access. The AWS world has no direct analog to this value, but it is used to represent the AWS certificate.

Returns:
the public key for storafe

setAccessKeys

public void setAccessKeys(byte[] publicKey,
                          byte[] privateKey)
Establishes the access key values.

Parameters:
publicKey - the public key part of the access key
privateKey - the private key part of the access key

setAccessPrivate

public void setAccessPrivate(byte[] accessPrivate)
Sets the private access key.

Parameters:
accessPrivate - the proper private access key value.

setAccessPublic

public void setAccessPublic(byte[] accessPublic)
Sets the public access key.

Parameters:
accessPublic - the proper public access key value

setAccountNumber

public void setAccountNumber(String accountNumber)
Sets the account number for this provider context.

Parameters:
accountNumber - the account number associated with the provider account

setCloudName

public void setCloudName(String name)
Sets the name of the cloud supported by this context.

Parameters:
name - the name of the underlying cloud

setCustomProperties

public void setCustomProperties(Properties properties)
Establishes any custom properties for use by the Dasein Cloud implementation.

Parameters:
properties - custom properties for the Dasein Cloud implementation

setEndpoint

public void setEndpoint(String endpoint)
Sets the cloud endpoint for the provider context.

Parameters:
host - the host to which cloud API calls are routed

setProviderName

public void setProviderName(String name)
Sets the name of the organization providing cloud services.

Parameters:
name - the name of the organization providing cloud services

setRegionId

public void setRegionId(String regionId)
Sets the region context for this provider context.

Parameters:
regionId - the unique cloud ID for the region supporting this context

setStorageKeys

public void setStorageKeys(byte[] publicKey,
                           byte[] privateKey)
Sets the storage keypair for this provider context.

Parameters:
publicKey - the storage key public key
privateKey - the storage key private key

setStoragePrivate

public void setStoragePrivate(byte[] storagePrivate)
Sets the storage private key.

Parameters:
storagePrivate - the storage private key

setStoragePublic

public void setStoragePublic(byte[] storagePublic)
Sets the storage public key value.

Parameters:
storagePublic - the storage public key