001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.management.jmx;
016    
017    import com.liferay.portal.kernel.jmx.model.MBean;
018    import com.liferay.portal.kernel.management.ManageActionException;
019    
020    import javax.management.MBeanInfo;
021    import javax.management.MBeanServer;
022    import javax.management.ObjectName;
023    
024    /**
025     * @author Shuyang Zhou
026     */
027    public class LoadMBeanInfoAction extends BaseJMXManageAction {
028    
029            public LoadMBeanInfoAction(MBean mBean) {
030                    _mBean = mBean;
031            }
032    
033            public void action() throws ManageActionException {
034                    try {
035                            ObjectName objectName = _mBean.getObjectName();
036    
037                            MBeanServer mBeanServer = getMBeanServer();
038    
039                            MBeanInfo mBeanInfo = mBeanServer.getMBeanInfo(objectName);
040    
041                            _mBean = new MBean(objectName, mBeanInfo);
042                    }
043                    catch (Exception e) {
044                            throw new ManageActionException(e);
045                    }
046            }
047    
048            public MBean getMBean() {
049                    return _mBean;
050            }
051    
052            private MBean _mBean;
053    
054    }