Java Dynamic Management Kit 3.2 Programming Guide | ||||
---|---|---|---|---|
![]() | ![]() | Chapter 1. Introduction to the Java Dynamic Management Kit | ![]() | ![]() |
The main steps in developing an application with the Java Dynamic Management Kit are:
Writing the m-beans that define your application
Testing the m-beans with a web browser
Designing your base agent
Generating the c-beans corresponding to your m-beans
Optional: using the job tool for further testing
Developing a manager in the Java language
When using the Java Dynamic Management Kit for agent development, you write Java classes that define your application. The only restriction imposed by the Java Dynamic Management Kit is that your classes must comply with the design pattern for m-beans described in Chapter 3.
After you have compiled your m-bean classes, you are able to use a web browser to test them. You do this by connecting a web browser to a running agent (for example, the default base agent), instantiating m-beans, and performing other operations on the m-bean instances. Before connecting a web browser to an agent, make sure that:
The agent is running on a machine that you can access by using the HTTP protocol.
The agent contains an instance of HTML adaptor.
The compiled m-bean classes are stored at a location specified in the CLASSPATH environment variable of the agent.
To use a web browser to communicate with an agent, open the page given by this URL in a web browser:
http://host:port |
where:
host is the host name of the machine on which the agent is running.
port is the port number used by the HTML adaptor in the agent. By default it is 8082.
The HTML page displayed is generated by the HTML adaptor and enables you to perform the following operations on m-beans in the agent:
Reading or writing the properties of an m-bean instance
Performing an action on an m-bean instance
Instantiating an m-bean
Deleting an m-bean instance
For detailed instructions on how to use a web browser for testing m-beans in an agent, refer to The M-Bean Browser Web Page in Chapter 8.
A base agent is a container in which m-beans are instantiated and run. A base agent consists of:
The framework, initialized with the base services
At least one adaptor
A base agent can also contain m-beans instantiated when the base agent is started; optionally these last for the lifetime of the base agent. In designing the base agent you have to decide which m-beans you want to be instantiated when the agent is started, and which you want to be instantiated on demand.
An agent consists of a base agent and the m-beans instantiated during the lifetime of the base agent.
To generate a c-bean from an m-bean, use the mogen compiler. The m-bean classes input to mogen must be in the form of compiled Java classes, not source files.
A c-bean consists of two components:
A Java interface that defines which of the methods of the m-bean are accessible to a Java manager.
A Java stub class that implements the methods defined in the Java interface.
For example, if you have an m-bean MyClass, the mogen compiler gives you a c-bean that consists of the following files:
MyClassMO.java - the Java interface
MyClassMOStub.java - the Java stub
For information on how to use mogen, refer to Chapter 6.
The mogen compiler generates Java source code, not compiled Java classes. For your c-beans to be accessible to a Java manager, you have to compile the files that mogen generates, and make sure that the compiled Java classes are stored at the location specified by the CLASSPATH environment variable of the manager.
After you have generated c-beans, you are able to use the job tool for further testing. You do this by connecting the job tool to a running agent (for example, the default base agent), instantiating m-beans, and performing other operations on the m-bean instances. The job tool provides a graphical representation of m-beans in an agent. It is a simple example of a Java manager that can perform basic operations on m-beans in an agent.
Before using the job tool to communicate with an agent, make sure that:
The agent contains an instance of an adaptor that communicates through an adaptor client. These adaptors are listed in Supported Protocols in Chapter 7.
The agent is running on a machine that the job tool can access using the protocol of the adaptor in the agent.
The compiled m-bean classes are stored at a location specified in the CLASSPATH environment variable of the agent.
The compiled c-bean classes are stored at a location specified in the CLASSPATH environment variable of the job tool.
To start the job tool, type the command for your operating environment:
In a Solaris operating environment:
prompt% installDir/SUNWconn/jaw/bin/job |
In a Windows NT operating environment:
C:\> "installDir\SUNWconn\jaw\bin\job" |
The job tool window is opened. Before performing any operations on m-beans, you have to connect the job tool to an agent. Once connected, the job tool enables you to perform the following operations on m-beans in the agent:
Reading or writing the properties of an m-bean instance
Performing an action on an m-bean instance
Instantiating an m-bean
Deleting an m-bean instance
For detailed instructions on how to use the job tool, refer to The job Tool in Chapter 8.
Use the adaptor client API to develop a manager in the Java language. The main steps in developing a Java manager are:
Initializing an adaptor client
Adding the services that the adaptor client requires to operate
Instantiating objects in an agent
Getting or setting properties of objects
Performing actions on objects
The interaction between an m-bean in an agent and a c-bean in a Java manager is shown in Figure 1-2.
For information on how to use the adaptor client API, refer to Chapter 7.
![]() | ![]() | ![]() |
Product Components | ![]() | Tutorial Example |