1 4 package com.tc.management.remote.protocol.terracotta; 5 6 import java.io.IOException ; 7 import java.net.MalformedURLException ; 8 import java.util.HashMap ; 9 import java.util.Map ; 10 11 import javax.management.MBeanServer ; 12 import javax.management.remote.JMXConnectorServer ; 13 import javax.management.remote.JMXConnectorServerProvider ; 14 import javax.management.remote.JMXServiceURL ; 15 import javax.management.remote.generic.GenericConnectorServer; 16 17 public class ServerProvider implements JMXConnectorServerProvider { 18 19 public JMXConnectorServer newJMXConnectorServer(final JMXServiceURL jmxServiceURL, final Map initialEnvironment, 20 final MBeanServer mBeanServer) throws IOException { 21 if (!jmxServiceURL.getProtocol().equals("terracotta")) { 22 MalformedURLException exception = new MalformedURLException ("Protocol not terracotta: " 23 + jmxServiceURL.getProtocol()); 24 throw exception; 25 } 26 Map terracottaEnvironment = initialEnvironment != null ? new HashMap (initialEnvironment) : new HashMap (); 27 terracottaEnvironment.put(GenericConnectorServer.MESSAGE_CONNECTION_SERVER, 28 new TunnelingMessageConnectionServer(jmxServiceURL)); 29 return new GenericConnectorServer(terracottaEnvironment, mBeanServer); 30 } 31 32 } 33 | Popular Tags |