FileDocCategorySizeDatePackage
ObjectName.javaAPI DocJava SE 6 API80030Tue Jun 10 00:26:14 BST 2008javax.management

ObjectName

public class ObjectName extends Object implements Comparable, QueryExp

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
  • An object name pattern, within the context of a query

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 "{@code //}", 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:

  • Another backslash. The second backslash has no special meaning and the two characters represent a single backslash.
  • The character 'n'. The two characters represent a newline ('\n' in Java).
  • A quote. The two characters represent a quote, and that quote is not considered to terminate the quoted value. An ending closing quote must be present for the quoted value to be valid.
  • A question mark (?) or asterisk (*). The two characters represent a question mark or asterisk respectively.

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:

  • {@code *:type=Foo,name=Bar} to match names in any domain whose exact set of keys is {@code type=Foo,name=Bar}.
  • {@code d:type=Foo,name=Bar,*} to match names in the domain {@code d} that have the keys {@code type=Foo,name=Bar} plus zero or more other keys.
  • {@code *:type=Foo,name=Bar,*} to match names in any domain that has the keys {@code type=Foo,name=Bar} plus zero or more other keys.
  • {@code d:type=F?o,name=Bar} will match e.g. {@code d:type=Foo,name=Bar} and {@code d:type=Fro,name=Bar}.
  • {@code d:type=F*o,name=Bar} will match e.g. {@code d:type=Fo,name=Bar} and {@code d:type=Frodo,name=Bar}.
  • {@code d:type=Foo,name="B*"} will match e.g. {@code d:type=Foo,name="Bling"}. Wildcards are recognized even inside quotes, and like other special characters can be escaped with {@code \}.

An ObjectName can be written as a String with the following elements in order:

  • The domain.
  • A colon (:).
  • A key property list as defined below.

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

The serialVersionUID of this class is 1081892073854801359L.

since
1.5

Fields Summary
private static final long
oldSerialVersionUID
private static final long
newSerialVersionUID
private static final ObjectStreamField[]
oldSerialPersistentFields
private static final ObjectStreamField[]
newSerialPersistentFields
private static final long
serialVersionUID
private static final ObjectStreamField[]
serialPersistentFields
private static boolean
compat
private static final Property[]
_Empty_property_array
a shared empty array for empty property lists
private transient String
_canonicalName
a String containing the canonical name
private transient Property[]
_kp_array
An array of properties in the same seq order as time creation
private transient Property[]
_ca_array
An array of properties in the same seq order as canonical order
private transient int
_domain_length
The length of the domain part of built objectname
private transient Map
_propertyList
The propertyList of built object name. Initialized lazily. Table that contains all the pairs (key,value) for this ObjectName.
private transient boolean
_domain_pattern
boolean that declares if this ObjectName domain part is a pattern
private transient boolean
_property_list_pattern
boolean that declares if this ObjectName contains a pattern on the key property list
private transient boolean
_property_value_pattern
boolean that declares if this ObjectName contains a pattern on the value of at least one key property
public static final ObjectName
WILDCARD
Defines the wildcard "*:*" ObjectName.
Constructors Summary
public ObjectName(String name)
Construct an object name from the given string.

param
name A string representation of the object name.
exception
MalformedObjectNameException The string passed as a parameter does not have the right format.
exception
NullPointerException The name parameter is null.

	construct(name);
    
public ObjectName(String domain, String key, String value)
Construct an object name with exactly one key property.

param
domain The domain part of the object name.
param
key The attribute in the key property of the object name.
param
value The value in the key property of the object name.
exception
MalformedObjectNameException The domain, key, or value contains an illegal character, or value does not follow the rules for quoting.
exception
NullPointerException One of the parameters is null.

	// If key or value are null a NullPointerException
	// will be thrown by the put method in Hashtable.
	//
	Map<String,String> table = Collections.singletonMap(key, value);
	construct(domain, table);
    
public ObjectName(String domain, Hashtable table)
Construct an object name with several key properties from a Hashtable.

param
domain The domain part of the object name.
param
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.
exception
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.
exception
NullPointerException One of the parameters is null.

        construct(domain, table);
	/* The exception for when a key or value in the table is not a
	   String is now ClassCastException rather than
	   MalformedObjectNameException.  This was not previously
	   specified.  */
    
Methods Summary
private java.util.Map_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.

return
The table of key properties.

        synchronized (this) {
            if (_propertyList == null) {
                // build (lazy eval) the property list from the canonical
		// properties array
                _propertyList = new HashMap<String,String>();
                int len = _ca_array.length;
                Property prop;
                for (int i = len - 1; i >= 0; i--) {
                    prop = _ca_array[i];
                    _propertyList.put(prop.getKeyString(_canonicalName),
                                      prop.getValueString(_canonicalName));
                }
            }
        }
        return _propertyList;
    
private voidaddProperty(javax.management.ObjectName$Property prop, int index, java.util.Map keys_map, java.lang.String key_name)
Add passed property to the list at the given index for the passed key name


        if (keys_map.containsKey(key_name)) throw new
                MalformedObjectNameException("key `" +
					 key_name +"' already defined");

        // if no more space for property arrays, have to increase it
        if (index == _kp_array.length) {
            Property[] tmp_prop_array = new Property[index + 10];
            System.arraycopy(_kp_array, 0, tmp_prop_array, 0, index);
            _kp_array = tmp_prop_array;
        }
        _kp_array[index] = prop;
        keys_map.put(key_name, prop);
    
public booleanapply(javax.management.ObjectName name)

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 {@link #equals(Object)} method.

param
name The name of the MBean to compare to.
return
True if name matches this ObjectName.
exception
NullPointerException if name is null.
since.unbundled
JMX 1.2

        try {
            WILDCARD = new ObjectName("*:*");
        } catch (MalformedObjectNameException e) {
            throw new Error("Can't initialize wildcard name", e);
        }
    

        if (name == null) throw new NullPointerException();

	if (name._domain_pattern ||
            name._property_list_pattern ||
            name._property_value_pattern)
	    return false;

	// No pattern
	if (!_domain_pattern &&
            !_property_list_pattern &&
            !_property_value_pattern)
	    return _canonicalName.equals(name._canonicalName);

	return matchDomains(name) && matchKeys(name);
    
private static voidcheckKey(java.lang.String key)
Check if the supplied key is a valid key.


	if (key == null) throw new
	    NullPointerException("Invalid key (null)");

	final int len = key.length();
	if (len == 0) throw new
	    MalformedObjectNameException("Invalid key (empty)");
	final char[] k=key.toCharArray();
	final int endKey = parseKey(k,0);
	if (endKey < len) throw new
	    MalformedObjectNameException("Invalid character in value: `" +
					 k[endKey] + "'");
    
private static booleancheckValue(java.lang.String val)
Check if the supplied value is a valid value.

return
true if the value is a pattern, otherwise false.


	if (val == null) throw new
	    NullPointerException("Invalid value (null)");

        final int len = val.length();
        if (len == 0)
            return false;

	final char[] s = val.toCharArray();
	final int[] result = parseValue(s,0);
        final int endValue = result[0];
        final boolean value_pattern = result[1] == 1;
        if (endValue < len) throw new
	    MalformedObjectNameException("Invalid character in value: `" +
					 s[endValue] + "'");
	return value_pattern;
    
public intcompareTo(javax.management.ObjectName name)

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

param
name the ObjectName to be compared.
return
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

        // (1) Compare domains
        //
        int domainValue = this.getDomain().compareTo(name.getDomain());
        if (domainValue != 0)
            return domainValue;

        // (2) Compare "type=" keys
        //
        // Within a given domain, all names with missing or empty "type="
        // come before all names with non-empty type.
        //
        // When both types are missing or empty, canonical-name ordering
        // applies which is a total order.
        //
        String thisTypeKey = this.getKeyProperty("type");
        String anotherTypeKey = name.getKeyProperty("type");
        if (thisTypeKey == null)
            thisTypeKey = "";
        if (anotherTypeKey == null)
            anotherTypeKey = "";
        int typeKeyValue = thisTypeKey.compareTo(anotherTypeKey);
        if (typeKeyValue != 0)
            return typeKeyValue;

        // (3) Compare canonical names
        //
        return this.getCanonicalName().compareTo(name.getCanonicalName());
    
private voidconstruct(java.lang.String name)
Initializes this {@link ObjectName} from the given string representation.

param
name A string representation of the {@link ObjectName}
exception
MalformedObjectNameException The string passed as a parameter does not have the right format.
exception
NullPointerException The name parameter is null.


    // Instance private fields <=======================================

    // Private fields <========================================


    //  Private methods ---------------------------------------->

    // Category : Instance construction ------------------------->

                                                
       
	   

	// The name cannot be null
	if (name == null)
	    throw new NullPointerException("name cannot be null");

	// Test if the name is empty
	if (name.length() == 0) {
            // this is equivalent to the whole word query object name.
            _canonicalName = "*:*";
            _kp_array = _Empty_property_array;
            _ca_array = _Empty_property_array;
            _domain_length = 1;
            _propertyList = null;
            _domain_pattern = true;
            _property_list_pattern = true;
            _property_value_pattern = false;
            return;
        }

        // initialize parsing of the string
        char[] name_chars = name.toCharArray();
        int len = name_chars.length;
        char[] canonical_chars = new char[len]; // canonical form will be same
                                                // length at most
        int cname_index = 0;
	int index = 0;
        char c, c1;

        // parses domain part
    domain_parsing:
        while (index < len) {
            switch (c = name_chars[index]) {
                case ':" :
                    _domain_length = index++;
                    break domain_parsing;
                case '=" :
                    // ":" omission check.
                    //
                    // Although "=" is a valid character in the domain part
                    // it is true that it is rarely used in the real world.
                    // So check straight away if the ":" has been omitted
                    // from the ObjectName. This allows us to provide a more
                    // accurate exception message.
                    int i = ++index;
                    while ((i < len) && (name_chars[i++] != ':"))
                        if (i == len)
                            throw new MalformedObjectNameException(
                                "Domain part must be specified");
		    break;
                case '\n" :
                    throw new MalformedObjectNameException(
			      "Invalid character '\\n' in domain name");
                case '*" :
                case '?" :
                    _domain_pattern = true;
		    index++;
		    break;
                default :
                    index++;
		    break;
            }
        }

        // check for non-empty properties
        if (index == len)
	    throw new MalformedObjectNameException(
					 "Key properties cannot be empty");

        // we have got the domain part, begins building of _canonicalName
        System.arraycopy(name_chars, 0, canonical_chars, 0, _domain_length);
        canonical_chars[_domain_length] = ':";
        cname_index = _domain_length + 1;

        // parses property list
        Property prop;
        Map<String,Property> keys_map = new HashMap<String,Property>();
        String[] keys;
        String key_name;
        boolean quoted_value;
        int property_index = 0;
        int in_index;
        int key_index, key_length, value_index, value_length;

        keys = new String[10];
        _kp_array = new Property[10];
        _property_list_pattern = false;
        _property_value_pattern = false;

        while (index < len) {
            c = name_chars[index];

            // case of pattern properties
            if (c == '*") {
                if (_property_list_pattern)
		    throw new MalformedObjectNameException(
			      "Cannot have several '*' characters in pattern " +
			      "property list");
                else {
                    _property_list_pattern = true;
                    if ((++index < len ) && (name_chars[index] != ',"))
			throw new MalformedObjectNameException(
			          "Invalid character found after '*': end of " +
				  "name or ',' expected");
                    else if (index == len) {
                        if (property_index == 0) {
                            // empty properties case
                            _kp_array = _Empty_property_array;
                            _ca_array = _Empty_property_array;
                            _propertyList = Collections.emptyMap();
                        }
                        break;
                    } else {
                        // correct pattern spec in props, continue
                        index++;
                        continue;
                    }
                }
            }

            // standard property case, key part
            in_index = index;
            key_index = in_index;
            if (name_chars[in_index] == '=")
                throw new MalformedObjectNameException("Invalid key (empty)");
            while ((in_index < len) && ((c1 = name_chars[in_index++]) != '="))
                switch (c1) {
                    // '=' considered to introduce value part
                    case  '*" :
                    case  '?" :
                    case  '," :
                    case  ':" :
                    case  '\n" :
			final String ichar = ((c1=='\n")?"\\n":""+c1);
                        throw new MalformedObjectNameException(
				  "Invalid character '" + ichar +
				  "' in key part of property");
                }
            if (name_chars[in_index - 1] != '=")
		throw new MalformedObjectNameException(
					     "Unterminated key property part");
            value_index = in_index; // in_index pointing after '=' char
            key_length = value_index - key_index - 1; // found end of key

            // standard property case, value part
            boolean value_pattern = false;
            if (in_index < len && name_chars[in_index] == '\"") {
                quoted_value = true;
                // the case of quoted value part
            quoted_value_parsing:
                while ((++in_index < len) &&
		       ((c1 = name_chars[in_index]) != '\"")) {
                    // the case of an escaped character
                    if (c1 == '\\") {
                        if (++in_index == len)
			    throw new MalformedObjectNameException(
					       "Unterminated quoted value");
                        switch (c1 = name_chars[in_index]) {
                            case '\\" :
                            case '\"" :
                            case '?" :
                            case '*" :
                            case 'n" :
                                break; // valid character
                            default :
                                throw new MalformedObjectNameException(
					  "Invalid escape sequence '\\" +
					  c1 + "' in quoted value");
                        }
		    } else if (c1 == '\n") {
			throw new MalformedObjectNameException(
						     "Newline in quoted value");
		    } else {
                        switch (c1) {
                            case '?" :
                            case '*" :
                                value_pattern = true;
                                break;
                        }
                    }
		}
                if (in_index == len)
		    throw new MalformedObjectNameException(
						 "Unterminated quoted value");
                else value_length = ++in_index - value_index;
            } else {
                // the case of standard value part
                quoted_value = false;
                while ((in_index < len) && ((c1 = name_chars[in_index]) != ',"))
                switch (c1) {
                    // ',' considered to be the value separator
                    case '*" :
                    case '?" :
                        value_pattern = true;
                        in_index++;
                        break;
                    case '=" :
                    case ':" :
                    case '"" :
                    case '\n" :
			final String ichar = ((c1=='\n")?"\\n":""+c1);
                        throw new MalformedObjectNameException(
						 "Invalid character '" + c1 +
						 "' in value part of property");
                    default :
                        in_index++;
                        break;
                }
                value_length = in_index - value_index;
            }

            // Parsed property, checks the end of name
            if (in_index == len - 1) {
                if (quoted_value)
		    throw new MalformedObjectNameException(
					     "Invalid ending character `" +
					     name_chars[in_index] + "'");
                else throw new MalformedObjectNameException(
						  "Invalid ending comma");
            } else in_index++;

            // we got the key and value part, prepare a property for this
            if (!value_pattern) {
                prop = new Property(key_index, key_length, value_length);
            } else {
                _property_value_pattern = true;
                prop = new PatternProperty(key_index, key_length, value_length);
            }
            key_name = name.substring(key_index, key_index + key_length);

            if (property_index == keys.length) {
                String[] tmp_string_array = new String[property_index + 10];
                System.arraycopy(keys, 0, tmp_string_array, 0, property_index);
                keys = tmp_string_array;
            }
            keys[property_index] = key_name;

            addProperty(prop, property_index, keys_map, key_name);
            property_index++;
            index = in_index;
        }

        // computes and set canonical name
        setCanonicalName(name_chars, canonical_chars, keys,
			 keys_map, cname_index, property_index);
    
private voidconstruct(java.lang.String domain, java.util.Map props)
Construct an ObjectName from a domain and a Hashtable.

param
domain Domain of the ObjectName.
param
props Map containing couples key -> value.
exception
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.
exception
NullPointerException One of the parameters is null.


	// The domain cannot be null
	if (domain == null)
	    throw new NullPointerException("domain cannot be null");

	// The key property list cannot be null
	if (props == null)
	    throw new NullPointerException("key property list cannot be null");

	// The key property list cannot be empty
	if (props.isEmpty())
	    throw new MalformedObjectNameException(
					 "key property list cannot be empty");

        // checks domain validity
	if (!isDomain(domain))
            throw new MalformedObjectNameException("Invalid domain: " + domain);

        // init canonicalname
	final StringBuilder sb = new StringBuilder();
        sb.append(domain).append(':");
        _domain_length = domain.length();

        // allocates the property array
        int nb_props = props.size();
        _kp_array = new Property[nb_props];

	String[] keys = new String[nb_props];
        final Map<String,Property> keys_map = new HashMap<String,Property>();
        Property prop;
        int key_index;
	int i = 0;
	for (Map.Entry<String,String> entry : props.entrySet()) {
            if (sb.length() > 0)
		sb.append(",");
	    String key = entry.getKey();
	    String value;
	    try {
		value = entry.getValue();
	    } catch (ClassCastException e) {
		throw new MalformedObjectNameException(e.getMessage());
	    }
	    key_index = sb.length();
            checkKey(key);
            sb.append(key);
	    keys[i] = key;
            sb.append("=");
            boolean value_pattern = checkValue(value);
            sb.append(value);
            if (!value_pattern) {
                prop = new Property(key_index,
                                    key.length(),
                                    value.length());
            } else {
                _property_value_pattern = true;
                prop = new PatternProperty(key_index,
                                           key.length(),
                                           value.length());
            }
	    addProperty(prop, i, keys_map, key);
	    i++;
	}

        // initialize canonical name and data structure
        int len = sb.length();
        char[] initial_chars = new char[len];
        sb.getChars(0, len, initial_chars, 0);
        char[] canonical_chars = new char[len];
        System.arraycopy(initial_chars, 0, canonical_chars, 0,
			 _domain_length + 1);
        setCanonicalName(initial_chars, canonical_chars, keys, keys_map,
			 _domain_length + 1, _kp_array.length);
    
public booleanequals(java.lang.Object object)
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 {@link #getCanonicalName()}.

param
object The object name that the current object name is to be compared with.
return
True if object is an ObjectName whose canonical form is equal to that of this ObjectName.


        // same object case
        if (this == object) return true;

        // object is not an object name case
        if (!(object instanceof ObjectName)) return false;

        // equality when canonical names are the same
        // (because usage of intern())
        ObjectName on = (ObjectName) object;
        String on_string = on._canonicalName;
        if (_canonicalName == on_string) return true;

        // Because we are sharing canonical form between object names,
        // we have finished the comparison at this stage ==> unequal
        return false;
   
public java.lang.StringgetCanonicalKeyPropertyListString()
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 {@link String#compareTo(String) String.compareTo(String)}.

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

        if (_ca_array.length == 0) return "";

        int len = _canonicalName.length();
        if (_property_list_pattern) len -= 2;
        return _canonicalName.substring(_domain_length +1, len);
    
public java.lang.StringgetCanonicalName()

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 {@link #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.

return
The canonical form of the name.

        return _canonicalName;
    
public java.lang.StringgetDomain()
Returns the domain part.

return
The domain.

        return _canonicalName.substring(0, _domain_length);
    
public static javax.management.ObjectNamegetInstance(java.lang.String name)

Return an instance of ObjectName that can be used anywhere an object obtained with {@link #ObjectName(String) 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.

param
name A string representation of the object name.
return
an ObjectName corresponding to the given String.
exception
MalformedObjectNameException The string passed as a parameter does not have the right format.
exception
NullPointerException The name parameter is null.
since.unbundled
JMX 1.2

        return new ObjectName(name);
    
public static javax.management.ObjectNamegetInstance(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 {@link #ObjectName(String, String, String) 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.

param
domain The domain part of the object name.
param
key The attribute in the key property of the object name.
param
value The value in the key property of the object name.
return
an ObjectName corresponding to the given domain, key, and value.
exception
MalformedObjectNameException The domain, key, or value contains an illegal character, or value does not follow the rules for quoting.
exception
NullPointerException One of the parameters is null.
since.unbundled
JMX 1.2

        return new ObjectName(domain, key, value);
    
public static javax.management.ObjectNamegetInstance(java.lang.String domain, java.util.Hashtable table)

Return an instance of ObjectName that can be used anywhere an object obtained with {@link #ObjectName(String, Hashtable) 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.

param
domain The domain part of the object name.
param
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.
return
an ObjectName corresponding to the given domain and key mappings.
exception
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.
exception
NullPointerException One of the parameters is null.
since.unbundled
JMX 1.2

        return new ObjectName(domain, table);
    
public static javax.management.ObjectNamegetInstance(javax.management.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.

param
name an instance of the ObjectName class or of a subclass
return
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.
exception
NullPointerException The name is null.
since.unbundled
JMX 1.2

	if (name.getClass().equals(ObjectName.class))
	    return name;
	try {
	    return new ObjectName(name.getSerializedNameString());
	} catch (MalformedObjectNameException e) {
	    throw new IllegalArgumentException("Unexpected: " + e);
	    // can't happen
	}
    
public java.lang.StringgetKeyProperty(java.lang.String property)
Obtains the value associated with a key in a key property.

param
property The property whose value is to be obtained.
return
The value of the property, or null if there is no such property in this ObjectName.
exception
NullPointerException If property is null.

        return _getKeyPropertyList().get(property);
    
public java.util.HashtablegetKeyPropertyList()

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.

return
The table of key properties.

        return new Hashtable<String,String>(_getKeyPropertyList());
    
public java.lang.StringgetKeyPropertyListString()

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

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

        // BEWARE : we rebuild the propertyliststring at each call !!
        if (_kp_array.length == 0) return "";

        // the size of the string is the canonical one minus domain
	// part and pattern part
        final int total_size = _canonicalName.length() - _domain_length - 1
	    - (_property_list_pattern?2:0);

        final char[] dest_chars = new char[total_size];
        final char[] value = _canonicalName.toCharArray();
	writeKeyPropertyListString(value,dest_chars,0);
        return new String(dest_chars);
    
private java.lang.StringgetSerializedNameString()

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

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


        // the size of the string is the canonical one
        final int total_size = _canonicalName.length();
        final char[] dest_chars = new char[total_size];
	final char[] value = _canonicalName.toCharArray();
	final int offset = _domain_length+1;

	// copy "domain:" into dest_chars
	//
	System.arraycopy(value, 0, dest_chars, 0, offset);

	// Add property list string
	final int end = writeKeyPropertyListString(value,dest_chars,offset);

	// Add ",*" if necessary
        if (_property_list_pattern) {
	    if (end == offset)  {
		// Property list string is empty.
		dest_chars[end] = '*";
	    } else {
		// Property list string is not empty.
		dest_chars[end]   = ',";
		dest_chars[end+1] = '*";
	    }
	}

        return new String(dest_chars);
    
public inthashCode()
Returns a hash code for this object name.

        return _canonicalName.hashCode();
    
private booleanisDomain(java.lang.String domain)
Check if domain is a valid domain. Set _domain_pattern if appropriate.

	if (domain == null) return true;
	final char[] d=domain.toCharArray();
	final int len = d.length;
	int next = 0;
	while (next < len) {
	    final char c = d[next++];
	    switch (c) {
                case ':" :
                case '\n" :
                    return false;
                case '*" :
                case '?" :
                    _domain_pattern = true;
		    break;
	    }
	}
	return true;
    
public booleanisDomainPattern()
Checks whether the object name is a pattern on the domain part.

return
True if the name is a domain pattern, otherwise false.
since.unbundled
JMX 1.2

        return _domain_pattern;
    
public booleanisPattern()
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.

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

        return (_domain_pattern ||
                _property_list_pattern ||
                _property_value_pattern);
    
public booleanisPropertyListPattern()
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.

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

        return _property_list_pattern;
    
public booleanisPropertyPattern()
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=*,*").

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

        return _property_list_pattern || _property_value_pattern;
    
public booleanisPropertyValuePattern()
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.

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

        return _property_value_pattern;
    
public booleanisPropertyValuePattern(java.lang.String property)
Checks whether the value associated with a key in a key property is a pattern.

param
property The property whose value is to be checked.
return
True if the value associated with the given key property is a pattern, otherwise false.
exception
NullPointerException If property is null.
exception
IllegalArgumentException If property is not a valid key property for this ObjectName.
since
1.6

        if (property == null)
            throw new NullPointerException("key property can't be null");
        for (int i = 0; i < _ca_array.length; i++) {
            Property prop = _ca_array[i];
            String key = prop.getKeyString(_canonicalName);
            if (key.equals(property))
                return (prop instanceof PatternProperty);
        }
        throw new IllegalArgumentException("key property not found");
    
private final booleanmatchDomains(javax.management.ObjectName name)

	if (_domain_pattern) {
	    // wildmatch domains
	    final char[] dom_pattern = getDomain().toCharArray();
	    final char[] dom_string  = name.getDomain().toCharArray();
	    return wildmatch(dom_string,dom_pattern,0,0);
	}
	return getDomain().equals(name.getDomain());
    
private final booleanmatchKeys(javax.management.ObjectName name)

        // If key property value pattern but not key property list
        // pattern, then the number of key properties must be equal
        //
	if (_property_value_pattern &&
            !_property_list_pattern &&
            (name._ca_array.length != _ca_array.length))
                return false;

        // If key property value pattern or key property list pattern,
        // then every property inside pattern should exist in name
        //
        if (_property_value_pattern || _property_list_pattern) {
	    final Map<String,String> nameProps = name._getKeyPropertyList();
	    final Property[] props = _ca_array;
	    final String cn = _canonicalName;
	    for (int i = props.length - 1; i >= 0 ; i--) {
		// Find value in given object name for key at current
		// index in receiver
                //
		final Property p = props[i];
		final String   k = p.getKeyString(cn);
		final String   v = (String)nameProps.get(k);
		// Did we find a value for this key ?
                //
		if (v == null) return false;
		// If this property is ok (same key, same value), go to next
                //
                if (_property_value_pattern && (p instanceof PatternProperty)) {
                    // wildmatch key property values
                    final char[] val_pattern =
                            p.getValueString(cn).toCharArray();
                    final char[] val_string  = v.toCharArray();
                    if (wildmatch(val_string,val_pattern,0,0))
                        continue;
                    else
                        return false;
                }
		if (v.equals(p.getValueString(cn))) continue;
		return false;
	    }
	    return true;
	}

        // If no pattern, then canonical names must be equal
        //
	final String p1 = name.getCanonicalKeyPropertyListString();
	final String p2 = getCanonicalKeyPropertyListString();
	return (p1.equals(p2));
    
private static intparseKey(char[] s, int startKey)
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.

param
s The char array of the original string.
param
startKey index at which to begin parsing.
return
The index following the last character of the key.

	int next   = startKey;
	int endKey = startKey;
	final int len = s.length;
	while (next < len) {
	    final char k = s[next++];
	    switch (k) {
	    case '*":
	    case '?":
	    case ',":
	    case ':":
	    case '\n":
		final String ichar = ((k=='\n")?"\\n":""+k);
		throw new
		    MalformedObjectNameException("Invalid character in key: `"
						 + ichar + "'");
	    case '=":
		// we got the key.
		endKey = next-1;
		break;
	    default:
		if (next < len) continue;
		else endKey=next;
	    }
	    break;
	}
	return endKey;
    
private static int[]parseValue(char[] s, int startValue)
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.

param
s The char array of the original string.
param
startValue index at which to begin parsing.
return
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.


        boolean value_pattern = false;

        int next   = startValue;
	int endValue = startValue;

	final int len = s.length;
	final char q=s[startValue];

	if (q == '"") {
	    // quoted value
	    if (++next == len) throw new
		MalformedObjectNameException("Invalid quote");
	    while (next < len) {
		char last = s[next];
                if (last == '\\") {
                    if (++next == len) throw new
                        MalformedObjectNameException(
			   "Invalid unterminated quoted character sequence");
                    last = s[next];
                    switch (last) {
                        case '\\" :
                        case '?" :
                        case '*" :
			case 'n" :
                            break;
                        case '\"" :
			    // We have an escaped quote. If this escaped
			    // quote is the last character, it does not
			    // qualify as a valid termination quote.
			    //
			    if (next+1 == len) throw new
				MalformedObjectNameException(
						 "Missing termination quote");
			    break;
                        default:
                            throw new
                                MalformedObjectNameException(
				"Invalid quoted character sequence '\\" +
				last + "'");
                    }
                } else if (last == '\n") {
		    throw new MalformedObjectNameException(
						 "Newline in quoted value");
                } else if (last == '\"") {
                    next++;
                    break;
                } else {
                    switch (last) {
                        case '?" :
                        case '*" :
                            value_pattern = true;
                            break;
                    }
                }
                next++;

		// Check that last character is a termination quote.
		// We have already handled the case were the last
		// character is an escaped quote earlier.
		//
		if ((next >= len) && (last != '\"")) throw new
		    MalformedObjectNameException("Missing termination quote");
	    }
	    endValue = next;
	    if (next < len) {
		if (s[next++] != ',") throw new
		    MalformedObjectNameException("Invalid quote");
	    }
	} else {
	    // Non quoted value.
            while (next < len) {
                final char v=s[next++];
                switch(v) {
                    case '*":
                    case '?":
                        value_pattern = true;
                        if (next < len) continue;
                        else endValue=next;
                        break;
                    case '=":
                    case ':":
                    case '\n" :
                        final String ichar = ((v=='\n")?"\\n":""+v);
                        throw new
                            MalformedObjectNameException("Invalid character `" +
                                                         ichar + "' in value");
                    case ',":
                        endValue = next-1;
                        break;
                    default:
                        if (next < len) continue;
                        else endValue=next;
                }
                break;
            }
	}
	return new int[] { endValue, value_pattern ? 1 : 0 };
    
public static java.lang.Stringquote(java.lang.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'.

param
s the String to be quoted.
return
the quoted String.
exception
NullPointerException if s is null.
since.unbundled
JMX 1.2

	final StringBuilder buf = new StringBuilder("\"");
	final int len = s.length();
	for (int i = 0; i < len; i++) {
	    char c = s.charAt(i);
	    switch (c) {
	    case '\n":
		c = 'n";
		buf.append('\\");
		break;
	    case '\\":
	    case '\"":
	    case '*":
	    case '?":
		buf.append('\\");
		break;
	    }
	    buf.append(c);
	}
	buf.append('"");
	return buf.toString();
    
private voidreadObject(java.io.ObjectInputStream in)
Deserializes an {@link ObjectName} from an {@link ObjectInputStream}.

serialData
  • 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 {@link ObjectName}
    • <properties> represents the list of properties, as returned by {@link #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 {@link #ObjectName(String)} constructor to produce an equivalent {@link 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 {@link ObjectName}
    • <propertyList> is the {@link Hashtable} that contains all the pairs (key,value) for this {@link ObjectName}
    • <propertyListString> is the {@link String} representation of the list of properties in any order (not mandatorily a canonical representation)
    • <canonicalName> is the {@link String} containing this {@link ObjectName}'s canonical name
    • <pattern> is a boolean which is true if this {@link ObjectName} contains a pattern
    • <propertyPattern> is a boolean which is true if this {@link ObjectName} contains a pattern in the list of properties


	String cn;
	if (compat) {
	    // Read an object serialized in the old serial form
	    //
	    //in.defaultReadObject();
	    final ObjectInputStream.GetField fields = in.readFields();
	    cn = (String)fields.get("domain", "default")+
		":"+
		(String)fields.get("propertyListString", "");
	} else {
	    // Read an object serialized in the new serial form
	    //
	    in.defaultReadObject();
	    cn = (String)in.readObject();
	}

	try {
	    construct(cn);
	} catch (NullPointerException e) {
	    throw new InvalidObjectException(e.toString());
	} catch (MalformedObjectNameException e) {
	    throw new InvalidObjectException(e.toString());
	}
    
private voidsetCanonicalName(char[] specified_chars, char[] canonical_chars, java.lang.String[] keys, java.util.Map 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'.


        // Sort the list of found properties
        if (_kp_array != _Empty_property_array) {
            String[] tmp_keys = new String[nb_props];
            Property[] tmp_props = new Property[nb_props];

            System.arraycopy(keys, 0, tmp_keys, 0, nb_props);
            Arrays.sort(tmp_keys);
            keys = tmp_keys;
            System.arraycopy(_kp_array, 0, tmp_props, 0 , nb_props);
            _kp_array = tmp_props;
            _ca_array = new Property[nb_props];

            // now assigns _ca_array to the sorted list of keys
            // (there cannot be two identical keys in an objectname.
            for (int i = 0; i < nb_props; i++)
                _ca_array[i] = keys_map.get(keys[i]);

            // now we build the canonical name and set begin indexes of
            // properties to reflect canonical form
            int last_index = nb_props - 1;
            int prop_len;
            Property prop;
            for (int i = 0; i <= last_index; i++) {
                prop = _ca_array[i];
		// length of prop including '=' char
                prop_len = prop._key_length + prop._value_length + 1;
                System.arraycopy(specified_chars, prop._key_index,
				 canonical_chars, prop_index, prop_len);
                prop.setKeyIndex(prop_index);
                prop_index += prop_len;
                if (i != last_index) {
                    canonical_chars[prop_index] = ',";
                    prop_index++;
                }
            }
        }

        // terminate canonicalname with '*' in case of pattern
        if (_property_list_pattern) {
            if (_kp_array != _Empty_property_array)
		canonical_chars[prop_index++] = ',";
            canonical_chars[prop_index++] = '*";
        }

        // we now build the canonicalname string
        _canonicalName = (new String(canonical_chars, 0, prop_index)).intern();
    
public voidsetMBeanServer(javax.management.MBeanServer mbs)

 
public java.lang.StringtoString()

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.

return
a string representation of this object name.

	return getSerializedNameString();
    
public static java.lang.Stringunquote(java.lang.String q)

Returns an unquoted form of the given String. If q is a String returned by {@link #quote 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.

param
q the String to be unquoted.
return
the unquoted String.
exception
IllegalArgumentException if q could not have been returned by the {@link #quote} method, for instance if it does not begin and end with a quote (").
exception
NullPointerException if q is null.
since.unbundled
JMX 1.2

	final StringBuilder buf = new StringBuilder();
	final int len = q.length();
	if (len < 2 || q.charAt(0) != '"" || q.charAt(len - 1) != '"")
	    throw new IllegalArgumentException("Argument not quoted");
	for (int i = 1; i < len - 1; i++) {
	    char c = q.charAt(i);
	    if (c == '\\") {
		if (i == len - 2)
		    throw new IllegalArgumentException("Trailing backslash");
		c = q.charAt(++i);
		switch (c) {
		case 'n":
		    c = '\n";
		    break;
		case '\\":
		case '\"":
		case '*":
		case '?":
		    break;
                default:
                  throw new IllegalArgumentException(
				   "Bad character '" + c + "' after backslash");
		}
	    } else {
                switch (c) {
                    case '*" :
                    case '?" :
                    case '\"":
                    case '\n":
                         throw new IllegalArgumentException(
					  "Invalid unescaped character '" + c +
					  "' in the string to unquote");
                }
            }
	    buf.append(c);
	}
	return buf.toString();
    
private static booleanwildmatch(char[] s, char[] p, int si, int pi)

        char c;
        final int slen = s.length;
        final int plen = p.length;

        while (pi < plen) { // While still string
            c = p[pi++];
            if (c == '?") {
                if (++si > slen) return false;
            } else if (c == '*") { // Wildcard
                if (pi >= plen) return true;
                do {
                    if (wildmatch(s,p,si,pi)) return true;
                } while (++si < slen);
                return false;
            } else {
                if (si >= slen || c != s[si++]) return false;
            }
        }
        return (si == slen);
    
private intwriteKeyPropertyListString(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 {@link #ObjectName(String)}, the key properties in the returned String will be in the same order as in the argument to the constructor.

return
offset + #of chars written

        if (_kp_array.length == 0) return offset;

        final char[] dest_chars = data;
        final char[] value = _canonicalName.toCharArray();

        int index = offset;
        final int len = _kp_array.length;
	final int last = len - 1;
        for (int i = 0; i < len; i++) {
            final Property prop = _kp_array[i];
            final int prop_len = prop._key_length + prop._value_length + 1;
            System.arraycopy(value, prop._key_index, dest_chars, index,
			     prop_len);
            index += prop_len;
            if (i < last ) dest_chars[index++] = ',";
        }
	return index;
    
private voidwriteObject(java.io.ObjectOutputStream out)
Serializes an {@link ObjectName} to an {@link ObjectOutputStream}.

serialData
  • 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 {@link ObjectName}
    • <properties> represents the list of properties, as returned by {@link #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 {@link #ObjectName(String)} constructor to produce an equivalent {@link 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 {@link ObjectName}
    • <propertyList> is the {@link Hashtable} that contains all the pairs (key,value) for this {@link ObjectName}
    • <propertyListString> is the {@link String} representation of the list of properties in any order (not mandatorily a canonical representation)
    • <canonicalName> is the {@link String} containing this {@link ObjectName}'s canonical name
    • <pattern> is a boolean which is true if this {@link ObjectName} contains a pattern
    • <propertyPattern> is a boolean which is true if this {@link ObjectName} contains a pattern in the list of properties


      if (compat)
      {
        // Serializes this instance in the old serial form
        // Read CR 6441274 before making any changes to this code
        ObjectOutputStream.PutField fields = out.putFields();
	fields.put("domain", _canonicalName.substring(0, _domain_length));
	fields.put("propertyList", getKeyPropertyList());
	fields.put("propertyListString", getKeyPropertyListString());
	fields.put("canonicalName", _canonicalName);
	fields.put("pattern", (_domain_pattern || _property_list_pattern));
	fields.put("propertyPattern", _property_list_pattern);
	out.writeFields();
      }
      else
      {
        // Serializes this instance in the new serial form
        //
        out.defaultWriteObject();
        out.writeObject(getSerializedNameString());
      }