1 7 8 10 package org.jboss.net.axis.server; 11 12 import org.jboss.axis.EngineConfiguration; 13 import org.jboss.axis.EngineConfigurationFactory; 14 import org.jboss.axis.server.AxisServer; 15 import org.jboss.mx.util.MBeanServerLocator; 16 17 import javax.management.JMException ; 18 import javax.management.MBeanServer ; 19 import javax.management.MalformedObjectNameException ; 20 import javax.management.ObjectName ; 21 22 29 30 public class JMXEngineConfigurationFactory 31 implements EngineConfigurationFactory 32 { 33 34 38 protected ObjectName objectName; 39 protected MBeanServer server; 40 41 45 46 47 protected JMXEngineConfigurationFactory(String name) 48 throws MalformedObjectNameException 49 { 50 server = MBeanServerLocator.locateJBoss(); 51 this.objectName = new ObjectName (name); 52 } 53 54 58 61 62 protected Object getAttribute(String attributeName) 63 { 64 try 65 { 66 return server.getAttribute(objectName, attributeName); 67 } 68 catch (JMException e) 69 { 70 return null; 71 } 72 } 73 74 78 79 public AxisServer getAxisServer() 80 { 81 return (AxisServer)getAttribute("AxisServer"); 82 } 83 84 87 public EngineConfiguration getClientEngineConfig() 88 { 89 return (EngineConfiguration)getAttribute("ClientEngineConfiguration"); 90 } 91 92 95 public EngineConfiguration getServerEngineConfig() 96 { 97 return (EngineConfiguration)getAttribute("ServerEngineConfiguration"); 98 } 99 100 105 public static JMXEngineConfigurationFactory newJMXFactory(String param) 106 { 107 try 108 { 109 return new JMXEngineConfigurationFactory((String )param); 110 } 111 catch (MalformedObjectNameException e) 112 { 113 return null; 114 } 115 } 116 117 122 123 public static EngineConfigurationFactory newFactory(Object param) 124 { 125 if (param instanceof String ) 126 { 127 return newJMXFactory((String )param); 128 } 129 else 130 { 131 return null; 132 } 133 } 134 135 } 136 | Popular Tags |