Class: javax.management.remote.JMXServiceURL
- public class JMXServiceURL
- implements Serializable
The address of a JMX API connector server. Instances of this class are immutable.
The address is an Abstract Service URL for SLP, as defined in RFC 2609 and amended by RFC 3111. It must look like this:
service:jmx:protocol:sap
Here, protocol is the transport
protocol to be used to connect to the connector server. It is
a string of one or more ASCII characters, each of which is a
letter, a digit, or one of the characters + or
-. The first character must be a letter.
Uppercase letters are converted into lowercase ones.
sap is the address at which the connector
server is found. This address uses a subset of the syntax defined
by RFC 2609 for IP-based protocols. It is a subset because the
user@host syntax is not supported.
The other syntaxes defined by RFC 2609 are not currently supported by this class.
The supported syntax is:
//[host[:port]][url-path]
Square brackets [] indicate optional parts of
the address. Not all protocols will recognize all optional
parts.
The host is a host name, an IPv4 numeric
host address, or an IPv6 numeric address enclosed in square
brackets.
The port is a decimal port number. 0
means a default or anonymous port, depending on the protocol.
The host and port
can be omitted. The port cannot be supplied
without a host.
The url-path, if any, begins with a slash
(/) or a semicolon (;) and continues to
the end of the address. It can contain attributes using the
semicolon syntax specified in RFC 2609. Those attributes are not
parsed by this class and incorrect attribute syntax is not
detected.
Although it is legal according to RFC 2609 to have a
url-path that begins with a semicolon, not
all implementations of SLP allow it, so it is recommended to avoid
that syntax.
Case is not significant in the initial
service:jmx:protocol string or in the host
part of the address. Depending on the protocol, case can be
significant in the url-path.
Methods
-
JMXServiceURLtop
public JMXServiceURL(String serviceURL) throws MalformedURLExceptionConstructs a
JMXServiceURLby parsing a Service URL string. -
JMXServiceURLtop
Constructs a
JMXServiceURLwith the given protocol, host, and port. This constructor is equivalent to JMXServiceURL(protocol, host, port, null). -
JMXServiceURLtop
public JMXServiceURL(String protocol, String host, int port, String urlPath) throws MalformedURLExceptionConstructs a
JMXServiceURLwith the given parts. -
addCharsToBitSettop
-
equalstop
public boolean equals(Object obj)Indicates whether some other object is equal to this one. This method returns true if and only if
objis an instance ofJMXServiceURLwhose javax.management.remote.JMXServiceURL.getProtocol(), javax.management.remote.JMXServiceURL.getHost(), javax.management.remote.JMXServiceURL.getPort(), and javax.management.remote.JMXServiceURL.getURLPath() methods return the same values as for this object. The values for javax.management.remote.JMXServiceURL.getProtocol() and javax.management.remote.JMXServiceURL.getHost() can differ in case without affecting equality. -
getHosttop
public String getHost()The host part of the Service URL. If the Service URL was constructed with the constructor that takes a URL string parameter, the result is the substring specifying the host in that URL. If the Service URL was constructed with a constructor that takes a separate host parameter, the result is the string that was specified. If that string was null, the result is
InetAddress.getLocalHost().getHostName().In either case, if the host was specified using the
[...]syntax for numeric IPv6 addresses, the square brackets are not included in the return value here. -
getPorttop
public int getPort()The port of the Service URL. If no port was specified, the returned value is 0.
-
getProtocoltop
public String getProtocol()The protocol part of the Service URL.
-
getURLPathtop
public String getURLPath()The URL Path part of the Service URL. This is an empty string, or a string beginning with a slash (
/), or a string beginning with a semicolon (;). -
hashCodetop
public int hashCode()Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided byjava.util.Hashtable.The general contract of
hashCodeis:- Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
- If two objects are equal according to the equals(Object)
method, then calling the
hashCodemethod on each of the two objects must produce the same integer result. - It is not required that if two objects are unequal according to the Object.equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hashtables.
As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)
-
indexOftop
static private int indexOf(String s, char c, int fromIndex) -
indexOfFirstNotInSettop
-
isNumericIPv6Addresstop
static private boolean isNumericIPv6Address(String s) -
toStringtop
public String toString()The string representation of this Service URL. If the value returned by this method is supplied to the
JMXServiceURLconstructor, the resultant object is equal to this one.The
hostpart of the returned string is the value returned by javax.management.remote.JMXServiceURL.getHost(). If that value specifies a numeric IPv6 address, it is surrounded by square brackets[].The
portpart of the returned string is the value returned by javax.management.remote.JMXServiceURL.getPort() in its shortest decimal form. If the value is zero, it is omitted. -
validatetop
private void validate() throws MalformedURLException -
validateHosttop
private void validateHost() throws MalformedURLException -
validateHosttop
static private void validateHost(String h) throws MalformedURLException
Fields
-
alphaBitSet
static final private BitSet alphaBitSet -
alphaNumericBitSet
static final private BitSet alphaNumericBitSet -
host
final private String hostThe value returned by javax.management.remote.JMXServiceURL.getHost(). -
hostNameBitSet
static final private BitSet hostNameBitSet -
logger
static final private ClassLogger logger -
numericBitSet
static final private BitSet numericBitSet -
port
final private int portThe value returned by javax.management.remote.JMXServiceURL.getPort(). -
protocol
final private String protocolThe value returned by javax.management.remote.JMXServiceURL.getProtocol(). -
protocolBitSet
static final private BitSet protocolBitSet -
randomException
static final private Exception randomException -
serialVersionUID
static final private long serialVersionUID = 8173364409860779292 -
toString
transient private String toStringCached result of javax.management.remote.JMXServiceURL.toString(). -
urlPath
final private String urlPathThe value returned by javax.management.remote.JMXServiceURL.getURLPath().
