Example on MLet

Contents:

Introduction

This is a simple example to illustrate the use of dynamic loading of management applet (MLet).
__________________________________________________________________________________________________________________________

Overview

Let us say MBeans present at a remote place wants to get registered/managed with the local Multi-Protocol (JMX) server. The javax.management.loading.MLet mbean allows us to achieve this.
__________________________________________________________________________________________________________________________

Getting Started :

Source files

The main source file is,

In the folder "test" we have the source for the sample mbeans namely, The main file MLetAgent.java has 3 adaptors (HTTP/RMI/CORBA) along with MLet MBean, registered with the MBeanServer.

Consider, MBeans in local Multi-Protocol MBeanServer as,

Suppose, at remote host the following MBean is present To get these MBeans registered & managed by the local Multi-Protocol server, then we have to define a mlet text file accordingly. For instance, in this example the sample-mlet.txt file describes to download the MySample.jar which has the mbeans from host="localhost" & port="8080".

Compilation

To compile the source files go to AdventNet/JavaAgent/examples/jmx/mlet directory in the command prompt and type,

compile *.java [Windows]
sh compile sh *.java [Linux/Solaris]

This will compile the source files in the respective directory.

Running the Agent

To start the agent go to AdventNet/JavaAgent/examples/jmx/mlet directory in the command prompt and,

1. Run the startServer.bat/sh to start the remote web-server for downloading the mlet.(starts at port 8080, as specified in  AdventNet/JavaAgent/etc/MletServer.xml file.)

2. Also run the run.bat or run.sh.

          By default,
                  (a) RMI registry service will be started at port 1099
                  (b) HTML Adaptor will be started at port 8030.

Testing

1. Use any webbrowser to connect to the Multi-Protocol (JMX) server (through HTML adaptor) by specifying the URL as http://localhost:8030

2. Use MBean browser to access the data through RMI/CORBA/HTTP ( start MBean browser using MBeanBrowser.bat/MBeanBrowser.sh in AdventNet/JavaAgent/bin directoy)

3. Now to register the remote mbeans, select the MLet mbean in MBean/WebBrowser

             (a) invoke the method "void getMBeansFromURL(java.lang.String)" with parameter as  "http://localhost:8080/sample-mlet.txt"
             (b) now the mbean MLetGroup:description=myPackage.MySample gets registered and updated in the main mbeans list view of the browser as specified in the mlet file.
             (c) Now the remote mbeans are configurable through the adaptors
__________________________________________________________________________________________________________________________


Copyright (c) 1996-2004 AdventNet, Inc. All Rights Reserved.