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    import java.util.ArrayList;
019    import java.util.List;
020    
021    import org.apache.maven.wagon.events.SessionEvent;
022    
023    /**
024     * Holds timing and byte count information about a transfer operation
025     * 
026     * @author Jeff Caddel
027     * 
028     * @since May 27, 2010 6:51:19 PM
029     */
030    public class SessionTracker {
031            SimpleFormatter formatter = new SimpleFormatter();
032            List<TransferTracker> transfers = new ArrayList<TransferTracker>();
033            List<SessionEvent> sessionEvents = new ArrayList<SessionEvent>();
034            long opened;
035            long loggedIn;
036            long disconnecting;
037            long loggedOff;
038            long disconnected;
039    
040            public TransferTracker getCurrentTransfer() {
041                    if (transfers.size() == 0) {
042                            return null;
043                    } else {
044                            return transfers.get(transfers.size() - 1);
045                    }
046            }
047    
048            public void addSessionEvent(SessionEvent sessionEvent) {
049                    sessionEvents.add(sessionEvent);
050            }
051    
052            public void addTransfer(TransferTracker transfer) {
053                    transfers.add(transfer);
054            }
055    
056            public List<TransferTracker> getTransfers() {
057                    return transfers;
058            }
059    
060            public void setTransfers(List<TransferTracker> transfers) {
061                    this.transfers = transfers;
062            }
063    
064            public List<SessionEvent> getSessionEvents() {
065                    return sessionEvents;
066            }
067    
068            public void setSessionEvents(List<SessionEvent> sessionEvents) {
069                    this.sessionEvents = sessionEvents;
070            }
071    
072            public SimpleFormatter getFormatter() {
073                    return formatter;
074            }
075    
076            public void setFormatter(SimpleFormatter formatter) {
077                    this.formatter = formatter;
078            }
079    
080            public long getOpened() {
081                    return opened;
082            }
083    
084            public void setOpened(long opened) {
085                    this.opened = opened;
086            }
087    
088            public long getLoggedIn() {
089                    return loggedIn;
090            }
091    
092            public void setLoggedIn(long loggedIn) {
093                    this.loggedIn = loggedIn;
094            }
095    
096            public long getDisconnecting() {
097                    return disconnecting;
098            }
099    
100            public void setDisconnecting(long disconnecting) {
101                    this.disconnecting = disconnecting;
102            }
103    
104            public long getLoggedOff() {
105                    return loggedOff;
106            }
107    
108            public void setLoggedOff(long loggedOff) {
109                    this.loggedOff = loggedOff;
110            }
111    
112            public long getDisconnected() {
113                    return disconnected;
114            }
115    
116            public void setDisconnected(long disconnected) {
117                    this.disconnected = disconnected;
118            }
119    
120    }