01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */package org.apache.cxf.systest.http;
19:
20: import java.net.URL;
21:
22: import org.apache.cxf.bus.spring.SpringBusFactory;
23: import org.apache.cxf.jaxws.EndpointImpl;
24: import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
25:
26: public class Server extends AbstractBusTestServerBase {
27:
28: private String name;
29: private String address;
30: private URL configFileURL;
31:
32: public Server(String[] args) throws Exception {
33: this (args[0], args[1], args[2]);
34: }
35:
36: public Server(String n, String addr, String conf) throws Exception {
37: name = n;
38: address = addr;
39: configFileURL = new URL(conf);
40: //System.out.println("Starting " + name
41: // + " Server at " + address
42: // + " with config " + configFileURL);
43:
44: }
45:
46: protected void run() {
47: // We use a null binding id in the call to EndpointImpl
48: // constructor. Why?
49: final String nullBindingID = null;
50:
51: // We need to specify to use defaults on constructing the
52: // bus, because our configuration file doesn't have
53: // everything needed.
54: final boolean useDefaults = true;
55:
56: // We configure a new bus for this server.
57: setBus(new SpringBusFactory().createBus(configFileURL,
58: useDefaults));
59:
60: // This impl class must have the appropriate annotations
61: // to match the WSDL file that we are using.
62: Object implementor = new GreeterImpl(name);
63:
64: // I don't know why this works.
65: EndpointImpl ep = new EndpointImpl(getBus(), implementor,
66: nullBindingID, this .getClass().getResource(
67: "resources/greeting.wsdl").toString());
68: // How the hell do I know what the name of the
69: // http-destination is from using this call?
70:
71: ep.publish(address);
72: }
73:
74: public static void main(String[] args) {
75: try {
76: Server s = new Server(args);
77: s.start();
78: } catch (Exception ex) {
79: ex.printStackTrace();
80: System.exit(-1);
81: } /*finally {
82: System.out.println("done!");
83: } */
84: }
85: }
|