1 17 package org.alfresco.filesys.server; 18 19 import java.util.Vector ; 20 21 24 public class NetworkServerList 25 { 26 28 private Vector <NetworkServer> m_servers; 29 30 33 public NetworkServerList() 34 { 35 m_servers = new Vector <NetworkServer>(); 36 } 37 38 43 public final int numberOfServers() 44 { 45 return m_servers.size(); 46 } 47 48 53 public final void addServer(NetworkServer server) 54 { 55 m_servers.add(server); 56 } 57 58 64 public final NetworkServer getServer(int idx) 65 { 66 67 69 if (idx < 0 || idx >= m_servers.size()) 70 return null; 71 return m_servers.get(idx); 72 } 73 74 80 public final NetworkServer findServer(String name) 81 { 82 83 85 for (int i = 0; i < m_servers.size(); i++) 86 { 87 88 90 NetworkServer server = m_servers.get(i); 91 92 if (server.getProtocolName().equals(name)) 93 return server; 94 } 95 96 98 return null; 99 } 100 101 107 public final NetworkServer removeServer(int idx) 108 { 109 110 112 if (idx < 0 || idx >= m_servers.size()) 113 return null; 114 115 117 NetworkServer server = m_servers.get(idx); 118 m_servers.remove(idx); 119 return server; 120 } 121 122 128 public final NetworkServer removeServer(String proto) 129 { 130 131 133 for (int i = 0; i < m_servers.size(); i++) 134 { 135 136 138 NetworkServer server = m_servers.get(i); 139 140 if (server.getProtocolName().equals(proto)) 141 { 142 m_servers.remove(i); 143 return server; 144 } 145 } 146 147 149 return null; 150 } 151 152 155 public final void removeAll() 156 { 157 m_servers.removeAllElements(); 158 } 159 } 160 | Popular Tags |