1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.kernel.management.jmx;
16  
17  import com.liferay.portal.kernel.jmx.model.MBean;
18  import com.liferay.portal.kernel.management.ManageActionException;
19  
20  import javax.management.MBeanInfo;
21  import javax.management.MBeanServer;
22  import javax.management.ObjectName;
23  
24  /**
25   * <a href="LoadMBeanInfoAction.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Shuyang Zhou
28   */
29  public class LoadMBeanInfoAction extends BaseJMXManageAction<MBean> {
30  
31      public LoadMBeanInfoAction(MBean mBean) {
32          _mBean = mBean;
33      }
34  
35      public MBean action() throws ManageActionException {
36          try {
37              ObjectName objectName = _mBean.getObjectName();
38  
39              MBeanServer mBeanServer = getMBeanServer();
40  
41              MBeanInfo mBeanInfo = mBeanServer.getMBeanInfo(objectName);
42  
43              return new MBean(objectName, mBeanInfo);
44          }
45          catch (Exception e) {
46              throw new ManageActionException(e);
47          }
48      }
49  
50      private MBean _mBean;
51  
52  }