org.jboss.mx.util
Class MBeanInstaller

java.lang.Object
  extended by org.jboss.mx.util.MBeanInstaller

public class MBeanInstaller
extends Object

MBean installer utility

This installer allows MLet to install or upgrade a mbean based on the version specified in the MLet conf file. If the mbean version is newer than the registered in the server, the installer unregisters the old mbean and then registers the new one. This management needs to store the mbean version into the MBeanRegistry in the server. When we register mbeans, however, we can't pass the metadata to MBeanServer through the standard JMX api because Both of createMBean() and registerMBean() have no extra arguments to attach the metadata. Thus we call MBeanServer.invoke() directly to set/get the internal MBean metadata. Currently version and date are stored in the mbean registry as mbean metadata. The date will be used for preparing presentaionString for this mbean info. For managment purpose, we can add any extra data to the matadata if you need.

Version:
$Revision: 1.10.4.2 $

Revisions:

20020219 Juha Lindfors:

Author:
Fusayuki Minamoto., Juha Lindfors.

Field Summary
static String DATE
           
static String VERSIONS
           
 
Constructor Summary
MBeanInstaller(MBeanServer server, ClassLoader ctxClassLoader, ObjectName loaderName)
          Create a new MBean installer instance.
 
Method Summary
 ObjectInstance createMBean(MBeanElement element)
           
 ObjectInstance deserialize(MBeanElement element)
           
 ObjectInstance installMBean(MBeanElement element)
          Install a mbean with mbean metadata
 ObjectInstance updateMBean(MBeanElement element)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSIONS

public static final String VERSIONS
See Also:
Constant Field Values

DATE

public static final String DATE
See Also:
Constant Field Values
Constructor Detail

MBeanInstaller

public MBeanInstaller(MBeanServer server,
                      ClassLoader ctxClassLoader,
                      ObjectName loaderName)
               throws Exception
Create a new MBean installer instance.

Parameters:
server - reference to the MBean server where the new MBeans will be registered to
ctxClassLoader - Context class loader reference which will be stored in the registry for the new MBeans. This classloader will be set as the thread context classloader when the MBean is invoked.
loaderName - Object name of the classloader that should be used to instantiate the newly registered MBeans. This should normally be the object name of the MLet MBean that is installing the new MBeans.
Throws:
Exception
Method Detail

installMBean

public ObjectInstance installMBean(MBeanElement element)
                            throws MBeanException,
                                   ReflectionException,
                                   InstanceNotFoundException,
                                   MalformedObjectNameException
Install a mbean with mbean metadata

Parameters:
element - the data parsed from the Mlet file
Returns:
mbean instance
Throws:
MBeanException
ReflectionException
InstanceNotFoundException
MalformedObjectNameException

createMBean

public ObjectInstance createMBean(MBeanElement element)
                           throws MBeanException,
                                  ReflectionException,
                                  InstanceNotFoundException,
                                  MalformedObjectNameException
Throws:
MBeanException
ReflectionException
InstanceNotFoundException
MalformedObjectNameException

deserialize

public ObjectInstance deserialize(MBeanElement element)
                           throws MBeanException,
                                  ReflectionException,
                                  InstanceNotFoundException,
                                  MalformedObjectNameException
Throws:
MBeanException
ReflectionException
InstanceNotFoundException
MalformedObjectNameException

updateMBean

public ObjectInstance updateMBean(MBeanElement element)
                           throws MBeanException,
                                  ReflectionException,
                                  InstanceNotFoundException,
                                  MalformedObjectNameException
Throws:
MBeanException
ReflectionException
InstanceNotFoundException
MalformedObjectNameException


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.