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