Author: dkulp
Date: Fri Jun 26 19:38:57 2009
New Revision: 788830
URL: http://svn.apache.org/viewvc?rev=788830&view=rev
Log:
Merged revisions 788820 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r788820 | dkulp | 2009-06-26 15:13:14 -0400 (Fri, 26 Jun 2009) | 4 lines
Change <cxf:bus> processing to configure the existing bus, not create a
new one
Make Bus have properties so props (like schema-validation) can be
enabled globally
........
Modified:
cxf/branches/2.2.x-fixes/ (props changed)
cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/Bus.java
cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/message/MessageImpl.java
cxf/branches/2.2.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java
cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java
cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java
cxf/branches/2.2.x-fixes/rt/core/src/main/resources/schemas/core.xsd
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 26 19:38:57 2009
@@ -1 +1 @@
-/cxf/trunk:782728-782730,783097,783294,783396,784059,784181-784184,784893,784895,785279-785282,785468,785621,785624,785651,785734,785866,786142,786271-786272,786395,786512,786514,786582-786583,786638,786647,786850,787200,787269,787277-787279,787290-787291,787305,787323,787366,787849,788030,788060,788187,788451,788703,788774,788819
+/cxf/trunk:782728-782730,783097,783294,783396,784059,784181-784184,784893,784895,785279-785282,785468,785621,785624,785651,785734,785866,786142,786271-786272,786395,786512,786514,786582-786583,786638,786647,786850,787200,787269,787277-787279,787290-787291,787305,787323,787366,787849,788030,788060,788187,788451,788703,788774,788819-788820
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/Bus.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/Bus.java?rev=788830&r1=788829&r2=788830&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/Bus.java
(original)
+++ cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/Bus.java Fri Jun
26 19:38:57 2009
@@ -19,6 +19,8 @@
package org.apache.cxf;
+import java.util.Map;
+
import org.apache.cxf.interceptor.InterceptorProvider;
/**
@@ -40,4 +42,9 @@
void shutdown(boolean wait);
void run();
+
+ void setProperty(String s, Object o);
+ Object getProperty(String s);
+ Map<String, Object> getProperties();
+
}
Modified:
cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/message/MessageImpl.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/message/MessageImpl.java?rev=788830&r1=788829&r2=788830&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/message/MessageImpl.java
(original)
+++
cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/message/MessageImpl.java
Fri Jun 26 19:38:57 2009
@@ -24,6 +24,7 @@
import java.util.Map;
import java.util.Set;
+import org.apache.cxf.Bus;
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.interceptor.InterceptorChain;
import org.apache.cxf.service.Service;
@@ -143,6 +144,13 @@
}
}
+ if (val == null) {
+ Bus bus = ex.get(Bus.class);
+ if (bus != null) {
+ val = bus.getProperty(key);
+ }
+ }
+
return val;
}
Modified:
cxf/branches/2.2.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java?rev=788830&r1=788829&r2=788830&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java
(original)
+++
cxf/branches/2.2.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java
Fri Jun 26 19:38:57 2009
@@ -20,6 +20,8 @@
+import java.util.Collections;
+import java.util.Map;
import java.util.ResourceBundle;
import org.apache.cxf.Bus;
@@ -119,4 +121,18 @@
DummyBus.initializeCount = count;
}
+
+ public Map<String, Object> getProperties() {
+ return Collections.emptyMap();
+ }
+
+
+ public Object getProperty(String s) {
+ return null;
+ }
+
+
+ public void setProperty(String s, Object o) {
+ }
+
}
Modified:
cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java?rev=788830&r1=788829&r2=788830&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java
(original)
+++
cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java
Fri Jun 26 19:38:57 2009
@@ -36,6 +36,7 @@
private BusState state;
private Collection<AbstractFeature> features;
private ExtensionFinder finder;
+ private Map<String, Object> properties = new ConcurrentHashMap<String,
Object>();
public CXFBusImpl() {
this(null);
@@ -152,4 +153,21 @@
public interface ExtensionFinder {
<T> T findExtension(Class<T> cls);
}
+
+ public Map<String, Object> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, Object> map) {
+ properties.clear();
+ properties.putAll(map);
+ }
+
+ public Object getProperty(String s) {
+ return properties.get(s);
+ }
+
+ public void setProperty(String s, Object o) {
+ properties.put(s, o);
+ }
}
Modified:
cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java?rev=788830&r1=788829&r2=788830&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java
(original)
+++
cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java
Fri Jun 26 19:38:57 2009
@@ -19,7 +19,9 @@
package org.apache.cxf.bus.spring;
+import java.util.Collection;
import java.util.List;
+import java.util.Map;
import org.w3c.dom.Element;
@@ -27,6 +29,9 @@
import org.apache.cxf.bus.CXFBusImpl;
import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser;
+import org.apache.cxf.configuration.spring.BusWiringType;
+import org.apache.cxf.feature.AbstractFeature;
+import org.apache.cxf.interceptor.Interceptor;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.ParserContext;
@@ -34,9 +39,18 @@
public BusDefinitionParser() {
super();
- setBeanClass(CXFBusImpl.class);
+ setBeanClass(BusConfig.class);
}
-
+ protected void doParse(Element element, ParserContext ctx,
BeanDefinitionBuilder bean) {
+ String bus = element.getAttribute("bus");
+ if (StringUtils.isEmpty(bus)) {
+ addBusWiringAttribute(bean, BusWiringType.CONSTRUCTOR);
+ } else {
+ bean.addConstructorArgReference(bus);
+ }
+ super.doParse(element, ctx, bean);
+ }
+
@Override
protected void mapElement(ParserContext ctx,
BeanDefinitionBuilder bean,
@@ -47,14 +61,72 @@
|| "features".equals(name)) {
List list = ctx.getDelegate().parseListElement(e,
bean.getBeanDefinition());
bean.addPropertyValue(name, list);
- }
+ } else if ("properties".equals(name)) {
+ Map map = ctx.getDelegate().parseMapElement(e,
bean.getBeanDefinition());
+ bean.addPropertyValue("properties", map);
+ }
}
protected String getIdOrName(Element elem) {
String id = super.getIdOrName(elem);
if (StringUtils.isEmpty(id)) {
- id = Bus.DEFAULT_BUS_ID;
+ id = Bus.DEFAULT_BUS_ID + ".config";
}
return id;
}
+
+ public static class BusConfig {
+ CXFBusImpl bus;
+
+ public BusConfig(Bus b) {
+ bus = (CXFBusImpl)b;
+ }
+ public List<Interceptor> getOutFaultInterceptors() {
+ return bus.getOutFaultInterceptors();
+ }
+
+ public List<Interceptor> getInFaultInterceptors() {
+ return bus.getInFaultInterceptors();
+ }
+
+ public List<Interceptor> getInInterceptors() {
+ return bus.getInInterceptors();
+ }
+
+ public List<Interceptor> getOutInterceptors() {
+ return bus.getOutInterceptors();
+ }
+
+ public void setInInterceptors(List<Interceptor> interceptors) {
+ bus.setInInterceptors(interceptors);
+ }
+
+ public void setInFaultInterceptors(List<Interceptor> interceptors) {
+ bus.setInFaultInterceptors(interceptors);
+ }
+
+ public void setOutInterceptors(List<Interceptor> interceptors) {
+ bus.setOutInterceptors(interceptors);
+ }
+
+ public void setOutFaultInterceptors(List<Interceptor> interceptors) {
+ bus.setOutFaultInterceptors(interceptors);
+ }
+
+ public Collection<AbstractFeature> getFeatures() {
+ return bus.getFeatures();
+ }
+
+ public void setFeatures(Collection<AbstractFeature> features) {
+ bus.setFeatures(features);
+ }
+
+ public Map<String, Object> getProperties() {
+ return bus.getProperties();
+ }
+ public void setProperties(Map<String, Object> s) {
+ bus.setProperties(s);
+ }
+
+ }
}
Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/resources/schemas/core.xsd
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/resources/schemas/core.xsd?rev=788830&r1=788829&r2=788830&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/resources/schemas/core.xsd
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/resources/schemas/core.xsd Fri
Jun 26 19:38:57 2009
@@ -110,6 +110,11 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
+ <xsd:element name="properties" type="beans:mapType" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>Specifies a map of properties that are
passed to the bus.</xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
</xsd:all>
<xsd:attributeGroup ref="cxf-beans:beanAttributes"/>
</xsd:complexType>