Author: dkulp Date: Tue Jun 30 14:18:50 2009 New Revision: 789754 URL: http://svn.apache.org/viewvc?rev=789754&view=rev Log: Merged revisions 788830 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.2.x-fixes
................ r788830 | dkulp | 2009-06-26 15:38:57 -0400 (Fri, 26 Jun 2009) | 12 lines 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.1.x-fixes/ (props changed) cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/Bus.java cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/message/MessageImpl.java cxf/branches/2.1.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java cxf/branches/2.1.x-fixes/rt/core/src/main/resources/schemas/core.xsd Propchange: cxf/branches/2.1.x-fixes/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Jun 30 14:18:50 2009 @@ -1,2 +1,2 @@ -/cxf/branches/2.2.x-fixes:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049,773146,773581,773691,773693,774446-774496,774558,774760,774851,774979,775423,776024-776025,776218,776429,776459,777189,777224,777243,777481,777505,777572,777580,780033,780184,780213,780421,780664,780800,780902,780911,781497,781841,782733,782735-782736,783099,783407,784064,784197,785293,785296,785298-785299,785301,785656,786158,786587,786589,786591-786592,786640,787272,787276,787282-787283,787285,787295,787307,787324,7873 67,788824-788825,788827-788828 -/cxf/trunk:782181,782728-782730,783097,783396,784059,784181,784895,785279-785282,785468,786142,786271,786395,786582-786583,786638,786647,787269,787277-787279,787290,787305,787323,787366,788060,788187,788703,788774 +/cxf/branches/2.2.x-fixes:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049,773146,773581,773691,773693,774446-774496,774558,774760,774851,774979,775423,776024-776025,776218,776429,776459,777189,777224,777243,777481,777505,777572,777580,780033,780184,780213,780421,780664,780800,780902,780911,781497,781841,782733,782735-782736,783099,783407,784064,784197,785293,785296,785298-785299,785301,785656,786158,786587,786589,786591-786592,786640,787272,787276,787282-787283,787285,787295,787307,787324,7873 67,788824-788825,788827-788828,788830 +/cxf/trunk:782181,782728-782730,783097,783396,784059,784181,784895,785279-785282,785468,786142,786271,786395,786582-786583,786638,786647,787269,787277-787279,787290,787305,787323,787366,788060,788187,788703,788774,788820 Propchange: cxf/branches/2.1.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/Bus.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/Bus.java?rev=789754&r1=789753&r2=789754&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/Bus.java (original) +++ cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/Bus.java Tue Jun 30 14:18:50 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.1.x-fixes/api/src/main/java/org/apache/cxf/message/MessageImpl.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/message/MessageImpl.java?rev=789754&r1=789753&r2=789754&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/message/MessageImpl.java (original) +++ cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/message/MessageImpl.java Tue Jun 30 14:18:50 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.1.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java?rev=789754&r1=789753&r2=789754&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java (original) +++ cxf/branches/2.1.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java Tue Jun 30 14:18:50 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.1.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java?rev=789754&r1=789753&r2=789754&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java (original) +++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java Tue Jun 30 14:18:50 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.1.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java?rev=789754&r1=789753&r2=789754&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java (original) +++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java Tue Jun 30 14:18:50 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.1.x-fixes/rt/core/src/main/resources/schemas/core.xsd URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/resources/schemas/core.xsd?rev=789754&r1=789753&r2=789754&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/core/src/main/resources/schemas/core.xsd (original) +++ cxf/branches/2.1.x-fixes/rt/core/src/main/resources/schemas/core.xsd Tue Jun 30 14:18:50 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>
