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.interceptor;
09:
10: import javax.management.MBeanServer;
11: import javax.management.MBeanServerFactory;
12: import javax.management.ObjectName;
13:
14: import org.huihoo.jfox.jmx.adaptor.http.HtmlAdaptorServer;
15: import org.huihoo.jfox.jmx.ExtendedMBeanServerDelegate;
16:
17: /**
18: *
19: * @author <a href="mailto:young_yy@hotmail.org">Young Yang</a>
20: */
21:
22: public class InterceptorAgent {
23:
24: public static void main(String[] args) throws Exception {
25: MBeanServer server = MBeanServerFactory.createMBeanServer();
26: ObjectName on = new ObjectName(":type=interceptor");
27: server
28: .createMBean(
29: "org.huihoo.jfox.jmx.interceptor.MBeanServerInterceptorListener",
30: on);
31: server.addNotificationListener(ExtendedMBeanServerDelegate
32: .getObjectName(), on, null, null);
33: server.createMBean("example.jmx.standard.SimpleStandard",
34: new ObjectName(":type=simple"));
35: ObjectName haName = new ObjectName(
36: "Adaptor:type=HtmlAdaptor,port=8088");
37:
38: HtmlAdaptorServer ha = new HtmlAdaptorServer();
39: server.registerMBean(ha, haName);
40: ha.start();
41:
42: }
43: }
|