com.xerox.amazonws.sdb
Class Item

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

public class Item
extends AWSQueryConnection

This class provides an interface with the Amazon SDB service. It provides methods for listing items and adding/removing attributes.

Author:
D. Kavanagh, developer@dotech.com

Field Summary
 
Fields inherited from class com.xerox.amazonws.common.AWSConnection
headers
 
Constructor Summary
protected Item(String identifier, String domainName, String awsAccessId, String awsSecretKey, boolean isSecure, int port, String server)
           
 
Method Summary
 SDBResult deleteAttributes(List<ItemAttribute> attributes)
          Deletes one or more attributes.
 SDBResult deleteAttributes(List<ItemAttribute> attributes, List<Condition> conditions)
          Deletes one or more attributes.
 List<ItemAttribute> getAttributes()
          Gets a map of all attributes for this item
 List<ItemAttribute> getAttributes(List<String> attributes)
          Gets selected attributes.
 List<ItemAttribute> getAttributes(String attributeName)
          Deprecated. this didn't work, so I don't expect anyone was using it anyway!
 Map<String,List<String>> getAttributesMap(List<String> attributes)
          Gets selected attributes.
 String getIdentifier()
          Gets the name of the identifier that is unique to this Item
protected
<T> T
makeRequestInt(org.apache.http.client.methods.HttpRequestBase method, String action, Map<String,String> params, Class<T> respType)
           
 SDBResult putAttributes(List<ItemAttribute> attributes)
          Creates attributes for this item.
 SDBResult putAttributes(List<ItemAttribute> attributes, List<Condition> conditions)
          Creates attributes for this item.
 
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, getSignatureVersion, getUrl, isSecure, makeURL, setResourcePrefix, setServer, setSignatureVersion, urlencode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Item

protected Item(String identifier,
               String domainName,
               String awsAccessId,
               String awsSecretKey,
               boolean isSecure,
               int port,
               String server)
        throws SDBException
Throws:
SDBException
Method Detail

getIdentifier

public String getIdentifier()
Gets the name of the identifier that is unique to this Item

Returns:
the id

getAttributes

public List<ItemAttribute> getAttributes()
                                  throws SDBException
Gets a map of all attributes for this item

Returns:
the map of attributes
Throws:
SDBException - wraps checked exceptions

getAttributes

public List<ItemAttribute> getAttributes(String attributeName)
                                  throws SDBException
Deprecated. this didn't work, so I don't expect anyone was using it anyway!

Gets attributes of a given name. The parameter limits the results to those of the name given.

Parameters:
attributeName - a name that limits the results
Returns:
the list of attributes
Throws:
SDBException - wraps checked exceptions

getAttributes

public List<ItemAttribute> getAttributes(List<String> attributes)
                                  throws SDBException
Gets selected attributes. The parameter limits the results to those of the name(s) given.

Parameters:
attributes - name(s) that limits the results
Returns:
the list of attributes
Throws:
SDBException - wraps checked exceptions

getAttributesMap

public Map<String,List<String>> getAttributesMap(List<String> attributes)
                                          throws SDBException
Gets selected attributes. The parameter limits the results to those of the name(s) given.

Parameters:
attributes - name(s) that limits the results
Returns:
the list of attributes
Throws:
SDBException - wraps checked exceptions

putAttributes

public SDBResult putAttributes(List<ItemAttribute> attributes)
                        throws SDBException
Creates attributes for this item. Each item can have "replace" specified which indicates to replace the Attribute/Value or ad a new Attribute/Value. NOTE: if an attribute value is null, that attribute will be ignored.

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

putAttributes

public SDBResult putAttributes(List<ItemAttribute> attributes,
                               List<Condition> conditions)
                        throws SDBException
Creates attributes for this item. Each item can have "replace" specified which indicates to replace the Attribute/Value or ad a new Attribute/Value. NOTE: if an attribute value is null, that attribute will be ignored.

Parameters:
attributes - list of attributes to add
conditions - the conditions under which attributes should be put
Throws:
SDBException - wraps checked exceptions

deleteAttributes

public SDBResult deleteAttributes(List<ItemAttribute> attributes)
                           throws SDBException
Deletes one or more attributes.

Parameters:
attributes - the names of the attributes to be deleted
Throws:
SDBException - wraps checked exceptions

deleteAttributes

public SDBResult deleteAttributes(List<ItemAttribute> attributes,
                                  List<Condition> conditions)
                           throws SDBException
Deletes one or more attributes.

Parameters:
attributes - the names of the attributes to be deleted
conditions - the conditions under which the delete should happen
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