org.springframework.build.aws.ant
Class Upload

java.lang.Object
  extended by org.springframework.build.aws.ant.AbstractS3Operation
      extended by org.springframework.build.aws.ant.Upload
All Implemented Interfaces:
S3Operation

public class Upload
extends AbstractS3Operation

A member of the S3 ANT task for dealing with Amazon S3 upload behavior. This operation will use the credentials setup in its parent S3 task tag.

Author:
Ben Hale

Field Summary
private  java.io.File file
           
private  java.util.List<org.apache.tools.ant.types.FileSet> fileSets
           
private  java.util.Set<Metadata> metadatas
           
private  boolean publicRead
           
private  java.lang.String toDir
           
private  java.lang.String toFile
           
 
Fields inherited from class org.springframework.build.aws.ant.AbstractS3Operation
bucketName, project
 
Constructor Summary
Upload()
           
 
Method Summary
 void addFileSet(org.apache.tools.ant.types.FileSet fileSet)
          Adds an optional fileSet to read files from.
 void addMetadata(Metadata metadata)
          Adds an optional piece of
private  void buildDestinationPath(org.jets3t.service.S3Service service, org.jets3t.service.model.S3Bucket bucket, java.lang.String destination)
           
 void execute(org.jets3t.service.S3Service service)
          Execute an S3 operation
private  java.lang.String getDestinationPath(java.lang.String destination)
           
 void init()
          Verify that required parameters have been set
private  void logEnd(java.io.File source, long startTime, long endTime)
           
private  void logStart(java.io.File source, org.jets3t.service.model.S3Object destination)
           
private  void processFileToDir(org.jets3t.service.S3Service service)
           
private  void processFileToFile(org.jets3t.service.S3Service service)
           
private  void processSetToDir(org.jets3t.service.S3Service service)
           
private  void putFile(org.jets3t.service.S3Service service, org.jets3t.service.model.S3Bucket bucket, java.io.File source, java.lang.String key)
           
 void setFile(java.io.File file)
          Optional parameter that corresponds to the file to upload
 void setPublicRead(boolean publicRead)
          Optional parameter that corresponds to public readability of the object in S3.
 void setToDir(java.lang.String toDir)
          Optional parameter that corresponds to the target object 'directory' in S3
 void setToFile(java.lang.String toFile)
          Optional parameter that corresponds to the target object key in S3
 
Methods inherited from class org.springframework.build.aws.ant.AbstractS3Operation
getOperationBucket, getS3SafeDirectory, getS3Scanner, setBucketName, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

file

private java.io.File file

fileSets

private java.util.List<org.apache.tools.ant.types.FileSet> fileSets

toDir

private java.lang.String toDir

toFile

private java.lang.String toFile

publicRead

private boolean publicRead

metadatas

private java.util.Set<Metadata> metadatas
Constructor Detail

Upload

public Upload()
Method Detail

setFile

public void setFile(java.io.File file)
Optional parameter that corresponds to the file to upload

Parameters:
file - The file to upload

addFileSet

public void addFileSet(org.apache.tools.ant.types.FileSet fileSet)
Adds an optional fileSet to read files from.

Parameters:
fileSet - The set of files to upload

addMetadata

public void addMetadata(Metadata metadata)
Adds an optional piece of

Parameters:
property -

setToDir

public void setToDir(java.lang.String toDir)
Optional parameter that corresponds to the target object 'directory' in S3

Parameters:
toDir - The target object 'directory' in S3

setToFile

public void setToFile(java.lang.String toFile)
Optional parameter that corresponds to the target object key in S3

Parameters:
toFile - The target object key in S3

setPublicRead

public void setPublicRead(boolean publicRead)
Optional parameter that corresponds to public readability of the object in S3. Defaults to false.

Parameters:
publicRead -

init

public void init()
Verify that required parameters have been set


execute

public void execute(org.jets3t.service.S3Service service)
             throws org.jets3t.service.S3ServiceException,
                    java.io.IOException
Description copied from interface: S3Operation
Execute an S3 operation

Parameters:
service - The S3 Service to execute against
Throws:
org.jets3t.service.S3ServiceException
java.io.IOException

processFileToFile

private void processFileToFile(org.jets3t.service.S3Service service)
                        throws org.jets3t.service.S3ServiceException,
                               java.io.IOException
Throws:
org.jets3t.service.S3ServiceException
java.io.IOException

processFileToDir

private void processFileToDir(org.jets3t.service.S3Service service)
                       throws org.jets3t.service.S3ServiceException,
                              java.io.IOException
Throws:
org.jets3t.service.S3ServiceException
java.io.IOException

processSetToDir

private void processSetToDir(org.jets3t.service.S3Service service)
                      throws org.jets3t.service.S3ServiceException,
                             java.io.IOException
Throws:
org.jets3t.service.S3ServiceException
java.io.IOException

putFile

private void putFile(org.jets3t.service.S3Service service,
                     org.jets3t.service.model.S3Bucket bucket,
                     java.io.File source,
                     java.lang.String key)
              throws org.jets3t.service.S3ServiceException,
                     java.io.IOException
Throws:
org.jets3t.service.S3ServiceException
java.io.IOException

getDestinationPath

private java.lang.String getDestinationPath(java.lang.String destination)

buildDestinationPath

private void buildDestinationPath(org.jets3t.service.S3Service service,
                                  org.jets3t.service.model.S3Bucket bucket,
                                  java.lang.String destination)
                           throws org.jets3t.service.S3ServiceException
Throws:
org.jets3t.service.S3ServiceException

logStart

private void logStart(java.io.File source,
                      org.jets3t.service.model.S3Object destination)
               throws java.io.IOException
Throws:
java.io.IOException

logEnd

private void logEnd(java.io.File source,
                    long startTime,
                    long endTime)