com.xerox.amazonws.simpledb
Class SimpleDB

java.lang.Object
  extended by com.xerox.amazonws.simpledb.SimpleDB

public class SimpleDB
extends Object

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

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
 SDBResult<Domain> createDomain(String name)
          Creates a domain.
 SDBResult deleteDomain(Domain domain)
          Deletes a domain.
 SDBResult deleteDomain(String name)
          Deletes a domain.
 AWSQueryConnection getConnectionDelegate()
          Returns connection object, so connection params can be tweaked
 Domain getDomain(String domainName)
          Method for getting a Domain object without getting a list of them.
 SDBListResult<Domain> listDomains()
          Gets a list of domains
 SDBListResult<Domain> listDomains(String nextToken)
          Gets a list of domains
 SDBListResult<Domain> 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 setEndpoint(String endpointHost)
          This method sets the endpoint (based on EU or US endpoint)
 
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

getConnectionDelegate

public AWSQueryConnection getConnectionDelegate()
Returns connection object, so connection params can be tweaked


setEndpoint

public void setEndpoint(String endpointHost)
This method sets the endpoint (based on EU or US endpoint)

Parameters:
endpointHost - the name of the enpoint server

createDomain

public SDBResult<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 SDBResult deleteDomain(Domain domain)
                       throws SDBException
Deletes a domain.

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

deleteDomain

public SDBResult 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 SDBListResult<Domain> listDomains()
                                  throws SDBException
Gets a list of domains

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

listDomains

public SDBListResult<Domain> listDomains(String nextToken)
                                  throws SDBException
Gets a list of domains

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

listDomains

public SDBListResult<Domain> 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