com.amazon.s3
Class AWSAuthConnection

java.lang.Object
  extended bycom.amazon.s3.AWSAuthConnection

public class AWSAuthConnection
extends java.lang.Object

An interface into the S3 system. It is initially configured with authentication and connection parameters and exposes methods to access and manipulate S3 data.


Constructor Summary
AWSAuthConnection(java.lang.String awsAccessKeyId, java.lang.String awsSecretAccessKey)
           
AWSAuthConnection(java.lang.String awsAccessKeyId, java.lang.String awsSecretAccessKey, boolean isSecure)
           
AWSAuthConnection(java.lang.String awsAccessKeyId, java.lang.String awsSecretAccessKey, boolean isSecure, java.lang.String server)
           
AWSAuthConnection(java.lang.String awsAccessKeyId, java.lang.String awsSecretAccessKey, boolean isSecure, java.lang.String server, int port)
          Create a new interface to interact with S3 with the given credential and connection parameters
 
Method Summary
 Response createBucket(java.lang.String bucket, java.util.Map headers)
          Creates a new bucket.
 Response delete(java.lang.String bucket, java.lang.String key, java.util.Map headers)
          Deletes an object from S3.
 Response deleteBucket(java.lang.String bucket, java.util.Map headers)
          Deletes a bucket.
 GetResponse get(java.lang.String bucket, java.lang.String key, java.util.Map headers)
          Reads an object from S3.
 GetResponse getACL(java.lang.String bucket, java.lang.String key, java.util.Map headers)
          Get the ACL for a given object (or bucket, if key is null).
 GetResponse getBucketACL(java.lang.String bucket, java.util.Map headers)
          Get the ACL for a given bucket
 GetResponse getBucketLogging(java.lang.String bucket, java.util.Map headers)
          Get the logging xml document for a given bucket
static java.lang.String httpDate()
          Generate an rfc822 date for use in the Date HTTP header.
 ListAllMyBucketsResponse listAllMyBuckets(java.util.Map headers)
          List all the buckets created by this account.
 ListBucketResponse listBucket(java.lang.String bucket, java.lang.String prefix, java.lang.String marker, java.lang.Integer maxKeys, java.util.Map headers)
          Lists the contents of a bucket.
 ListBucketResponse listBucket(java.lang.String bucket, java.lang.String prefix, java.lang.String marker, java.lang.Integer maxKeys, java.lang.String delimiter, java.util.Map headers)
          Lists the contents of a bucket.
 Response put(java.lang.String bucket, java.lang.String key, S3Object object, java.util.Map headers)
          Writes an object to S3.
 Response putACL(java.lang.String bucket, java.lang.String key, java.lang.String aclXMLDoc, java.util.Map headers)
          Write a new ACL for a given object
 Response putBucketACL(java.lang.String bucket, java.lang.String aclXMLDoc, java.util.Map headers)
          Write a new ACL for a given bucket
 Response putBucketLogging(java.lang.String bucket, java.lang.String loggingXMLDoc, java.util.Map headers)
          Write a new logging xml document for a given bucket
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AWSAuthConnection

public AWSAuthConnection(java.lang.String awsAccessKeyId,
                         java.lang.String awsSecretAccessKey)

AWSAuthConnection

public AWSAuthConnection(java.lang.String awsAccessKeyId,
                         java.lang.String awsSecretAccessKey,
                         boolean isSecure)

AWSAuthConnection

public AWSAuthConnection(java.lang.String awsAccessKeyId,
                         java.lang.String awsSecretAccessKey,
                         boolean isSecure,
                         java.lang.String server)

AWSAuthConnection

public AWSAuthConnection(java.lang.String awsAccessKeyId,
                         java.lang.String awsSecretAccessKey,
                         boolean isSecure,
                         java.lang.String server,
                         int port)
Create a new interface to interact with S3 with the given credential and connection parameters

Parameters:
awsAccessKeyId - The your user key into AWS
awsSecretAccessKey - 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 S3.
server - Which host to connect to. Usually, this will be s3.amazonaws.com
port - Which port to use.
Method Detail

createBucket

public Response createBucket(java.lang.String bucket,
                             java.util.Map headers)
                      throws java.net.MalformedURLException,
                             java.io.IOException
Creates a new bucket.

Parameters:
bucket - The name of the bucket to create.
headers - A Map of String to List of Strings representing the http headers to pass (can be null).
Throws:
java.net.MalformedURLException
java.io.IOException

listBucket

public ListBucketResponse listBucket(java.lang.String bucket,
                                     java.lang.String prefix,
                                     java.lang.String marker,
                                     java.lang.Integer maxKeys,
                                     java.util.Map headers)
                              throws java.net.MalformedURLException,
                                     java.io.IOException
Lists the contents of a bucket.

Parameters:
bucket - The name of the bucket to create.
prefix - All returned keys will start with this string (can be null).
marker - All returned keys will be lexographically greater than this string (can be null).
maxKeys - The maximum number of keys to return (can be null).
headers - A Map of String to List of Strings representing the http headers to pass (can be null).
Throws:
java.net.MalformedURLException
java.io.IOException

listBucket

public ListBucketResponse listBucket(java.lang.String bucket,
                                     java.lang.String prefix,
                                     java.lang.String marker,
                                     java.lang.Integer maxKeys,
                                     java.lang.String delimiter,
                                     java.util.Map headers)
                              throws java.net.MalformedURLException,
                                     java.io.IOException
Lists the contents of a bucket.

Parameters:
bucket - The name of the bucket to create.
prefix - All returned keys will start with this string (can be null).
marker - All returned keys will be lexographically greater than this string (can be null).
maxKeys - The maximum number of keys to return (can be null).
delimiter - Keys that contain a string between the prefix and the first occurrence of the delimiter will be rolled up into a single element.
headers - A Map of String to List of Strings representing the http headers to pass (can be null).
Throws:
java.net.MalformedURLException
java.io.IOException

deleteBucket

public Response deleteBucket(java.lang.String bucket,
                             java.util.Map headers)
                      throws java.net.MalformedURLException,
                             java.io.IOException
Deletes a bucket.

Parameters:
bucket - The name of the bucket to delete.
headers - A Map of String to List of Strings representing the http headers to pass (can be null).
Throws:
java.net.MalformedURLException
java.io.IOException

put

public Response put(java.lang.String bucket,
                    java.lang.String key,
                    S3Object object,
                    java.util.Map headers)
             throws java.net.MalformedURLException,
                    java.io.IOException
Writes an object to S3.

Parameters:
bucket - The name of the bucket to which the object will be added.
key - The name of the key to use.
object - An S3Object containing the data to write.
headers - A Map of String to List of Strings representing the http headers to pass (can be null).
Throws:
java.net.MalformedURLException
java.io.IOException

get

public GetResponse get(java.lang.String bucket,
                       java.lang.String key,
                       java.util.Map headers)
                throws java.net.MalformedURLException,
                       java.io.IOException
Reads an object from S3.

Parameters:
bucket - The name of the bucket where the object lives.
key - The name of the key to use.
headers - A Map of String to List of Strings representing the http headers to pass (can be null).
Throws:
java.net.MalformedURLException
java.io.IOException

delete

public Response delete(java.lang.String bucket,
                       java.lang.String key,
                       java.util.Map headers)
                throws java.net.MalformedURLException,
                       java.io.IOException
Deletes an object from S3.

Parameters:
bucket - The name of the bucket where the object lives.
key - The name of the key to use.
headers - A Map of String to List of Strings representing the http headers to pass (can be null).
Throws:
java.net.MalformedURLException
java.io.IOException

getBucketLogging

public GetResponse getBucketLogging(java.lang.String bucket,
                                    java.util.Map headers)
                             throws java.net.MalformedURLException,
                                    java.io.IOException
Get the logging xml document for a given bucket

Parameters:
bucket - The name of the bucket
headers - A Map of String to List of Strings representing the http headers to pass (can be null).
Throws:
java.net.MalformedURLException
java.io.IOException

putBucketLogging

public Response putBucketLogging(java.lang.String bucket,
                                 java.lang.String loggingXMLDoc,
                                 java.util.Map headers)
                          throws java.net.MalformedURLException,
                                 java.io.IOException
Write a new logging xml document for a given bucket

Parameters:
loggingXMLDoc - The xml representation of the logging configuration as a String
bucket - The name of the bucket
headers - A Map of String to List of Strings representing the http headers to pass (can be null).
Throws:
java.net.MalformedURLException
java.io.IOException

getBucketACL

public GetResponse getBucketACL(java.lang.String bucket,
                                java.util.Map headers)
                         throws java.net.MalformedURLException,
                                java.io.IOException
Get the ACL for a given bucket

Parameters:
bucket - The name of the bucket where the object lives.
headers - A Map of String to List of Strings representing the http headers to pass (can be null).
Throws:
java.net.MalformedURLException
java.io.IOException

getACL

public GetResponse getACL(java.lang.String bucket,
                          java.lang.String key,
                          java.util.Map headers)
                   throws java.net.MalformedURLException,
                          java.io.IOException
Get the ACL for a given object (or bucket, if key is null).

Parameters:
bucket - The name of the bucket where the object lives.
key - The name of the key to use.
headers - A Map of String to List of Strings representing the http headers to pass (can be null).
Throws:
java.net.MalformedURLException
java.io.IOException

putBucketACL

public Response putBucketACL(java.lang.String bucket,
                             java.lang.String aclXMLDoc,
                             java.util.Map headers)
                      throws java.net.MalformedURLException,
                             java.io.IOException
Write a new ACL for a given bucket

Parameters:
aclXMLDoc - The xml representation of the ACL as a String
bucket - The name of the bucket where the object lives.
headers - A Map of String to List of Strings representing the http headers to pass (can be null).
Throws:
java.net.MalformedURLException
java.io.IOException

putACL

public Response putACL(java.lang.String bucket,
                       java.lang.String key,
                       java.lang.String aclXMLDoc,
                       java.util.Map headers)
                throws java.net.MalformedURLException,
                       java.io.IOException
Write a new ACL for a given object

Parameters:
aclXMLDoc - The xml representation of the ACL as a String
bucket - The name of the bucket where the object lives.
key - The name of the key to use.
headers - A Map of String to List of Strings representing the http headers to pass (can be null).
Throws:
java.net.MalformedURLException
java.io.IOException

listAllMyBuckets

public ListAllMyBucketsResponse listAllMyBuckets(java.util.Map headers)
                                          throws java.net.MalformedURLException,
                                                 java.io.IOException
List all the buckets created by this account.

Parameters:
headers - A Map of String to List of Strings representing the http headers to pass (can be null).
Throws:
java.net.MalformedURLException
java.io.IOException

httpDate

public static java.lang.String httpDate()
Generate an rfc822 date for use in the Date HTTP header.