[jboss-svn-commits] JBL Code SVN: r35232 - in labs/jbossesb/branches/JBESB_4_9_CP/product: lib/ext and 14 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Sep 22 09:13:22 EDT 2010


Author: kevin.conner at jboss.com
Date: 2010-09-22 09:13:21 -0400 (Wed, 22 Sep 2010)
New Revision: 35232

Added:
   labs/jbossesb/branches/JBESB_4_9_CP/product/lib/ext/org.springframework.context-3.0.2.RELEASE.jar
   labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/
   labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/
   labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/
   labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/jboss/
   labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/jboss/internal/
   labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/jboss/internal/soa/
   labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/jboss/internal/soa/esb/
   labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/jboss/internal/soa/esb/soap/
   labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/jboss/internal/soa/esb/soap/cxf/
   labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/jboss/internal/soa/esb/soap/cxf/ESBCXFServletExt.java
   labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/jboss/internal/soa/esb/soap/cxf/ExtensionDeploymentAspect.java
   labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/jboss/internal/soa/esb/soap/cxf/LoadOnStartupDeploymentAspect.java
   labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/cxf/ServletControllerExtProvider.java
   labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/cxf/ServletControllerExtProviderFactory.java
Removed:
   labs/jbossesb/branches/JBESB_4_9_CP/product/services/spring/lib/ext/org.springframework.context-3.0.2.RELEASE.jar
Modified:
   labs/jbossesb/branches/JBESB_4_9_CP/product/build-distr.xml
   labs/jbossesb/branches/JBESB_4_9_CP/product/build.xml
   labs/jbossesb/branches/JBESB_4_9_CP/product/services/base-project-build.xml
   labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/build.xml
   labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/cxf/SOAPProcessorCXFServletContext.java
   labs/jbossesb/branches/JBESB_4_9_CP/product/services/spring/build.xml
Log:
Revisit the CXF invm invocations for SOAPProcessor: JBESB-3484

Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/build-distr.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/build-distr.xml	2010-09-22 13:08:36 UTC (rev 35231)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/build-distr.xml	2010-09-22 13:13:21 UTC (rev 35232)
@@ -88,7 +88,7 @@
 
         <mkdir dir="${build.dir}/jbossesb.sar/lib"/>
         <copy todir="${build.dir}/jbossesb.sar/lib">
-            <fileset dir="${build.lib.dir}" includes="jbossesb*.jar" excludes="jbossesb-registry.jar jbossesb-transport*.jar"/>
+            <fileset dir="${build.lib.dir}" includes="jbossesb*.jar" excludes="jbossesb-registry.jar jbossesb-transport*.jar jbossesb-cxf*.jar"/>
             <!-- xbean for reading/marchalling xml for configuration, and scout -->
             <fileset dir="${lib.dir}" includes="xbean*.jar"/>
             <fileset dir="${lib.dir}" includes="stax-api-*.jar"/>

Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/build.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/build.xml	2010-09-22 13:08:36 UTC (rev 35231)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/build.xml	2010-09-22 13:13:21 UTC (rev 35232)
@@ -328,9 +328,7 @@
 		<mkdir dir="${org.jboss.esb.installationdirectory}/lib/ext"/>
 			<copy
 				todir="${org.jboss.esb.installationdirectory}/lib/ext">
-				<fileset dir="lib/ext">
-					<include name="*.jar"/>
-				</fileset>
+				<fileset dir="lib/ext" includes="*.jar" excludes="org.springframework.context-*.jar"/>
 			</copy>
 		
 		<copy file="lib/Licenses.txt" todir="${org.jboss.esb.installationdirectory}/lib"/>

Copied: labs/jbossesb/branches/JBESB_4_9_CP/product/lib/ext/org.springframework.context-3.0.2.RELEASE.jar (from rev 35057, labs/jbossesb/branches/JBESB_4_9_CP/product/services/spring/lib/ext/org.springframework.context-3.0.2.RELEASE.jar)
===================================================================
(Binary files differ)

Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/services/base-project-build.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/services/base-project-build.xml	2010-09-22 13:08:36 UTC (rev 35231)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/services/base-project-build.xml	2010-09-22 13:13:21 UTC (rev 35232)
@@ -13,6 +13,7 @@
 	<dirname property="services.dir" file="${ant.file.base-build}"/>
 	<property name="esb.root.dir" location="../.."/>
 	<property name="lib.excludes" value=""/>
+	<property name="build.lib.excludes" value=""/>
 	<target name="clean">
 		<delete dir="build" />
 		<delete file="TESTS-TestSuites.xml" quiet="true"/>
@@ -20,7 +21,16 @@
 
 	<property name="endorsed.dir" location="${esb.root.dir}/lib/ext/endorsed"/>
 	
-	<target name="prepare">
+	<target name="init.classpath">
+		<path id="classpath">
+			<path refid="base-classpath"/>
+		</path>
+		<path id="exec.classpath">
+			<path refid="classpath"/>
+		</path>
+	</target>
+	
+	<target name="prepare" depends="init.classpath">
 		<mkdir dir="build/${ant.project.name}.esb/META-INF" />
 		<mkdir dir="build/classes" />
 		<antcall target="service-prepare"/>
@@ -82,10 +92,6 @@
         <pathelement location="${esb.root.dir}/etc/test/registry"/>
 	</path>
 
-	<path id="classpath">
-		<path refid="base-classpath"/>
-	</path>
-
     <path id="test.classpath">
         <fileset dir="${esb.root.dir}/../testlib" includes="*.jar" />
     </path>
@@ -132,7 +138,7 @@
         <copy todir="build/${ant.project.name}.esb/" >
         	<fileset dir="lib/ext" includes="*.jar" excludes="${lib.excludes}"/>
         	<fileset dir="src/main/resources/" includes="**/*"/>
-        	<fileset dir="build" includes="*.jar"/>
+        	<fileset dir="build" includes="*.jar" excludes="${build.lib.excludes}"/>
          </copy>
     </target>
 	
@@ -164,7 +170,7 @@
     	<mkdir dir="build/tests/report"/>
     	<javac srcdir="src/test/java" destdir="build/tests/classes" debug="on" >
 			<classpath>
-                <path refid="classpath" />
+                <path refid="exec.classpath" />
                 <path refid="test.classpath" />
             </classpath>
 		</javac>
@@ -189,7 +195,7 @@
 	    		<!-- using instrumented code for code coverage -->
 	            <pathelement location="${coverage.dir}/instr"/>
 	            <pathelement location="build/tests/classes/"/>
-	            <path refid="classpath" />
+	            <path refid="exec.classpath" />
                 <path refid="test.classpath" />
 	            <pathelement location="../soapui-client/target/aop-classes"/>
             </classpath>

Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/build.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/build.xml	2010-09-22 13:08:36 UTC (rev 35231)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/build.xml	2010-09-22 13:13:21 UTC (rev 35232)
@@ -7,6 +7,10 @@
 	<property name="aop.src.dir" location="${aop.dir}/java"/>
 	<property name="aop.resources.dir" location="${aop.dir}/resources"/>
 
+	<property name="cxf.dir" location="cxf"/>
+	<property name="cxf.src.dir" location="${cxf.dir}/java"/>
+	<property name="cxf.resources.dir" location="${cxf.dir}/resources"/>
+
         <property name="wise.jar" value="wise-core.jar"/>
         <property name="jaxws.jar" value="jaxws-tools-2.1.1.jar"/>
 
@@ -17,27 +21,47 @@
         <property name="aopc.wise.classes.dir" location="${build.dir}/aopc-wise-classes"/>
         <property name="aopc.jaxws.classes.dir" location="${build.dir}/aopc-jaxws-classes"/>
 
+        <property name="cxf.jar.name" value="jbossesb-cxf.jar"/>
+        <property name="cxf.classes.dir" location="${build.dir}/cxf-classes"/>
+        <property name="cxf.jar" value="${build.dir}/${cxf.jar.name}"/>
+
+	<condition property="cxf.compile">
+		<equals arg1="${java.specification.version}" arg2="1.6"/>
+	</condition>
+
         <property name="lib.excludes" value="${wise.jar}"/>
+	<property name="build.lib.excludes" value="${cxf.jar.name}"/>
+
 	<!-- Import the base Ant build script... -->
         <import file="${services.base.build}"/>
 	
 	<target name="test" depends="base.test"/>
 
-    <path id="classpath">
-        <path refid="base-classpath" />
+    <target name="init.classpath">
+        <path id="classpath">
+            <path refid="base-classpath" />
 
-        <fileset dir="../../lib/ext" includes="*.jar"/>
-        <fileset dir="../../build/lib" includes="*.jar"/>
+            <fileset dir="../../lib/ext" includes="*.jar"/>
+            <fileset dir="../../build/lib" includes="*.jar"/>
 
-        <!-- Adding the Smooks jars... -->
-        <fileset dir="../smooks/lib/ext" includes="*.jar"/>
+            <!-- Adding the Smooks jars... -->
+            <fileset dir="../smooks/lib/ext" includes="*.jar"/>
 
-        <!-- Stuff required for testing... -->
-        <fileset dir="../soapui-client/src/lib" includes="*.jar"/>
-        <pathelement location="../soapui-client/target/classes" />
-    </path>
+            <!-- Stuff required for testing... -->
+            <fileset dir="../soapui-client/src/lib" includes="*.jar"/>
+            <pathelement location="../soapui-client/target/classes" />
+        </path>
+    </target>
 
-    <target name="service-compile" depends="prepare">
+    <target name="cxf-compile" if="cxf.compile">
+       <delete dir="${cxf.classes.dir}" quiet="true"/>
+       <mkdir dir="${cxf.classes.dir}"/>
+
+       <javac srcdir="${cxf.src.dir}" destdir="${cxf.classes.dir}"
+           debug="true" classpathref="classpath"/>
+    </target>
+
+    <target name="service-compile" depends="prepare, cxf-compile">
        <delete dir="${aop.classes.dir}" quiet="true"/>
        <mkdir dir="${aop.classes.dir}"/>
 
@@ -45,7 +69,7 @@
            debug="true" source="1.5" classpathref="classpath"/>
     </target>
 
-    <target name="service-jar" depends="aop-jar, aopc-jar"/>
+    <target name="service-jar" depends="aop-jar, aopc-jar, cxf-jar"/>
 
     <target name="aop-jar" depends="compile">
         <jar destfile="${aop.jar}">
@@ -54,6 +78,12 @@
         </jar>
     </target>
 
+    <target name="cxf-jar" depends="compile" if="cxf.compile">
+        <jar destfile="${cxf.jar}">
+            <fileset dir="${cxf.classes.dir}"/>
+        </jar>
+    </target>
+
     <target name="aopc-jar">
         <taskdef name="aopc" classname="org.jboss.aop.ant.AopC"
             classpathref="classpath"/>
@@ -99,5 +129,9 @@
                 includes="jaxws-rt*.jar jaxb-xjc*.jar"/>
             <fileset file="${aop.jar}"/>
         </copy>
+
+        <copy todir="${esb.product.lib.dir}">
+            <fileset file="${cxf.jar}"/>
+        </copy>
     </target>
 </project>

Added: labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/jboss/internal/soa/esb/soap/cxf/ESBCXFServletExt.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/jboss/internal/soa/esb/soap/cxf/ESBCXFServletExt.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/jboss/internal/soa/esb/soap/cxf/ESBCXFServletExt.java	2010-09-22 13:13:21 UTC (rev 35232)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.internal.soa.esb.soap.cxf;
+
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.ObjectName;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.stack.cxf.CXFServletExt;
+import org.jboss.wsf.stack.cxf.ServletControllerExt;
+
+public class ESBCXFServletExt extends CXFServletExt
+{
+    public void init(final ServletConfig servletConfig)
+        throws ServletException
+    {
+        super.init(servletConfig) ;
+        final Endpoint endpoint = getEndpoint(servletConfig.getServletContext()) ;
+        final Map<Class<?>, Object> extensions = endpoint.getAttachment(Map.class) ;
+        if (extensions != null)
+        {
+            extensions.put(ServletControllerExt.class, controller) ;
+        }
+    }
+    
+    private Endpoint getEndpoint(final ServletContext context)
+        throws ServletException
+    {
+        String contextPath = context.getContextPath() ;
+        if (contextPath.startsWith("/"))
+        {
+            contextPath = contextPath.substring(1) ;
+        }
+
+        Endpoint endpoint = null ;
+        String servletName = getServletName() ;
+        for (ObjectName sepId : epRegistry.getEndpoints())
+        {
+            String propContext = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_CONTEXT) ;
+            String propEndpoint = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT) ;
+            if (servletName.equals(propEndpoint) && contextPath.equals(propContext))
+            {
+                endpoint = epRegistry.getEndpoint(sepId) ;
+                break ;
+            }
+        }
+
+        if (endpoint == null)
+        {
+            throw new ServletException("Could not obtain endpoint for context: " + contextPath + ", servlet name: " + servletName) ;
+        }
+        else
+        {
+            return endpoint ;
+        }
+    }
+}


Property changes on: labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/jboss/internal/soa/esb/soap/cxf/ESBCXFServletExt.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Added: labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/jboss/internal/soa/esb/soap/cxf/ExtensionDeploymentAspect.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/jboss/internal/soa/esb/soap/cxf/ExtensionDeploymentAspect.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/jboss/internal/soa/esb/soap/cxf/ExtensionDeploymentAspect.java	2010-09-22 13:13:21 UTC (rev 35232)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.internal.soa.esb.soap.cxf;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.deployment.Endpoint;
+
+/**
+ * A jbossws deployment aspect that creates an extension bag attached to the endpoints.
+ *
+ * @author <a href='mailto:kevin.conner at jboss.com>Kevin Conner</a>
+ */
+public class ExtensionDeploymentAspect extends DeploymentAspect
+{
+   @Override
+   public void start(Deployment dep)
+   {
+       for (Endpoint endpoint : dep.getService().getEndpoints())
+       {
+           endpoint.addAttachment(Map.class, new ConcurrentHashMap<Object, Object>()) ;
+       }
+   }
+
+   @Override
+   public void stop(Deployment dep)
+   {
+       for (Endpoint endpoint : dep.getService().getEndpoints())
+       {
+           endpoint.removeAttachment(Map.class) ;
+       }
+   }
+}


Property changes on: labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/jboss/internal/soa/esb/soap/cxf/ExtensionDeploymentAspect.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Added: labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/jboss/internal/soa/esb/soap/cxf/LoadOnStartupDeploymentAspect.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/jboss/internal/soa/esb/soap/cxf/LoadOnStartupDeploymentAspect.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/jboss/internal/soa/esb/soap/cxf/LoadOnStartupDeploymentAspect.java	2010-09-22 13:13:21 UTC (rev 35232)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.internal.soa.esb.soap.cxf;
+
+import java.util.Map;
+
+import org.jboss.metadata.web.jboss.JBossServletMetaData;
+import org.jboss.metadata.web.jboss.JBossServletsMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.deployment.Endpoint;
+
+/**
+ * A jbossws deployment aspect that modified the load on startup servlet configuration.
+ *
+ * @author <a href='mailto:kevin.conner at jboss.com>Kevin Conner</a>
+ */
+public class LoadOnStartupDeploymentAspect extends DeploymentAspect
+{
+    private String servletClassProperty ;
+    private int loadOnStartup = 1 ;
+
+    public String getServletClassProperty()
+    {
+       return servletClassProperty ;
+    }
+
+    public void setServletClassProperty(final String servletClassProperty)
+    {
+        this.servletClassProperty = servletClassProperty ;
+    }
+
+    public int getLoadOnStartup()
+    {
+       return loadOnStartup ;
+    }
+
+    public void setLoadOnStartup(final int loadOnStartup)
+    {
+        this.loadOnStartup = loadOnStartup ;
+    }
+    
+    @Override
+    public void start(final Deployment dep)
+    {
+        if (servletClassProperty != null)
+        {
+            final Object servletClassObj = dep.getProperty(servletClassProperty) ;
+            if (servletClassObj != null)
+            {
+                final String servletClass = servletClassObj.toString() ;
+                final JBossWebMetaData webMetaData = dep.getAttachment(JBossWebMetaData.class);
+                if (webMetaData != null)
+                {
+                    final JBossServletsMetaData servlets = webMetaData.getServlets() ;
+                    if (servlets != null)
+                    {
+                        for(JBossServletMetaData servlet : servlets)
+                        {
+                            if (servlet != null)
+                            {
+                                final String currentClass = servlet.getServletClass() ;
+                                if (servletClass.equals(currentClass))
+                                {
+                                    if (servlet.getLoadOnStartup() == -1)
+                                    {
+                                        servlet.setLoadOnStartup(loadOnStartup) ;
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+}


Property changes on: labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/cxf/java/org/jboss/internal/soa/esb/soap/cxf/LoadOnStartupDeploymentAspect.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/cxf/SOAPProcessorCXFServletContext.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/cxf/SOAPProcessorCXFServletContext.java	2010-09-22 13:08:36 UTC (rev 35231)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/cxf/SOAPProcessorCXFServletContext.java	2010-09-22 13:13:21 UTC (rev 35232)
@@ -29,14 +29,8 @@
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 
-import org.apache.cxf.Bus;
-import org.apache.cxf.transport.DestinationFactory;
-import org.apache.cxf.transport.DestinationFactoryManager;
 import org.apache.cxf.transport.servlet.ServletController;
-import org.apache.cxf.transport.servlet.ServletTransportFactory;
 import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.stack.cxf.ServletControllerExt;
-import org.jboss.wsf.stack.cxf.configuration.BusHolder;
 
 /**
  * This is an adapter used when integrating with JBossWS CXF integration.
@@ -47,40 +41,29 @@
 {
     private static final String CONTROLLER_NAME = ServletController.class.getName() ;
     
-    private final ServletControllerExt servletControllerExt ;
+    private final Endpoint endpoint ;
     
+    private ServletControllerExtProvider provider ;
+    
     public SOAPProcessorCXFServletContext(final Endpoint endpoint)
     {
-        final BusHolder busHolder = endpoint.getAttachment(BusHolder.class) ;
-        final Bus bus = busHolder.getBus() ;
-
-        final ServletTransportFactory servletTransportFactory = new SOAPProcessorServletTransportFactory(bus, getTransport(bus)) ;
-        servletControllerExt = new ServletControllerExt(servletTransportFactory, null, this, bus) ;
+        this.endpoint = endpoint ;
     }
     
-    private ServletTransportFactory getTransport(final Bus bus)
+    private synchronized ServletControllerExtProvider getProvider()
     {
-        final DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class) ;
-        try
+        if (provider == null)
         {
-            final DestinationFactory df = dfm.getDestinationFactory("http://cxf.apache.org/transports/http/configuration") ;
-            if (df instanceof ServletTransportFactory)
-            {
-                return (ServletTransportFactory)df ;
-            }
+            provider = ServletControllerExtProviderFactory.getFactory(endpoint, this) ;
         }
-        catch (final Throwable th)
-        {
-            throw new IllegalStateException("Could not locate CXF transport", th) ;
-        }
-        throw new IllegalStateException("Could not locate CXF transport") ;
+        return provider ;
     }
-
+    
     public Object getAttribute(final String name)
     {
         if (CONTROLLER_NAME.equals(name))
         {
-            return servletControllerExt ;
+            return getProvider().getServletControllerExt() ;
         }
         else
         {

Added: labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/cxf/ServletControllerExtProvider.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/cxf/ServletControllerExtProvider.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/cxf/ServletControllerExtProvider.java	2010-09-22 13:13:21 UTC (rev 35232)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+
+package org.jboss.soa.esb.actions.soap.adapter.cxf;
+
+import org.jboss.wsf.stack.cxf.ServletControllerExt;
+
+/**
+ * Interface for accessing the ServletControllerExt for the CXF integration.
+ *  
+ * @author <a href="mailto:kevin.conner at jboss.com">Kevin Conner</a>
+ */
+interface ServletControllerExtProvider
+{
+    ServletControllerExt getServletControllerExt() ;
+}


Property changes on: labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/cxf/ServletControllerExtProvider.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Added: labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/cxf/ServletControllerExtProviderFactory.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/cxf/ServletControllerExtProviderFactory.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/cxf/ServletControllerExtProviderFactory.java	2010-09-22 13:13:21 UTC (rev 35232)
@@ -0,0 +1,154 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+
+package org.jboss.soa.esb.actions.soap.adapter.cxf;
+
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.transport.DestinationFactory;
+import org.apache.cxf.transport.DestinationFactoryManager;
+import org.apache.cxf.transport.servlet.ServletController;
+import org.apache.cxf.transport.servlet.ServletTransportFactory;
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.util.ClassUtil;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.stack.cxf.ServletControllerExt;
+import org.jboss.wsf.stack.cxf.configuration.BusHolder;
+
+/**
+ * This provides alternative implementations for obtaining the ServletControllerExt for the CXF integration.
+ *  
+ * @author <a href="mailto:kevin.conner at jboss.com">Kevin Conner</a>
+ */
+abstract class ServletControllerExtProviderFactory
+{
+    private static final ServletControllerExtProviderFactory FACTORY ;
+    private static final Logger LOGGER = Logger.getLogger(ServletControllerExtProviderFactory.class) ;
+    
+    public static ServletControllerExtProvider getFactory(final Endpoint endpoint, final ServletContext context)
+    {
+        return FACTORY.getProvider(endpoint, context) ;
+    }
+    
+    abstract ServletControllerExtProvider getProvider(final Endpoint endpoint, final ServletContext context) ;
+    
+    static
+    {
+        boolean busHolderExists = false ;
+        try
+        {
+            ClassUtil.forName("org.jboss.wsf.stack.cxf.configuration.BusHolder", ServletControllerExtProviderFactory.class) ;
+            busHolderExists = true ;
+        }
+        catch (final Throwable th) {} // ignore
+        
+        if (busHolderExists)
+        {
+            FACTORY = new BusHolderFactory() ;
+        }
+        else
+        {
+            FACTORY = new ServletControllerExtFactory() ;
+        }
+    }
+    
+    private static final class BusHolderFactory extends ServletControllerExtProviderFactory
+    {
+        ServletControllerExtProvider getProvider(final Endpoint endpoint, final ServletContext context)
+        {
+            return new BusHolderImpl(endpoint, context) ;
+        }
+    }
+    
+    private static final class BusHolderImpl implements ServletControllerExtProvider
+    {
+        private final ServletControllerExt servletControllerExt ;
+        
+        BusHolderImpl(final Endpoint endpoint, final ServletContext context)
+        {
+            final BusHolder busHolder = endpoint.getAttachment(BusHolder.class) ;
+            final Bus bus = busHolder.getBus() ;
+
+            final ServletTransportFactory servletTransportFactory = new SOAPProcessorServletTransportFactory(bus, getTransport(bus)) ;
+            servletControllerExt = new ServletControllerExt(servletTransportFactory, null, context, bus) ;
+        }
+
+        private static ServletTransportFactory getTransport(final Bus bus)
+        {
+            final DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class) ;
+            try
+            {
+                final DestinationFactory df = dfm.getDestinationFactory("http://cxf.apache.org/transports/http/configuration") ;
+                if (df instanceof ServletTransportFactory)
+                {
+                    return (ServletTransportFactory)df ;
+                }
+            }
+            catch (final Throwable th)
+            {
+                throw new IllegalStateException("Could not locate CXF transport", th) ;
+            }
+            throw new IllegalStateException("Could not locate CXF transport") ;
+        }
+        
+        public ServletControllerExt getServletControllerExt()
+        {
+            return servletControllerExt;
+        }
+    }
+
+    private static final class ServletControllerExtFactory extends ServletControllerExtProviderFactory
+    {
+        ServletControllerExtProvider getProvider(final Endpoint endpoint, final ServletContext context)
+        {
+            return new ServletControllerExtImpl(endpoint, context) ;
+        }
+    }
+    
+    private static final class ServletControllerExtImpl implements ServletControllerExtProvider
+    {
+        private final ServletControllerExt servletControllerExt ;
+        
+        ServletControllerExtImpl(final Endpoint endpoint, final ServletContext context)
+        {
+            final Map<Class<?>, Object> extensions = endpoint.getAttachment(Map.class) ;
+            servletControllerExt = (ServletControllerExt) extensions.get(ServletControllerExt.class) ;
+            if (servletControllerExt == null)
+            {
+                LOGGER.error("ServletControllerExt not present in endpoint attachments.  Has the CXF integration bean configured?  See ESB documentation for details.") ;
+                throw new IllegalStateException("Could not locate CXF ServletControllerExt attachment") ;
+            }
+        }
+
+        public ServletControllerExt getServletControllerExt()
+        {
+            return servletControllerExt;
+        }
+    }
+}


Property changes on: labs/jbossesb/branches/JBESB_4_9_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/cxf/ServletControllerExtProviderFactory.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/services/spring/build.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/services/spring/build.xml	2010-09-22 13:08:36 UTC (rev 35231)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/services/spring/build.xml	2010-09-22 13:13:21 UTC (rev 35232)
@@ -1,22 +1,29 @@
 <project name="spring" default="test" basedir=".">
 	
 	<property file="build.properties"/>
+
+	<property name="build.dir" location="build"/>
+	
 	<!-- Import the base Ant build script... -->
 	<import file="${services.base.build}"/>
-	
+
+	<target name="init.classpath">
+		<path id="classpath">
+			<path refid="base-classpath"/>
+			<fileset dir="lib/ext/snowdrop" includes="*.jar" />
+			<fileset dir="${esb.root.dir}/lib/ext" includes="org.springframework.context-3.0.2.RELEASE.jar"/>
+		</path>
+		<path id="exec.classpath">
+			<path refid="base-classpath"/>
+			<fileset dir="${esb.root.dir}/lib/ext" includes="org.springframework.context-3.0.2.RELEASE.jar"/>
+		</path>
+	</target>
+
 	<target name="test" depends="base.test"/>
-	
-	<!-- 
-	Redifining the base compile so as to add in the snowdrop jars.  Not adding these in the build-time
-	jars because the built-time jars are added to the test classpath, which we don't want.
-	 -->
-	<target name="base-compile" depends="prepare">
-		<javac srcdir="src/main/java" destdir="build/classes" debug="on" >
-			<classpath>
-			    <path refid="classpath" />
-				<fileset dir="lib/ext/snowdrop" includes="*.jar" />
-			</classpath>
-		</javac>
+
+	<target name="service-esb" depends="base-esb">
+		<copy todir="${build.dir}/${ant.project.name}.esb">
+			<fileset dir="${esb.root.dir}/lib/ext" includes="org.springframework.context-3.0.2.RELEASE.jar"/>
+		</copy>
 	</target>
-
-</project>
\ No newline at end of file
+</project>

Deleted: labs/jbossesb/branches/JBESB_4_9_CP/product/services/spring/lib/ext/org.springframework.context-3.0.2.RELEASE.jar
===================================================================
(Binary files differ)



More information about the jboss-svn-commits mailing list