01: /* JFox, the OpenSource J2EE Application Server
02: *
03: * Copyright (C) 2002 huihoo.com
04: * Distributable under GNU LGPL license
05: * See the GNU Lesser General Public License for more details.
06: */
07:
08: package org.huihoo.jfox.jmx.adaptor.http;
09:
10: import javax.management.ObjectName;
11: import javax.management.MBeanRegistration;
12: import javax.management.MBeanServer;
13:
14: /**
15: *
16: * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
17: */
18:
19: public class HtmlAdaptorServer implements HtmlAdaptorServerMBean,
20: MBeanRegistration {
21:
22: private HttpServer httpServer = null;
23:
24: public void stop() {
25: try {
26: httpServer.stop();
27: } catch (Exception e) {
28: e.printStackTrace();
29: }
30: }
31:
32: public void start() {
33: try {
34: httpServer.start();
35: } catch (Exception e) {
36: e.printStackTrace();
37: }
38: }
39:
40: public void setPort(int port) {
41: httpServer.setPort(port);
42: }
43:
44: public int getPort() {
45: return httpServer.getPort();
46: }
47:
48: public String getHost() {
49: return httpServer.getHost();
50: }
51:
52: public ObjectName preRegister(MBeanServer mbeanServer,
53: ObjectName objectName) throws Exception {
54: httpServer = new HttpServer(mbeanServer);
55: if (objectName == null)
56: objectName = new ObjectName(mbeanServer.getDefaultDomain(),
57: "Service", "HtmlAdaptor");
58: return objectName;
59: }
60:
61: public void postRegister(Boolean boolean1) {
62:
63: }
64:
65: public void preDeregister() throws Exception {
66: this .stop();
67: }
68:
69: public void postDeregister() {
70:
71: }
72:
73: public static void main(String[] args) {
74:
75: }
76: }
|