01: package demo.hw.server;
02:
03: import javax.management.MBeanServer;
04: import javax.management.ObjectName;
05: import javax.xml.ws.Endpoint;
06: import org.objectweb.celtix.Bus;
07:
08: public class Server implements ServerMBean {
09:
10: private static GreeterImpl implementor;
11: private String address;
12:
13: protected Server() throws Exception {
14: System.out.println("Starting Server");
15: implementor = new GreeterImpl();
16: address = "http://localhost:9000/SoapContext/SoapPort";
17: Endpoint.publish(address, implementor);
18: //register to the bus MBServer
19: Bus bus = Bus.getCurrent();
20: MBeanServer mbserver = bus.getInstrumentationManager()
21: .getMBeanServer();
22: ObjectName name = new ObjectName(
23: "org.objectweb.celtix.instrumentation:type=ServerMBean,Bus="
24: + bus.getBusID() + ",name=ServerMBean");
25: mbserver.registerMBean(this , name);
26: }
27:
28: public String getServiceName() {
29: return "SoapService";
30: }
31:
32: public String getAddress() {
33: return address;
34: }
35:
36: public static void main(String args[]) throws Exception {
37: new Server();
38: System.out.println("Server ready...");
39:
40: Thread.sleep(5 * 60 * 1000);
41:
42: System.out.println("Server exiting");
43: implementor.shutDown();
44: System.exit(0);
45: }
46:
47: }
|