KickJava   Java API By Example, From Geeks To Geeks.

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


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.ArrayList JavaDoc;
18
19
20
21 import javax.management.MBeanServer JavaDoc;
22
23 import javax.management.MBeanServerFactory JavaDoc;
24
25
26
27
28
29 /**
30
31  * Local connection to a MBean server.
32
33  * The reference to the MBean server is get by a call to the MBeanServerFactory class.
34
35  * If several servers are registered, the first is taken.
36
37  *
38
39  * @author letiemble
40
41  * @created 4 septembre 2002
42
43  * @version $Revision: 1.6 $
44
45  */

46
47 public class LocalConnectionService extends AbstractConnectionService
48
49 {
50
51    /**
52
53     * Description of the Method
54
55     *
56
57     * @exception Exception Description of the Exception
58
59     */

60
61    public void createMBeanServer()
62
63       throws Exception JavaDoc
64
65    {
66
67       MBeanServer JavaDoc server = null;
68
69
70
71       ArrayList JavaDoc servers = MBeanServerFactory.findMBeanServer(null);
72
73       if ((servers == null) || (servers.size() == 0))
74
75       {
76
77          throw new Exception JavaDoc("No MBeanServer found !!!");
78
79       }
80
81       server = (MBeanServer JavaDoc) servers.get(0);
82
83       this.setMBeanServer(server);
84
85    }
86
87 }
88
89
Popular Tags