Top Description Fields Constructors Methods
sun.jvmstat.monitor

public Class VmIdentifier

extends Object
Class Inheritance
Imports
java.net.*

An abstraction that identifies a target Java Virtual Machine. The VmIdentifier, or vmid, provides a convenient string representation of the information needed to locate and communicate with a target Java Virtual Machine. The string, based on a URI, may specify the communications protocol, host name, local vm identifier, and protocol specific information for a target Java Virtual Machine. The format for a VmIdentifier string is:
     [protocol:][//]lvmid[@hostname][:port][/servername]
The only required component of this string is the Local Virtual Machine Identifier, or lvmid, which uniquely identifies the target Java Virtual Machine on a host. The optional components of the VmIdentifier include:

All VmIdentifier instances are constructed as absolute, hierarchical URIs. The constructors will accept relative (and even some malformed, though convenient) URI strings. Such strings are transformed into legitimate, absolute URI strings.

With the exception of file: based VmIdentifier strings, all VmIdentifier strings must include a lvmid. Attempting to construct a non-file based VmIdentifier that doesn't include a lvmid component will result in a MonitorException.

Here are some examples of VmIdentifier strings.

Author
Brian Doherty
Since
1.5
See Also
URI, HostIdentifier

Field Summary

Modifier and TypeField and Description
private URI

Constructor Summary

AccessConstructor and Description
public
VmIdentifier(String
a string representing a target Java Virtual Machine. The syntax of the string must conforms to the rules specified in the class documentation.
uriString
)

Create a VmIdentifier instance from a string value.

public
VmIdentifier(URI
a well formed, absolute URI indicating the target Java Virtual Machine.
uri
)

Create a VmIdentifier instance from a URI object.

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 VmIdentifier and its URI field is equal to this object's URI field. Otherwise, return 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 Authority part for this VmIdentifier.
getAuthority
()

Return the Authority part of this VmIdentifier.

public String

Returns:

String - the Fragment part for this VmIdentifier.
getFragment
()

Return the Fragment part of this VmIdentifier.

public String

Returns:

String - the Host part for this VmIdentifier.
getHost
()

Return the Host part of this VmIdentifier.

public HostIdentifier

Returns:

HostIdentifier - the host identifier for the host containing the Java Virtual Machine represented by this VmIdentifier.
getHostIdentifier
()

Return the corresponding HostIdentifier for this VmIdentifier.

public int

Returns:

int - the lvmid for this VmIdentifier.
getLocalVmId
()

Return the Local Virtual Machine Identifier for this VmIdentifier.

public String

Returns:

String - the Path part for this VmIdentifier.
getPath
()

Return the Path part of this VmIdentifier.

public int

Returns:

int - the Port part for this VmIdentifier.
getPort
()

Return the Port part of this VmIdentifier.

public String

Returns:

String - the Query part for this VmIdentifier.
getQuery
()

Return the Query part of this VmIdentifier.

public String

Returns:

String - the scheme for this VmIdentifier.
getScheme
()

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

public String

Returns:

String - the Scheme Specific Part for this VmIdentifier.
getSchemeSpecificPart
()

Return the Scheme Specific Part of this VmIdentifier.

public URI

Returns:

URI - the URI.
getURI
()

Return the URI associated with the VmIdentifier.

public String

Returns:

String - the UserInfo part for this VmIdentifier.
getUserInfo
()

Return the UserInfo part of this VmIdentifier.

public int

Returns:

int - the hashcode.
hashCode
()

Overrides java.lang.Object.hashCode.

Return the hash code for this VmIdentifier.

public String

Returns:

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

Overrides java.lang.Object.toString.

Convert to a string representation.

private void
validate()

check that the VmIdentifier includes a unique numerical identifier for the target JVM.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

uriback to summary
private URI uri

Constructor Detail

VmIdentifierback to summary
public VmIdentifier(String uriString) throws URISyntaxException

Create a VmIdentifier instance from a string value.

Parameters
uriString:String

a string representing a target Java Virtual Machine. The syntax of the string must conforms to the rules specified in the class documentation.

Exceptions
URISyntaxException:
Thrown when the uriString or its canonical form is poorly formed.
VmIdentifierback to summary
public VmIdentifier(URI uri) throws URISyntaxException

Create a VmIdentifier instance from a URI object.

Parameters
uri:URI

a well formed, absolute URI indicating the target Java Virtual Machine.

Exceptions
URISyntaxException:
Thrown if the URI is missing some required component.

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 VmIdentifier and its URI field is equal to this object's URI field. Otherwise, return false.

See Also
URI#equals(Object)
getAuthorityback to summary
public String getAuthority()

Return the Authority part of this VmIdentifier.

Returns:String

String - the Authority part for this VmIdentifier.

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

Return the Fragment part of this VmIdentifier.

Returns:String

String - the Fragment part for this VmIdentifier.

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

Return the Host part of this VmIdentifier.

Returns:String

String - the Host part for this VmIdentifier.

See Also
URI#getHost()
getHostIdentifierback to summary
public HostIdentifier getHostIdentifier() throws URISyntaxException

Return the corresponding HostIdentifier for this VmIdentifier.

This method constructs a HostIdentifier object from the VmIdentifier. If the VmIdentifier is not specific about the protocol or other components of the URI, then the resulting HostIdentifier will be constructed based on this missing information. Typically, the missing components will have result in the HostIdentifier assigning assumed defaults that allow the VmIdentifier to be resolved according to those defaults.

For example, a VmIdentifier that specifies only a lvmid will result in a HostIdentifier for localhost utilizing the default local protocol, local:. A VmIdentifier that specifies both a vmid and a hostname will result in a HostIdentifier for the specified host with the default remote protocol, rmi:, using the protocol defaults for the port and servername components.

Returns:HostIdentifier

HostIdentifier - the host identifier for the host containing the Java Virtual Machine represented by this VmIdentifier.

Exceptions
URISyntaxException:
Thrown if a bad host URI is constructed. This exception may get encapsulated into a MonitorException in a future version.
getLocalVmIdback to summary
public int getLocalVmId()

Return the Local Virtual Machine Identifier for this VmIdentifier. The Local Virtual Machine Identifier is also known as the lvmid.

Returns:int

int - the lvmid for this VmIdentifier.

getPathback to summary
public String getPath()

Return the Path part of this VmIdentifier.

Returns:String

String - the Path part for this VmIdentifier.

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

Return the Port part of this VmIdentifier.

Returns:int

int - the Port part for this VmIdentifier.

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

Return the Query part of this VmIdentifier.

Returns:String

String - the Query part for this VmIdentifier.

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

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

Returns:String

String - the scheme for this VmIdentifier.

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

Return the Scheme Specific Part of this VmIdentifier.

Returns:String

String - the Scheme Specific Part for this VmIdentifier.

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

Return the URI associated with the VmIdentifier.

Returns:URI

URI - the URI.

See Also
URI
getUserInfoback to summary
public String getUserInfo()

Return the UserInfo part of this VmIdentifier.

Returns:String

String - the UserInfo part for this VmIdentifier.

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

Overrides java.lang.Object.hashCode.

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

Returns:int

int - the hashcode.

See Also
URI#hashCode()
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 VmIdentifier.

See Also
URI#toString()
validateback to summary
private void validate() throws URISyntaxException

check that the VmIdentifier includes a unique numerical identifier for the target JVM.