001 /**
002 * Copyright 2010-2013 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.maven.wagon;
017
018 import java.io.File;
019
020 import org.apache.maven.wagon.events.TransferEvent;
021 import org.apache.maven.wagon.resource.Resource;
022
023 import com.amazonaws.services.s3.AmazonS3Client;
024 import com.amazonaws.services.s3.transfer.TransferManager;
025
026 /**
027 * This is the context needed by the Wagon for uploading a file and tracking its progress as it goes
028 */
029 public class PutFileContext {
030 File source;
031 String destination;
032 Resource resource;
033 TransferProgress progress;
034 TransferListenerSupport listeners;
035 RequestFactory factory;
036 TransferManager transferManager;
037 AmazonS3Client client;
038
039 public void fireStart() {
040 listeners.fireTransferInitiated(getResource(), TransferEvent.REQUEST_PUT);
041 listeners.fireTransferStarted(getResource(), TransferEvent.REQUEST_PUT);
042 }
043
044 public void fireComplete() {
045 listeners.fireTransferCompleted(getResource(), TransferEvent.REQUEST_PUT);
046 }
047
048 public Resource getResource() {
049 return resource;
050 }
051
052 public void setResource(Resource resource) {
053 this.resource = resource;
054 }
055
056 public TransferProgress getProgress() {
057 return progress;
058 }
059
060 public void setProgress(TransferProgress progress) {
061 this.progress = progress;
062 }
063
064 public TransferListenerSupport getListeners() {
065 return listeners;
066 }
067
068 public void setListeners(TransferListenerSupport listeners) {
069 this.listeners = listeners;
070 }
071
072 public String getDestination() {
073 return destination;
074 }
075
076 public void setDestination(String destination) {
077 this.destination = destination;
078 }
079
080 public File getSource() {
081 return source;
082 }
083
084 public void setSource(File source) {
085 this.source = source;
086 }
087
088 public RequestFactory getFactory() {
089 return factory;
090 }
091
092 public void setFactory(RequestFactory factory) {
093 this.factory = factory;
094 }
095
096 public TransferManager getTransferManager() {
097 return transferManager;
098 }
099
100 public void setTransferManager(TransferManager transferManager) {
101 this.transferManager = transferManager;
102 }
103
104 public AmazonS3Client getClient() {
105 return client;
106 }
107
108 public void setClient(AmazonS3Client client) {
109 this.client = client;
110 }
111
112 }