mx4j.server
Class ChainedMBeanServerBuilder

java.lang.Object
  extended byjavax.management.MBeanServerBuilder
      extended bymx4j.server.ChainedMBeanServerBuilder

public class ChainedMBeanServerBuilder
extends javax.management.MBeanServerBuilder

Base class for chained MBeanServerBuilders.
By default this class delegates all method calls to the nested MBeanServerBuilder.
See the MX4J documentation on how to use correctly this class.

Example implementation:

 public class LoggingBuilder extends ChainedMBeanServerBuilder
 {
    public LoggingBuilder()
    {
       super(new MX4JMBeanServerBuilder());
    }
 

public MBeanServer newMBeanServer(String defaultDomain, MBeanServer outer, MBeanServerDelegate delegate) { LoggingMBeanServer external = new LoggingMBeanServer(); MBeanServer nested = getBuilder().newMBeanServer(defaultDomain, outer == null ? external : outer, delegate); external.setMBeanServer(nested); return external; } }

public class LoggingMBeanServer extends ChainedMBeanServer { protected void setMBeanServer(MBeanServer server) { super.setMBeanServer(server); }

public Object getAttribute(ObjectName objectName, String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException { Object value = super.getAttribute(objectName, attribute); System.out.println("Value is: " + value); return value; }

... }

Version:
$Revision: 1.3 $

Constructor Summary
ChainedMBeanServerBuilder(javax.management.MBeanServerBuilder builder)
          Creates a new chained MBeanServerBuilder
 
Method Summary
protected  javax.management.MBeanServerBuilder getMBeanServerBuilder()
          Returns the chained MBeanServerBuilder this object delegates to.
 javax.management.MBeanServer newMBeanServer(java.lang.String defaultDomain, javax.management.MBeanServer outer, javax.management.MBeanServerDelegate delegate)
          Forwards the call to the chained builder.
 javax.management.MBeanServerDelegate newMBeanServerDelegate()
          Forwards the call to the chained builder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChainedMBeanServerBuilder

public ChainedMBeanServerBuilder(javax.management.MBeanServerBuilder builder)
Creates a new chained MBeanServerBuilder

Parameters:
builder - The MBeanServerBuilder this object delegates to.
Method Detail

newMBeanServerDelegate

public javax.management.MBeanServerDelegate newMBeanServerDelegate()
Forwards the call to the chained builder.

See Also:
MBeanServerBuilder.newMBeanServerDelegate()

newMBeanServer

public javax.management.MBeanServer newMBeanServer(java.lang.String defaultDomain,
                                                   javax.management.MBeanServer outer,
                                                   javax.management.MBeanServerDelegate delegate)
Forwards the call to the chained builder.

See Also:
MBeanServerBuilder.newMBeanServer(java.lang.String, javax.management.MBeanServer, javax.management.MBeanServerDelegate)

getMBeanServerBuilder

protected javax.management.MBeanServerBuilder getMBeanServerBuilder()
Returns the chained MBeanServerBuilder this object delegates to.



Copyright © 2001-2005 The MX4J Contributors. All Rights Reserved.