1 19 package org.lucane.common; 20 21 import java.io.Serializable ; 22 23 26 public class ConnectInfo implements Serializable 27 { 28 private String name; private String hostname; private int port; 31 private String type; 33 private String key; 34 35 44 public ConnectInfo(String name, String hostname, int port, 45 String key, String type) 46 { 47 this.name = name; 48 this.hostname = hostname; 49 this.port = port; 50 this.type = type; 51 this.key = key; 52 53 Logging.getLogger().fine("** new ConnectInfo: " + this); 54 } 55 56 61 public String toString() 62 { 63 return this.name + "@" + this.hostname + ":" + 64 this.port + " (" + this.type + ")"; 65 } 66 67 72 public String getRepresentation() 73 { 74 return this.name + " " + this.hostname + " " + 75 this.port + " " + this.key + " " + this.type; 76 } 77 78 83 public String getName() 84 { 85 return this.name; 86 } 87 88 93 public String getHostName() 94 { 95 return this.hostname; 96 } 97 98 103 public void setHostName(String hostname) 104 { 105 this.hostname = hostname; 106 } 107 108 113 public int getPort() 114 { 115 return this.port; 116 } 117 118 123 public void setPort(int port) 124 { 125 this.port = port; 126 } 127 128 133 public void setPublicKey(String key) 134 { 135 this.key = key; 136 } 137 138 143 public String getPublicKey() 144 { 145 return this.key; 146 } 147 148 153 public boolean isService() 154 { 155 return this.type.equalsIgnoreCase("service"); 156 } 157 158 163 public boolean isServer() 164 { 165 return this.type.equalsIgnoreCase("Server"); 166 } 167 168 173 public boolean isClient() 174 { 175 return this.type.equalsIgnoreCase("Client"); 176 } 177 178 183 public boolean isWebClient() 184 { 185 return this.type.equalsIgnoreCase("WebClient"); 186 } 187 188 192 public boolean useSSL() 193 { 194 return !this.key.equals("nokey"); 195 } 196 } 197 | Popular Tags |