javax.management
Class ObjectName

java.lang.Object
  extended byjavax.management.ObjectName
All Implemented Interfaces:
QueryExp (src) , java.io.Serializable

public class ObjectName
extends java.lang.Object
implements java.io.Serializable, QueryExp (src)

Object name represents the MBean reference.

See Also:
MBeanServer (src) , Serialized Form

Constructor Summary
ObjectName(java.lang.String name)
           
ObjectName(java.lang.String domain, java.util.Hashtable table)
          Construct a new ObjectName
ObjectName(java.lang.String domain, java.lang.String key, java.lang.String value)
          Construct a new ObjectName
 
Method Summary
 boolean apply(ObjectName (src)  name)
          Apply this query expression to an MBean.
 boolean equals(java.lang.Object object)
           
 java.lang.String getCanonicalKeyPropertyListString()
           
 java.lang.String getCanonicalName()
          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.
 java.lang.String getDomain()
           
static ObjectName (src) getInstance(ObjectName (src)  name)
          Return an instance of ObjectName that can be used anywhere the given object can be used.
static ObjectName (src) getInstance(java.lang.String name)
          Return an instance of an ObjectName
static ObjectName (src) getInstance(java.lang.String domain, java.util.Hashtable table)
          Return an instance of an ObjectName
static ObjectName (src) getInstance(java.lang.String domain, java.lang.String key, java.lang.String value)
          Return an instance of an ObjectName
 java.lang.String getKeyProperty(java.lang.String property)
           
 java.util.Hashtable getKeyPropertyList()
           
 java.lang.String getKeyPropertyListString()
          Construct the key property list, ignoring patters Note, it might not be the same order
 int hashCode()
           
 boolean isDomainPattern()
           
 boolean isPattern()
           
 boolean isPropertyPattern()
           
static java.lang.String quote(java.lang.String value)
          Quotes the passed string suitable for use as a value in an ObjectName.
 void setMBeanServer(MBeanServer (src)  server)
          Set the MBeanServer for this query.
 java.lang.String toString()
           
static java.lang.String unquote(java.lang.String value)
          Unquotes a string, unquote(quote(s)).equals(s) is always true.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectName

public ObjectName(java.lang.String name)
           throws MalformedObjectNameException (src) ,
                  java.lang.NullPointerException
Parameters:
name - a string representation of the object name
Throws:
MalformedObjectNameException (src) - for an invalid object name
java.lang.NullPointerException - for a null name

ObjectName

public ObjectName(java.lang.String domain,
                  java.lang.String key,
                  java.lang.String value)
           throws MalformedObjectNameException (src) ,
                  java.lang.NullPointerException
Construct a new ObjectName

Parameters:
domain - the domain of the object name
key - the key of the single property
value - the value of the single property
Throws:
MalformedObjectNameException (src) - for an invalid object name
java.lang.NullPointerException - for a null parameter

ObjectName

public ObjectName(java.lang.String domain,
                  java.util.Hashtable table)
           throws MalformedObjectNameException (src) ,
                  java.lang.NullPointerException
Construct a new ObjectName

Parameters:
domain - the domain of the object name
table - of hashtable for key property pairs
Throws:
MalformedObjectNameException (src) - for an invalid object name
java.lang.NullPointerException - for a null parameter
Method Detail

getInstance

public static ObjectName (src)  getInstance(java.lang.String name)
                              throws MalformedObjectNameException (src) ,
                                     java.lang.NullPointerException
Return an instance of an ObjectName

Parameters:
name - a string representation of the object name
Throws:
MalformedObjectNameException (src) - for an invalid object name
java.lang.NullPointerException - for a null name

getInstance

public static ObjectName (src)  getInstance(java.lang.String domain,
                                     java.lang.String key,
                                     java.lang.String value)
                              throws MalformedObjectNameException (src) ,
                                     java.lang.NullPointerException
Return an instance of an ObjectName

Parameters:
domain - the domain of the object name
key - the key of the single property
value - the value of the single property
Throws:
MalformedObjectNameException (src) - for an invalid object name
java.lang.NullPointerException - for a null parameter

getInstance

public static ObjectName (src)  getInstance(java.lang.String domain,
                                     java.util.Hashtable table)
                              throws MalformedObjectNameException (src) ,
                                     java.lang.NullPointerException
Return an instance of an ObjectName

Parameters:
domain - the domain of the object name
table - of hashtable for key property pairs
Throws:
MalformedObjectNameException (src) - for an invalid object name
java.lang.NullPointerException - for a null parameter

getInstance

public static ObjectName (src)  getInstance(ObjectName (src)  name)
                              throws java.lang.NullPointerException
Return an instance of ObjectName that can be used anywhere the given object can be used. The returned object may be of a subclass of ObjectName. If name is of a subclass of ObjectName, it is not guaranteed that the returned object will be of the same class. The returned value may or may not be identical to name. Calling this method twice with the same parameters may return the same object or two equal but not identical objects. Since ObjectName is immutable, it is not usually useful to make a copy of an ObjectName. The principal use of this method is to guard against a malicious caller who might pass an instance of a subclass with surprising behaviour to sensitive code. Such code can call this method to obtain an ObjectName that is known not to have surprising behaviour.

Parameters:
name - - an instance of the ObjectName class or of a subclass
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.
Throws:
java.lang.NullPointerException

quote

public static java.lang.String quote(java.lang.String value)
                              throws java.lang.NullPointerException
Quotes the passed string suitable for use as a value in an ObjectName.

Parameters:
value - the string to quote
Returns:
the quoted string
Throws:
java.lang.NullPointerException - for a null string

unquote

public static java.lang.String unquote(java.lang.String value)
                                throws java.lang.IllegalArgumentException,
                                       java.lang.NullPointerException
Unquotes a string, unquote(quote(s)).equals(s) is always true.

Parameters:
value - the string to unquote
Returns:
the unquoted string
Throws:
java.lang.IllegalArgumentException - when the string is not of a form that can be unquoted.
java.lang.NullPointerException - for a null string

equals

public boolean equals(java.lang.Object object)

hashCode

public int hashCode()

toString

public java.lang.String toString()

isPattern

public boolean isPattern()

getCanonicalName

public java.lang.String getCanonicalName()
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 pattern; - an asterisk for an ObjectName that is a property pattern with no keys; or - a comma and an asterisk (,*) for an ObjectName that is a property pattern with at least one key.


getDomain

public java.lang.String getDomain()

getKeyProperty

public java.lang.String getKeyProperty(java.lang.String property)
                                throws java.lang.NullPointerException
Throws:
java.lang.NullPointerException

getKeyPropertyList

public java.util.Hashtable getKeyPropertyList()

getKeyPropertyListString

public java.lang.String getKeyPropertyListString()
Construct the key property list, ignoring patters Note, it might not be the same order


getCanonicalKeyPropertyListString

public java.lang.String getCanonicalKeyPropertyListString()

isPropertyPattern

public boolean isPropertyPattern()

isDomainPattern

public boolean isDomainPattern()

apply

public boolean apply(ObjectName (src)  name)
              throws java.lang.NullPointerException
Description copied from interface: QueryExp (src)
Apply this query expression to an MBean.

Specified by:
apply in interface QueryExp (src)
Parameters:
name - the object name of the mbean
Returns:
true or false as the result of the query expression.
Throws:
java.lang.NullPointerException

setMBeanServer

public void setMBeanServer(MBeanServer (src)  server)
Description copied from interface: QueryExp (src)
Set the MBeanServer for this query. Only MBeans registered in this server can be used in queries.

Specified by:
setMBeanServer in interface QueryExp (src)
Parameters:
server - the MBeanServer