|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--javax.management.ObjectName
Represents the object name of an MBean, or a pattern that can match the names of several MBeans. Instances of this class are immutable.
An instance of this class can be used to represent:
An object name consists of two parts, the domain and the key properties.
The domain is a string of characters not including
the character colon (:).
If the domain includes at least one occurrence of the wildcard
characters asterisk (*) or question mark
(?), then the object name is a pattern. The asterisk
matches any sequence of zero or more characters, while the question
mark matches any single character.
If the domain is empty, it will be replaced in certain contexts by the default domain of the MBean server in which the ObjectName is used.
The key properties are an unordered set of keys and associated values.
Each key is a nonempty string of characters which may
not contain any of the characters comma (,), equals
(=), colon, asterisk, or question mark. The same key
may not occur twice in a given ObjectName.
Each value associated with a key is a string of characters that is either unquoted or quoted.
An unquoted value is a possibly empty string of characters which may not contain any of the characters comma, equals, colon, quote, asterisk, or question mark.
A quoted value consists of a quote ("),
followed by a possibly empty string of characters, followed by
another quote. Within the string of characters, the backslash
(\) has a special meaning. It must be followed by
one of the following characters:
A quote, question mark, or star may not appear inside a quoted value except immediately after an odd number of consecutive backslashes.
The quotes surrounding a quoted value, and any backslashes within that value, are considered to be part of the value.
An ObjectName may be a property pattern. In this case it may have zero or more keys and associated values. It matches a nonpattern ObjectName whose domain matches and that contains the same keys and associated values, as well as possibly other keys and values.
An ObjectName is a pattern if its domain contains a wildcard or if the ObjectName is a property pattern.
If an ObjectName is not a pattern, it must contain at least one key with its associated value.
An ObjectName can be written as a String with the following elements in order:
:).
A key property list written as a String is a comma-separated
list of elements. Each element is either an asterisk or a key
property. A key property consists of a key, an equals
(=), and the associated value.
At most one element of a key property list may be an asterisk. If the key property list contains an asterisk element, the ObjectName is a property pattern.
Spaces have no special significance in a String representing an ObjectName. For example, the String:
domain: key1 = value1 , key2 = value2represents an ObjectName with two keys. The name of each key contains six characters, of which the first and last are spaces. The value associated with the key
" key1 "
also begins and ends with a space.
In addition to the restrictions on characters spelt out above,
no part of an ObjectName may contain a newline character
('\n'), whether the domain, a key, or a value, whether
quoted or unquoted. The newline character can be represented in a
quoted value with the sequence \n.
The rules on special characters and quoting apply regardless of which constructor is used to make an ObjectName.
To avoid collisions between MBeans supplied by different
vendors, a useful convention is to begin the domain name with the
reverse DNS name of the organization that specifies the MBeans,
followed by a period and a string whose interpretation is
determined by that organization. For example, MBeans specified by
Sun Microsystems Inc., DNS name sun.com, would have
domains such as com.sun.MyDomain. This is essentially
the same convention as for Java-language package names.
| Constructor Summary | |
ObjectName(java.lang.String name)
Allows an object name to be created from the given string. |
|
ObjectName(java.lang.String domain,
java.util.Hashtable table)
Allows an object name with several key properties to be created. |
|
ObjectName(java.lang.String domain,
java.lang.String key,
java.lang.String value)
Allows an object name to be created using only one key property. |
|
| Method Summary | |
(package private) static void |
|
boolean |
apply(ObjectName name)
Test whether this ObjectName, which may be a pattern, matches another ObjectName. |
boolean |
equals(java.lang.Object object)
Compares the current object name with another object name. |
java.lang.String |
getCanonicalKeyPropertyListString()
Returns a string representation of the list of key properties in which the key properties are sorted in lexical order. |
java.lang.String |
getCanonicalName()
Returns the canonical form of the name; that is, a string representation where the properties are sorted in lexical order. |
java.lang.String |
getDomain()
Returns the domain part. |
static ObjectName |
getInstance(ObjectName name)
Return an instance of ObjectName that can be used anywhere the given object can be used. |
static ObjectName |
getInstance(java.lang.String name)
Return an instance of ObjectName that can be used anywhere an object obtained with new ObjectName(name) can be
used. |
static ObjectName |
getInstance(java.lang.String domain,
java.util.Hashtable table)
Return an instance of ObjectName that can be used anywhere an object obtained with new ObjectName(domain, table) can be used. |
static ObjectName |
getInstance(java.lang.String domain,
java.lang.String key,
java.lang.String value)
Return an instance of ObjectName that can be used anywhere an object obtained with new ObjectName(domain, key, value) can be used. |
java.lang.String |
getKeyProperty(java.lang.String property)
Obtains the value of a key property in a key property. |
java.util.Hashtable |
getKeyPropertyList()
Returns a pointer to the list of key properties. |
java.lang.String |
getKeyPropertyListString()
Returns a string representation of the list of key properties specified at creation time. |
int |
hashCode()
Returns a hash code for this object name. |
boolean |
isDomainPattern()
Checks whether the object name is a pattern on the domain part. |
boolean |
isPattern()
Checks if a name to be used is a pattern for a query. |
boolean |
isPropertyPattern()
Checks whether the object name is a pattern on the key properties. |
static java.lang.String |
quote(java.lang.String s)
Returns a quoted form of the given String, suitable for inclusion in an ObjectName. |
void |
setMBeanServer(MBeanServer mbs)
Sets the MBean server on which the query is to be performed. |
java.lang.String |
toString()
Returns a string representation of the object name. |
static java.lang.String |
unquote(java.lang.String q)
Returns an unquoted form of the given String. |
| Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
| Constructor Detail |
public ObjectName(java.lang.String name)
throws MalformedObjectNameException,
java.lang.NullPointerException
name - - A string representation of the object name.
public ObjectName(java.lang.String domain,
java.util.Hashtable table)
throws MalformedObjectNameException,
java.lang.NullPointerException
domain - - The domain part of the object name.table - - A hash table containing one or more search keys.
Each search key is an attribute-value pair.
public ObjectName(java.lang.String domain,
java.lang.String key,
java.lang.String value)
throws MalformedObjectNameException,
java.lang.NullPointerException
domain - - The domain part of the object name.key - - The attribute in the key property of the object name.value - - The value in the key property of the object name.| Method Detail |
static void()
public java.lang.String getDomain()
public java.lang.String getKeyProperty(java.lang.String property)
throws java.lang.NullPointerException
property - - The property whose value is to be obtained.public java.util.Hashtable getKeyPropertyList()
public boolean apply(ObjectName name)
throws java.lang.NullPointerException
Test whether this ObjectName, which may be a pattern, matches another
ObjectName. If name is a pattern, the result is false.
If this ObjectName is a pattern, the result is true if and only if
name matches the pattern. If neither this ObjectName nor
name is a pattern, the result is true if and only if the
two ObjectNames are equal as described for the
equals(Object) method.
name - The name of the MBean to compare to.name matches this ObjectName.name is null.
public static ObjectName getInstance(java.lang.String name)
throws MalformedObjectNameException,
java.lang.NullPointerException
Return an instance of ObjectName that can be used anywhere an object
obtained with new ObjectName(name) can be
used. The returned object may be of a subclass of ObjectName. Calling
this method twice with the same parameters may return the same object or
two equal but not identical objects.
name - A string representation of the object name.name parameter is null.
public static ObjectName getInstance(java.lang.String domain,
java.lang.String key,
java.lang.String value)
throws MalformedObjectNameException,
java.lang.NullPointerException
Return an instance of ObjectName that can be used anywhere an object
obtained with new ObjectName(domain, key, value) can be used. The returned object
may be of a subclass of ObjectName. Calling this method twice with the
same parameters may return the same object or two equal but not
identical objects.
domain - The domain part of the object name.key - The attribute in the key property of the object name.value - The value in the key property of the object name.domain,
key, or value contains an illegal
character, or value does not follow the rules
for quoting.
public static ObjectName getInstance(java.lang.String domain,
java.util.Hashtable table)
throws MalformedObjectNameException,
java.lang.NullPointerException
Return an instance of ObjectName that can be used anywhere an object
obtained with new ObjectName(domain, table) can be used. The returned object may be
of a subclass of ObjectName. Calling this method twice with the same
parameters may return the same object or two equal but not
identical objects.
domain - The domain part of the object name.table - A hash table containing one or more key properties. The
key of each entry in the table is the key of a key property
in the object name. The associated value in the table is
the associated value in the object name.domain
contains an illegal character, or one of the keys or values
in table contains an illegal character, or one
of the values in table does not follow the
rules for quoting.
public static ObjectName getInstance(ObjectName name)
throws java.lang.NullPointerException
Return an instance of ObjectName that can be used anywhere the given
object can be used. The returned object may be of a subclass of
ObjectName. If name is of a subclass of ObjectName, it is
not guaranteed that the returned object will be of the same class.
The returned value may or may not be identical to name.
Calling this method twice with the same parameters may return the same
object or two equal but not identical objects.
Since ObjectName is immutable, it is not usually useful to make a copy of an ObjectName. The principal use of this method is to guard against a malicious caller who might pass an instance of a subclass with surprising behaviour to sensitive code. Such code can call this method to obtain an ObjectName that is known not to have surprising behaviour.
name - an instance of the ObjectName class or of a subclassname respects the
semantics of ObjectName, then the returned object is equal
(though not necessarily identical) to name.name is null.public boolean isDomainPattern()
public boolean isPattern()
public static java.lang.String quote(java.lang.String s)
throws java.lang.NullPointerException
Returns a quoted form of the given String, suitable for
inclusion in an ObjectName. The returned value can be used as
the value associated with a key in an ObjectName. The String
s may contain any character. Appropriate quoting
ensures that the returned value is legal in an ObjectName.
The returned value consists of a quote ('"'), a sequence of
characters corresponding to the characters of s,
and another quote. Characters in s appear
unchanged within the returned value except:
s - the String to be quoted.s is null.
public static java.lang.String unquote(java.lang.String q)
throws java.lang.IllegalArgumentException,
java.lang.NullPointerException
Returns an unquoted form of the given String. If q is
a String returned by quote(s), then
unquote(q).equals(s). If there is no String s
for which quote(s).equals(q), then unquote(q) throws
an IllegalArgumentException.
These rules imply that there is a one-to-one mapping between quoted and unquoted forms.
q - the String to be unquoted.q could not
have been returned by the quote(java.lang.String) method, for
instance if it does not begin and end with a quote (").q is null.public void setMBeanServer(MBeanServer mbs)
server - The MBean server on which the query is to be performed.public java.lang.String toString()
public boolean equals(java.lang.Object object)
getCanonicalName().object - The object name that the current object name is to be
compared with.object is an ObjectName whose
canonical form is equal to that of this ObjectName.public int hashCode()
public java.lang.String getCanonicalName()
public java.lang.String getKeyPropertyListString()
public java.lang.String getCanonicalKeyPropertyListString()
public boolean isPropertyPattern()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||