KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > hello_world_soap_http > GreeterServerMain


1 package org.objectweb.hello_world_soap_http;
2
3 import javax.xml.ws.Endpoint;
4
5 import org.objectweb.celtix.Bus;
6
7 public class GreeterServerMain {
8
9     protected GreeterServerMain() {
10     }
11
12     public static void main(String JavaDoc args[]) throws Exception JavaDoc {
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 JavaDoc(new GreeterServerMain().new TerminationHandler(bus, true)));
23         Object JavaDoc implementor = new AnnotatedGreeterImpl();
24         String JavaDoc address = "http://loalhost:8080/hello_world_soap_http";
25         Endpoint.publish(address, implementor);
26         bus.run();
27     }
28
29     private class TerminationHandler implements Runnable JavaDoc {
30         private final Bus bus;
31         private final boolean processRemainingTasks;
32
33         TerminationHandler(Bus b, boolean p) {
34             bus = b;
35             processRemainingTasks = p;
36         }
37
38         public void run() {
39             try {
40                 bus.shutdown(processRemainingTasks);
41             } catch (Exception JavaDoc ex) {
42                 System.err.println("Failed to shutdown the bus:\n" + ex.getMessage());
43             }
44         }
45     }
46 }
47
Popular Tags