org.springframework.build.aws.ant
Class AbstractS3Operation

java.lang.Object
  extended by org.springframework.build.aws.ant.AbstractS3Operation
All Implemented Interfaces:
S3Operation
Direct Known Subclasses:
AbstractS3DownloadOperation, Delete, Upload

public abstract class AbstractS3Operation
extends java.lang.Object
implements S3Operation


Field Summary
protected  java.lang.String bucketName
           
protected  org.apache.tools.ant.Project project
           
 
Constructor Summary
AbstractS3Operation()
           
 
Method Summary
protected  org.jets3t.service.model.S3Bucket getOperationBucket()
          Get the bucket for this operation
protected  java.lang.String getS3SafeDirectory(java.io.File file)
          Gets a 'directory' that is safe to use with S3.
protected  S3Scanner getS3Scanner(org.jets3t.service.model.S3Bucket bucket, org.apache.tools.ant.types.PatternSet patterns, java.lang.String baseDirectory)
          Returns a file scanner for an S3 repository.
 void setBucketName(java.lang.String bucketName)
          Required parameter that corresponds to the S3 bucket to delete from
 void setProject(org.apache.tools.ant.Project project)
          Infrastructure element
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.build.aws.ant.S3Operation
execute
 

Field Detail

bucketName

protected java.lang.String bucketName

project

protected org.apache.tools.ant.Project project
Constructor Detail

AbstractS3Operation

public AbstractS3Operation()
Method Detail

setBucketName

public void setBucketName(java.lang.String bucketName)
Required parameter that corresponds to the S3 bucket to delete from

Parameters:
bucketName - The name of the bucket

setProject

public void setProject(org.apache.tools.ant.Project project)
Infrastructure element

Parameters:
project - The project this task is running in

getS3Scanner

protected S3Scanner getS3Scanner(org.jets3t.service.model.S3Bucket bucket,
                                 org.apache.tools.ant.types.PatternSet patterns,
                                 java.lang.String baseDirectory)
Returns a file scanner for an S3 repository.

Parameters:
bucket - The bucket to scan
patterns - The patterns to scan for
baseDirectory - The 'directory' to start the scan at
Returns:
An initialized scanner

getOperationBucket

protected org.jets3t.service.model.S3Bucket getOperationBucket()
Get the bucket for this operation

Returns:
An S3 bucket

getS3SafeDirectory

protected java.lang.String getS3SafeDirectory(java.io.File file)
                                       throws java.io.IOException
Gets a 'directory' that is safe to use with S3. Due to some stupidity in ANT, a fileset will only pass back a dir argument that is relative to the project root. This strips that project root part of that directory giving you the intended path from the root of the bucket.

Parameters:
file - The ANT supplied directory to be normalized
Returns:
A path that has been stripped of it's project root and made safe for S3
Throws:
java.io.IOException