1 23 24 package com.sun.enterprise.deployment.client; 25 26 import com.sun.enterprise.admin.jmx.remote.DefaultConfiguration; 27 28 35 public class ServerConnectionIdentifier { 36 37 40 private String hostName; 41 42 45 private int hostPort; 46 47 50 private String userName; 51 52 55 private String password; 56 57 60 private String protocol; 61 62 private boolean secure = false; 63 64 private ServerConnectionEnvironment env; 65 66 67 public ServerConnectionIdentifier() { 68 } 69 70 74 public String getHostName() { 75 return this.hostName; 76 } 77 78 82 public void setHostName(String hostName) { 83 this.hostName = hostName; 84 } 85 86 90 public int getHostPort() { 91 return this.hostPort; 92 } 93 94 98 public void setHostPort(int hostPort) { 99 this.hostPort = hostPort; 100 } 101 102 106 public String getUserName() { 107 return this.userName; 108 } 109 110 114 public void setUserName(String userName) { 115 this.userName = userName; 116 } 117 118 122 public String getPassword() { 123 return this.password; 124 } 125 126 130 public void setPassword(String password) { 131 this.password = password; 132 } 133 134 public void setSecure(boolean secure) { 135 this.secure = secure; 136 } 137 138 public boolean isSecure() { 139 return this.secure; 140 } 141 142 public ServerConnectionEnvironment getConnectionEnvironment() { 143 if (env == null) { 144 env = new ServerConnectionEnvironment(); 145 } 146 return env; 147 } 148 149 public void setConnectionEnvironment(ServerConnectionEnvironment env) { 150 this.env = env; 151 } 152 153 160 public String getProtocol() { 161 if (isSecure()) { 162 return DefaultConfiguration.S1_HTTPS_PROTOCOL; 163 } else { 164 return DefaultConfiguration.S1_HTTP_PROTOCOL; 165 } 166 } 167 168 171 public boolean equals(Object other) { 172 if (other instanceof ServerConnectionIdentifier) { 173 ServerConnectionIdentifier dci = (ServerConnectionIdentifier) other; 174 if (hostName==null) { 175 return false; 176 } else { 177 if (!hostName.equals(dci.hostName)) 178 return false; 179 } 180 if (hostPort!=dci.hostPort) { 181 return false; 182 } 183 if (!getConnectionEnvironment().equals(dci.getConnectionEnvironment())) { 184 return false; 185 } 186 if (protocol==null) { 187 return dci.protocol==null; 188 } else { 189 return protocol.equals(dci.protocol); 190 } 191 } else { 192 return false; 193 } 194 } 195 196 public String toString() { 197 return getUserName()+"("+ getPassword()+")@(" + getHostName() 198 + "):(" + getHostPort()+")" + ":" + getProtocol(); 199 } 200 } 201 | Popular Tags |