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