KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejtools > jmx > browser > model > connector > MX4J200IIOPConnectionService


1 /*
2
3  * EJTools, the Enterprise Java Tools
4
5  *
6
7  * Distributable under LGPL license.
8
9  * See terms of license at www.gnu.org.
10
11  */

12
13 package org.ejtools.jmx.browser.model.connector;
14
15
16
17 import java.util.Hashtable JavaDoc;
18
19
20
21 import javax.management.MBeanServer JavaDoc;
22
23 import javax.naming.Context JavaDoc;
24
25
26
27 import mx4j.tools.connector.RemoteMBeanServer;
28
29 import mx4j.tools.connector.rmi.iiop.IIOPConnector;
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 /**
42
43  * @author Laurent Etiemble
44
45  * @version $Revision: 1.1 $
46
47  */

48
49 public class MX4J200IIOPConnectionService extends AbstractConnectionService
50
51 {
52
53    /** Description of the Field */
54
55    protected IIOPConnector 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 JavaDoc e)
78
79       {
80
81          // Do nothing
82

83       }
84
85       this.setConnected(false);
86
87    }
88
89
90
91
92
93    /**
94
95     * @exception Exception Description of the Exception
96
97     */

98
99    protected void createMBeanServer()
100
101       throws Exception JavaDoc
102
103    {
104
105       System.setProperty("jmx.serial.form", "1.2");
106
107
108
109       Hashtable JavaDoc props = new Hashtable JavaDoc();
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 IIOPConnector();
124
125       this.connector.connect(this.profile.getProperty(ConnectionMetaData.CONTEXT), props);
126
127
128
129       RemoteMBeanServer remoteServer = this.connector.getRemoteMBeanServer();
130
131       MBeanServer JavaDoc mbeanServer = MBeanServerProxy.createMBeanProxy(remoteServer, RemoteMBeanServer.class);
132
133       this.setMBeanServer(mbeanServer);
134
135    }
136
137 }
138
139
Popular Tags