APIdia Launch Partner
Top Description Fields Constructors Methods
sun.jvmstat.monitor

public Class HostIdentifier

extends Object
Class Inheritance
Imports
java.net.*

An abstraction that identifies a target host and communications protocol. The HostIdentifier, or hostid, provides a convenient string representation of the information needed to locate and communicate with a target host. The string, based on a URI, may specify the the communications protocol, host name, and protocol specific information for a target host. The format for a HostIdentifier string is:
      [protocol:][[//]hostname][:port][/servername]
There are actually no required components of this string, as a null string is interpreted to mean a local connection to the local host and is equivalent to the string local://localhost. The components of the HostIdentifier are:

All HostIdentifier objects are represented as absolute, hierarchical URIs. The constructors accept relative URIs, but these will generally be transformed into an absolute URI specifying a default protocol. A HostIdentifier differs from a URI in that certain contractions and illicit syntactical constructions are allowed. The following are all valid HostIdentifier strings:

Author
Brian Doherty
Since
1.5
See Also
URI, VmIdentifier

Field Summary

Modifier and TypeField and Description
private URI

Constructor Summary

AccessConstructor and Description
public
HostIdentifier(String
a string representing a target host. The syntax of the string must conform to the rules specified in the class documentation.
uriString
)

Create a HostIdentifier instance from a string value.

public
HostIdentifier(String
the URI#getScheme component of a URI.
scheme
,
String
the URI#getAuthority component of a URI.
authority
,
String
the URI#getPath component of a URI.
path
,
String
the URI#getQuery component of a URI.
query
,
String
the URI#getFragment component of a URI.
fragment
)

Create a HostIdentifier instance from component parts of a URI.

public
HostIdentifier(VmIdentifier
the VmIdentifier use to construct the HostIdentifier.
vmid
)

Create a HostIdentifier instance from a VmIdentifier.

Method Summary

Modifier and TypeMethod and Description
private URI
canonicalize(String uriString)

creates a canonical representation of the uriString.

public boolean

Returns:

boolean - returns true if the given object is of type HostIdentifier and its URI field is equal to this object's URI field. Otherwise, returns false.
equals
(Object
the object to be test for equality.
object
)

Overrides java.lang.Object.equals.

Test for quality with other objects.

public String

Returns:

String - the fragment part for this HostIdentifier.
getFragment
()

Return the Fragment part of this HostIdentifier.

public String

Returns:

String - the host part for this HostIdentifier, or "localhost" if the URI.getHost() returns null.
getHost
()

Return the Host part of this HostIdentifier.

public String

Returns:

String - the path part for this HostIdentifier.
getPath
()

Return the Path part of this HostIdentifier.

public int

Returns:

String - the port for this HostIdentifier
getPort
()

Return the Port for of this HostIdentifier.

public String

Returns:

String - the query part for this HostIdentifier.
getQuery
()

Return the Query part of this HostIdentifier.

public String

Returns:

String - the scheme for this HostIdentifier.
getScheme
()

Return the Scheme, or protocol, portion of this HostIdentifier.

public String

Returns:

String - the scheme specific part for this HostIdentifier.
getSchemeSpecificPart
()

Return the Scheme Specific Part of this HostIdentifier.

public URI

Returns:

URI - the URI.
getURI
()

Return the URI associated with the HostIdentifier.

public String

Returns:

String - the user info part for this HostIdentifier.
getUserInfo
()

Return the User Info part of this HostIdentifier.

public int

Returns:

int - the hashcode.
hashCode
()

Overrides java.lang.Object.hashCode.

Return the hash code for this HostIdentifier.

public VmIdentifier

Returns:

VmIdentifier - the resolved VmIdentifier. If vmid was resolved on entry to this method, then the returned VmIdentifier will be equal, but not identical, to vmid.
resolve
(VmIdentifier
the unresolved VmIdentifier.
vmid
)

Resolve a VmIdentifier with this HostIdentifier.

public String

Returns:

String - a String representation of the HostIdentifier.
toString
()

Overrides java.lang.Object.toString.

Convert to a string representation.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

uriback to summary
private URI uri

Constructor Detail

HostIdentifierback to summary
public HostIdentifier(String uriString) throws URISyntaxException

Create a HostIdentifier instance from a string value.

Parameters
uriString:String

a string representing a target host. The syntax of the string must conform to the rules specified in the class documentation.

Exceptions
URISyntaxException:
Thrown when the uriString or its canonical form is poorly formed. This exception may get encapsulated into a MonitorException in a future version.
HostIdentifierback to summary
public HostIdentifier(String scheme, String authority, String path, String query, String fragment) throws URISyntaxException

Create a HostIdentifier instance from component parts of a URI.

Parameters
scheme:String

the URI#getScheme component of a URI.

authority:String

the URI#getAuthority component of a URI.

path:String

the URI#getPath component of a URI.

query:String

the URI#getQuery component of a URI.

fragment:String

the URI#getFragment component of a URI.

Exceptions
URISyntaxException:
Thrown when the uriString or its canonical form is poorly formed. This exception may get encapsulated into a MonitorException in a future version.
See Also
URI
HostIdentifierback to summary
public HostIdentifier(VmIdentifier vmid)

Create a HostIdentifier instance from a VmIdentifier. The necessary components of the VmIdentifier are extracted and reassembled into a HostIdentifier. If a "file:" scheme (protocol) is specified, the returned HostIdentifier will always be equivalent to HostIdentifier("file://localhost").

Parameters
vmid:VmIdentifier

the VmIdentifier use to construct the HostIdentifier.

Method Detail

canonicalizeback to summary
private URI canonicalize(String uriString) throws URISyntaxException

creates a canonical representation of the uriString. This method performs certain translations depending on the type of URI generated by the string.

equalsback to summary
public boolean equals(Object object)

Overrides java.lang.Object.equals.

Test for quality with other objects.

Parameters
object:Object

the object to be test for equality.

Returns:boolean

boolean - returns true if the given object is of type HostIdentifier and its URI field is equal to this object's URI field. Otherwise, returns false.

See Also
URI#equals(Object)
getFragmentback to summary
public String getFragment()

Return the Fragment part of this HostIdentifier.

Returns:String

String - the fragment part for this HostIdentifier.

See Also
URI#getFragment()
getHostback to summary
public String getHost()

Return the Host part of this HostIdentifier.

Returns:String

String - the host part for this HostIdentifier, or "localhost" if the URI.getHost() returns null.

See Also
URI#getUserInfo()
getPathback to summary
public String getPath()

Return the Path part of this HostIdentifier.

Returns:String

String - the path part for this HostIdentifier.

See Also
URI#getPath()
getPortback to summary
public int getPort()

Return the Port for of this HostIdentifier.

Returns:int

String - the port for this HostIdentifier

See Also
URI#getPort()
getQueryback to summary
public String getQuery()

Return the Query part of this HostIdentifier.

Returns:String

String - the query part for this HostIdentifier.

See Also
URI#getQuery()
getSchemeback to summary
public String getScheme()

Return the Scheme, or protocol, portion of this HostIdentifier.

Returns:String

String - the scheme for this HostIdentifier.

See Also
URI#getScheme()
getSchemeSpecificPartback to summary
public String getSchemeSpecificPart()

Return the Scheme Specific Part of this HostIdentifier.

Returns:String

String - the scheme specific part for this HostIdentifier.

See Also
URI#getSchemeSpecificPart()
getURIback to summary
public URI getURI()

Return the URI associated with the HostIdentifier.

Returns:URI

URI - the URI.

See Also
URI
getUserInfoback to summary
public String getUserInfo()

Return the User Info part of this HostIdentifier.

Returns:String

String - the user info part for this HostIdentifier.

See Also
URI#getUserInfo()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Return the hash code for this HostIdentifier. The hash code is identical to the hash code for the contained URI.

Returns:int

int - the hashcode.

See Also
URI#hashCode()
resolveback to summary
public VmIdentifier resolve(VmIdentifier vmid) throws URISyntaxException, MonitorException

Resolve a VmIdentifier with this HostIdentifier. A VmIdentifier, such as 1234 or 1234@hostname or any other string that omits certain components of the URI string may be valid, but is certainly incomplete. They are missing critical information for identifying the the communications protocol, target host, or other parameters. A VmIdentifier of this form is considered unresolved. This method uses components of the HostIdentifier to resolve the missing components of the VmIdentifier.

Specified components of the unresolved VmIdentifier take precedence over their HostIdentifier counterparts. For example, if the VmIdentifier indicates 1234@hostname:2099 and the HostIdentifier indicates rmi://hostname:1099/, then the resolved VmIdentifier will be rmi://1234@hostname:2099. Any component not explicitly specified or assumed by the HostIdentifier, will remain unresolved in resolved VmIdentifier.

A VmIdentifier specifying a file: scheme (protocol), is not changed in any way by this method.

Parameters
vmid:VmIdentifier

the unresolved VmIdentifier.

Returns:VmIdentifier

VmIdentifier - the resolved VmIdentifier. If vmid was resolved on entry to this method, then the returned VmIdentifier will be equal, but not identical, to vmid.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Convert to a string representation. Conversion is identical to calling getURI().toString(). This may change in a future release.

Returns:String

String - a String representation of the HostIdentifier.

See Also
URI#toString()