@@ -0,0 +1,1650 @@
+package tdl.s3.upload;%0A%0Aimport com.amazonaws.services.kms.model.NotFoundException;%0Aimport com.amazonaws.services.s3.AmazonS3;%0Aimport com.amazonaws.services.s3.model.AmazonS3Exception;%0A%0A/**%0A * This represents a single S3 object.%0A */%0Apublic class RemoteFile %7B%0A%0A    private final String bucket;%0A    %0A    private final String prefix;%0A    %0A    private final String path;%0A    %0A    private AmazonS3 client;%0A%0A    public RemoteFile(String bucket, String path) %7B%0A        this.bucket = bucket;%0A        this.path = path;%0A        this.prefix = %22%22;%0A    %7D%0A%0A    public RemoteFile(String bucket, String prefix, String path) %7B%0A        this.bucket = bucket;%0A        this.prefix = prefix;%0A        this.path = path;%0A        this.client = createDefaultClient();%0A    %7D%0A%0A    public RemoteFile(String bucket, String prefix, String path, AmazonS3 client) %7B%0A        this.bucket = bucket;%0A        this.prefix = prefix;%0A        this.path = path;%0A        this.client = client;%0A    %7D%0A%0A    public void setClient(AmazonS3 client) %7B%0A        this.client = client;%0A    %7D%0A    %0A    private AmazonS3 createDefaultClient() %7B%0A        //TODO: Create based on instance profile or environment.%0A        return null;%0A    %7D%0A    %0A    public String getFullPath() %7B%0A        return prefix + path;%0A    %7D%0A    %0A    public boolean isExists() %7B%0A        try %7B%0A            client.getObjectMetadata(bucket, getFullPath());%0A            return true;%0A        %7Dcatch (NotFoundException ex) %7B%0A            return false;%0A        %7D catch (AmazonS3Exception ex) %7B%0A            if (ex.getStatusCode() == 404) %7B%0A                return false;%0A            %7D else %7B%0A                throw ex;%0A            %7D%0A        %7D%0A    %7D%0A%7D%0A

Refactor uploader.