Author: dandiep
Date: Sun Apr 22 16:25:03 2007
New Revision: 531301
URL: http://svn.apache.org/viewvc?view=rev&rev=531301
Log:
Improve Bus start up time SIGNIFICANTLY by:
1. Lazy-loading JAXBContexts in Jaxb WSDL extensions and JaxbAssertionBuilder
2. Reusing a NamespaceHandlerResolver (which finds the spring.handlers
extensions)
across various XmlBeanDefinitionReader instances so the results of the first
lookup
are cached. (http://opensource.atlassian.com/projects/spring/browse/SPR-3404)
3. Creating fewer/less complex bean definitions when possible
4. Removing property-editors.xml (we aren't using them really except for with
WS-RM,
so I put those editors inside cxf-extension-rm.xml)
In the systests module in Eclipse, I'm down to about 3.7 seconds from 7.5. If
you take out ws-* its definitely under 4 seconds. From Maven it appears to be
around 1.3 seconds now.
Added:
incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java
(with props)
Removed:
incubator/cxf/trunk/api/src/main/resources/META-INF/
incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-property-editors.xml
incubator/cxf/trunk/rt/management/src/main/resources/META-INF/cxf/cxf-property-editors.xml
incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/cxfcfg.xml
incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-property-editors.xml
Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java
incubator/cxf/trunk/api/src/test/java/org/apache/cxf/wsdl/JAXBExtensionHelperTest.java
incubator/cxf/trunk/distribution/bundle/pom.xml
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/configuration/spring/JaxbClassPathXmlApplicationContext.java
incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/BusApplicationContextTest.java
incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/org/apache/cxf/jaxws/spring/jaxws.xsd
incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingPolicyInterceptorProvider.java
incubator/cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml
incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/EndpointReferenceDomainExpressionBuilder.java
incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension-rm.xml
Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java?view=diff&rev=531301&r1=531300&r2=531301
==============================================================================
---
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java
(original)
+++
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java
Sun Apr 22 16:25:03 2007
@@ -34,6 +34,7 @@
import org.apache.cxf.common.classloader.ClassLoaderUtils;
import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.PackageUtils;
import org.apache.cxf.jaxb.JAXBUtils;
import org.apache.cxf.ws.policy.AssertionBuilder;
import org.apache.neethi.Assertion;
@@ -44,6 +45,7 @@
private static final Logger LOG =
LogUtils.getL7dLogger(JaxbAssertionBuilder.class);
private Unmarshaller unmarshaller;
private Collection<QName> supportedTypes;
+ private Class<T> type;
/**
* Constructs a JAXBAssertionBuilder from the QName of the schema type
@@ -76,12 +78,31 @@
* @throws ClassNotFoundException
*/
public JaxbAssertionBuilder(Class<T> type, QName qn) throws JAXBException {
-
- JAXBContext context =
JAXBContext.newInstance(type.getPackage().getName());
- unmarshaller = context.createUnmarshaller();
+ this.type = type;
supportedTypes = Collections.singletonList(qn);
}
+ protected Unmarshaller getUnmarshaller() {
+ if (unmarshaller == null) {
+ try {
+ createUnmarhsaller();
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ return unmarshaller;
+ }
+
+ protected synchronized void createUnmarhsaller() throws JAXBException {
+ if (unmarshaller != null) {
+ return;
+ }
+
+ JAXBContext context =
JAXBContext.newInstance(PackageUtils.getPackageName(type),
+ type.getClassLoader());
+ unmarshaller = context.createUnmarshaller();
+ }
public Assertion build(Element element) {
QName name = new QName(element.getNamespaceURI(),
element.getLocalName());
@@ -127,7 +148,7 @@
protected T getData(Element element) {
Object obj = null;
try {
- obj = unmarshaller.unmarshal(element);
+ obj = getUnmarshaller().unmarshal(element);
} catch (JAXBException ex) {
LogUtils.log(LOG, Level.SEVERE, "UNMARSHAL_ELEMENT_EXC", ex);
}
Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java?view=diff&rev=531301&r1=531300&r2=531301
==============================================================================
---
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java
(original)
+++
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java
Sun Apr 22 16:25:03 2007
@@ -50,11 +50,10 @@
*
*/
public class JAXBExtensionHelper implements ExtensionSerializer,
ExtensionDeserializer {
- final JAXBContext context;
+ JAXBContext context;
final Class<? extends TExtensibilityElementImpl> typeClass;
- public JAXBExtensionHelper(JAXBContext c, Class<? extends
TExtensibilityElementImpl> cls) {
- context = c;
+ public JAXBExtensionHelper(Class<? extends TExtensibilityElementImpl> cls)
{
typeClass = cls;
}
@@ -71,8 +70,7 @@
Class<?> parentType,
Class<? extends
TExtensibilityElementImpl> cls) throws JAXBException {
- JAXBContext context =
JAXBContext.newInstance(PackageUtils.getPackageName(cls), cls.getClassLoader());
- JAXBExtensionHelper helper = new JAXBExtensionHelper(context, cls);
+ JAXBExtensionHelper helper = new JAXBExtensionHelper(cls);
try {
Class<?> objectFactory =
Class.forName(PackageUtils.getPackageName(cls) + ".ObjectFactory");
@@ -102,6 +100,26 @@
}
}
+ protected JAXBContext getJAXBContext() {
+ if (context == null) {
+ try {
+ createJAXBContext();
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return context;
+ }
+
+ protected synchronized void createJAXBContext() throws JAXBException {
+ if (context != null) {
+ return;
+ }
+
+ context =
JAXBContext.newInstance(PackageUtils.getPackageName(typeClass),
+ typeClass.getClassLoader());
+ }
+
/* (non-Javadoc)
* @see javax.wsdl.extensions.ExtensionSerializer#marshall(java.lang.Class,
* javax.xml.namespace.QName, javax.wsdl.extensions.ExtensibilityElement,
@@ -111,7 +129,7 @@
final Definition wsdl, ExtensionRegistry registry)
throws WSDLException {
// TODO Auto-generated method stub
try {
- Marshaller u = context.createMarshaller();
+ Marshaller u = getJAXBContext().createMarshaller();
u.setProperty("jaxb.encoding", "UTF-8");
u.setProperty("jaxb.fragment", Boolean.TRUE);
u.setProperty("jaxb.formatted.output", Boolean.TRUE);
@@ -171,7 +189,7 @@
public ExtensibilityElement unmarshall(Class parent, QName qname, Element
element, Definition wsdl,
ExtensionRegistry registry) throws
WSDLException {
try {
- Unmarshaller u = context.createUnmarshaller();
+ Unmarshaller u = getJAXBContext().createUnmarshaller();
Object o = u.unmarshal(element);
if (o instanceof JAXBElement<?>) {
Modified:
incubator/cxf/trunk/api/src/test/java/org/apache/cxf/wsdl/JAXBExtensionHelperTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/test/java/org/apache/cxf/wsdl/JAXBExtensionHelperTest.java?view=diff&rev=531301&r1=531300&r2=531301
==============================================================================
---
incubator/cxf/trunk/api/src/test/java/org/apache/cxf/wsdl/JAXBExtensionHelperTest.java
(original)
+++
incubator/cxf/trunk/api/src/test/java/org/apache/cxf/wsdl/JAXBExtensionHelperTest.java
Sun Apr 22 16:25:03 2007
@@ -23,7 +23,6 @@
import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
import java.io.StringReader;
-
import java.util.List;
import javax.wsdl.Definition;
@@ -32,7 +31,6 @@
import javax.wsdl.extensions.ExtensionRegistry;
import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
-import javax.xml.bind.JAXBContext;
import javax.xml.namespace.QName;
import junit.framework.TestCase;
@@ -41,8 +39,6 @@
import org.apache.cxf.abc.test.NewServiceType;
import org.apache.cxf.abc.test.TestPolicyType;
-import org.apache.cxf.common.util.PackageUtils;
-
public class JAXBExtensionHelperTest extends TestCase {
private WSDLFactory wsdlFactory;
@@ -135,9 +131,7 @@
ByteArrayOutputStream stream = new ByteArrayOutputStream();
- JAXBContext context =
JAXBContext.newInstance(PackageUtils.getPackageName(NewServiceType.class),
-
NewServiceType.class.getClassLoader());
- JAXBExtensionHelper helper = new JAXBExtensionHelper(context,
NewServiceType.class);
+ JAXBExtensionHelper helper = new
JAXBExtensionHelper(NewServiceType.class);
helper.marshall(javax.wsdl.Definition.class,
new QName("http://cxf.apache.org/test/hello_world",
"newService"),
newService,
Modified: incubator/cxf/trunk/distribution/bundle/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/bundle/pom.xml?view=diff&rev=531301&r1=531300&r2=531301
==============================================================================
--- incubator/cxf/trunk/distribution/bundle/pom.xml (original)
+++ incubator/cxf/trunk/distribution/bundle/pom.xml Sun Apr 22 16:25:03 2007
@@ -277,9 +277,6 @@
<transformer
implementation="org.codehaus.mojo.shade.resource.XmlAppendingTransformer">
<resource>META-INF/bus-extensions.xml</resource>
</transformer>
- <transformer
implementation="org.codehaus.mojo.shade.resource.XmlAppendingTransformer">
-
<resource>META-INF/cxf/cxf-property-editors.xml</resource>
- </transformer>
<transformer
implementation="org.apache.cxf.maven.PluginTransformer">
<resource>META-INF/tools-plugin.xml</resource>
</transformer>
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java?view=diff&rev=531301&r1=531300&r2=531301
==============================================================================
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java
(original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java
Sun Apr 22 16:25:03 2007
@@ -44,8 +44,7 @@
private static final String DEFAULT_CXF_CFG_FILE = "META-INF/cxf/cxf.xml";
private static final String DEFAULT_CXF_EXT_CFG_FILE =
"classpath*:META-INF/cxf/cxf.extension";
- private static final String CXF_PROPERTY_EDITORS_CFG_FILE =
- "classpath*:META-INF/cxf/cxf-property-editors.xml";
+
private static final Logger LOG =
LogUtils.getL7dLogger(BusApplicationContext.class);
private boolean includeDefaults;
@@ -61,7 +60,7 @@
}
BusApplicationContext(String cf, boolean include, ApplicationContext
parent) {
- super((String[])null, parent, false);
+ super((String[])null, parent);
cfgFile = cf;
includeDefaults = include;
}
@@ -83,7 +82,6 @@
.currentThread().getContextClassLoader());
Collections.addAll(resources,
resolver.getResources(DEFAULT_CXF_CFG_FILE));
- Collections.addAll(resources,
resolver.getResources(CXF_PROPERTY_EDITORS_CFG_FILE));
Resource[] exts =
resolver.getResources(DEFAULT_CXF_EXT_CFG_FILE);
for (Resource r : exts) {
@@ -149,6 +147,5 @@
res = resources.toArray(res);
return res;
}
-
}
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/configuration/spring/JaxbClassPathXmlApplicationContext.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/configuration/spring/JaxbClassPathXmlApplicationContext.java?view=diff&rev=531301&r1=531300&r2=531301
==============================================================================
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/configuration/spring/JaxbClassPathXmlApplicationContext.java
(original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/configuration/spring/JaxbClassPathXmlApplicationContext.java
Sun Apr 22 16:25:03 2007
@@ -30,6 +30,7 @@
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.configuration.Configurer;
import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -43,6 +44,7 @@
private static final Logger LOG =
LogUtils.getL7dLogger(JaxbClassPathXmlApplicationContext.class);
String[] cfgFileLocations;
+ private DefaultNamespaceHandlerResolver nsHandlerResolver;
public JaxbClassPathXmlApplicationContext(String location) throws
BeansException {
super(new String[]{location});
@@ -66,12 +68,19 @@
@Override
protected void initBeanDefinitionReader(XmlBeanDefinitionReader reader) {
+ // Spring always creates a new one of these, which takes a fair amount
+ // of time on startup (nearly 1/2 second) as it gets created for every
+ // spring context on the classpath
+ if (nsHandlerResolver == null) {
+ nsHandlerResolver = new DefaultNamespaceHandlerResolver();
+ }
+ reader.setNamespaceHandlerResolver(nsHandlerResolver);
+
reader.setDocumentReaderClass(JaxbBeanDefinitionDocumentReader.class);
// TODO: check why VALIDATION_XSD complains about mixed content in
// value elements - this should be legal according to the xsd
reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE);
reader.setNamespaceAware(true);
-
}
@Override
Modified:
incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/BusApplicationContextTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/BusApplicationContextTest.java?view=diff&rev=531301&r1=531300&r2=531301
==============================================================================
---
incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/BusApplicationContextTest.java
(original)
+++
incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/BusApplicationContextTest.java
Sun Apr 22 16:25:03 2007
@@ -30,8 +30,8 @@
ctx = new BusApplicationContext(cfgFile, false);
assertEquals("Unexpected number of resources", 1,
ctx.getConfigResources().length);
ctx = new BusApplicationContext("nowhere.xml", true);
- assertEquals("Unexpected number of resources", 2,
ctx.getConfigResources().length);
+ assertEquals("Unexpected number of resources", 1,
ctx.getConfigResources().length);
ctx = new BusApplicationContext(cfgFile, true);
- assertEquals("Unexpected number of resources", 3,
ctx.getConfigResources().length);
+ assertEquals("Unexpected number of resources", 2,
ctx.getConfigResources().length);
}
}
Modified:
incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/org/apache/cxf/jaxws/spring/jaxws.xsd
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/org/apache/cxf/jaxws/spring/jaxws.xsd?view=diff&rev=531301&r1=531300&r2=531301
==============================================================================
---
incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/org/apache/cxf/jaxws/spring/jaxws.xsd
(original)
+++
incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/org/apache/cxf/jaxws/spring/jaxws.xsd
Sun Apr 22 16:25:03 2007
@@ -26,6 +26,7 @@
<xsd:element name="properties" type="beans:mapType" minOccurs="0"/>
<xsd:element name="serviceFactory" type="xsd:anyType"
minOccurs="0"/>
</xsd:sequence>
+ <xsd:attribute name="abstract" type="xsd:boolean" />
<xsd:attribute name="address" type="xsd:string" />
<xsd:attribute name="createdFromAPI" type="xsd:string" />
<xsd:attribute name="bindingUri" type="xsd:string" />
@@ -58,6 +59,7 @@
<xsd:element name="serviceBean" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="serviceFactory" type="xsd:anyType"
minOccurs="0"/>
</xsd:sequence>
+ <xsd:attribute name="abstract" type="xsd:boolean" />
<xsd:attribute name="address" type="xsd:string" />
<xsd:attribute name="bus" type="xsd:string" />
<xsd:attribute name="createdFromAPI" type="xsd:string" />
@@ -85,6 +87,7 @@
<xsd:element name="properties" type="beans:mapType" minOccurs="0"/>
<xsd:element name="conduitSelector" type="xsd:anyType"
minOccurs="0"/>
</xsd:sequence>
+ <xsd:attribute name="abstract" type="xsd:boolean" />
<xsd:attribute name="address" type="xsd:string" />
<xsd:attribute name="bindingUri" type="xsd:string" />
<xsd:attribute name="bus" type="xsd:string" />
Modified:
incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java?view=diff&rev=531301&r1=531300&r2=531301
==============================================================================
---
incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
(original)
+++
incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
Sun Apr 22 16:25:03 2007
@@ -39,13 +39,16 @@
public void setUp() throws Exception {
control = EasyMock.createNiceControl();
bus = control.createMock(Bus.class);
+
+ Configurer configurer = new ConfigurerImpl();
+
+ bus.getExtension(Configurer.class);
+ EasyMock.expectLastCall().andReturn(configurer).anyTimes();
+ control.replay();
}
@Test
public void testEngineEquality() {
-
- setUpConfigurer(null);
-
JettyHTTPServerEngine engine = JettyHTTPServerEngine.getForPort(bus,
"http", 1234);
assertTrue("Engine references for the same port should point to the
same instance",
engine == JettyHTTPServerEngine.getForPort(bus, "http",
1234));
@@ -57,9 +60,6 @@
@Test
public void testNoSSLServerPolicySet() {
-
- setUpConfigurer(null);
-
JettyHTTPServerEngine engine = JettyHTTPServerEngine.getForPort(bus,
"http", 1234);
assertFalse("SSLServerPolicy must not be set",
engine.isSetSslServer());
engine = JettyHTTPServerEngine.getForPort(bus, "http", 1235, null);
@@ -74,9 +74,6 @@
@Test
public void testDestinationSSLServerPolicy() {
-
- setUpConfigurer(null);
-
SSLServerPolicy policy = new SSLServerPolicy();
JettyHTTPServerEngine engine = JettyHTTPServerEngine.getForPort(bus,
"http", 1234,
policy);
@@ -90,25 +87,5 @@
JettyHTTPServerEngine.destroyForPort(1234);
}
-
- @Test
- public void testSSLServerPolicySetFromConfig() {
-
- setUpConfigurer("/org/apache/cxf/transport/http_jetty/cxfcfg.xml");
-
- JettyHTTPServerEngine engine = JettyHTTPServerEngine.getForPort(bus,
"http", 1234);
- assertTrue("SSLServerPolicy must be set", engine.isSetSslServer());
-
- JettyHTTPServerEngine.destroyForPort(1234);
- }
-
- private void setUpConfigurer(String cxfFile) {
- Configurer configurer = cxfFile == null
- ? new ConfigurerImpl() : new
ConfigurerImpl(cxfFile);
-
-
- bus.getExtension(Configurer.class);
- EasyMock.expectLastCall().andReturn(configurer).anyTimes();
- control.replay();
- }
+
}
Modified:
incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingPolicyInterceptorProvider.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingPolicyInterceptorProvider.java?view=diff&rev=531301&r1=531300&r2=531301
==============================================================================
---
incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingPolicyInterceptorProvider.java
(original)
+++
incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingPolicyInterceptorProvider.java
Sun Apr 22 16:25:03 2007
@@ -25,6 +25,8 @@
import javax.xml.namespace.QName;
import org.apache.cxf.interceptor.AbstractAttributedInterceptorProvider;
+import org.apache.cxf.ws.addressing.MAPAggregator;
+import org.apache.cxf.ws.addressing.soap.MAPCodec;
import org.apache.cxf.ws.policy.PolicyInterceptorProvider;
/**
@@ -36,6 +38,8 @@
implements PolicyInterceptorProvider {
private static final Collection<QName> ASSERTION_TYPES;
+ private static final MAPAggregator MAP_AGGREGATOR = new MAPAggregator();
+ private static final MAPCodec MAP_CODEC = new MAPCodec();
static {
Collection<QName> types = new ArrayList<QName>();
@@ -45,6 +49,21 @@
ASSERTION_TYPES = types;
}
+ public AddressingPolicyInterceptorProvider() {
+ super();
+ getInInterceptors().add(MAP_AGGREGATOR);
+ getInInterceptors().add(MAP_CODEC);
+
+ getOutInterceptors().add(MAP_AGGREGATOR);
+ getOutInterceptors().add(MAP_CODEC);
+
+ getInFaultInterceptors().add(MAP_AGGREGATOR);
+ getInFaultInterceptors().add(MAP_CODEC);
+
+ getOutFaultInterceptors().add(MAP_AGGREGATOR);
+ getOutFaultInterceptors().add(MAP_CODEC);
+ }
+
public Collection<QName> getAssertionTypes() {
return ASSERTION_TYPES;
}
Modified:
incubator/cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml?view=diff&rev=531301&r1=531300&r2=531301
==============================================================================
---
incubator/cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml
(original)
+++
incubator/cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml
Sun Apr 22 16:25:03 2007
@@ -26,34 +26,6 @@
<constructor-arg ref="cxf"/>
</bean>
- <bean class="org.apache.cxf.ws.addressing.MAPAggregator"/>
- <bean class="org.apache.cxf.ws.addressing.soap.MAPCodec"/>
-
- <bean
class="org.apache.cxf.ws.addressing.policy.AddressingPolicyInterceptorProvider">
- <property name="inInterceptors">
- <list>
- <ref bean="org.apache.cxf.ws.addressing.MAPAggregator"/>
- <ref bean="org.apache.cxf.ws.addressing.soap.MAPCodec"/>
- </list>
- </property>
- <property name="inFaultInterceptors">
- <list>
- <ref bean="org.apache.cxf.ws.addressing.soap.MAPCodec"/>
- <ref bean="org.apache.cxf.ws.addressing.MAPAggregator"/>
- </list>
- </property>
- <property name="outInterceptors">
- <list>
- <ref bean="org.apache.cxf.ws.addressing.MAPAggregator"/>
- <ref bean="org.apache.cxf.ws.addressing.soap.MAPCodec"/>
- </list>
- </property>
- <property name="outFaultInterceptors">
- <list>
- <ref bean="org.apache.cxf.ws.addressing.MAPAggregator"/>
- <ref bean="org.apache.cxf.ws.addressing.soap.MAPCodec"/>
- </list>
- </property>
- </bean>
+ <bean
class="org.apache.cxf.ws.addressing.policy.AddressingPolicyInterceptorProvider"/>
</beans>
Modified:
incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/EndpointReferenceDomainExpressionBuilder.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/EndpointReferenceDomainExpressionBuilder.java?view=diff&rev=531301&r1=531300&r2=531301
==============================================================================
---
incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/EndpointReferenceDomainExpressionBuilder.java
(original)
+++
incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/EndpointReferenceDomainExpressionBuilder.java
Sun Apr 22 16:25:03 2007
@@ -50,13 +50,7 @@
private Unmarshaller unmarshaller;
EndpointReferenceDomainExpressionBuilder() {
- try {
- JAXBContext context =
JAXBContext.newInstance(EndpointReferenceType.class.getPackage().getName());
- unmarshaller = context.createUnmarshaller();
- } catch (JAXBException ex) {
- throw new PolicyException(new
Message("EPR_DOMAIN_EXPRESSION_BUILDER_INIT_EXC", BUNDLE,
- (Object[])null), ex);
- }
+
}
public Collection<QName> getDomainExpressionTypes() {
@@ -66,7 +60,7 @@
public DomainExpression build(Element e) {
Object obj = null;
try {
- obj = unmarshaller.unmarshal(e);
+ obj = getUnmarshaller().unmarshal(e);
} catch (JAXBException ex) {
throw new PolicyException(new
Message("EPR_DOMAIN_EXPRESSION_BUILD_EXC", BUNDLE,
(Object[])null), ex);
@@ -81,5 +75,25 @@
return eprde;
}
+ protected Unmarshaller getUnmarshaller() {
+ if (unmarshaller == null) {
+ createUnmarshaller();
+ }
+
+ return unmarshaller;
+ }
+ protected synchronized void createUnmarshaller() {
+ if (unmarshaller != null) {
+ return;
+ }
+
+ try {
+ JAXBContext context =
JAXBContext.newInstance(EndpointReferenceType.class.getPackage().getName());
+ unmarshaller = context.createUnmarshaller();
+ } catch (JAXBException ex) {
+ throw new PolicyException(new
Message("EPR_DOMAIN_EXPRESSION_BUILDER_INIT_EXC", BUNDLE,
+ (Object[])null), ex);
+ }
+ }
}
Added:
incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java?view=auto&rev=531301
==============================================================================
---
incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java
(added)
+++
incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java
Sun Apr 22 16:25:03 2007
@@ -0,0 +1,68 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.ws.rm.policy;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.interceptor.AbstractAttributedInterceptorProvider;
+import org.apache.cxf.ws.policy.PolicyInterceptorProvider;
+import org.apache.cxf.ws.rm.RMInInterceptor;
+import org.apache.cxf.ws.rm.RMOutInterceptor;
+import org.apache.cxf.ws.rm.soap.RMSoapInterceptor;
+
+public class RMPolicyInterceptorProvider extends
AbstractAttributedInterceptorProvider implements
+ PolicyInterceptorProvider {
+
+ private static final Collection<QName> ASSERTION_TYPES;
+ private RMInInterceptor rmIn = new RMInInterceptor();
+ private RMOutInterceptor rmOut = new RMOutInterceptor();
+ private RMSoapInterceptor rmSoap = new RMSoapInterceptor();
+
+ static {
+ Collection<QName> types = new ArrayList<QName>();
+ types.add(new QName("http://schemas.xmlsoap.org/ws/2005/02/rm/policy",
"RMAssertion"));
+ ASSERTION_TYPES = types;
+ }
+
+ public RMPolicyInterceptorProvider(Bus bus) {
+ super();
+ rmIn.setBus(bus);
+ rmOut.setBus(bus);
+
+ getInInterceptors().add(rmIn);
+ getInInterceptors().add(rmSoap);
+
+ getOutInterceptors().add(rmOut);
+ getOutInterceptors().add(rmSoap);
+
+ getInFaultInterceptors().add(rmIn);
+ getInFaultInterceptors().add(rmSoap);
+
+ getOutFaultInterceptors().add(rmOut);
+ getOutFaultInterceptors().add(rmSoap);
+ }
+
+ public Collection<QName> getAssertionTypes() {
+ return ASSERTION_TYPES;
+ }
+}
Propchange:
incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java
------------------------------------------------------------------------------
svn:executable = *
Propchange:
incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension-rm.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension-rm.xml?view=diff&rev=531301&r1=531300&r2=531301
==============================================================================
---
incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension-rm.xml
(original)
+++
incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension-rm.xml
Sun Apr 22 16:25:03 2007
@@ -26,50 +26,9 @@
<bean id="org.apache.cxf.ws.rm.RMManager"
class="org.apache.cxf.ws.rm.RMManager">
<property name="bus" ref="cxf"/>
</bean>
-
- <!-- global definition of interceptors, may need to switch qualified names
-->
-
- <bean class="org.apache.cxf.ws.rm.RMOutInterceptor">
- <property name="bus" ref="cxf"/>
- </bean>
- <bean class="org.apache.cxf.ws.rm.RMInInterceptor">
- <property name="bus" ref="cxf"/>
- </bean>
- <bean class="org.apache.cxf.ws.rm.soap.RMSoapInterceptor"/>
-
- <bean class="org.apache.cxf.ws.policy.PolicyInterceptorProviderImpl">
- <constructor-arg>
- <list>
- <bean class="javax.xml.namespace.QName">
- <constructor-arg
value="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"/>
- <constructor-arg value="RMAssertion"/>
- </bean>
- </list>
- </constructor-arg>
- <property name="inInterceptors">
- <list>
- <ref bean="org.apache.cxf.ws.rm.RMInInterceptor"/>
- <ref bean="org.apache.cxf.ws.rm.soap.RMSoapInterceptor"/>
- </list>
- </property>
- <property name="inFaultInterceptors">
- <list>
- <ref bean="org.apache.cxf.ws.rm.RMInInterceptor"/>
- <ref bean="org.apache.cxf.ws.rm.soap.RMSoapInterceptor"/>
- </list>
- </property>
- <property name="outInterceptors">
- <list>
- <ref bean="org.apache.cxf.ws.rm.RMOutInterceptor"/>
- <ref bean="org.apache.cxf.ws.rm.soap.RMSoapInterceptor"/>
- </list>
- </property>
- <property name="outFaultInterceptors">
- <list>
- <ref bean="org.apache.cxf.ws.rm.RMOutInterceptor"/>
- <ref bean="org.apache.cxf.ws.rm.soap.RMSoapInterceptor"/>
- </list>
- </property>
+
+ <bean class="org.apache.cxf.ws.rm.policy.RMPolicyInterceptorProvider">
+ <constructor-arg><ref bean="cxf"/></constructor-arg>
</bean>
<bean id="org.apache.cxf.ws.rm.RMAssertionBuilder"
class="org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertionBuilder">
@@ -82,4 +41,28 @@
</constructor-arg>
</bean>
+ <bean id="org.apache.cxf.ws.rm.customEditorConfigurer"
class="org.springframework.beans.factory.config.CustomEditorConfigurer">
+ <property name="propertyEditorRegistrars">
+ <list>
+ <bean
class="org.apache.cxf.configuration.spring.JaxbPropertyEditorRegistrar">
+ <property name="packageName"
value="org.apache.cxf.ws.rm.manager"/>
+ <property name="propertyClassNames">
+ <list>
+ <value>SourcePolicyType</value>
+ <value>DestinationPolicyType</value>
+ <value>DeliveryAssuranceType</value>
+ </list>
+ </property>
+ </bean>
+ <bean
class="org.apache.cxf.configuration.spring.JaxbPropertyEditorRegistrar">
+ <property name="packageName"
value="org.apache.cxf.ws.rm.policy"/>
+ <property name="propertyClassNames">
+ <list>
+ <value>RMAssertion</value>
+ </list>
+ </property>
+ </bean>
+ </list>
+ </property>
+ </bean>
</beans>