01: package org.objectweb.celtix.systest.ws.rm;
02:
03: import java.net.URL;
04: import java.util.concurrent.Future;
05: import java.util.logging.Logger;
06:
07: import javax.jws.WebService;
08: import javax.xml.namespace.QName;
09: import javax.xml.ws.AsyncHandler;
10: import javax.xml.ws.Endpoint;
11: import javax.xml.ws.Response;
12:
13: import org.objectweb.celtix.greeter_control.Control;
14: import org.objectweb.celtix.greeter_control.types.StartGreeterResponse;
15: import org.objectweb.celtix.greeter_control.types.StopGreeterResponse;
16:
17: @WebService(serviceName="ControlService",portName="ControlPort",endpointInterface="org.objectweb.celtix.greeter_control.Control",targetNamespace="http://celtix.objectweb.org/greeter_control")
18: public class ControlImpl implements Control {
19:
20: private static final Logger LOG = Logger
21: .getLogger(ControlImpl.class.getName());
22: private static QName serviceName = new QName(
23: "http://celtix.objectweb.org/greeter_control",
24: "GreeterService");
25: private Endpoint endpoint;
26:
27: public boolean startGreeter(String configuration) {
28:
29: if (!(null == configuration || "".equals(configuration))) {
30: setConfigFileProperty(configuration);
31: }
32:
33: TestConfigurator tc = new TestConfigurator();
34: tc.configureServer(serviceName);
35:
36: GreeterImpl implementor = new GreeterImpl();
37: String address = "http://localhost:9000/SoapContext/GreeterPort";
38: endpoint = Endpoint.publish(address, implementor);
39:
40: return true;
41: }
42:
43: public boolean stopGreeter() {
44:
45: if (null != endpoint) {
46: LOG.info("Stopping Greeter endpoint");
47: endpoint.stop();
48: } else {
49: LOG.info("No endpoint active.");
50: }
51: endpoint = null;
52: return true;
53: }
54:
55: public static void setConfigFileProperty(String cfgName) {
56: URL url = ControlImpl.class.getResource(cfgName + ".xml");
57: if (null == url) {
58: LOG.severe("cannot find test resource " + cfgName + ".xml");
59: return;
60: }
61: String configFileName = url.toString();
62: System.setProperty("celtix.config.file", configFileName);
63: }
64:
65: public Future<?> startGreeterAsync(String requestType,
66: AsyncHandler<StartGreeterResponse> asyncHandler) {
67: // never called
68: return null;
69: }
70:
71: public Response<StartGreeterResponse> startGreeterAsync(
72: String requestType) {
73: // never called
74: return null;
75: }
76:
77: public Response<StopGreeterResponse> stopGreeterAsync() {
78: // never called
79: return null;
80: }
81:
82: public Future<?> stopGreeterAsync(
83: AsyncHandler<StopGreeterResponse> asyncHandler) {
84: // never called
85: return null;
86: }
87:
88: }
|