1 8 9 package mx4j.tools.remote.http; 10 11 import java.io.IOException ; 12 import java.util.Map ; 13 import javax.management.MBeanServerConnection ; 14 import javax.security.auth.Subject ; 15 16 import mx4j.remote.DefaultRemoteNotificationServerHandler; 17 import mx4j.remote.RemoteNotificationServerHandler; 18 import mx4j.tools.remote.AbstractConnectionManager; 19 import mx4j.tools.remote.AbstractJMXConnectorServer; 20 import mx4j.tools.remote.Connection; 21 22 25 public class HTTPConnectionManager extends AbstractConnectionManager 26 { 27 private final MBeanServerConnection mbeanServerConnection; 28 private final String protocol; 29 30 public HTTPConnectionManager(AbstractJMXConnectorServer server, String protocol, Map environment) 31 { 32 super(server, environment); 33 this.mbeanServerConnection = server.getMBeanServer(); 34 this.protocol = protocol; 35 } 36 37 public String getProtocol() 38 { 39 return protocol; 40 } 41 42 protected Connection doConnect(String connectionId, Subject subject) throws IOException 43 { 44 RemoteNotificationServerHandler notificationHandler = new DefaultRemoteNotificationServerHandler(getEnvironment()); 45 HTTPConnection invoker = new HTTPServerInvoker(mbeanServerConnection, notificationHandler); 46 HTTPConnection subjectInvoker = HTTPSubjectInvoker.newInstance(invoker, subject, getSecurityContext(), getEnvironment()); 47 Connection handler = new HTTPConnectionHandler(subjectInvoker, this, connectionId); 48 return handler; 49 } 50 51 55 protected void doClose() throws IOException 56 { 57 } 58 59 63 protected void doCloseConnection(Connection connection) throws IOException 64 { 65 } 66 } 67 | Popular Tags |