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.frontend.spring;
19:
20: import java.util.List;
21: import java.util.Map;
22:
23: import javax.xml.namespace.QName;
24:
25: import org.w3c.dom.Element;
26:
27: import org.apache.cxf.configuration.spring.AbstractFactoryBeanDefinitionParser;
28: import org.apache.cxf.frontend.ClientProxyFactoryBean;
29: import org.springframework.beans.factory.support.BeanDefinitionBuilder;
30: import org.springframework.beans.factory.xml.ParserContext;
31:
32: public class ClientProxyFactoryBeanDefinitionParser extends
33: AbstractFactoryBeanDefinitionParser {
34:
35: public ClientProxyFactoryBeanDefinitionParser() {
36: super ();
37: setBeanClass(Object.class);
38: }
39:
40: @Override
41: protected Class getFactoryClass() {
42: return ClientProxyFactoryBean.class;
43: }
44:
45: @Override
46: protected String getFactoryIdSuffix() {
47: return ".proxyFactory";
48: }
49:
50: @Override
51: protected String getSuffix() {
52: return ".simple-client";
53: }
54:
55: @Override
56: protected void mapAttribute(BeanDefinitionBuilder bean, Element e,
57: String name, String val) {
58: if ("endpointName".equals(name) || "serviceName".equals(name)) {
59: QName q = parseQName(e, val);
60: bean.addPropertyValue(name, q);
61: } else {
62: mapToProperty(bean, name, val);
63: }
64: }
65:
66: @Override
67: protected void mapElement(ParserContext ctx,
68: BeanDefinitionBuilder bean, Element e, String name) {
69: if ("properties".equals(name)) {
70: Map map = ctx.getDelegate().parseMapElement(e,
71: bean.getBeanDefinition());
72: bean.addPropertyValue("properties", map);
73: } else if ("binding".equals(name)) {
74: setFirstChildAsProperty(e, ctx, bean, "bindingConfig");
75: } else if ("inInterceptors".equals(name)
76: || "inFaultInterceptors".equals(name)
77: || "outInterceptors".equals(name)
78: || "outFaultInterceptors".equals(name)
79: || "features".equals(name)) {
80: List list = ctx.getDelegate().parseListElement(e,
81: bean.getBeanDefinition());
82: bean.addPropertyValue(name, list);
83: } else {
84: setFirstChildAsProperty(e, ctx, bean, name);
85: }
86: }
87: }
|