// Path: src/main/java/com/github/rholder/esthree/progress/MutableProgressListener.java
// public interface MutableProgressListener extends ProgressListener {
// 
//     /**
//      * Set and listen to the given {@link Progress} implementation.
//      *
//      * @param progress the underlying implementation to watch
//      * @return this {@link MutableProgressListener}
//      */
//     MutableProgressListener withTransferProgress(Progress progress);
// 
//     /**
//      * The current completed percentage from 0.0 - 100.0.
//      *
//      * @param completed current percentage completed
//      * @return this {@link MutableProgressListener}
//      */
//     MutableProgressListener withCompleted(Double completed);
// 
//     /**
//      * The number to multiply the current transferred percentage by to determine
//      * how far along the download is. This is useful when multiple chunks are
//      * being fetched and each incoming chunk contributes only a percentage of
//      * the total number of bytes expected to be transferred.
//      *
//      * @param multiplier multiply the completed percentage by this
//      * @return this {@link MutableProgressListener}
//      */
//     MutableProgressListener withMultiplier(Double multiplier);
// }
// 
// Path: src/main/java/com/github/rholder/esthree/progress/TransferProgressWrapper.java
// public class TransferProgressWrapper implements Progress {
// 
//     public TransferProgress transferProgress;
// 
//     public TransferProgressWrapper(TransferProgress transferProgress) {
//         this.transferProgress = transferProgress;
//     }
// 
//     @Override
//     public double getPercentTransferred() {
//         return transferProgress.getPercentTransferred();
//     }
// 
//     @Override
//     public long getBytesTransferred() {
//         return transferProgress.getBytesTransferred();
//     }
// 
//     @Override
//     public void setTotalBytesToTransfer(long totalBytesToTransfer) {
//         transferProgress.setTotalBytesToTransfer(totalBytesToTransfer);
//     }
// 
//     @Override
//     public long getTotalBytesToTransfer() {
//         return transferProgress.getTotalBytesToTransfer();
//     }
// 
//     @Override
//     public void updateProgress(long bytes) {
//         transferProgress.updateProgress(bytes);
//     }
// }


import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.ObjectMetadata;
import com.amazonaws.services.s3.model.PutObjectRequest;
import com.amazonaws.services.s3.model.SSEAlgorithm;
import com.amazonaws.services.s3.transfer.TransferManager;
import com.amazonaws.services.s3.transfer.Upload;
import com.github.rholder.esthree.progress.MutableProgressListener;
import com.github.rholder.esthree.progress.TransferProgressWrapper;
import java.io.File;
import java.util.Map;
import java.util.concurrent.Callable;
/*
 * Copyright 2014 Ray Holder
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.github.rholder.esthree.command;



public class Put implements Callable<Integer> {

    public AmazonS3Client amazonS3Client;
    public String bucket;
    public String key;
    public File inputFile;
    public Map<String, String> metadata;
    public boolean sse;

    public MutableProgressListener progressListener;

    public Put(AmazonS3Client amazonS3Client, String bucket, String key, File inputFile, Map<String, String> metadata, boolean sse) {
        this.amazonS3Client = amazonS3Client;
        this.bucket = bucket;
        this.key = key;
        this.inputFile = inputFile;
        this.metadata = metadata;
        this.sse = sse;
    }

// Path: src/main/java/com/github/rholder/esthree/progress/MutableProgressListener.java
// public interface MutableProgressListener extends ProgressListener {
// 
//     /**
//      * Set and listen to the given {@link Progress} implementation.
//      *
//      * @param progress the underlying implementation to watch
//      * @return this {@link MutableProgressListener}
//      */
//     MutableProgressListener withTransferProgress(Progress progress);
// 
//     /**
//      * The current completed percentage from 0.0 - 100.0.
//      *
//      * @param completed current percentage completed
//      * @return this {@link MutableProgressListener}
//      */
//     MutableProgressListener withCompleted(Double completed);
// 
//     /**
//      * The number to multiply the current transferred percentage by to determine
//      * how far along the download is. This is useful when multiple chunks are
//      * being fetched and each incoming chunk contributes only a percentage of
//      * the total number of bytes expected to be transferred.
//      *
//      * @param multiplier multiply the completed percentage by this
//      * @return this {@link MutableProgressListener}
//      */
//     MutableProgressListener withMultiplier(Double multiplier);
// }
// 
// Path: src/main/java/com/github/rholder/esthree/progress/TransferProgressWrapper.java
// public class TransferProgressWrapper implements Progress {
// 
//     public TransferProgress transferProgress;
// 
//     public TransferProgressWrapper(TransferProgress transferProgress) {
//         this.transferProgress = transferProgress;
//     }
// 
//     @Override
//     public double getPercentTransferred() {
//         return transferProgress.getPercentTransferred();
//     }
// 
//     @Override
//     public long getBytesTransferred() {
//         return transferProgress.getBytesTransferred();
//     }
// 
//     @Override
//     public void setTotalBytesToTransfer(long totalBytesToTransfer) {
//         transferProgress.setTotalBytesToTransfer(totalBytesToTransfer);
//     }
// 
//     @Override
//     public long getTotalBytesToTransfer() {
//         return transferProgress.getTotalBytesToTransfer();
//     }
// 
//     @Override
//     public void updateProgress(long bytes) {
//         transferProgress.updateProgress(bytes);
//     }
// }


// Path: src/main/java/com/github/rholder/esthree/command/Put.java
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.ObjectMetadata;
import com.amazonaws.services.s3.model.PutObjectRequest;
import com.amazonaws.services.s3.model.SSEAlgorithm;
import com.amazonaws.services.s3.transfer.TransferManager;
import com.amazonaws.services.s3.transfer.Upload;
import com.github.rholder.esthree.progress.MutableProgressListener;
import com.github.rholder.esthree.progress.TransferProgressWrapper;
import java.io.File;
import java.util.Map;
import java.util.concurrent.Callable;

/*
 * Copyright 2014 Ray Holder
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.github.rholder.esthree.command;



public class Put implements Callable<Integer> {

    public AmazonS3Client amazonS3Client;
    public String bucket;
    public String key;
    public File inputFile;
    public Map<String, String> metadata;
    public boolean sse;

    public MutableProgressListener progressListener;

    public Put(AmazonS3Client amazonS3Client, String bucket, String key, File inputFile, Map<String, String> metadata, boolean sse) {
        this.amazonS3Client = amazonS3Client;
        this.bucket = bucket;
        this.key = key;
        this.inputFile = inputFile;
        this.metadata = metadata;
        this.sse = sse;
    }

    public Put withProgressListener(MutableProgressListener progressListener) {