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.factory_pattern;
19:
20: import javax.jws.WebService;
21: import javax.xml.namespace.QName;
22:
23: import org.apache.cxf.BusFactory;
24: import org.apache.cxf.jaxws.EndpointImpl;
25: import org.apache.cxf.ws.addressing.EndpointReferenceType;
26: import org.apache.cxf.wsdl.EndpointReferenceUtils;
27:
28: @WebService(serviceName="NumberFactoryService",portName="NumberFactoryPort",endpointInterface="org.apache.cxf.factory_pattern.NumberFactory",targetNamespace="http://cxf.apache.org/factory_pattern")
29: public class ManualNumberFactoryImpl extends NumberFactoryImpl {
30:
31: public EndpointReferenceType create(String id) {
32: manageNumberServantInitialisation();
33:
34: // manually force id into address context as context appendage
35: EndpointReferenceType epr = EndpointReferenceUtils
36: .duplicate(templateEpr);
37: EndpointReferenceUtils.setAddress(epr, EndpointReferenceUtils
38: .getAddress(epr)
39: + id);
40: return epr;
41: }
42:
43: protected void initDefaultServant() {
44: servant = new ManualNumberImpl();
45:
46: String wsdlLocation = "testutils/factory_pattern.wsdl";
47: String bindingId = null;
48: EndpointImpl ep = new EndpointImpl(BusFactory.getDefaultBus(),
49: servant, bindingId, wsdlLocation);
50: ep.setEndpointName(new QName(NUMBER_SERVICE_QNAME
51: .getNamespaceURI(), "NumberPort"));
52: ep.publish();
53: templateEpr = ep.getServer().getDestination().getAddress();
54: }
55: }
|