com.xerox.amazonws.simpledb
Class Domain

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

public class Domain
extends Object

This class provides an interface with the Amazon SDB service. It provides methods for listing and deleting items.

Author:
D. Kavanagh, developer@dotech.com

Constructor Summary
protected Domain(String domainName, AWSQueryConnection connection)
           
 
Method Summary
 SDBResult addItem(Item item)
          Adds an item.
 SDBResult addItem(String identifier, Map<String,Set<String>> attributes, List<Condition> conditions)
          Adds an item.
 SDBResult batchPutAttributes(List<Item> items)
          Batch inserts multiple items w/ attributes
 Item createItem(String identifier)
          This method returns an item object, which exists locally only.
 SDBResult deleteAttributes(String identifier, Set<String> attributes, List<Condition> conditions)
          Deletes attributes from an item
 SDBResult deleteItem(String identifier)
          Deletes an item.
 AWSQueryConnection getConnectionDelegate()
          Returns connection object, so connection params can be tweaked
 Result<Item> getItem(String identifier)
          Returns an named item.
 ItemCache getItemCache()
           
 SDBResult<DomainMetadata> getMetadata()
          Returns information about the domain.
 String getName()
          Gets the name of the domain represented by this object.
protected
<T> T
makeRequestInt(org.apache.http.client.methods.HttpRequestBase method, String action, Map<String,String> params, Class<T> respType)
           
 SDBResult replaceAttributes(String identifier, Map<String,Set<String>> attributes, List<Condition> conditions)
          Replace attributes on an item.
 SDBListResult<Item> selectItems(String selectExpression, String nextToken, boolean consistent)
          Performs a query against this domain.
 void setCacheProvider(ItemCache cache)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Domain

protected Domain(String domainName,
                 AWSQueryConnection connection)
          throws SDBException
Throws:
SDBException
Method Detail

getConnectionDelegate

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


getName

public String getName()
Gets the name of the domain represented by this object.

Returns:
the name of the domain

getMetadata

public SDBResult<DomainMetadata> getMetadata()
                                      throws SDBException
Returns information about the domain.

Returns:
the object containing metadata about this domain
Throws:
SDBException - wraps checked exceptions

addItem

public SDBResult addItem(Item item)
                  throws SDBException
Adds an item.

Parameters:
item - the item to add to this domain
Throws:
SDBException - wraps checked exceptions

addItem

public SDBResult addItem(String identifier,
                         Map<String,Set<String>> attributes,
                         List<Condition> conditions)
                  throws SDBException
Adds an item. This method also works to add attributes to an existing item.

Parameters:
identifier - the name of the item to be added
attributes - the attributes to associate with this item
conditions - the conditions under which attributes should be put
Throws:
SDBException - wraps checked exceptions

batchPutAttributes

public SDBResult batchPutAttributes(List<Item> items)
                             throws SDBException
Batch inserts multiple items w/ attributes

Parameters:
attributes - list of attributes to add
Throws:
SDBException - wraps checked exceptions

replaceAttributes

public SDBResult replaceAttributes(String identifier,
                                   Map<String,Set<String>> attributes,
                                   List<Condition> conditions)
                            throws SDBException
Replace attributes on an item. Using this call will force attribute values to be with the new ones supplied.

Parameters:
identifier - the name of the item to be added
attributes - the attributes to associate with this item
conditions - the conditions under which attributes should be put
Throws:
SDBException - wraps checked exceptions

deleteAttributes

public SDBResult deleteAttributes(String identifier,
                                  Set<String> attributes,
                                  List<Condition> conditions)
                           throws SDBException
Deletes attributes from an item

Parameters:
identifier - the name of the item
attributes - the names of the attributes to be deleted
conditions - the conditions under which attributes should be put
Throws:
SDBException - wraps checked exceptions

deleteItem

public SDBResult deleteItem(String identifier)
                     throws SDBException
Deletes an item.

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

createItem

public Item createItem(String identifier)
This method returns an item object, which exists locally only. It must be persisted with addItem, batchPutAttributes or replaceAttributes

Parameters:
identifier - the name of the item to be deleted
Returns:
item object
Throws:
SDBException - wraps checked exceptions

getItem

public Result<Item> getItem(String identifier)
                     throws SDBException
Returns an named item.

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

selectItems

public SDBListResult<Item> selectItems(String selectExpression,
                                       String nextToken,
                                       boolean consistent)
                                throws SDBException
Performs a query against this domain. A set of items is returned which may not be complete. If the nextToken in the result is set, this method can be called again with the same query and the supplied nextToken.

Parameters:
selectExpression - the query to be run
nextToken - an optional token to get more results
consistent - if true, consistency is assured
Throws:
SDBException - wraps checked exceptions

getItemCache

public ItemCache getItemCache()

setCacheProvider

public void setCacheProvider(ItemCache cache)

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