001    package org.kuali.maven.wagon;
002    
003    /**
004     * Holds timing and byte count information about a transfer operation
005     * 
006     * @author Jeff Caddel
007     * 
008     * @since May 27, 2010 6:51:19 PM
009     */
010    public class TransferTracker {
011            long initiated;
012            long started;
013            long completed;
014            int byteCount;
015            SimpleFormatter formatter = new SimpleFormatter();
016    
017            public long getInitiated() {
018                    return initiated;
019            }
020    
021            public void setInitiated(long initiated) {
022                    this.initiated = initiated;
023            }
024    
025            public long getStarted() {
026                    return started;
027            }
028    
029            public void setStarted(long started) {
030                    this.started = started;
031            }
032    
033            public long getCompleted() {
034                    return completed;
035            }
036    
037            public void setCompleted(long completed) {
038                    this.completed = completed;
039            }
040    
041            public int getByteCount() {
042                    return byteCount;
043            }
044    
045            public void setByteCount(int byteCount) {
046                    this.byteCount = byteCount;
047            }
048    
049            public String toString() {
050                    long elapsed = completed - started;
051                    StringBuffer sb = new StringBuffer();
052                    sb.append("[" + formatter.getTime(elapsed));
053                    sb.append(", " + formatter.getSize(byteCount));
054                    sb.append(", " + formatter.getRate(elapsed, byteCount));
055                    sb.append("]");
056                    return sb.toString();
057            }
058    }