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.management.ManageActionException;
18  
19  import javax.management.MBeanServer;
20  import javax.management.ObjectName;
21  
22  /**
23   * <a href="DoOperationAction.java.html"><b><i>View Source</i></b></a>
24   *
25   * @author Shuyang Zhou
26   */
27  public class DoOperationAction extends BaseJMXManageAction<Object> {
28  
29      public DoOperationAction(
30          ObjectName objectName, String operationName, Object[] parameters,
31          String[] signature) {
32  
33          _objectName = objectName;
34          _operationName = operationName;
35          _parameters = parameters;
36          _signature = signature;
37      }
38  
39      public Object action() throws ManageActionException {
40          try {
41              MBeanServer mBeanServer = getMBeanServer();
42  
43              return mBeanServer.invoke(
44                  _objectName, _operationName, _parameters, _signature);
45  
46          }
47          catch (Exception e) {
48              throw new ManageActionException(e);
49          }
50      }
51  
52      private ObjectName _objectName;
53      private String _operationName;
54      private Object[] _parameters;
55      private String[] _signature;
56  
57  }