001    /*****************************************************************************
002     * Copyright (C) NanoContainer Organization. All rights reserved.            *
003     * ------------------------------------------------------------------------- *
004     * The software in this package is published under the terms of the BSD      *
005     * style license a copy of which has been included with this distribution in *
006     * the LICENSE.txt file.                                                     *
007     *                                                                           *
008     * Original code by Joerg Schaible                                           *
009     *****************************************************************************/
010    
011    package org.picocontainer.gems.jmx;
012    
013    import javax.management.MBeanInfo;
014    import javax.management.NotCompliantMBeanException;
015    import javax.management.StandardMBean;
016    
017    
018    /**
019     * StandardMBean with a provided MBeanInfo.
020     * @author Jörg Schaible
021     */
022    public final class StandardNanoMBean extends StandardMBean {
023        private final MBeanInfo mBeanInfo;
024    
025        /**
026         * Construct a StandardNanoMBean. The only difference to a {@link StandardMBean} of the JSR 3 is the user provided
027         * {@link MBeanInfo}.
028         * @param implementation
029         * @param management
030         * @param mBeanInfo
031         * @throws NotCompliantMBeanException
032         */
033        public StandardNanoMBean(final Object implementation, final Class management, final MBeanInfo mBeanInfo)
034                throws NotCompliantMBeanException {
035            super(implementation, management);
036            this.mBeanInfo = mBeanInfo;
037        }
038    
039        /**
040         * Return the provided {@link MBeanInfo}.
041         * @see javax.management.StandardMBean#getMBeanInfo()
042         */
043        @Override
044            public MBeanInfo getMBeanInfo() {
045            return mBeanInfo;
046        }
047    }