1 45 package org.exolab.jms.net.connector; 46 47 import java.net.InetAddress ; 48 import java.net.UnknownHostException ; 49 import java.security.Principal ; 50 51 import org.exolab.jms.net.uri.URI; 52 import org.exolab.jms.net.uri.URIHelper; 53 import org.exolab.jms.net.util.Properties; 54 import org.exolab.jms.net.orb.ORB; 55 56 57 64 public class URIRequestInfo implements ConnectionRequestInfo { 65 66 69 private URI _uri; 70 71 74 private Principal _principal; 75 76 77 82 public URIRequestInfo(URI uri) { 83 _uri = uri; 84 _principal = URIHelper.getPrincipal(uri); 85 } 86 87 93 public String getHost() { 94 return _uri.getHost(); 95 } 96 97 105 public InetAddress getHostAddress() throws UnknownHostException { 106 String host = getHost(); 107 return (host != null) ? InetAddress.getByName(host) : null; 108 } 109 110 115 public int getPort() { 116 return _uri.getPort(); 117 } 118 119 124 public URI getURI() { 125 return _uri; 126 } 127 128 133 public Principal getPrincipal() { 134 return _principal; 135 } 136 137 142 public void export(Properties properties) { 143 properties.set(ORB.PROVIDER_URI, _uri); 144 } 145 146 153 public boolean equals(Object other) { 154 boolean equal = (this == other); 155 if (!equal && other instanceof URIRequestInfo) { 156 URIRequestInfo info = (URIRequestInfo) other; 157 equal = _uri.equals(info._uri); 158 } 159 return equal; 160 } 161 162 167 public int hashCode() { 168 return _uri.hashCode(); 169 } 170 171 } 172 | Popular Tags |