| 1 | // jademx - JADE management using JMX |
| 2 | // Copyright 2005 Caboodle Networks, Inc. |
| 3 | // |
| 4 | // This library is free software; you can redistribute it and/or |
| 5 | // modify it under the terms of the GNU Lesser General Public |
| 6 | // License as published by the Free Software Foundation; either |
| 7 | // version 2.1 of the License, or (at your option) any later version. |
| 8 | // |
| 9 | // This library is distributed in the hope that it will be useful, |
| 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | // Lesser General Public License for more details. |
| 13 | // |
| 14 | // You should have received a copy of the GNU Lesser General Public |
| 15 | // License along with this library; if not, write to the Free Software |
| 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
| 17 | |
| 18 | |
| 19 | package jade.jademx.server; |
| 20 | |
| 21 | /** |
| 22 | * JadeMXServer for JBoss <code>MBeanServerLocator</code> |
| 23 | * @author David Bernstein, <a href="http://www.caboodlenetworks.com" |
| 24 | * >Caboodle Networks, Inc.</a>* |
| 25 | */ |
| 26 | public class JBossMBeanServerLocator extends StaticMethod { |
| 27 | |
| 28 | /** name of JBoss <code>MBeanServerLocator</code> class */ |
| 29 | private final static String CLASS_NAME = |
| 30 | "org.jboss.mx.util.MBeanServerLocator"; |
| 31 | |
| 32 | /** want to use <code>locate</code> method */ |
| 33 | public final static String LOCATE = "locate"; |
| 34 | |
| 35 | /** want to use <code>locateJBoss</code> method */ |
| 36 | public final static String LOCATE_JBOSS = "locateJBoss"; |
| 37 | |
| 38 | /** |
| 39 | * make a JadeMXServer for JBoss <code>MBeanServerLocator.locateJBoss</code> |
| 40 | */ |
| 41 | public JBossMBeanServerLocator() { |
| 42 | this( LOCATE_JBOSS, null ); |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * make a JadeMXServer for JBoss <code>MBeanServerLocator</code> given agent |
| 47 | * @param methodName <code>locate</code> or <code>locateJBoss</code> |
| 48 | * @param agentID this is the JMX agentID, not the JADE agentID |
| 49 | */ |
| 50 | protected JBossMBeanServerLocator( String methodName, String agentID ) { |
| 51 | this( |
| 52 | |
| 53 | methodName, |
| 54 | |
| 55 | ((LOCATE_JBOSS.equals(methodName) || (null==agentID)) |
| 56 | ? ( new Class[] { } ) |
| 57 | : ( new Class[] {String.class} ) ), |
| 58 | |
| 59 | |
| 60 | ((LOCATE_JBOSS.equals(methodName) || (null==agentID)) |
| 61 | ? ( new Object[] { } ) |
| 62 | : ( new Object[] {agentID} ) ) |
| 63 | |
| 64 | ); |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * @param methodName |
| 69 | * @param signature |
| 70 | * @param arguments |
| 71 | */ |
| 72 | private JBossMBeanServerLocator( |
| 73 | String methodName, |
| 74 | Class signature[], |
| 75 | Object arguments[] ) { |
| 76 | super( CLASS_NAME, methodName, signature, arguments ); |
| 77 | } |
| 78 | |
| 79 | } |