1 12 13 package org.ejtools.jmx.browser.model.connector; 14 15 16 17 import java.util.Hashtable ; 18 19 20 21 import javax.management.MBeanServer ; 22 23 import javax.naming.Context ; 24 25 26 27 import mx4j.connector.RemoteMBeanServer; 28 29 import mx4j.connector.rmi.jrmp.JRMPConnector; 30 31 32 33 import org.ejtools.jmx.MBeanServerProxy; 34 35 import org.ejtools.jmx.browser.model.service.ConnectionMetaData; 36 37 38 39 40 41 48 49 public class MX4J111JRMPConnectionService extends AbstractConnectionService 50 51 { 52 53 54 55 protected JRMPConnector connector = null; 56 57 58 59 60 61 62 63 public void disconnect() 64 65 { 66 67 super.disconnect(); 68 69 try 70 71 { 72 73 this.connector.close(); 74 75 } 76 77 catch (Exception e) 78 79 { 80 81 83 } 84 85 this.setConnected(false); 86 87 } 88 89 90 91 92 93 98 99 protected void createMBeanServer() 100 101 throws Exception 102 103 { 104 105 System.setProperty("jmx.serial.form", "1.1"); 106 107 108 109 Hashtable props = new Hashtable (); 110 111 props.put(Context.INITIAL_CONTEXT_FACTORY, this.profile.getProperty(ConnectionMetaData.FACTORY)); 112 113 props.put(Context.URL_PKG_PREFIXES, this.profile.getProperty(ConnectionMetaData.PACKAGES)); 114 115 props.put(Context.PROVIDER_URL, this.profile.getProperty(ConnectionMetaData.URL)); 116 117 props.put(Context.SECURITY_PRINCIPAL, this.profile.getProperty(ConnectionMetaData.PRINCIPAL)); 118 119 props.put(Context.SECURITY_CREDENTIALS, this.profile.getProperty(ConnectionMetaData.CREDENTIALS)); 120 121 122 123 this.connector = new JRMPConnector(); 124 125 this.connector.connect(this.profile.getProperty(ConnectionMetaData.CONTEXT), props); 126 127 128 129 RemoteMBeanServer remoteServer = this.connector.getRemoteMBeanServer(); 130 131 MBeanServer mbeanServer = MBeanServerProxy.createMBeanProxy(remoteServer, RemoteMBeanServer.class); 132 133 this.setMBeanServer(mbeanServer); 134 135 } 136 137 } 138 139 | Popular Tags |