1 17 package org.alfresco.filesys.ftp; 18 19 import java.util.*; 20 21 26 public class FTPSessionList 27 { 28 29 31 private Hashtable<Integer , FTPSrvSession> m_sessions; 32 33 36 public FTPSessionList() 37 { 38 m_sessions = new Hashtable<Integer , FTPSrvSession>(); 39 } 40 41 46 public final int numberOfSessions() 47 { 48 return m_sessions.size(); 49 } 50 51 56 public final void addSession(FTPSrvSession sess) 57 { 58 m_sessions.put(new Integer (sess.getSessionId()), sess); 59 } 60 61 67 public final FTPSrvSession findSession(int id) 68 { 69 return findSession(new Integer (id)); 70 } 71 72 78 public final FTPSrvSession findSession(Integer id) 79 { 80 return m_sessions.get(id); 81 } 82 83 89 public final FTPSrvSession removeSession(int id) 90 { 91 return removeSession(new Integer (id)); 92 } 93 94 100 public final FTPSrvSession removeSession(FTPSrvSession sess) 101 { 102 return removeSession(sess.getSessionId()); 103 } 104 105 111 public final FTPSrvSession removeSession(Integer id) 112 { 113 114 116 FTPSrvSession sess = findSession(id); 117 118 120 m_sessions.remove(id); 121 return sess; 122 } 123 124 129 public final Enumeration enumerate() 130 { 131 return m_sessions.keys(); 132 } 133 } 134 | Popular Tags |