001 /**
002 * Copyright 2010-2012 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 /**
019 * Holds timing and byte count information about a transfer operation
020 *
021 * @author Jeff Caddel
022 *
023 * @since May 27, 2010 6:51:19 PM
024 */
025 public class TransferTracker {
026 long initiated;
027 long started;
028 long completed;
029 int byteCount;
030 SimpleFormatter formatter = new SimpleFormatter();
031
032 public long getInitiated() {
033 return initiated;
034 }
035
036 public void setInitiated(long initiated) {
037 this.initiated = initiated;
038 }
039
040 public long getStarted() {
041 return started;
042 }
043
044 public void setStarted(long started) {
045 this.started = started;
046 }
047
048 public long getCompleted() {
049 return completed;
050 }
051
052 public void setCompleted(long completed) {
053 this.completed = completed;
054 }
055
056 public int getByteCount() {
057 return byteCount;
058 }
059
060 public void setByteCount(int byteCount) {
061 this.byteCount = byteCount;
062 }
063
064 public String toString() {
065 long elapsed = completed - started;
066 StringBuffer sb = new StringBuffer();
067 sb.append("[" + formatter.getTime(elapsed));
068 sb.append(", " + formatter.getSize(byteCount));
069 sb.append(", " + formatter.getRate(elapsed, byteCount));
070 sb.append("]");
071 return sb.toString();
072 }
073 }