cascading.util
Class S3Util

java.lang.Object
  extended by cascading.util.S3Util

public class S3Util
extends Object

Class S3Util encapsulates calls to the JetS3t API.


Nested Class Summary
static class S3Util.Request
           
 
Field Summary
static String MIME_DIRECTORY
           
 
Constructor Summary
S3Util()
           
 
Method Summary
static boolean deleteObject(S3Service s3Service, S3Bucket s3Bucket, Path path)
           
static String getKeyFrom(Path path)
           
static S3Object getObject(S3Service s3Service, S3Bucket s3Bucket, Path path, S3Util.Request type)
           
static InputStream getObjectInputStream(S3Object object)
           
static S3Bucket getS3Bucket(URI uri)
           
static RestS3Service getS3Service(URI uri)
           
static RestS3Service getS3Service(URI uri, String defaultAccessKey, String defaultSecretAccessKey)
           
static boolean isDirectory(S3Object object)
           
static S3Object[] listObjects(S3Service s3Service, S3Bucket s3Bucket, Path path)
           
static String[] parseAWSUri(URI uri, String defaultAccessKey, String defaultSecretAccessKey)
          Parses the userinfo username and password out of the given URI, and retuns the embedded, or default, AWS access and secret keys.
static void putObject(S3Service s3Service, S3Bucket bucket, S3Object object)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIME_DIRECTORY

public static final String MIME_DIRECTORY
See Also:
Constant Field Values
Constructor Detail

S3Util

public S3Util()
Method Detail

parseAWSUri

public static String[] parseAWSUri(URI uri,
                                   String defaultAccessKey,
                                   String defaultSecretAccessKey)
Parses the userinfo username and password out of the given URI, and retuns the embedded, or default, AWS access and secret keys.

This code will handle underscores in bucket names.

Parameters:
uri -
defaultAccessKey -
defaultSecretAccessKey -
Returns:
a String[] with accessKey and secretKey

getS3Service

public static RestS3Service getS3Service(URI uri)

getS3Service

public static RestS3Service getS3Service(URI uri,
                                         String defaultAccessKey,
                                         String defaultSecretAccessKey)

getS3Bucket

public static S3Bucket getS3Bucket(URI uri)

deleteObject

public static boolean deleteObject(S3Service s3Service,
                                   S3Bucket s3Bucket,
                                   Path path)
                            throws IOException
Throws:
IOException

getObject

public static S3Object getObject(S3Service s3Service,
                                 S3Bucket s3Bucket,
                                 Path path,
                                 S3Util.Request type)
                          throws IOException
Parameters:
s3Service -
s3Bucket -
path -
type -
Returns:
null if the S3 service returns a 404
Throws:
IOException - thrown if there is an error communicating to S3

getKeyFrom

public static String getKeyFrom(Path path)

listObjects

public static S3Object[] listObjects(S3Service s3Service,
                                     S3Bucket s3Bucket,
                                     Path path)
                              throws IOException
Throws:
IOException

isDirectory

public static boolean isDirectory(S3Object object)

putObject

public static void putObject(S3Service s3Service,
                             S3Bucket bucket,
                             S3Object object)
                      throws IOException
Throws:
IOException

getObjectInputStream

public static InputStream getObjectInputStream(S3Object object)
                                        throws IOException
Throws:
IOException


Copyright © 2007-2008 Concurrent, Inc. All Rights Reserved.