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.ws.rm.spring;
19:
20: import javax.xml.namespace.QName;
21:
22: import org.w3c.dom.Element;
23:
24: import org.apache.cxf.Bus;
25: import org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser;
26: import org.apache.cxf.ws.rm.RMManager;
27: import org.apache.cxf.ws.rm.policy.RMAssertion;
28: import org.springframework.beans.factory.support.BeanDefinitionBuilder;
29: import org.springframework.beans.factory.xml.ParserContext;
30:
31: public class RMManagerBeanDefinitionParser extends
32: AbstractBeanDefinitionParser {
33:
34: private static final String RM_NS = "http://cxf.apache.org/ws/rm/manager";
35:
36: @Override
37: protected void doParse(Element element, ParserContext ctx,
38: BeanDefinitionBuilder bean) {
39: mapElementToJaxbProperty(element, bean, new QName(RM_NS,
40: "deliveryAssurance"), "deliveryAssurance");
41: mapElementToJaxbProperty(element, bean, new QName(RM_NS,
42: "sourcePolicy"), "sourcePolicy");
43: mapElementToJaxbProperty(element, bean, new QName(RM_NS,
44: "destinationPolicy"), "destinationPolicy");
45: mapElementToJaxbProperty(element, bean, new QName(
46: "http://schemas.xmlsoap.org/ws/2005/02/rm/policy",
47: "RMAssertion"), "RMAssertion", RMAssertion.class);
48:
49: ctx.getDelegate().parsePropertyElements(element,
50: bean.getBeanDefinition());
51:
52: String bus = element.getAttribute("bus");
53: if (bus == null
54: || "".equals(bus)
55: && ctx.getRegistry().containsBeanDefinition(
56: Bus.DEFAULT_BUS_ID)) {
57: bean.addPropertyReference("bus", Bus.DEFAULT_BUS_ID);
58: } else {
59: bean.addPropertyReference("bus", bus);
60: }
61: }
62:
63: @Override
64: protected boolean hasBusProperty() {
65: return true;
66: }
67:
68: @Override
69: protected Class getBeanClass(Element element) {
70: return RMManager.class;
71: }
72:
73: @Override
74: protected String getJaxbPackage() {
75: return "org.apache.cxf.ws.rm.manager";
76: }
77:
78: }
|