View Javadoc

1   /*
2    * $Id: JmxModernSupport.java 11234 2008-03-06 23:44:34Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  package org.mule.module.management.support;
11  
12  import java.util.Arrays;
13  import java.util.Collection;
14  
15  import javax.management.MBeanServer;
16  import javax.management.MalformedObjectNameException;
17  import javax.management.ObjectName;
18  
19  /**
20   * Support class using JMX 1.2 and newer calls.
21   */
22  public class JmxModernSupport extends AbstractJmxSupport
23  {
24  
25      /** {@inheritDoc} */
26      public String escape(String input)
27      {
28          return ObjectName.quote(input);
29      }
30  
31      /**
32       * For modern JMX implementation just delegate to a standard factory method.
33       * @param name object name
34       * @return ObjectName for MBeanServer
35       * @throws MalformedObjectNameException for invalid names
36       */
37      public ObjectName getObjectName(String name) throws MalformedObjectNameException
38      {
39          return ObjectName.getInstance(name);
40      }
41  
42      /** {@inheritDoc} */
43      protected Collection getDomains(final MBeanServer server)
44      {
45          return Arrays.asList(server.getDomains());
46      }
47  }