Top Description Inners Fields Constructors Methods
javax.management

public Class ObjectName

extends Object
implements Comparable<ObjectName>, QueryExp
Class Inheritance
All Implemented Interfaces
javax.management.QueryExp, java.io.Serializable, java.lang.Comparable
Annotations
@SuppressWarnings:serial
Imports
com.sun.jmx.mbeanserver.GetPropertyAction, .Util, java.io.IOException, .InvalidObjectException, .ObjectInputStream, .ObjectOutputStream, .ObjectStreamField, java.security.AccessController, java.util.Arrays, .Collections, .HashMap, .Hashtable, .Map

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 (:). It is recommended that the domain should not contain the string "//", which is reserved for future use.

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, or quote.

If the unquoted value contains at least one occurrence of the wildcard characters asterisk or question mark, then the object name is a property value pattern. The asterisk matches any sequence of zero or more characters, while the question mark matches any single character.

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 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.

If the quoted value contains at least one occurrence of the characters asterisk or question mark and they are not preceded by a backslash, then they are considered as wildcard characters and the object name is a property value pattern. The asterisk matches any sequence of zero or more characters, while the question mark matches any single character.

An ObjectName may be a property list 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 property value pattern when at least one of its quoted or unquoted key property values contains the wildcard characters asterisk or question mark as described above. In this case it has one or more keys and associated values, with at least one of the values containing wildcard characters. It matches a nonpattern ObjectName whose domain matches and that contains the same keys whose values match; if the property value pattern is also a property list pattern then the nonpattern ObjectName can contain other keys and values.

An ObjectName is a property pattern if it is either a property list pattern or a property value pattern or both.

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.

Examples of ObjectName patterns are:

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 list pattern.

Spaces have no special significance in a String representing an ObjectName. For example, the String:

domain: key1 = value1 , key2 = value2
represents 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 example.com would have domains such as com.example.MyDomain. This is essentially the same convention as for Java-language package names.

The serialVersionUID of this class is 1081892073854801359L.

Implementation Note

The maximum allowed length of the domain name in this implementation is Integer.MAX_VALUE/4

Since
1.5

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
ObjectName.PatternProperty

Marker class for value pattern property.

private static class
ObjectName.Property

A structure recording property structure and proposing minimal services

Field Summary

Modifier and TypeField and Description
private transient ObjectName.Property[]
_ca_array

An array of properties in the same seq order as canonical order

private transient String
_canonicalName

a String containing the canonical name

private transient int
_compressed_storage

This field encodes _domain_pattern, _property_list_pattern and _property_value_pattern booleans and _domain_length integer.

private static final ObjectName.Property[]
_Empty_property_array

a shared empty array for empty property lists

private transient ObjectName.Property[]
_kp_array

An array of properties in the same seq order as time creation

private transient Map<String, String>
_propertyList

The propertyList of built object name.

private static boolean
private static final int
private static final int
private static final int
private static final ObjectStreamField[]
private static final long
private static final ObjectStreamField[]
private static final long
private static final int
private static final int
private static final ObjectStreamField[]
private static final long
public static final ObjectName
WILDCARD

Defines the wildcard "*:*" ObjectName.

Constructor Summary

AccessConstructor and Description
public
ObjectName(String
A string representation of the object name.
name
)

Construct an object name from the given string.

public
ObjectName(String
The domain part of the object name.
domain
,
String
The attribute in the key property of the object name.
key
,
String
The value in the key property of the object name.
value
)

Construct an object name with exactly one key property.

public
ObjectName(String
The domain part of the object name.
domain
,
Hashtable<String, String>
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.
table
)

Construct an object name with several key properties from a Hashtable.

Method Summary

Modifier and TypeMethod and Description
private Map<String, String>

Returns:

The table of key properties.
_getKeyPropertyList
()

Returns the key properties as a Map.

private void
addProperty(ObjectName.Property prop, int index, Map<String, ObjectName.Property> keys_map, String key_name)

Add passed property to the list at the given index for the passed key name

public boolean

Returns:

True if name matches this ObjectName.
apply
(ObjectName
The name of the MBean to compare to.
name
)

Implements javax.management.QueryExp.apply.

Test whether this ObjectName, which may be a pattern, matches another ObjectName.

private static void
checkKey(String key)

Check if the supplied key is a valid key.

private static boolean

Returns:

true if the value is a pattern, otherwise false.
checkValue
(String val)

Check if the supplied value is a valid value.

public int

Returns:

a negative integer, zero, or a positive integer as this ObjectName is less than, equal to, or greater than the specified ObjectName.
compareTo
(ObjectName
the ObjectName to be compared.
name
)

Implements java.lang.Comparable.compareTo.

Compares two ObjectName instances.

private void
construct(String
A string representation of the ObjectName
name
)

Initializes this ObjectName from the given string representation.

private void
construct(String
Domain of the ObjectName.
domain
,
Map<String, String>
Map containing couples key -> value.
props
)

Construct an ObjectName from a domain and a Hashtable.

public boolean

Returns:

True if object is an ObjectName whose canonical form is equal to that of this ObjectName.
equals
(Object
The object name that the current object name is to be compared with.
object
)

Overrides java.lang.Object.equals.

Compares the current object name with another object name.

public String

Returns:

The canonical key property list string. This string is independent of whether the ObjectName is a pattern.
getCanonicalKeyPropertyListString
()

Returns a string representation of the list of key properties, in which the key properties are sorted in lexical order.

public String

Returns:

The canonical form of the name.
getCanonicalName
()

Returns the canonical form of the name; that is, a string representation where the properties are sorted in lexical order.

public String

Returns:

The domain.
getDomain
()

Returns the domain part.

private int
public static ObjectName

Returns:

an ObjectName corresponding to the given String.
getInstance
(String
A string representation of the object name.
name
)

Return an instance of ObjectName that can be used anywhere an object obtained with new ObjectName(name) can be used.

public static ObjectName

Returns:

an ObjectName corresponding to the given domain, key, and value.
getInstance
(String
The domain part of the object name.
domain
,
String
The attribute in the key property of the object name.
key
,
String
The value in the key property of the object name.
value
)

Return an instance of ObjectName that can be used anywhere an object obtained with new ObjectName(domain, key, value) can be used.

public static ObjectName

Returns:

an ObjectName corresponding to the given domain and key mappings.
getInstance
(String
The domain part of the object name.
domain
,
Hashtable<String, String>
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.
table
)

Return an instance of ObjectName that can be used anywhere an object obtained with new ObjectName(domain, table) can be used.

public static ObjectName

Returns:

an instance of ObjectName or a subclass that is known to have the same semantics. If name respects the semantics of ObjectName, then the returned object is equal (though not necessarily identical) to name.
getInstance
(ObjectName
an instance of the ObjectName class or of a subclass
name
)

Return an instance of ObjectName that can be used anywhere the given object can be used.

public String

Returns:

The value of the property, or null if there is no such property in this ObjectName.
getKeyProperty
(String
The property whose value is to be obtained.
property
)

Obtains the value associated with a key in a key property.

public Hashtable<String, String>

Returns:

The table of key properties.
getKeyPropertyList
()

Returns the key properties as a Hashtable.

public String

Returns:

The key property list string. This string is independent of whether the ObjectName is a pattern.
getKeyPropertyListString
()

Returns a string representation of the list of key properties specified at creation time.

private String

Returns:

The key property list string. This string is independent of whether the ObjectName is a pattern.
getSerializedNameString
()

Returns the serialized string of the ObjectName.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code for this object name.

private boolean
isDomain(String domain)

Check if domain is a valid domain.

public boolean

Returns:

True if the name is a domain pattern, otherwise false.
isDomainPattern
()

Checks whether the object name is a pattern on the domain part.

public boolean

Returns:

True if the name is a pattern, otherwise false.
isPattern
()

Checks whether the object name is a pattern.

public boolean

Returns:

True if the name is a property list pattern, otherwise false.
isPropertyListPattern
()

Checks whether the object name is a pattern on the key property list.

public boolean

Returns:

True if the name is a property pattern, otherwise false.
isPropertyPattern
()

Checks whether the object name is a pattern on the key properties.

public boolean

Returns:

True if the name is a property value pattern, otherwise false.
isPropertyValuePattern
()

Checks whether the object name is a pattern on the value part of at least one of the key properties.

public boolean

Returns:

True if the value associated with the given key property is a pattern, otherwise false.
isPropertyValuePattern
(String
The property whose value is to be checked.
property
)

Checks whether the value associated with a key in a key property is a pattern.

private final boolean
private final boolean
private static int

Returns:

The index following the last character of the key.
parseKey
(final char[]
The char array of the original string.
s
,
final int
index at which to begin parsing.
startKey
)

Parse a key.

private static int[]

Returns:

The first element of the int array indicates the index following the last character of the value. The second element of the int array indicates that the value is a pattern when its value equals 1.
parseValue
(final char[]
The char array of the original string.
s
,
final int
index at which to begin parsing.
startValue
)

Parse a value.

public static String

Returns:

the quoted String.
quote
(String
the String to be quoted.
s
)

Returns a quoted form of the given String, suitable for inclusion in an ObjectName.

private void
private void
setCanonicalName(char[] specified_chars, char[] canonical_chars, String[] keys, Map<String, ObjectName.Property> keys_map, int prop_index, int nb_props)

Sets the canonical name of receiver from input 'specified_chars' array, by filling 'canonical_chars' array with found 'nb-props' properties starting at position 'prop_index'.

private void
setDomainLength(int
The domain length
length
)

Validates and sets the domain length

private void
setDomainPattern(boolean
true if the domain name is a pattern, false otherwise
value
)

Marks the object name as representing a pattern on the domain part.

public void
setMBeanServer(MBeanServer
The MBean server on which the query is to be performed.
mbs
)

Implements javax.management.QueryExp.setMBeanServer.

Sets the MBean server on which the query is to be performed.

private void
setPropertyListPattern(boolean
true if the key property list is a pattern, false otherwise
value
)

Marks the object name as representing a pattern on the key property list.

private void
setPropertyValuePattern(boolean
true if the value part of at least one of the key properties is a pattern, false otherwise
value
)

Marks the object name as representing a pattern on the value part.

public String

Returns:

a string representation of this object name.
toString
()

Overrides java.lang.Object.toString.

Returns a string representation of the object name.

public static String

Returns:

the unquoted String.
unquote
(String
the String to be unquoted.
q
)

Returns an unquoted form of the given String.

private int

Returns:

offset + #of chars written
writeKeyPropertyListString
(char[] canonicalChars, char[] data, int offset)

Write a string representation of the list of key properties specified at creation time in the given array, starting at the specified offset.

private void
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

_ca_arrayback to summary
private transient ObjectName.Property[] _ca_array

An array of properties in the same seq order as canonical order

_canonicalNameback to summary
private transient String _canonicalName

a String containing the canonical name

_compressed_storageback to summary
private transient int _compressed_storage

This field encodes _domain_pattern, _property_list_pattern and _property_value_pattern booleans and _domain_length integer.

The following masks can be used to extract the value:

.
_Empty_property_arrayback to summary
private static final ObjectName.Property[] _Empty_property_array

a shared empty array for empty property lists

_kp_arrayback to summary
private transient ObjectName.Property[] _kp_array

An array of properties in the same seq order as time creation

_propertyListback to summary
private transient Map<String, String> _propertyList

The propertyList of built object name. Initialized lazily. Table that contains all the pairs (key,value) for this ObjectName.

compatback to summary
private static boolean compat
DOMAIN_LENGTH_MASKback to summary
private static final int DOMAIN_LENGTH_MASK
DOMAIN_PATTERNback to summary
private static final int DOMAIN_PATTERN
FLAG_MASKback to summary
private static final int FLAG_MASK
newSerialPersistentFieldsback to summary
private static final ObjectStreamField[] newSerialPersistentFields
newSerialVersionUIDback to summary
private static final long newSerialVersionUID
oldSerialPersistentFieldsback to summary
private static final ObjectStreamField[] oldSerialPersistentFields
oldSerialVersionUIDback to summary
private static final long oldSerialVersionUID
PROPLIST_PATTERNback to summary
private static final int PROPLIST_PATTERN
PROPVAL_PATTERNback to summary
private static final int PROPVAL_PATTERN
serialPersistentFieldsback to summary
private static final ObjectStreamField[] serialPersistentFields
serialVersionUIDback to summary
private static final long serialVersionUID
WILDCARDback to summary
public static final ObjectName WILDCARD

Defines the wildcard "*:*" ObjectName.

Since
1.6

Constructor Detail

ObjectNameback to summary
public ObjectName(String name) throws MalformedObjectNameException

Construct an object name from the given string.

Parameters
name:String

A string representation of the object name.

Exceptions
MalformedObjectNameException:
The string passed as a parameter does not have the right format.
NullPointerException:
The name parameter is null.
ObjectNameback to summary
public ObjectName(String domain, String key, String value) throws MalformedObjectNameException

Construct an object name with exactly one key property.

Parameters
domain:String

The domain part of the object name.

key:String

The attribute in the key property of the object name.

value:String

The value in the key property of the object name.

Exceptions
MalformedObjectNameException:
The domain, key, or value contains an illegal character, or value does not follow the rules for quoting, or the domain's length exceeds the maximum allowed length.
NullPointerException:
One of the parameters is null.
ObjectNameback to summary
public ObjectName(String domain, Hashtable<String, String> table) throws MalformedObjectNameException

Construct an object name with several key properties from a Hashtable.

Parameters
domain:String

The domain part of the object name.

table:Hashtable<String, String>

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.

Exceptions
MalformedObjectNameException:
The 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, or the domain's length exceeds the maximum allowed length.
NullPointerException:
One of the parameters is null.

Method Detail

_getKeyPropertyListback to summary
private Map<String, String> _getKeyPropertyList()

Returns the key properties as a Map. The returned value is a Map in which each key is a key in the ObjectName's key property list and each value is the associated value.

The returned value must not be modified.

Returns:Map<String, String>

The table of key properties.

addPropertyback to summary
private void addProperty(ObjectName.Property prop, int index, Map<String, ObjectName.Property> keys_map, String key_name) throws MalformedObjectNameException

Add passed property to the list at the given index for the passed key name

applyback to summary
public boolean apply(ObjectName name)

Implements javax.management.QueryExp.apply.

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.

Parameters
name:ObjectName

The name of the MBean to compare to.

Returns:boolean

True if name matches this ObjectName.

Exceptions
NullPointerException:
if name is null.
checkKeyback to summary
private static void checkKey(String key) throws MalformedObjectNameException

Check if the supplied key is a valid key.

checkValueback to summary
private static boolean checkValue(String val) throws MalformedObjectNameException

Check if the supplied value is a valid value.

Returns:boolean

true if the value is a pattern, otherwise false.

compareToback to summary
public int compareTo(ObjectName name)

Implements java.lang.Comparable.compareTo.

Compares two ObjectName instances. The ordering relation between ObjectNames is not completely specified but is intended to be such that a sorted list of ObjectNames will appear in an order that is convenient for a person to read.

In particular, if the two ObjectName instances have different domains then their order is the lexicographical order of the domains. The ordering of the key property list remains unspecified.

For example, the ObjectName instances below:

  • Shapes:type=Square,name=3
  • Colors:type=Red,name=2
  • Shapes:type=Triangle,side=isosceles,name=2
  • Colors:type=Red,name=1
  • Shapes:type=Square,name=1
  • Colors:type=Blue,name=1
  • Shapes:type=Square,name=2
  • JMImplementation:type=MBeanServerDelegate
  • Shapes:type=Triangle,side=scalene,name=1

could be ordered as follows:

  • Colors:type=Blue,name=1
  • Colors:type=Red,name=1
  • Colors:type=Red,name=2
  • JMImplementation:type=MBeanServerDelegate
  • Shapes:type=Square,name=1
  • Shapes:type=Square,name=2
  • Shapes:type=Square,name=3
  • Shapes:type=Triangle,side=scalene,name=1
  • Shapes:type=Triangle,side=isosceles,name=2
Parameters
name:ObjectName

the ObjectName to be compared.

Returns:int

a negative integer, zero, or a positive integer as this ObjectName is less than, equal to, or greater than the specified ObjectName.

Since
1.6
constructback to summary
private void construct(String name) throws MalformedObjectNameException

Initializes this ObjectName from the given string representation.

Parameters
name:String

A string representation of the ObjectName

Exceptions
MalformedObjectNameException:
The string passed as a parameter does not have the right format.
NullPointerException:
The name parameter is null.
constructback to summary
private void construct(String domain, Map<String, String> props) throws MalformedObjectNameException

Construct an ObjectName from a domain and a Hashtable.

Parameters
domain:String

Domain of the ObjectName.

props:Map<String, String>

Map containing couples key -> value.

Exceptions
MalformedObjectNameException:
The 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, or the domain's length exceeds the maximum allowed length.
NullPointerException:
One of the parameters is null.
equalsback to summary
public boolean equals(Object object)

Overrides java.lang.Object.equals.

Compares the current object name with another object name. Two ObjectName instances are equal if and only if their canonical forms are equal. The canonical form is the string described for getCanonicalName().

Parameters
object:Object

The object name that the current object name is to be compared with.

Returns:boolean

True if object is an ObjectName whose canonical form is equal to that of this ObjectName.

Annotations
@Override
getCanonicalKeyPropertyListStringback to summary
public String getCanonicalKeyPropertyListString()

Returns a string representation of the list of key properties, in which the key properties are sorted in lexical order. This is used in lexicographic comparisons performed in order to select MBeans based on their key property list. Lexical order is the order implied by String.compareTo(String).

Returns:String

The canonical key property list string. This string is independent of whether the ObjectName is a pattern.

getCanonicalNameback to summary
public String getCanonicalName()

Returns the canonical form of the name; that is, a string representation where the properties are sorted in lexical order.

More precisely, the canonical form of the name is a String consisting of the domain part, a colon (:), the canonical key property list, and a pattern indication.

The canonical key property list is the same string as described for getCanonicalKeyPropertyListString().

The pattern indication is:

  • empty for an ObjectName that is not a property list pattern;
  • an asterisk for an ObjectName that is a property list pattern with no keys; or
  • a comma and an asterisk (,*) for an ObjectName that is a property list pattern with at least one key.
Returns:String

The canonical form of the name.

getDomainback to summary
public String getDomain()

Returns the domain part.

Returns:String

The domain.

getDomainLengthback to summary
private int getDomainLength()
getInstanceback to summary
public static ObjectName getInstance(String name) throws MalformedObjectNameException, 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.

Parameters
name:String

A string representation of the object name.

Returns:ObjectName

an ObjectName corresponding to the given String.

Exceptions
MalformedObjectNameException:
The string passed as a parameter does not have the right format.
NullPointerException:
The name parameter is null.
getInstanceback to summary
public static ObjectName getInstance(String domain, String key, String value) throws MalformedObjectNameException

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.

Parameters
domain:String

The domain part of the object name.

key:String

The attribute in the key property of the object name.

value:String

The value in the key property of the object name.

Returns:ObjectName

an ObjectName corresponding to the given domain, key, and value.

Exceptions
MalformedObjectNameException:
The domain, key, or value contains an illegal character, or value does not follow the rules for quoting, or the domain's length exceeds the maximum allowed length.
NullPointerException:
One of the parameters is null.
getInstanceback to summary
public static ObjectName getInstance(String domain, Hashtable<String, String> table) throws MalformedObjectNameException

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.

Parameters
domain:String

The domain part of the object name.

table:Hashtable<String, String>

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.

Returns:ObjectName

an ObjectName corresponding to the given domain and key mappings.

Exceptions
MalformedObjectNameException:
The 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, or the domain's length exceeds the maximum allowed length.
NullPointerException:
One of the parameters is null.
getInstanceback to summary
public static ObjectName getInstance(ObjectName name)

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 behavior to sensitive code. Such code can call this method to obtain an ObjectName that is known not to have surprising behavior.

Parameters
name:ObjectName

an instance of the ObjectName class or of a subclass

Returns:ObjectName

an instance of ObjectName or a subclass that is known to have the same semantics. If name respects the semantics of ObjectName, then the returned object is equal (though not necessarily identical) to name.

Exceptions
NullPointerException:
The name is null.
getKeyPropertyback to summary
public String getKeyProperty(String property)

Obtains the value associated with a key in a key property.

Parameters
property:String

The property whose value is to be obtained.

Returns:String

The value of the property, or null if there is no such property in this ObjectName.

Exceptions
NullPointerException:
If property is null.
getKeyPropertyListback to summary
public Hashtable<String, String> getKeyPropertyList()

Returns the key properties as a Hashtable. The returned value is a Hashtable in which each key is a key in the ObjectName's key property list and each value is the associated value.

The returned value may be unmodifiable. If it is modifiable, changing it has no effect on this ObjectName.

Returns:Hashtable<String, String>

The table of key properties.

getKeyPropertyListStringback to summary
public String getKeyPropertyListString()

Returns a string representation of the list of key properties specified at creation time. If this ObjectName was constructed with the constructor ObjectName(String), the key properties in the returned String will be in the same order as in the argument to the constructor.

Returns:String

The key property list string. This string is independent of whether the ObjectName is a pattern.

getSerializedNameStringback to summary
private String getSerializedNameString()

Returns the serialized string of the ObjectName. properties specified at creation time. If this ObjectName was constructed with the constructor ObjectName(String), the key properties in the returned String will be in the same order as in the argument to the constructor.

Returns:String

The key property list string. This string is independent of whether the ObjectName is a pattern.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code for this object name.

Returns:int

Doc from java.lang.Object.hashCode.

a hash code value for this object

Annotations
@Override
isDomainback to summary
private boolean isDomain(String domain)

Check if domain is a valid domain. Set _domain_pattern if appropriate.

isDomainPatternback to summary
public boolean isDomainPattern()

Checks whether the object name is a pattern on the domain part.

Returns:boolean

True if the name is a domain pattern, otherwise false.

isPatternback to summary
public boolean isPattern()

Checks whether the object name is a pattern.

An object name is a pattern if its domain contains a wildcard or if the object name is a property pattern.

Returns:boolean

True if the name is a pattern, otherwise false.

isPropertyListPatternback to summary
public boolean isPropertyListPattern()

Checks whether the object name is a pattern on the key property list.

For example, "d:k=v,*" and "d:k=*,*" are key property list patterns whereas "d:k=*" is not.

Returns:boolean

True if the name is a property list pattern, otherwise false.

Since
1.6
isPropertyPatternback to summary
public boolean isPropertyPattern()

Checks whether the object name is a pattern on the key properties.

An object name is a pattern on the key properties if it is a pattern on the key property list (e.g. "d:k=v,*") or on the property values (e.g. "d:k=*") or on both (e.g. "d:k=*,*").

Returns:boolean

True if the name is a property pattern, otherwise false.

isPropertyValuePatternback to summary
public boolean isPropertyValuePattern()

Checks whether the object name is a pattern on the value part of at least one of the key properties.

For example, "d:k=*" and "d:k=*,*" are property value patterns whereas "d:k=v,*" is not.

Returns:boolean

True if the name is a property value pattern, otherwise false.

Since
1.6
isPropertyValuePatternback to summary
public boolean isPropertyValuePattern(String property)

Checks whether the value associated with a key in a key property is a pattern.

Parameters
property:String

The property whose value is to be checked.

Returns:boolean

True if the value associated with the given key property is a pattern, otherwise false.

Exceptions
NullPointerException:
If property is null.
IllegalArgumentException:
If property is not a valid key property for this ObjectName.
Since
1.6
matchDomainsback to summary
private final boolean matchDomains(ObjectName name)
matchKeysback to summary
private final boolean matchKeys(ObjectName name)
parseKeyback to summary
private static int parseKey(final char[] s, final int startKey) throws MalformedObjectNameException

Parse a key.

final int endKey=parseKey(s,startKey);

key starts at startKey (included), and ends at endKey (excluded). If (startKey == endKey), then the key is empty.

Parameters
s:char[]

The char array of the original string.

startKey:int

index at which to begin parsing.

Returns:int

The index following the last character of the key.

parseValueback to summary
private static int[] parseValue(final char[] s, final int startValue) throws MalformedObjectNameException

Parse a value.

final int endVal=parseValue(s,startVal);

value starts at startVal (included), and ends at endVal (excluded). If (startVal == endVal), then the key is empty.

Parameters
s:char[]

The char array of the original string.

startValue:int

index at which to begin parsing.

Returns:int[]

The first element of the int array indicates the index following the last character of the value. The second element of the int array indicates that the value is a pattern when its value equals 1.

quoteback to summary
public static String quote(String s)

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:

  • A quote ('"') is replaced by a backslash (\) followed by a quote.
  • An asterisk ('*') is replaced by a backslash (\) followed by an asterisk.
  • A question mark ('?') is replaced by a backslash (\) followed by a question mark.
  • A backslash ('\') is replaced by two backslashes.
  • A newline character (the character '\n' in Java) is replaced by a backslash followed by the character '\n'.
Parameters
s:String

the String to be quoted.

Returns:String

the quoted String.

Exceptions
NullPointerException:
if s is null.
readObjectback to summary
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException

Deserializes an ObjectName from an ObjectInputStream.

Serial data
  • In the current serial form (value of property jmx.serial.form differs from 1.0): the string "<domain>:<properties><wild>", where:
    • <domain> represents the domain part of the ObjectName
    • <properties> represents the list of properties, as returned by getKeyPropertyListString
    • <wild> is empty if not isPropertyPattern, or is the character "*" if isPropertyPattern and <properties> is empty, or is ",*" if isPropertyPattern and <properties> is not empty.
    The intent is that this string could be supplied to the ObjectName(String) constructor to produce an equivalent ObjectName.
  • In the old serial form (value of property jmx.serial.form is 1.0): <domain> <propertyList> <propertyListString> <canonicalName> <pattern> <propertyPattern>, where:
    • <domain> represents the domain part of the ObjectName
    • <propertyList> is the Hashtable that contains all the pairs (key,value) for this ObjectName
    • <propertyListString> is the String representation of the list of properties in any order (not mandatorily a canonical representation)
    • <canonicalName> is the String containing this ObjectName's canonical name
    • <pattern> is a boolean which is true if this ObjectName contains a pattern
    • <propertyPattern> is a boolean which is true if this ObjectName contains a pattern in the list of properties
setCanonicalNameback to summary
private void setCanonicalName(char[] specified_chars, char[] canonical_chars, String[] keys, Map<String, ObjectName.Property> keys_map, int prop_index, int nb_props)

Sets the canonical name of receiver from input 'specified_chars' array, by filling 'canonical_chars' array with found 'nb-props' properties starting at position 'prop_index'.

setDomainLengthback to summary
private void setDomainLength(int length) throws MalformedObjectNameException

Validates and sets the domain length

Parameters
length:int

The domain length

Exceptions
MalformedObjectNameException:
When the given domain length exceeds the maximum allowed length
setDomainPatternback to summary
private void setDomainPattern(boolean value)

Marks the object name as representing a pattern on the domain part.

Parameters
value:boolean

true if the domain name is a pattern, false otherwise

setMBeanServerback to summary
public void setMBeanServer(MBeanServer mbs)

Implements javax.management.QueryExp.setMBeanServer.

Doc from javax.management.QueryExp.setMBeanServer.

Sets the MBean server on which the query is to be performed.

Parameters
mbs:MBeanServer

The MBean server on which the query is to be performed.

setPropertyListPatternback to summary
private void setPropertyListPattern(boolean value)

Marks the object name as representing a pattern on the key property list.

Parameters
value:boolean

true if the key property list is a pattern, false otherwise

setPropertyValuePatternback to summary
private void setPropertyValuePattern(boolean value)

Marks the object name as representing a pattern on the value part.

Parameters
value:boolean

true if the value part of at least one of the key properties is a pattern, false otherwise

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object name. The format of this string is not specified, but users can expect that two ObjectNames return the same string if and only if they are equal.

Returns:String

a string representation of this object name.

Annotations
@Override
unquoteback to summary
public static String unquote(String q)

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.

Parameters
q:String

the String to be unquoted.

Returns:String

the unquoted String.

Exceptions
IllegalArgumentException:
if q could not have been returned by the quote method, for instance if it does not begin and end with a quote (").
NullPointerException:
if q is null.
writeKeyPropertyListStringback to summary
private int writeKeyPropertyListString(char[] canonicalChars, char[] data, int offset)

Write a string representation of the list of key properties specified at creation time in the given array, starting at the specified offset. If this ObjectName was constructed with the constructor ObjectName(String), the key properties in the returned String will be in the same order as in the argument to the constructor.

Returns:int

offset + #of chars written

writeObjectback to summary
private void writeObject(ObjectOutputStream out) throws IOException

Serializes an ObjectName to an ObjectOutputStream.

Serial data
  • In the current serial form (value of property jmx.serial.form differs from 1.0): the string "<domain>:<properties><wild>", where:
    • <domain> represents the domain part of the ObjectName
    • <properties> represents the list of properties, as returned by getKeyPropertyListString
    • <wild> is empty if not isPropertyPattern, or is the character "*" if this isPropertyPattern and <properties> is empty, or is ",*" if isPropertyPattern and <properties> is not empty.
    The intent is that this string could be supplied to the ObjectName(String) constructor to produce an equivalent ObjectName.
  • In the old serial form (value of property jmx.serial.form is 1.0): <domain> <propertyList> <propertyListString> <canonicalName> <pattern> <propertyPattern>, where:
    • <domain> represents the domain part of the ObjectName
    • <propertyList> is the Hashtable that contains all the pairs (key,value) for this ObjectName
    • <propertyListString> is the String representation of the list of properties in any order (not mandatorily a canonical representation)
    • <canonicalName> is the String containing this ObjectName's canonical name
    • <pattern> is a boolean which is true if this ObjectName contains a pattern
    • <propertyPattern> is a boolean which is true if this ObjectName contains a pattern in the list of properties
javax.management back to summary

private Class ObjectName.PatternProperty

extends Property
Class Inheritance

Marker class for value pattern property.

Field Summary

Inherited from javax.management.ObjectName.Property:
_key_index_key_length_value_length

Constructor Summary

AccessConstructor and Description
pack-priv
PatternProperty(int key_index, int key_length, int value_length)

Constructor.

Method Summary

Inherited from javax.management.ObjectName.Property:
getKeyStringgetValueStringsetKeyIndex

Constructor Detail

PatternPropertyback to summary
pack-priv PatternProperty(int key_index, int key_length, int value_length)

Constructor.

javax.management back to summary

private Class ObjectName.Property

extends Object
Class Inheritance
Known Direct Subclasses
javax.management.ObjectName.PatternProperty

A structure recording property structure and proposing minimal services

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv int
pack-priv int

Constructor Summary

AccessConstructor and Description
pack-priv
Property(int key_index, int key_length, int value_length)

Constructor.

Method Summary

Modifier and TypeMethod and Description
pack-priv String
getKeyString(String name)

Returns a key string for receiver key

pack-priv String
getValueString(String name)

Returns a value string for receiver key

pack-priv void
setKeyIndex(int key_index)

Assigns the key index of property

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_key_indexback to summary
pack-priv int _key_index
_key_lengthback to summary
pack-priv int _key_length
_value_lengthback to summary
pack-priv int _value_length

Constructor Detail

Propertyback to summary
pack-priv Property(int key_index, int key_length, int value_length)

Constructor.

Method Detail

getKeyStringback to summary
pack-priv String getKeyString(String name)

Returns a key string for receiver key

getValueStringback to summary
pack-priv String getValueString(String name)

Returns a value string for receiver key

setKeyIndexback to summary
pack-priv void setKeyIndex(int key_index)

Assigns the key index of property