View Javadoc

1   /**
2    * Copyright 2004-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.maven.wagon;
17  
18  /**
19   * Holds timing and byte count information about a transfer operation
20   * 
21   * @author Jeff Caddel
22   * 
23   * @since May 27, 2010 6:51:19 PM
24   */
25  public class TransferTracker {
26  	long initiated;
27  	long started;
28  	long completed;
29  	int byteCount;
30  	SimpleFormatter formatter = new SimpleFormatter();
31  
32  	public long getInitiated() {
33  		return initiated;
34  	}
35  
36  	public void setInitiated(long initiated) {
37  		this.initiated = initiated;
38  	}
39  
40  	public long getStarted() {
41  		return started;
42  	}
43  
44  	public void setStarted(long started) {
45  		this.started = started;
46  	}
47  
48  	public long getCompleted() {
49  		return completed;
50  	}
51  
52  	public void setCompleted(long completed) {
53  		this.completed = completed;
54  	}
55  
56  	public int getByteCount() {
57  		return byteCount;
58  	}
59  
60  	public void setByteCount(int byteCount) {
61  		this.byteCount = byteCount;
62  	}
63  
64  	public String toString() {
65  		long elapsed = completed - started;
66  		StringBuffer sb = new StringBuffer();
67  		sb.append("[" + formatter.getTime(elapsed));
68  		sb.append(", " + formatter.getSize(byteCount));
69  		sb.append(", " + formatter.getRate(elapsed, byteCount));
70  		sb.append("]");
71  		return sb.toString();
72  	}
73  }