1 package org.apache.tools.ant.taskdefs.optional.jmx.connector; 2 3 52 53 60 public class JMXConnectorFactory { 61 62 65 private JMXConnectorFactory() { 66 } 67 68 83 public static JMXConnector createConnector(String serverType) 84 throws ClassNotFoundException , InstantiationException , 85 IllegalAccessException { 86 87 try { 88 Class connectorClass = JMXConnectorFactory.class.getClassLoader().loadClass("org.apache.tools.ant.taskdefs.optional.jmx.connector."+serverType+".Connector"); 89 90 JMXConnector connector = (JMXConnector) connectorClass.newInstance(); 91 return connector; 92 } catch (Exception x) { 93 Class connectorClass = JMXConnectorFactory.class.getClassLoader().loadClass(serverType); 94 95 JMXConnector connector = (JMXConnector) connectorClass.newInstance(); 96 return connector; 97 } 98 99 } 100 101 102 } 103 104 117 | Popular Tags |