org.jboss.mx.util
Class MBeanInstaller

java.lang.Object
  extended byorg.jboss.mx.util.MBeanInstaller

public class MBeanInstaller
extends java.lang.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.


Field Summary
static java.lang.String DATE
           
static java.lang.String VERSIONS
           
 
Constructor Summary
MBeanInstaller(MBeanServer (src)  server, java.lang.ClassLoader ctxClassLoader, ObjectName (src)  loaderName)
          Create a new MBean installer instance.
 
Method Summary
 ObjectInstance (src) createMBean(MBeanElement (src)  element)
           
 ObjectInstance (src) deserialize(MBeanElement (src)  element)
           
 ObjectInstance (src) installMBean(MBeanElement (src)  element)
          Install a mbean with mbean metadata
 ObjectInstance (src) updateMBean(MBeanElement (src)  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 java.lang.String VERSIONS
See Also:
Constant Field Values (src)

DATE

public static final java.lang.String DATE
See Also:
Constant Field Values (src)
Constructor Detail

MBeanInstaller

public MBeanInstaller(MBeanServer (src)  server,
                      java.lang.ClassLoader ctxClassLoader,
                      ObjectName (src)  loaderName)
               throws java.lang.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.
Method Detail

installMBean

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

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

createMBean

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

deserialize

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

updateMBean

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