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