Java Dynamic Management Kit 3.2 Programming Guide
[ Previous ][ Fast Back ]Chapter 10. Base Services - Customizing the Framework[ Fast Forward ][ Next ]

Metadata Service

An agent uses the metadata service to obtain the properties and actions supported by an m-bean. A metadata service is supplied with the Java Dynamic Management Kit as the com.sun.jaw.impl.agent.services.light.MetaDataSrv class. This implementation uses the design patterns for m-beans to obtain the properties and actions supported by an m-bean. It is based on the Reflection API provided by the JavaŽ 2 SDK, Standard Edition, version 1.2. The metadata service implements the com.sun.jaw.reference.agent.services.MetaDataSrvIf Java interface.

Changing the Metadata Service

When you initialize the framework, it is initialized with the default implementation of the metadata service, regardless of the constructor you invoke. If you want to change the metadata service that an agent uses, add a new metadata service to replace the existing one.

The Java Dynamic Management Kit enables you to add a new metadata service to an agent in either of the following ways:

Adding the metadata service by invoking a setter method gives faster performance than adding it to the repository. However, if the service has been added by invoking a setter method:

Adding the Metadata Service by Invoking a Setter Method

Example 10-2 shows how to add the metadata service to an agent by invoking a setter method.

Example 10-2. Adding the Metadata Service by Invoking a Setter Method
import com.sun.jaw.impl.agent.services.light.MetaDataSrv;
import com.sun.jaw.reference.agent.services.MetaDataSrvIf;
...
meta = new MetaDataSrv();

// Pass the metadata service to the core management framework
cmf.setMetaDataSrvIf(meta);

Adding the Metadata Service to the Repository

When you add the metadata service to the repository, the class part of the object name (see Object Name in Chapter 4) you specify must contain the class name defined in the com.sun.jaw.reference.common.ServiceName Java class. The class name is used by the framework to retrieve the service from the repository. Once registered, the service is accessible to management applications, after the agent contains an adaptor.

Example 10-3 shows how to add the metadata service to the repository.

Example 10-3. Adding the Metadata Service to the Repository

// Create the metadata service
meta = new MetaDataSrv();

// Create the object name
String domain = cmf.getDomain()
name = new ObjectName(domain + ":" + ServiceName.META);

// Register the metadata service
cmf.addObject(meta, name);


[ Previous ][ Home ][ Next ]
Activation Interface[ Up ]Filtering Service