站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 jmx API Documentation 英文版文档

MBeanInstaller (JBoss/JMX API) - JBoss 4.0.1 sp1 jmx API Documentation 英文版文档


org.jboss.mx.util
Class MBeanInstaller

java.lang.Object
  extended byorg.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 $

Revisions:

20020219 Juha Lindfors:

  • Clarified the use of classloaders in the code, renaming loader to a more explicit ctxClassLoader
  • Fixed some irregularities with the install/update code -- original implementatio was cause IndexOutOfBoundsExceptions which prevented some replacements in valid cases. Fixing this uncovered update logic that would replace MBeans that were not associated with versioning information at all.

    The current semantics should be:

    1. If an MBean is registered without versioning information it can never be automatically replaced by another MBean (regardless of the versioning information in the new MBean).
    2. An MBean that has a higher version number (as determined by the MLetVersion Comparable interface) can automatically replace an MBean that was registered with a lower version number.
    3. An MBean without versioning info can never automatically replace an MBean that was registered with version.
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.
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.