01: /* JFox, the OpenSource J2EE Application Server
02: *
03: * Copyright (C) 2002 huihoo.org
04: * Distributable under GNU LGPL license
05: * See the GNU Lesser General Public License for more details.
06: */
07:
08: package example.jmx.query;
09:
10: import java.util.Set;
11: import java.util.Iterator;
12:
13: import javax.management.MBeanServer;
14: import javax.management.MBeanServerFactory;
15: import javax.management.ObjectName;
16:
17: /**
18: *
19: * @author <a href="mailto:young_yy@hotmail.org">Young Yang</a>
20: */
21:
22: public class SimpleQuery {
23:
24: public static void main(String[] args) throws Exception {
25: MBeanServer server = MBeanServerFactory.createMBeanServer();
26: server.createMBean("example.jmx.standard.SimpleStandard",
27: new ObjectName(":name=simple"));
28: ObjectName on = new ObjectName("*:*");
29: Set set = server.queryNames(on, null);
30: Iterator it = set.iterator();
31: while (it.hasNext()) {
32: System.out.println(it.next());
33: }
34:
35: }
36: }
|