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.jaxws.binding.soap;
19:
20: import javax.jws.soap.SOAPBinding;
21: import javax.jws.soap.SOAPBinding.Style;
22: import javax.jws.soap.SOAPBinding.Use;
23:
24: import org.apache.cxf.binding.soap.SoapBindingConfiguration;
25: import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
26:
27: /**
28: * Introspects the SOAPBinding annotation to provide to construct
29: * a {@link org.apache.cxf.service.model.BindingInfo}.
30: */
31: public class JaxWsSoapBindingConfiguration extends
32: SoapBindingConfiguration {
33: JaxWsServiceFactoryBean serviceFactory;
34:
35: public JaxWsSoapBindingConfiguration(JaxWsServiceFactoryBean sifb) {
36: serviceFactory = sifb;
37: }
38:
39: public void setJaxWsServiceFactoryBean(JaxWsServiceFactoryBean b) {
40: serviceFactory = b;
41: }
42:
43: @Override
44: protected String getStyle() {
45: SOAPBinding sb = getServiceClass().getAnnotation(
46: SOAPBinding.class);
47: if (sb != null) {
48: if (sb.style().equals(Style.DOCUMENT)) {
49: return "document";
50: } else if (sb.style().equals(Style.RPC)) {
51: return "rpc";
52: }
53: }
54: return super .getStyle();
55: }
56:
57: Class<?> getServiceClass() {
58: return getJaxWsServiceFactory().getJaxWsImplementorInfo()
59: .getEndpointClass();
60: }
61:
62: private JaxWsServiceFactoryBean getJaxWsServiceFactory() {
63: return serviceFactory;
64: }
65:
66: @Override
67: public String getUse() {
68: SOAPBinding sb = getServiceClass().getAnnotation(
69: SOAPBinding.class);
70: if (sb != null) {
71: if (sb.use().equals(Use.LITERAL)) {
72: return "literal";
73: } else if (sb.use().equals(Use.ENCODED)) {
74: return "encoded";
75: }
76: }
77: return super.getStyle();
78: }
79: }
|