64 * <li><p><tt>servername</tt> - The treatment of the Path, Query, and 65 * Fragment components of the HostIdentifier are implementation 66 * (protocol) dependent. These components are ignored by the 67 * default local protocol, <em>local:</em>. For the default remote 68 * protocol, <em>rmi</em>, the Path component is interpreted as 69 * the name of the RMI remote object. The Query component may 70 * contain an access mode specifier <em>?mode=</em> specifying 71 * <em>"r"</em> or <em>"rw"</em> access (write access currently 72 * ignored). The Fragment part is ignored. 73 * </p></li> 74 * </ul> 75 * <p> 76 * All HostIdentifier objects are represented as absolute, hierarchical URIs. 77 * The constructors accept relative URIs, but these will generally be 78 * transformed into an absolute URI specifying a default protocol. A 79 * HostIdentifier differs from a URI in that certain contractions and 80 * illicit syntactical constructions are allowed. The following are all 81 * valid HostIdentifier strings: 82 * 83 * <ul> 84 * <li><p>< null > - transformed into "//localhost"</p></li> 85 * <li><p>localhost - transformed into "//localhost"</p></li> 86 * <li><p>hostname - transformed into "//hostname"</p></li> 87 * <li><p>hostname:port - transformed into "//hostname:port"</p></li> 88 * <li><p>proto:hostname - transformed into "proto://hostname"</p></li> 89 * <li><p>proto:hostname:port - transformed into 90 * "proto://hostname:port"</p></li> 91 * <li><p>proto://hostname:port</p></li> 92 * </ul> 93 * </p> 94 * 95 * @see URI 96 * @see VmIdentifier 97 * 98 * @author Brian Doherty 99 * @since 1.5 100 */ 101 public class HostIdentifier { 102 private URI uri; 103 104 /** 105 * creates a canonical representation of the uriString. This method 106 * performs certain translations depending on the type of URI generated 107 * by the string. 108 */ 109 private URI canonicalize(String uriString) throws URISyntaxException { 110 if ((uriString == null) || (uriString.compareTo("localhost") == 0)) { 111 uriString = "//localhost"; 112 return new URI(uriString); 113 } | 64 * <li><p><tt>servername</tt> - The treatment of the Path, Query, and 65 * Fragment components of the HostIdentifier are implementation 66 * (protocol) dependent. These components are ignored by the 67 * default local protocol, <em>local:</em>. For the default remote 68 * protocol, <em>rmi</em>, the Path component is interpreted as 69 * the name of the RMI remote object. The Query component may 70 * contain an access mode specifier <em>?mode=</em> specifying 71 * <em>"r"</em> or <em>"rw"</em> access (write access currently 72 * ignored). The Fragment part is ignored. 73 * </p></li> 74 * </ul> 75 * <p> 76 * All HostIdentifier objects are represented as absolute, hierarchical URIs. 77 * The constructors accept relative URIs, but these will generally be 78 * transformed into an absolute URI specifying a default protocol. A 79 * HostIdentifier differs from a URI in that certain contractions and 80 * illicit syntactical constructions are allowed. The following are all 81 * valid HostIdentifier strings: 82 * 83 * <ul> 84 * <li>{@code <null>} - transformed into "//localhost"</li> 85 * <li>localhost - transformed into "//localhost"</li> 86 * <li>hostname - transformed into "//hostname"</li> 87 * <li>hostname:port - transformed into "//hostname:port"</li> 88 * <li>proto:hostname - transformed into "proto://hostname"</li> 89 * <li>proto:hostname:port - transformed into 90 * "proto://hostname:port"</li> 91 * <li>proto://hostname:port</li> 92 * </ul> 93 * 94 * @see URI 95 * @see VmIdentifier 96 * 97 * @author Brian Doherty 98 * @since 1.5 99 */ 100 public class HostIdentifier { 101 private URI uri; 102 103 /** 104 * creates a canonical representation of the uriString. This method 105 * performs certain translations depending on the type of URI generated 106 * by the string. 107 */ 108 private URI canonicalize(String uriString) throws URISyntaxException { 109 if ((uriString == null) || (uriString.compareTo("localhost") == 0)) { 110 uriString = "//localhost"; 111 return new URI(uriString); 112 } |