Java Dynamic Management Kit 3.2 Programming Guide
[ Previous ][ Fast Back ]Chapter 4. Operations on M-Beans[ Fast Forward ][ Next ]

Object Name

An object name uniquely identifies an m-bean within a framework. Management applications use object names to identify the m-beans on which to perform management operations. An object name is represented by the class com.sun.jaw.reference.common.ObjectName.

An object name consists of the following parts:

Domain

The domain provides a structure for the naming space within a Java Dynamic Management agent or within a global management domain. A simple example is to use the host name of the machine on which the agent is running as the domain name for all objects controlled by the agent.

M-beans may be created without an object name, in which case they are given one by default. The domain name assigned by default is the same as the domain of the agent's framework object, as described in Assigning Object Names.

Class

The class specifies the Java class of the object that the m-bean instantiates. This part must correspond exactly to the full Java class-name, including any package name, of the m-bean.

Search Key

The search key enables unique names to be assigned to instances of the same class. A search key consists of one or more attribute-value pairs. An attribute in a search key does not have to correspond to a property within the m-bean. For example, if you use the attribute serialNo in a search key, the m-bean does not have to contain a property named serialNo. You can specify any number of attribute-value pairs in a search key.

The search key is optional. If you do not specify a search key for an m-bean, only one instance of the class is permitted within the domain. Such a class is called a singleton.

Syntax of an Object Name

domainPart:classPart[.attribute=value[,attribute=value]*]

The variable parts of this syntax are:

domainPart

The domain part of the object name. It must be followed by a colon (:).

classPart

The class part of the object name.

attribute

An attribute in the search key.

value

The value assigned to a given attribute.

The first attribute-value pair in a search key must be preceded by a dot (.). You can specify any number of attribute-value pairs in a search key, each separated by a comma (,). Each attribute must be separated from its corresponding value by an equals sign (=), without any intervening spaces.


Note - If the object name does not contain at least one equals sign (=), the entire string after the colon is considered the class part of the object name. In this case, the class is a singleton.


For example, an object representing a specific bank account could be named:
bankHost:account.id=123456,owner=smith


[ Previous ][ Home ][ Next ]
Operations on M-Beans[ Up ]Registering an M-Bean