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.binding.jbi;
19:
20: import javax.xml.namespace.QName;
21:
22: import org.apache.cxf.binding.AbstractBindingFactory;
23: import org.apache.cxf.binding.Binding;
24: import org.apache.cxf.binding.jbi.interceptor.JBIFaultInInterceptor;
25: import org.apache.cxf.binding.jbi.interceptor.JBIFaultOutInterceptor;
26: import org.apache.cxf.binding.jbi.interceptor.JBIOperationInInterceptor;
27: import org.apache.cxf.binding.jbi.interceptor.JBIWrapperInInterceptor;
28: import org.apache.cxf.binding.jbi.interceptor.JBIWrapperOutInterceptor;
29: import org.apache.cxf.interceptor.StaxInInterceptor;
30: import org.apache.cxf.interceptor.StaxOutInterceptor;
31: import org.apache.cxf.service.model.BindingInfo;
32: import org.apache.cxf.service.model.BindingOperationInfo;
33: import org.apache.cxf.service.model.OperationInfo;
34: import org.apache.cxf.service.model.ServiceInfo;
35:
36: public class JBIBindingFactory extends AbstractBindingFactory {
37:
38: public Binding createBinding(BindingInfo binding) {
39: JBIBinding jb = new JBIBinding((JBIBindingInfo) binding);
40: jb.getInInterceptors().add(new StaxInInterceptor());
41: jb.getInInterceptors().add(new JBIOperationInInterceptor());
42: jb.getInInterceptors().add(new JBIWrapperInInterceptor());
43: jb.getOutInterceptors().add(new StaxOutInterceptor());
44: jb.getOutInterceptors().add(new JBIWrapperOutInterceptor());
45: jb.getOutFaultInterceptors().add(new StaxOutInterceptor());
46: jb.getOutFaultInterceptors().add(new JBIFaultOutInterceptor());
47:
48: jb.getInFaultInterceptors().add(new JBIFaultInInterceptor());
49: return jb;
50: }
51:
52: public BindingInfo createBindingInfo(ServiceInfo service,
53: String namespace, Object config) {
54: JBIBindingInfo info = new JBIBindingInfo(service,
55: JBIConstants.NS_JBI_BINDING);
56: info.setName(new QName(service.getName().getNamespaceURI(),
57: service.getName().getLocalPart() + "JBIBinding"));
58:
59: for (OperationInfo op : service.getInterface().getOperations()) {
60: BindingOperationInfo bop = info
61: .buildOperation(op.getName(), op.getInputName(), op
62: .getOutputName());
63: info.addOperation(bop);
64: }
65:
66: return info;
67: }
68:
69: }
|