01: package org.objectweb.hello_world_soap_http;
02:
03: import javax.xml.ws.Endpoint;
04:
05: import org.objectweb.celtix.Bus;
06:
07: public class GreeterServerMain {
08:
09: protected GreeterServerMain() {
10: }
11:
12: public static void main(String args[]) throws Exception {
13: System.out.println("Starting Server");
14:
15: /**
16: * Creation of the endpoint could be part of the bus initialisation
17: * based on configuration. For now, do it manually.
18: */
19:
20: Bus bus = Bus.init(args);
21: Runtime.getRuntime().addShutdownHook(
22: new Thread(
23: new GreeterServerMain().new TerminationHandler(
24: bus, true)));
25: Object implementor = new AnnotatedGreeterImpl();
26: String address = "http://loalhost:8080/hello_world_soap_http";
27: Endpoint.publish(address, implementor);
28: bus.run();
29: }
30:
31: private class TerminationHandler implements Runnable {
32: private final Bus bus;
33: private final boolean processRemainingTasks;
34:
35: TerminationHandler(Bus b, boolean p) {
36: bus = b;
37: processRemainingTasks = p;
38: }
39:
40: public void run() {
41: try {
42: bus.shutdown(processRemainingTasks);
43: } catch (Exception ex) {
44: System.err.println("Failed to shutdown the bus:\n"
45: + ex.getMessage());
46: }
47: }
48: }
49: }
|