Author: alessio.soldano(a)jboss.com
Date: 2009-11-19 07:14:21 -0500 (Thu, 19 Nov 2009)
New Revision: 11132
Added:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSResourceResolver.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/ResourceResolverDeploymentAspect.java
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/JBossWSCXFConfigurer.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/DescriptorDeploymentAspect.java
stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config.xml
stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf.sar/META-INF/spring.schemas
stack/cxf/trunk/pom.xml
Log:
[JBWS-2828] Moving to Apache CXF 2.2.5: installing custom ResourceResolver, patching
JBossWSCXFConfigurer to deal with new reusable CXF factories
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/JBossWSCXFConfigurer.java
===================================================================
---
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/JBossWSCXFConfigurer.java 2009-11-19
12:06:59 UTC (rev 11131)
+++
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/JBossWSCXFConfigurer.java 2009-11-19
12:14:21 UTC (rev 11132)
@@ -26,6 +26,7 @@
import org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory;
import org.apache.cxf.frontend.ClientProxyFactoryBean;
import org.apache.cxf.jaxb.JAXBDataBinding;
+import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
import org.jboss.wsf.spi.binding.BindingCustomization;
import org.jboss.wsf.spi.binding.JAXBBindingCustomization;
@@ -95,9 +96,21 @@
if (customization != null)
{
//customize default databinding (early pulls in ServiceFactory default
databinding and configure it, as it's lazily loaded)
- setBindingCustomization(factory.getServiceFactory().getDataBinding(),
customization);
+ ReflectionServiceFactoryBean serviceFactory = factory.getServiceFactory();
+ serviceFactory.reset();
+ DataBinding serviceFactoryDataBinding = serviceFactory.getDataBinding(true);
+ setBindingCustomization(serviceFactoryDataBinding, customization);
+ serviceFactory.setDataBinding(serviceFactoryDataBinding);
//customize user provided databinding (CXF later overrides the ServiceFactory
databinding using the user provided one)
- setBindingCustomization(factory.getDataBinding(), customization);
+ if (factory.getDataBinding() == null)
+ {
+ //set the service factory's databinding to prevent CXF resetting
everything because user did not provide anything
+ factory.setDataBinding(serviceFactoryDataBinding);
+ }
+ else
+ {
+ setBindingCustomization(factory.getDataBinding(), customization);
+ }
}
//add other configurations here below
}
@@ -113,9 +126,21 @@
if (customization != null)
{
//customize default databinding (early pulls in ServiceFactory default
databinding and configure it, as it's lazily loaded)
- setBindingCustomization(factory.getServiceFactory().getDataBinding(),
customization);
+ ReflectionServiceFactoryBean serviceFactory = factory.getServiceFactory();
+ serviceFactory.reset();
+ DataBinding serviceFactoryDataBinding = serviceFactory.getDataBinding(true);
+ setBindingCustomization(serviceFactoryDataBinding, customization);
+ serviceFactory.setDataBinding(serviceFactoryDataBinding);
//customize user provided databinding (CXF later overrides the ServiceFactory
databinding using the user provided one)
- setBindingCustomization(factory.getDataBinding(), customization);
+ if (factory.getDataBinding() == null)
+ {
+ //set the service factory's databinding to prevent CXF resetting
everything because user did not provide anything
+ factory.setDataBinding(serviceFactoryDataBinding);
+ }
+ else
+ {
+ setBindingCustomization(factory.getDataBinding(), customization);
+ }
}
//add other configurations here below
}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java 2009-11-19
12:06:59 UTC (rev 11131)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java 2009-11-19
12:14:21 UTC (rev 11132)
@@ -40,12 +40,13 @@
import org.apache.cxf.binding.soap.SoapTransportFactory;
import org.apache.cxf.configuration.Configurer;
import org.apache.cxf.endpoint.Server;
-import org.apache.cxf.endpoint.ServerImpl;
import org.apache.cxf.endpoint.ServerRegistry;
import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
import org.apache.cxf.jaxws.support.JaxWsImplementorInfo;
import org.apache.cxf.management.InstrumentationManager;
import org.apache.cxf.management.counters.CounterRepository;
+import org.apache.cxf.resource.ResourceManager;
+import org.apache.cxf.resource.ResourceResolver;
import org.apache.cxf.transport.DestinationFactoryManager;
import org.apache.cxf.transport.jms.AddressType;
import org.apache.cxf.transport.jms.JMSDestination;
@@ -139,6 +140,14 @@
ServletContext context = servletConfig.getServletContext();
String contextPath = context.getContextPath();
endpoint = initServiceEndpoint(contextPath);
+
+ //Install the JBossWS resource resolver
+ ResourceResolver resourceResolver =
endpoint.getAttachment(ResourceResolver.class);
+ if (resourceResolver != null)
+ {
+ bus.getExtension(ResourceManager.class).addResourceResolver(resourceResolver);
+ }
+
//Add customization check to use default CXF configurer
BindingCustomization customization =
endpoint.getAttachment(BindingCustomization.class);
if (customization != null) {
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/DescriptorDeploymentAspect.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/DescriptorDeploymentAspect.java 2009-11-19
12:06:59 UTC (rev 11131)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/DescriptorDeploymentAspect.java 2009-11-19
12:14:21 UTC (rev 11132)
@@ -26,6 +26,10 @@
import java.util.HashMap;
import java.util.Map;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.soap.MTOM;
+import javax.xml.ws.soap.SOAPBinding;
+
import org.jboss.logging.Logger;
import org.jboss.wsf.common.integration.WSConstants;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
@@ -36,10 +40,6 @@
import org.jboss.wsf.stack.cxf.metadata.services.DDBeans;
import org.jboss.wsf.stack.cxf.metadata.services.DDEndpoint;
-import javax.xml.ws.BindingType;
-import javax.xml.ws.soap.SOAPBinding;
-import javax.xml.ws.soap.MTOM;
-
/**
* A deployer that locates or generates cxf.xml
*
@@ -140,7 +140,7 @@
{
// get resource URL
ArchiveDeployment archDep = (ArchiveDeployment)dep;
- cxfURL = archDep.getMetaDataFileURL(metadir + "/jbossws-cxf.xml");
+ cxfURL = archDep.getResourceResolver().resolve(metadir +
"/jbossws-cxf.xml");
log.info("JBossWS-CXF configuration found: " + cxfURL);
}
catch (IOException ignore)
@@ -202,6 +202,7 @@
* @param cxfURL CXF DD URL
* @see org.jboss.wsf.common.integration.WSConstants.STACK_CONTEXT_PARAMS
*/
+ @SuppressWarnings("unchecked")
private void putCXFConfigToDeployment(Deployment dep, URL cxfURL)
{
// get property map
Added:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSResourceResolver.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSResourceResolver.java
(rev 0)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSResourceResolver.java 2009-11-19
12:14:21 UTC (rev 11132)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.wsf.stack.cxf;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.apache.cxf.resource.ResourceResolver;
+import org.jboss.logging.Logger;
+
+/**
+ * A CXF resource resolver that uses the JBossWS spi resource resolver,
+ * which in turn uses unified virtual files to access resources attached
+ * to the deployment (via JBoss VFS).
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 17-Nov-2009
+ *
+ */
+public class JBossWSResourceResolver implements ResourceResolver
+{
+ private static Logger log = Logger.getLogger(JBossWSResourceResolver.class);
+ private org.jboss.wsf.spi.deployment.ResourceResolver resolver;
+
+ public JBossWSResourceResolver(org.jboss.wsf.spi.deployment.ResourceResolver
resolver)
+ {
+ this.resolver = resolver;
+ }
+
+ public InputStream getAsStream(String resourcePath)
+ {
+ URL url = resolve(resourcePath, URL.class);
+ if (url != null)
+ {
+ try
+ {
+ return url.openStream();
+ }
+ catch (IOException ioe)
+ {
+ log.warn("Cannot open stream for resource: " + resourcePath);
+ }
+ }
+ return null;
+ }
+
+ public <T> T resolve(String resourcePath, Class<T> resourceType)
+ {
+ URL url = null;
+ try
+ {
+ url = resolver.resolve(resourcePath);
+ }
+ catch (IOException ioe)
+ {
+ log.warn("Cannot resolve resource: " + resourcePath);
+ }
+ if (url != null && resourceType.isInstance(url))
+ {
+ return resourceType.cast(url);
+ }
+ return null;
+ }
+
+}
Property changes on:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSResourceResolver.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/ResourceResolverDeploymentAspect.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/ResourceResolverDeploymentAspect.java
(rev 0)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/ResourceResolverDeploymentAspect.java 2009-11-19
12:14:21 UTC (rev 11132)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.wsf.stack.cxf;
+
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.ResourceResolver;
+
+/**
+ * A deployment aspect for attaching a custom JBoss resources resolver to the endpoint;
+ * CXF requires a ResourceResolver for getting wsdl, xsd, etc. correctly when
they're
+ * not reachable using the context classloader (for instance if they're out of
+ * WEB-INF/classes in a war deployed on AS 5 or greater - see. JBAS-5151)
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 19-Nov-2009
+ */
+public class ResourceResolverDeploymentAspect extends DeploymentAspect
+{
+ @Override
+ public void start(Deployment dep)
+ {
+ if (dep instanceof ArchiveDeployment)
+ {
+ ResourceResolver resolver = ((ArchiveDeployment)dep).getResourceResolver();
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ ep.addAttachment(org.apache.cxf.resource.ResourceResolver.class, new
JBossWSResourceResolver(resolver));
+ }
+ }
+ }
+
+ @Override
+ public void stop(Deployment dep)
+ {
+ if (dep instanceof ArchiveDeployment)
+ {
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ ep.removeAttachment(org.apache.cxf.resource.ResourceResolver.class);
+ }
+ }
+ }
+}
Property changes on:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/ResourceResolverDeploymentAspect.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config.xml
===================================================================
--- stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config.xml 2009-11-19
12:06:59 UTC (rev 11131)
+++ stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config.xml 2009-11-19
12:14:21 UTC (rev 11132)
@@ -51,6 +51,11 @@
<property name="relativeOrder">22</property> <!--
[JBDEPLOY-201] workaround -->
</bean>
+ <bean name="ResourceResolverDeploymentAspect"
class="org.jboss.wsf.stack.cxf.ResourceResolverDeploymentAspect">
+ <property name="requires">StackDescriptor</property>
+ <property name="relativeOrder">23</property> <!--
[JBDEPLOY-201] workaround -->
+ </bean>
+
<bean name="WSCXFEndpointHandlerDeploymentAspect"
class="org.jboss.wsf.framework.deployment.EndpointHandlerDeploymentAspect">
<property name="requires">ContainerMetaData</property>
<property name="provides">StackEndpointHandler</property>
Modified:
stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf.sar/META-INF/spring.schemas
===================================================================
---
stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf.sar/META-INF/spring.schemas 2009-11-19
12:06:59 UTC (rev 11131)
+++
stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf.sar/META-INF/spring.schemas 2009-11-19
12:14:21 UTC (rev 11132)
@@ -45,6 +45,7 @@
http\://schemas.xmlsoap.org/ws/2004/08/addressing=schemas/wsdl/addressing.xsd
http\://cxf.apache.org/schemas/configuration/security.xsd=schemas/configuration/security.xsd
+http\://cxf.apache.org/schemas/configuration/parameterized-types.xsd=schemas/configuration/parameterized-types.xsd
#
Modified: stack/cxf/trunk/pom.xml
===================================================================
--- stack/cxf/trunk/pom.xml 2009-11-19 12:06:59 UTC (rev 11131)
+++ stack/cxf/trunk/pom.xml 2009-11-19 12:14:21 UTC (rev 11132)
@@ -45,7 +45,7 @@
<properties>
<jbossws.common.version>1.2.2-SNAPSHOT</jbossws.common.version>
<jbossws.framework.version>3.2.2-SNAPSHOT</jbossws.framework.version>
- <jbossws.spi.version>1.2.1.GA</jbossws.spi.version>
+ <jbossws.spi.version>1.2.2-SNAPSHOT</jbossws.spi.version>
<jbossws.jboss500.version>3.2.1.GA</jbossws.jboss500.version>
<jbossws.jboss501.version>3.2.1.GA</jbossws.jboss501.version>
<jbossws.jboss510.version>3.2.1.GA</jbossws.jboss510.version>
@@ -56,8 +56,7 @@
<jbossws.jboss600.version>3.2.1.GA</jbossws.jboss600.version>
-->
<!-- END -->
- <cxf.version>2.2.4</cxf.version>
- <cxf.anttasks.version>2.1.5</cxf.anttasks.version>
+ <cxf.version>2.2.5</cxf.version>
<cxf.stax.version>1.0.1</cxf.stax.version>
<cxf.asm.version>2.2.3</cxf.asm.version>
<fastinfoset.api.version>1.2.7</fastinfoset.api.version>
@@ -76,7 +75,7 @@
<saaj.api.version>1.3</saaj.api.version>
<velocity.version>1.5</velocity.version>
<xmlsec.version>1.4.3</xmlsec.version>
- <wstx.version>3.2.8</wstx.version>
+ <wstx.version>3.2.9</wstx.version>
<spring.version>2.5.5</spring.version>
</properties>