Java Dynamic Management Kit 3.2 Programming Guide | ||||
---|---|---|---|---|
![]() | ![]() | Chapter 10. Base Services - Customizing the Framework | ![]() | ![]() |
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.
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:
Invoking a setter method for the service within the Framework class
Adding the service to the repository
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:
It is not visible to remote applications
It cannot be stored in persistent storage
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); |
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); |
![]() | ![]() | ![]() |
Activation Interface | ![]() | Filtering Service |