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.ws.rm;
19:
20: import java.util.logging.Logger;
21:
22: import javax.jws.WebService;
23: import javax.xml.ws.Endpoint;
24:
25: import org.apache.cxf.BusFactory;
26: import org.apache.cxf.bus.spring.SpringBusFactory;
27: import org.apache.cxf.interceptor.Interceptor;
28: import org.apache.cxf.interceptor.LoggingInInterceptor;
29: import org.apache.cxf.interceptor.LoggingOutInterceptor;
30:
31: @WebService(serviceName="ControlService",portName="ControlPort",endpointInterface="org.apache.cxf.greeter_control.Control",targetNamespace="http://cxf.apache.org/greeter_control")
32: public class ControlImpl extends
33: org.apache.cxf.greeter_control.ControlImpl {
34:
35: private static final Logger LOG = Logger
36: .getLogger(ControlImpl.class.getName());
37:
38: @Override
39: public boolean startGreeter(String cfgResource) {
40: String derbyHome = System.getProperty("derby.system.home");
41: try {
42: System.setProperty("derby.system.home", derbyHome
43: + "-server");
44: SpringBusFactory bf = new SpringBusFactory();
45: greeterBus = bf.createBus(cfgResource);
46: BusFactory.setDefaultBus(greeterBus);
47: LOG.info("Initialised bus " + greeterBus
48: + " with cfg file resource: " + cfgResource);
49: LOG.fine("greeterBus inInterceptors: "
50: + greeterBus.getInInterceptors());
51:
52: Interceptor logIn = new LoggingInInterceptor();
53: Interceptor logOut = new LoggingOutInterceptor();
54: greeterBus.getInInterceptors().add(logIn);
55: greeterBus.getOutInterceptors().add(logOut);
56: greeterBus.getOutFaultInterceptors().add(logOut);
57:
58: Endpoint.publish(address, implementor);
59: LOG.info("Published greeter endpoint.");
60: } finally {
61: if (derbyHome != null) {
62: System.setProperty("derby.system.home", derbyHome);
63: } else {
64: System.clearProperty("derby.system.home");
65: }
66: }
67:
68: return true;
69: }
70:
71: }
|