01: /*****************************************************************************
02: * Copyright (C) NanoContainer Organization. All rights reserved. *
03: * ------------------------------------------------------------------------- *
04: * The software in this package is published under the terms of the BSD *
05: * style license a copy of which has been included with this distribution in *
06: * the LICENSE.txt file. *
07: * *
08: * Original code by Michael Ward *
09: *****************************************************************************/package org.picocontainer.gems.jmx.mx4j;
10:
11: import javax.management.DynamicMBean;
12: import javax.management.MBeanInfo;
13:
14: import org.picocontainer.gems.jmx.StandardMBeanFactory;
15:
16: /**
17: * This is the a factory for creating DynamicMBean instances. However it is tied specifically to MX4J. Those not
18: * interested in being dependent on MX4J should implement another Factory and register it to the container. The single
19: * difference to the StandardMBeanFactory is, that it does not need a special management interface for a component to
20: * expose.
21: * @author Michael Ward
22: * @version $Revision: 3905 $
23: */
24: public class MX4JDynamicMBeanFactory extends StandardMBeanFactory {
25:
26: /**
27: * Create a MX4JDynamicMBean for the component. MX4J is only used, if management is <code>null</code>.
28: * @see org.picocontainer.gems.jmx.StandardMBeanFactory#create(java.lang.Object, java.lang.Class,
29: * javax.management.MBeanInfo)
30: */
31: public DynamicMBean create(final Object componentInstance,
32: final Class management, final MBeanInfo mBeanInfo) {
33: if (management != null || mBeanInfo == null) {
34: return super .create(componentInstance, management,
35: mBeanInfo);
36: } else {
37: return new MX4JDynamicMBean(componentInstance, mBeanInfo);
38: }
39: }
40: }
|