com.sun.jaw.reference.common
Class ObjectName

java.lang.Object
  |
  +--com.sun.jaw.reference.common.ObjectName

public class ObjectName
extends java.lang.Object
implements java.io.Serializable

This class is used for representing an object name. An instance of this class can be used for representing:

An object name follows this rule:

domainName:className[.keyProperty=value[,keyProperty=value]*]

The variable parts of this rule are:

domainName
The name of the domain within which the object exists. The domain provides a structure for the naming space within a Java Dynamic Management agent or within a global management domain. A simple example of a domain is to use the host name of the machine on which the agent is running as the domain name for all the objects controlled by the agent. The domain name is followed by a colon (:). If the domain name is not present, the domain is controlled by the server.
className
The class of object that the object represents. This class does not need to correspond to the Java class of the object.
key
An attribute that represents a search key for naming the object. A key attribute used to name an object does not need to correspond to a property within the object.
value
The value assigned to key. Search keys for naming the object enable unique names to be assigned to instances of the same class. The first key attribute-value pair must be preceded by a period (.). An object name can contain any number of key attribute-value pairs, each separated by a comma (,). Search keys for naming an object are optional. If no search keys are specified, only one instance of the class is permitted within the domain. Such a class is called a singleton.

See Also:
Serialized Form

Constructor Summary
ObjectName(java.lang.String name)
          Allows an object name to be created given a string.
ObjectName(java.lang.String domain, java.lang.String className)
          Allows an object name without a key property to be created.
ObjectName(java.lang.String domain, java.lang.String className, java.util.Hashtable table)
          Allows an object name with several key properties to be created.
ObjectName(java.lang.String domain, java.lang.String className, java.lang.String key, java.lang.Object value)
          Allows an object name using only one key property to be created.
 
Method Summary
 boolean equals(java.lang.Object object)
          Compares the current object name with another object name.
 java.lang.String getCanonicalName()
          Obtains the canonical name.
 java.lang.String getCanonicalPropertyListString()
          Obtains a string representation of the list of properties in which the properties are sorted.
 java.lang.String getClassName()
          Obtains the class part.
 java.lang.String getDomain()
          Obtains the domain part.
 java.lang.Object getProperty(java.lang.String property)
          Obtains the value of a property in a search key.
 java.util.Hashtable getPropertyList()
          Obtains a pointer to the list of properties.
 java.lang.String getPropertyListString()
          Obtains a string representation of the list of properties specified at creation time.
 int hashCode()
          Returns a hash code for this object name.
 boolean isPropertyListEmpty()
          Checks if there are no key properties defined for this object name.
 java.lang.String toString()
          Translates an object name into a string.
 boolean validNameForObject()
          Checks if a name to be used as an object name is valid.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectName

public ObjectName(java.lang.String domain,
                  java.lang.String className,
                  java.util.Hashtable table)
           throws java.lang.IllegalArgumentException
Allows an object name with several key properties to be created.
Parameters:
domain - The domain part of the object name.
className - The class part of the object name.
table - A hash table containing one or more search keys. Each search key is an attribute-value pair.
Throws:
java.lang.IllegalArgumentException - One of the parameters in the call to the method is invalid.

ObjectName

public ObjectName(java.lang.String domain,
                  java.lang.String className,
                  java.lang.String key,
                  java.lang.Object value)
           throws java.lang.IllegalArgumentException
Allows an object name using only one key property to be created.
Parameters:
domain - The domain part of the object name.
className - The class part of the object name.
key - The attribute in the key property of the object name.
value - The value in the key property of the object name.
Throws:
java.lang.IllegalArgumentException - One of the parameters in the call to the method is invalid.

ObjectName

public ObjectName(java.lang.String domain,
                  java.lang.String className)
           throws java.lang.IllegalArgumentException
Allows an object name without a key property to be created.
Parameters:
domain - The domain part of the object name.
className - The class part of the object name.
Throws:
java.lang.IllegalArgumentException - One of the parameters in the call to the method is invalid.

ObjectName

public ObjectName(java.lang.String name)
           throws java.lang.IllegalArgumentException
Allows an object name to be created given a string.
Parameters:
name - A string representation of the object name.
Throws:
java.lang.IllegalArgumentException - One of the parameters in the call to the method is invalid.
Method Detail

toString

public java.lang.String toString()
Translates an object name into a string.
Returns:
A string representation of the object name.
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object object)
Compares the current object name with another object name.
Parameters:
object - The object name that the current object name is to be compared with.
Returns:
True if the two object names are equal, otherwise false.
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Returns a hash code for this object name.
Returns:
A hash code value for this object name.
Overrides:
hashCode in class java.lang.Object

validNameForObject

public boolean validNameForObject()
Checks if a name to be used as an object name is valid.
Returns:
True if the name is valid, otherwise false.

isPropertyListEmpty

public boolean isPropertyListEmpty()
Checks if there are no key properties defined for this object name.
Returns:
True if there are no key properties defined for this this object name, otherwise false.

getCanonicalName

public java.lang.String getCanonicalName()
Obtains the canonical name. A canonical name is a string representation of the name in which the properties are sorted.
Returns:
The canonical name.

getDomain

public java.lang.String getDomain()
Obtains the domain part.
Returns:
The domain part.

getClassName

public java.lang.String getClassName()
Obtains the class part.
Returns:
The class part.

getProperty

public java.lang.Object getProperty(java.lang.String property)
Obtains the value of a property in a search key.
Parameters:
The - property the value of which is to be obtained.
Returns:
The value of the property.

getPropertyList

public java.util.Hashtable getPropertyList()
Obtains a pointer to the list of properties.
Returns:
A pointer to the list of properties.

getPropertyListString

public java.lang.String getPropertyListString()
Obtains a string representation of the list of properties specified at creation time.
Returns:
A string representation of the list of properties.

getCanonicalPropertyListString

public java.lang.String getCanonicalPropertyListString()
Obtains a string representation of the list of properties in which the properties are sorted.
Returns:
A string representation of the list of properties in which the properties are sorted.