com.xerox.amazonws.sdb
Class SimpleDB

java.lang.Object
  extended by com.xerox.amazonws.common.AWSConnection
      extended by com.xerox.amazonws.common.AWSQueryConnection
          extended by com.xerox.amazonws.sdb.SimpleDB

public class SimpleDB
extends AWSQueryConnection

This class provides an interface with the Amazon SDB service. It provides high level methods for listing and creating and deleting domains.

Author:
D. Kavanagh, developer@dotech.com

Field Summary
 
Fields inherited from class com.xerox.amazonws.common.AWSConnection
headers
 
Constructor Summary
SimpleDB(String awsAccessId, String awsSecretKey)
          Initializes the sdb service with your AWS login information.
SimpleDB(String awsAccessId, String awsSecretKey, boolean isSecure)
          Initializes the sdb service with your AWS login information.
SimpleDB(String awsAccessId, String awsSecretKey, boolean isSecure, String server)
          Initializes the sdb service with your AWS login information.
SimpleDB(String awsAccessId, String awsSecretKey, boolean isSecure, String server, int port)
          Initializes the sdb service with your AWS login information.
 
Method Summary
 Domain createDomain(String name)
          Creates a domain.
 void deleteDomain(Domain domain)
          Deletes a domain.
 void deleteDomain(String name)
          Deletes a domain.
 Domain getDomain(String domainName)
          Method for getting a Domain object without getting a list of them.
 int getSignatureVersion()
          This method returns the signature version
 ListDomainsResult listDomains()
          Returns a list of domains for this account.
 ListDomainsResult listDomains(String nextToken)
          Returns a list of domains for this account.
 ListDomainsResult listDomains(String nextToken, int maxResults)
          Gets a list of domains
protected
<T> T
makeRequestInt(org.apache.http.client.methods.HttpRequestBase method, String action, Map<String,String> params, Class<T> respType)
           
 void setSignatureVersion(int version)
          This method sets the signature version used to sign requests (0 or 1).
 
Methods inherited from class com.xerox.amazonws.common.AWSQueryConnection
close, close, getConnectionManagerTimeout, getConnectionTimeout, getHeaders, getHttpClient, getMaxConnections, getMaxRetries, getServerTimeZone, getSoTimeout, getString, httpDate, makeRequest, setConnectionManagerTimeout, setConnectionTimeout, setHttpClient, setMaxConnections, setMaxRetries, setProxyValues, setProxyValues, setProxyValues, setServerTimeZone, setSoTimeout, useSystemProxy
 
Methods inherited from class com.xerox.amazonws.common.AWSConnection
encode, encode, getAlgorithm, getAwsAccessKeyId, getPort, getResourcePrefix, getSecretAccessKey, getServer, getUrl, isSecure, makeURL, setResourcePrefix, setServer, urlencode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleDB

public SimpleDB(String awsAccessId,
                String awsSecretKey)
Initializes the sdb service with your AWS login information.

Parameters:
awsAccessId - The your user key into AWS
awsSecretKey - The secret string used to generate signatures for authentication.

SimpleDB

public SimpleDB(String awsAccessId,
                String awsSecretKey,
                boolean isSecure)
Initializes the sdb service with your AWS login information.

Parameters:
awsAccessId - The your user key into AWS
awsSecretKey - The secret string used to generate signatures for authentication.
isSecure - True if the data should be encrypted on the wire on the way to or from SDB.

SimpleDB

public SimpleDB(String awsAccessId,
                String awsSecretKey,
                boolean isSecure,
                String server)
Initializes the sdb service with your AWS login information.

Parameters:
awsAccessId - The your user key into AWS
awsSecretKey - The secret string used to generate signatures for authentication.
isSecure - True if the data should be encrypted on the wire on the way to or from SDB.
server - Which host to connect to. Usually, this will be sdb.amazonaws.com

SimpleDB

public SimpleDB(String awsAccessId,
                String awsSecretKey,
                boolean isSecure,
                String server,
                int port)
Initializes the sdb service with your AWS login information.

Parameters:
awsAccessId - The your user key into AWS
awsSecretKey - The secret string used to generate signatures for authentication.
isSecure - True if the data should be encrypted on the wire on the way to or from SDB.
server - Which host to connect to. Usually, this will be sdb.amazonaws.com
port - Which port to use.
Method Detail

getSignatureVersion

public int getSignatureVersion()
This method returns the signature version

Overrides:
getSignatureVersion in class AWSConnection
Returns:
the version

setSignatureVersion

public void setSignatureVersion(int version)
This method sets the signature version used to sign requests (0 or 1).

Overrides:
setSignatureVersion in class AWSConnection
Parameters:
version - signature version

listDomains

public ListDomainsResult listDomains()
                              throws SDBException
Returns a list of domains for this account.

Returns:
A list of Domain instances.
Throws:
SDBException - wraps checked exceptions

listDomains

public ListDomainsResult listDomains(String nextToken)
                              throws SDBException
Returns a list of domains for this account.

Parameters:
nextToken - token to use when retrieving next results
Returns:
A list of Domain instances.
Throws:
SDBException - wraps checked exceptions

createDomain

public Domain createDomain(String name)
                    throws SDBException
Creates a domain. If domain already exists, no error is thrown.

Parameters:
name - name of the new domain
Throws:
SDBException - wraps checked exceptions

deleteDomain

public void deleteDomain(Domain domain)
                  throws SDBException
Deletes a domain.

Parameters:
domain - the domain to be deleted
Throws:
SDBException - wraps checked exceptions

deleteDomain

public void deleteDomain(String name)
                  throws SDBException
Deletes a domain.

Parameters:
name - the name of the domain to be deleted
Throws:
SDBException - wraps checked exceptions

getDomain

public Domain getDomain(String domainName)
                 throws SDBException
Method for getting a Domain object without getting a list of them.

Parameters:
domainName - the name of the domain to be returned
Throws:
SDBException - wraps checked exceptions

listDomains

public ListDomainsResult listDomains(String nextToken,
                                     int maxResults)
                              throws SDBException
Gets a list of domains

Parameters:
nextToken - token to use when retrieving next results
maxResults - the max number of results to return (0 means no max defined)
Throws:
SDBException - wraps checked exceptions

makeRequestInt

protected <T> T makeRequestInt(org.apache.http.client.methods.HttpRequestBase method,
                               String action,
                               Map<String,String> params,
                               Class<T> respType)
                    throws SDBException
Throws:
SDBException