package me.tango.devops.task;

/** Base class of all upload tasks. */
@SuppressWarnings({"PMD.CommentRequired","PMD.BeanMembersShouldSerialize"})
public abstract class AbstractUploadTask implements Runnable {
    protected final String region;
    protected final String bucket;
    protected final byte[] data;

    protected UploadTaskResult result;


    /**
     * Constructor.
     *
     * @param region Region
     * @param bucket Bucket
     * @param data  Data
     */
    @SuppressWarnings("PMD.ArrayIsStoredDirectly")
    public AbstractUploadTask(final String region, final String bucket, final byte[] data) {
        this.region = region;
        this.bucket = bucket;
        this.data = data;
    }

    public UploadTaskResult getResult() {
        return result;
    }

    @Override
    public abstract void run();


    public static class UploadTaskResult {
        private final boolean success;
        private final long uploadTime;
        private final long downloadTime;

        /** Result of upload task. */
        public UploadTaskResult(final boolean success, final long uploadTime,
            final long downloadTime) {
            this.success = success;
            this.uploadTime = uploadTime;
            this.downloadTime = downloadTime;
        }

        public boolean isSuccess() {
            return success;
        }

        public long getUploadTime() {
            return uploadTime;
        }

        public long getDownloadTime() {
            return downloadTime;
        }
    }
}

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

Update AbstractUploadTask.java