Author: alessio.soldano(a)jboss.com
Date: 2011-03-11 13:26:03 -0500 (Fri, 11 Mar 2011)
New Revision: 13889
Added:
stack/cxf/branches/spring-as7/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/util/DelegateClassLoader.java
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/springframework/
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/springframework/spring/
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/springframework/spring/main/
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/springframework/spring/main/module.xml
stack/cxf/branches/spring-as7/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SecurityActions.java
Modified:
stack/cxf/branches/spring-as7/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java
stack/cxf/branches/spring-as7/modules/client/src/test/java/org/jboss/wsf/stack/cxf/client/ProviderImplTest.java
stack/cxf/branches/spring-as7/modules/dist/src/main/distro/build-deploy.xml
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/apache/cxf/main/module.xml
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/jboss/as/webservices/main/module.xml
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/jboss/as/webservices/server/integration/main/module.xml
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/jboss/ws/cxf/jbossws-cxf-server/main/module.xml
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/jboss/ws/jaxws-client/main/module.xml
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/resources/modules-deploy.conf
stack/cxf/branches/spring-as7/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java
stack/cxf/branches/spring-as7/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
stack/cxf/branches/spring-as7/modules/server/src/main/java/org/jboss/wsf/stack/cxf/spring/handler/NamespaceHandlerResolver.java
stack/cxf/branches/spring-as7/modules/testsuite/cxf-spring-tests/pom.xml
stack/cxf/branches/spring-as7/modules/testsuite/pom.xml
Log:
Adding deploy scripts for spring, temporarly adding dependency on spring module to some of
the relevant jbossws/cxf modules, initial configuration of runtime CL for loading spring
additional contexts
Modified:
stack/cxf/branches/spring-as7/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java
===================================================================
---
stack/cxf/branches/spring-as7/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java 2011-03-11
18:21:09 UTC (rev 13888)
+++
stack/cxf/branches/spring-as7/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java 2011-03-11
18:26:03 UTC (rev 13889)
@@ -21,17 +21,11 @@
*/
package org.jboss.wsf.stack.cxf.client;
-import java.io.IOException;
-import java.io.InputStream;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
-import java.security.SecureClassLoader;
-import java.util.ArrayList;
-import java.util.Enumeration;
import java.util.List;
import java.util.Map;
-import java.util.NoSuchElementException;
import java.util.concurrent.Executor;
import javax.xml.namespace.QName;
@@ -48,6 +42,7 @@
import org.apache.cxf.jaxws.ServiceImpl;
import org.jboss.logging.Logger;
import org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory;
+import org.jboss.wsf.stack.cxf.client.util.DelegateClassLoader;
import org.w3c.dom.Element;
/**
@@ -410,112 +405,4 @@
}
}
- static final class DelegateClassLoader extends SecureClassLoader
- {
- private ClassLoader delegate;
-
- private ClassLoader parent;
-
- public DelegateClassLoader(final ClassLoader delegate, final ClassLoader parent)
- {
- super(parent);
- this.delegate = delegate;
- this.parent = parent;
- }
-
- /** {@inheritDoc} */
- @Override
- public Class<?> loadClass(final String className) throws
ClassNotFoundException
- {
- if (parent != null)
- {
- try
- {
- return parent.loadClass(className);
- }
- catch (ClassNotFoundException cnfe)
- {
- //NOOP, use delegate
- }
- }
- return delegate.loadClass(className);
- }
-
- /** {@inheritDoc} */
- @Override
- public URL getResource(final String name)
- {
- URL url = null;
- if (parent != null)
- {
- url = parent.getResource(name);
- }
- return (url == null) ? delegate.getResource(name) : url;
- }
-
- /** {@inheritDoc} */
- @Override
- public Enumeration<URL> getResources(final String name) throws IOException
- {
- final ArrayList<Enumeration<URL>> foundResources = new
ArrayList<Enumeration<URL>>();
-
- foundResources.add(delegate.getResources(name));
- if (parent != null)
- {
- foundResources.add(parent.getResources(name));
- }
-
- return new Enumeration<URL>()
- {
- private int position = foundResources.size() - 1;
-
- public boolean hasMoreElements()
- {
- while (position >= 0)
- {
- if (foundResources.get(position).hasMoreElements())
- {
- return true;
- }
- position--;
- }
- return false;
- }
-
- public URL nextElement()
- {
- while (position >= 0)
- {
- try
- {
- return (foundResources.get(position)).nextElement();
- }
- catch (NoSuchElementException e)
- {
- }
- position--;
- }
- throw new NoSuchElementException();
- }
- };
- }
-
- /** {@inheritDoc} */
- @Override
- public InputStream getResourceAsStream(final String name)
- {
- URL foundResource = getResource(name);
- if (foundResource != null)
- {
- try
- {
- return foundResource.openStream();
- }
- catch (IOException e)
- {
- }
- }
- return null;
- }
- };
}
Added:
stack/cxf/branches/spring-as7/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/util/DelegateClassLoader.java
===================================================================
---
stack/cxf/branches/spring-as7/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/util/DelegateClassLoader.java
(rev 0)
+++
stack/cxf/branches/spring-as7/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/util/DelegateClassLoader.java 2011-03-11
18:26:03 UTC (rev 13889)
@@ -0,0 +1,145 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.client.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.security.SecureClassLoader;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.NoSuchElementException;
+
+/**
+ * A delegate classloader
+ *
+ * @author alessio.soldano(a)jboss.com
+ *
+ */
+public class DelegateClassLoader extends SecureClassLoader
+{
+ private ClassLoader delegate;
+
+ private ClassLoader parent;
+
+ public DelegateClassLoader(final ClassLoader delegate, final ClassLoader parent)
+ {
+ super(parent);
+ this.delegate = delegate;
+ this.parent = parent;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public Class<?> loadClass(final String className) throws ClassNotFoundException
+ {
+ if (parent != null)
+ {
+ try
+ {
+ return parent.loadClass(className);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ //NOOP, use delegate
+ }
+ }
+ return delegate.loadClass(className);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public URL getResource(final String name)
+ {
+ URL url = null;
+ if (parent != null)
+ {
+ url = parent.getResource(name);
+ }
+ return (url == null) ? delegate.getResource(name) : url;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public Enumeration<URL> getResources(final String name) throws IOException
+ {
+ final ArrayList<Enumeration<URL>> foundResources = new
ArrayList<Enumeration<URL>>();
+
+ foundResources.add(delegate.getResources(name));
+ if (parent != null)
+ {
+ foundResources.add(parent.getResources(name));
+ }
+
+ return new Enumeration<URL>()
+ {
+ private int position = foundResources.size() - 1;
+
+ public boolean hasMoreElements()
+ {
+ while (position >= 0)
+ {
+ if (foundResources.get(position).hasMoreElements())
+ {
+ return true;
+ }
+ position--;
+ }
+ return false;
+ }
+
+ public URL nextElement()
+ {
+ while (position >= 0)
+ {
+ try
+ {
+ return (foundResources.get(position)).nextElement();
+ }
+ catch (NoSuchElementException e)
+ {
+ }
+ position--;
+ }
+ throw new NoSuchElementException();
+ }
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public InputStream getResourceAsStream(final String name)
+ {
+ URL foundResource = getResource(name);
+ if (foundResource != null)
+ {
+ try
+ {
+ return foundResource.openStream();
+ }
+ catch (IOException e)
+ {
+ }
+ }
+ return null;
+ }
+}
\ No newline at end of file
Modified:
stack/cxf/branches/spring-as7/modules/client/src/test/java/org/jboss/wsf/stack/cxf/client/ProviderImplTest.java
===================================================================
---
stack/cxf/branches/spring-as7/modules/client/src/test/java/org/jboss/wsf/stack/cxf/client/ProviderImplTest.java 2011-03-11
18:21:09 UTC (rev 13888)
+++
stack/cxf/branches/spring-as7/modules/client/src/test/java/org/jboss/wsf/stack/cxf/client/ProviderImplTest.java 2011-03-11
18:26:03 UTC (rev 13889)
@@ -34,8 +34,8 @@
import junit.framework.TestCase;
-import org.jboss.wsf.stack.cxf.client.ProviderImpl.DelegateClassLoader;
import org.jboss.wsf.stack.cxf.client.ProviderImpl.DelegateEndpointImpl;
+import org.jboss.wsf.stack.cxf.client.util.DelegateClassLoader;
import org.w3c.dom.Element;
/**
Modified: stack/cxf/branches/spring-as7/modules/dist/src/main/distro/build-deploy.xml
===================================================================
--- stack/cxf/branches/spring-as7/modules/dist/src/main/distro/build-deploy.xml 2011-03-11
18:21:09 UTC (rev 13888)
+++ stack/cxf/branches/spring-as7/modules/dist/src/main/distro/build-deploy.xml 2011-03-11
18:26:03 UTC (rev 13889)
@@ -124,7 +124,7 @@
<echo message="jbossws.integration.target=${jbossws.integration.target}"
file="${target.properties.file}"/>
</target>
- <target name="deploy-jboss700"
depends="undeploy-jboss700,deploy-structure-jboss700" description="Deploy
jbossws to jboss700">
+ <target name="deploy-jboss700"
depends="undeploy-jboss700,deploy-structure-jboss700,check-spring,install-spring-module"
description="Deploy jbossws to jboss700">
<fail message="Not available: ${jboss700.available.file}"
unless="jboss700.available"/>
<copy todir="${jboss700.home}" overwrite="true"
verbose="true">
<fileset dir="${deploy.structure}">
@@ -162,6 +162,13 @@
</antcall>
</target>
+ <target name="install-spring-module" if="spring-required">
+ <antcall target="deploy-spring-module" inheritall="false">
+ <param name="installserver"
value="${deploy.structure}"/>
+ <param name="thirdpartydir"
value="${deploy.artifacts.dir}"/>
+ </antcall>
+ </target>
+
<!-- ================================================================== -->
<!-- Create jbossws-deploy.conf and jbossws-server-deploy.conf -->
<!-- ================================================================== -->
Modified:
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/apache/cxf/main/module.xml
===================================================================
---
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/apache/cxf/main/module.xml 2011-03-11
18:21:09 UTC (rev 13888)
+++
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/apache/cxf/main/module.xml 2011-03-11
18:26:03 UTC (rev 13889)
@@ -42,5 +42,6 @@
<module name="org.apache.neethi" />
<module name="org.apache.ws.commons.xmlschema" />
<module name="wsdl4j.wsdl4j" />
+ <module name="org.springframework.spring"
optional="true"/>
</dependencies>
</module>
Modified:
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/jboss/as/webservices/main/module.xml
===================================================================
---
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/jboss/as/webservices/main/module.xml 2011-03-11
18:21:09 UTC (rev 13888)
+++
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/jboss/as/webservices/main/module.xml 2011-03-11
18:26:03 UTC (rev 13889)
@@ -52,5 +52,6 @@
<module name="org.jboss.ws.jaxws-client"
services="import"/>
<module name="org.jboss.ws.cxf.jbossws-cxf-server"
services="import"/>
<module name="org.jboss.ws.spi" />
+ <module name="org.springframework.spring" optional="true"
/>
</dependencies>
</module>
Modified:
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/jboss/as/webservices/server/integration/main/module.xml
===================================================================
---
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/jboss/as/webservices/server/integration/main/module.xml 2011-03-11
18:21:09 UTC (rev 13888)
+++
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/jboss/as/webservices/server/integration/main/module.xml 2011-03-11
18:26:03 UTC (rev 13889)
@@ -34,29 +34,33 @@
<module name="org.jboss.ws.jaxws-client" services="export"
export="true">
<imports>
<include path="META-INF/cxf"/>
+ <include path="META-INF"/>
</imports>
<exports>
<include path="META-INF/cxf"/>
+ <include path="META-INF"/>
</exports>
</module>
<module name="org.jboss.ws.cxf.jbossws-cxf-factories"
services="export" export="true"/>
<module name="org.jboss.ws.cxf.jbossws-cxf-transports-httpserver"
export="true">
<imports>
<include path="META-INF/cxf"/>
+ <include path="META-INF"/>
</imports>
<exports>
<include path="META-INF/cxf"/>
+ <include path="META-INF"/>
</exports>
</module>
<module name="org.jboss.ws.cxf.jbossws-cxf-server"
services="export" export="true"/>
<module name="org.apache.cxf" services="export"
export="true">
<imports>
<include path="META-INF/cxf"/>
- <include path="META-INF/spring.*"/>
+ <include path="META-INF"/>
</imports>
<exports>
<include path="META-INF/cxf"/>
- <include path="META-INF/spring.*"/>
+ <include path="META-INF"/>
</exports>
</module>
<module name="org.apache.xalan" services="export"
export="true"/>
@@ -64,5 +68,6 @@
<module name="org.jboss.as.webservices" services="export"
export="true"/>
<module name="com.sun.xml.messaging.saaj"
services="export" export="true"/>
<module name="wsdl4j.wsdl4j" export="true"/>
+ <module name="org.springframework.spring" optional="true"
export="true"/>
</dependencies>
</module>
Modified:
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/jboss/ws/cxf/jbossws-cxf-server/main/module.xml
===================================================================
---
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/jboss/ws/cxf/jbossws-cxf-server/main/module.xml 2011-03-11
18:21:09 UTC (rev 13888)
+++
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/jboss/ws/cxf/jbossws-cxf-server/main/module.xml 2011-03-11
18:26:03 UTC (rev 13889)
@@ -43,17 +43,18 @@
<module name="org.apache.cxf" services="import">
<imports>
<include path="META-INF/cxf"/> <!-- required to also pull
in the bus extensions from META-INF -->
- <include path="META-INF/spring.*"/>
+ <include path="META-INF/"/>
</imports>
</module>
<module name="org.jboss.ws.cxf.jbossws-cxf-transports-httpserver"
services="import">
<imports>
<include path="META-INF/cxf"/> <!-- required to also pull
in the bus extensions from META-INF -->
- <include path="META-INF/spring.*"/>
+ <include path="META-INF/"/>
</imports>
</module>
<module name="org.jboss.common-core" />
<module name="org.jboss.logging" />
<module name="wsdl4j.wsdl4j" />
+ <module name="org.springframework.spring" optional="true"
/>
</dependencies>
</module>
Modified:
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/jboss/ws/jaxws-client/main/module.xml
===================================================================
---
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/jboss/ws/jaxws-client/main/module.xml 2011-03-11
18:21:09 UTC (rev 13888)
+++
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/jboss/ws/jaxws-client/main/module.xml 2011-03-11
18:26:03 UTC (rev 13889)
@@ -33,22 +33,24 @@
<module name="javax.xml.bind.api" />
<module name="com.sun.xml.bind" services="import"/>
<module name="javax.xml.ws.api" />
+ <module name="org.jboss.ws.api" />
<module name="org.jboss.ws.spi" />
<module name="org.jboss.ws.common" />
<module name="org.jboss.ws.cxf.jbossws-cxf-factories"
services="import"/>
<module name="org.apache.cxf" services="import">
<imports>
<include path="META-INF/cxf"/> <!-- required to also pull
in the bus extensions from META-INF -->
- <include path="META-INF/spring.*"/>
+ <include path="META-INF/"/>
</imports>
</module>
<module name="org.jboss.ws.cxf.jbossws-cxf-transports-httpserver"
services="import">
<imports>
<include path="META-INF/cxf"/> <!-- required to also pull
in the bus extensions from META-INF -->
- <include path="META-INF/spring.*"/>
+ <include path="META-INF/"/>
</imports>
</module>
<module name="org.apache.neethi" />
<module name="org.jboss.logging" />
+ <module name="org.springframework.spring" optional="true"
/>
</dependencies>
</module>
Added:
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/springframework/spring/main/module.xml
===================================================================
---
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/springframework/spring/main/module.xml
(rev 0)
+++
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/modules/org/springframework/spring/main/module.xml 2011-03-11
18:26:03 UTC (rev 13889)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., 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.
+ -->
+
+<module xmlns="urn:jboss:module:1.0"
name="org.springframework.spring">
+
+ <resources>
+ <!-- Insert resources here -->
+ </resources>
+
+ <dependencies>
+ <module name="javax.api" />
+ <module name="javax.annotation.api" />
+ <module name="org.apache.commons.logging" />
+ </dependencies>
+</module>
Modified:
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
===================================================================
---
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2011-03-11
18:21:09 UTC (rev 13888)
+++
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2011-03-11
18:26:03 UTC (rev 13889)
@@ -391,6 +391,7 @@
<fileset dir="@{thirdpartydir}/modules">
<include name="**/module.xml"/>
<exclude name="**/jboss/as/webservices/**/module.xml"/>
+ <exclude name="**/spring/**/module.xml"/>
</fileset>
</installModules>
<copy toDir="@{targetdir}">
@@ -445,6 +446,25 @@
<!-- Install Spring -->
<!-- ================================================================== -->
+ <macrodef name="macro-install-spring-modules">
+ <attribute name="thirdpartydir"/>
+ <attribute name="targetdir"/>
+ <sequential>
+ <!-- libraries -->
+ <copy todir="@{targetdir}/org/springframework/spring/main"
flatten="false" overwrite="true">
+ <fileset dir="@{thirdpartydir}/lib">
+ <include name="**/spring-*.jar"/>
+ </fileset>
+ </copy>
+ <!-- module.xml files -->
+ <installModules targetDir="@{targetdir}">
+ <fileset dir="@{thirdpartydir}/modules">
+ <include name="**/spring/**/module.xml"/>
+ </fileset>
+ </installModules>
+ </sequential>
+ </macrodef>
+
<macrodef name="macro-install-spring">
<attribute name="thirdpartydir"/>
<attribute name="targetdir"/>
@@ -463,6 +483,12 @@
<macro-install-spring targetdir="${installserver}/common/lib"
thirdpartydir="${thirdpartydir}"/>
</target>
+ <target name="deploy-spring-module">
+ <fail message="installserver must be specified"
unless="installserver"/>
+ <fail message="thirdpartydir must be specified"
unless="thirdpartydir"/>
+ <macro-install-spring-modules targetdir="${installserver}/modules"
thirdpartydir="${thirdpartydir}"/>
+ </target>
+
<!-- ================================================================== -->
<!-- Undeploy JBossWS -->
<!-- ================================================================== -->
Modified:
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/resources/modules-deploy.conf
===================================================================
---
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/resources/modules-deploy.conf 2011-03-11
18:21:09 UTC (rev 13888)
+++
stack/cxf/branches/spring-as7/modules/resources/src/main/resources/resources/modules-deploy.conf 2011-03-11
18:26:03 UTC (rev 13889)
@@ -1 +1 @@
-org/apache/cxf/**, org/apache/neethi/**, org/apache/ws/commons/xmlschema/**,
org/jboss/ws/cxf/**, org/jboss/ws/**
\ No newline at end of file
+org/apache/cxf/**, org/apache/neethi/**, org/apache/ws/commons/xmlschema/**,
org/jboss/ws/cxf/**, org/jboss/ws/**, org/springframework/spring/**
\ No newline at end of file
Added:
stack/cxf/branches/spring-as7/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SecurityActions.java
===================================================================
---
stack/cxf/branches/spring-as7/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SecurityActions.java
(rev 0)
+++
stack/cxf/branches/spring-as7/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SecurityActions.java 2011-03-11
18:26:03 UTC (rev 13889)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.configuration;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 22-Feb-2011
+ *
+ */
+class SecurityActions
+{
+ /**
+ * Get context classloader.
+ *
+ * @return the current context classloader
+ */
+ static ClassLoader getContextClassLoader()
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
{
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+ }
+
+ /**
+ * Set context classloader.
+ *
+ * @param classLoader the classloader
+ */
+ static void setContextClassLoader(final ClassLoader classLoader)
+ {
+ if (System.getSecurityManager() == null)
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ }
+ else
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Object>()
+ {
+ public Object run()
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ return null;
+ }
+ });
+ }
+ }
+
+}
Modified:
stack/cxf/branches/spring-as7/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java
===================================================================
---
stack/cxf/branches/spring-as7/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java 2011-03-11
18:21:09 UTC (rev 13888)
+++
stack/cxf/branches/spring-as7/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java 2011-03-11
18:26:03 UTC (rev 13889)
@@ -159,7 +159,7 @@
GenericApplicationContext childCtx = new GenericApplicationContext(ctx);
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(childCtx);
reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD);
- reader.setNamespaceHandlerResolver(new NamespaceHandlerResolver());
+ reader.setNamespaceHandlerResolver(new
NamespaceHandlerResolver(SecurityActions.getContextClassLoader()));
reader.loadBeanDefinitions(new InputStreamResource(is));
childCtx.refresh();
return childCtx;
Modified:
stack/cxf/branches/spring-as7/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
===================================================================
---
stack/cxf/branches/spring-as7/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2011-03-11
18:21:09 UTC (rev 13888)
+++
stack/cxf/branches/spring-as7/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2011-03-11
18:26:03 UTC (rev 13889)
@@ -36,6 +36,7 @@
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.ResourceResolver;
import org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory;
+import org.jboss.wsf.stack.cxf.client.util.DelegateClassLoader;
import org.jboss.wsf.stack.cxf.configuration.BusHolder;
import org.jboss.wsf.stack.cxf.configuration.NonSpringBusHolder;
import org.jboss.wsf.stack.cxf.configuration.SpringBusHolder;
@@ -63,8 +64,6 @@
BusFactory.setThreadDefaultBus(null);
ArchiveDeployment aDep = (ArchiveDeployment) dep;
- //set the runtime classloader (pointing to the deployment unit) to allow CXF
accessing to the classes
- SecurityActions.setContextClassLoader(dep.getRuntimeClassLoader());
ResourceResolver deploymentResolver = aDep.getResourceResolver();
org.apache.cxf.resource.ResourceResolver resolver = new
JBossWSResourceResolver(deploymentResolver);
@@ -74,6 +73,14 @@
if (jbosswsCxfXml != null) // Spring available
{
+ //set the runtime classloader (pointing to the deployment unit) to allow CXF
accessing to the classes
+ ClassLoader loader = dep.getRuntimeClassLoader();
+ if (true) //can't load jbossws/cxf classes
+ {
+ loader = new DelegateClassLoader(origClassLoader, loader);
+ }
+ SecurityActions.setContextClassLoader(loader);
+
URL cxfServletURL = null;
try
{
@@ -98,6 +105,8 @@
else
//Spring not available
{
+ //set the runtime classloader (pointing to the deployment unit) to allow CXF
accessing to the classes
+ SecurityActions.setContextClassLoader(dep.getRuntimeClassLoader());
DDBeans metadata = dep.getAttachment(DDBeans.class);
holder = new NonSpringBusHolder(metadata);
Configurer configurer =
holder.createServerConfigurer(dep.getAttachment(BindingCustomization.class),
@@ -114,6 +123,8 @@
}
}
+
+
@Override
public void start(Deployment dep)
{
Modified:
stack/cxf/branches/spring-as7/modules/server/src/main/java/org/jboss/wsf/stack/cxf/spring/handler/NamespaceHandlerResolver.java
===================================================================
---
stack/cxf/branches/spring-as7/modules/server/src/main/java/org/jboss/wsf/stack/cxf/spring/handler/NamespaceHandlerResolver.java 2011-03-11
18:21:09 UTC (rev 13888)
+++
stack/cxf/branches/spring-as7/modules/server/src/main/java/org/jboss/wsf/stack/cxf/spring/handler/NamespaceHandlerResolver.java 2011-03-11
18:26:03 UTC (rev 13889)
@@ -62,6 +62,7 @@
public NamespaceHandlerResolver(ClassLoader classLoader)
{
super(classLoader);
+ this.loader = (classLoader != null ? classLoader :
ClassUtils.getDefaultClassLoader());
}
public NamespaceHandlerResolver(ClassLoader classLoader, String
handlerMappingsLocation)
Modified: stack/cxf/branches/spring-as7/modules/testsuite/cxf-spring-tests/pom.xml
===================================================================
--- stack/cxf/branches/spring-as7/modules/testsuite/cxf-spring-tests/pom.xml 2011-03-11
18:21:09 UTC (rev 13888)
+++ stack/cxf/branches/spring-as7/modules/testsuite/cxf-spring-tests/pom.xml 2011-03-11
18:26:03 UTC (rev 13889)
@@ -29,6 +29,12 @@
<groupId>org.picketbox</groupId>
<artifactId>picketbox-bare</artifactId>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
Modified: stack/cxf/branches/spring-as7/modules/testsuite/pom.xml
===================================================================
--- stack/cxf/branches/spring-as7/modules/testsuite/pom.xml 2011-03-11 18:21:09 UTC (rev
13888)
+++ stack/cxf/branches/spring-as7/modules/testsuite/pom.xml 2011-03-11 18:26:03 UTC (rev
13889)
@@ -869,6 +869,8 @@
<exclude>org/jboss/test/ws/jaxws/samples/webserviceref/**</exclude>
<exclude>org/jboss/test/ws/jaxws/samples/webservicerefsec/**</exclude>
<exclude>org/jboss/test/ws/jaxws/samples/securityDomain/**</exclude>
+ <!-- @SecurityDomain missing -->
+
<exclude>org/jboss/test/ws/jaxws/samples/wsseEJB/EjbEndpointImpl*</exclude>
</testExcludes>
</configuration>
<goals>