Overview  NT SampleAgent  Solaris SampleAgent  JarInstaller  Samples  Main Index 

 

JarInstaller MBean Service

 

This document describes an optional MBean developed as an enhancement to TMX4J. It is available in the jmxext.jar package. This MBean logs by default in a log file with the suffix Tmx4j_ unless a user-defined log file name prefix is specified in the jmx.properties file. The log level can be configured with the key JmxUserLogLevel. All the classes related to this MBean are grouped in the package com.tivoli.jmx.jar.

Package com.tivoli.jmx.jar

All the MBeans defined in this package are meant to offer a service to register and deregister javax.managemet.loading.MLets in a MBeanServer according to the jar files available in some user-defined directories. This service could be summarized as a jar management system that allows to update and upgrade a running JMX agent without stopping the JVM.


Note that if there is a dependency between a jar file and other jar files, the Class-Path attribute in the manifest file should be used.

Example

The following code snippet shows the basic usage of the JarInstallerMBean:

            server.createMBean(
              JarInstaller.class.getName(), installerObjName,
              new Object[] {new File("/to_be_monitored/jar_dir"), "mydomain"},
              new String[] {File.class.getName(), String.class.getName()});

            // set the purge flag
            Attribute purge = new Attribute("Purge", Boolean.TRUE);
            server.setAttribute(installerObjName, purge);

            //enable the installer
            server.invoke(installerObjName, "enable", null, null);

            // create mbeans or instantiate objects using classes available in the 
            // jar files observed in the directories specified 
            ...
            server.createMBean(....);
            ...	

            // disable the installer, further changes in the directories
            // observed will not be detected. 
            server.invoke(installerObjName, "disable", null, null);
            
            ...
            // if the purge attribute is true, the JarInstaller de-registration 
            // will unregister all the MLets, the Timer and the DirectoryObservers
            // in the domain "mydomain"
            server.unregisterMBean(installerObjName);  

Overview  NT SampleAgent  Solaris SampleAgent  JarInstaller  Samples  Main Index 

Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries.
 
File Last Updated: 11/21/2001