[jboss-cvs] JBossAS SVN: r61870 - in trunk: ejb3/src/main/org/jboss/ejb3 and 8 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 29 19:00:26 EDT 2007


Author: thomas.diesler at jboss.com
Date: 2007-03-29 19:00:25 -0400 (Thu, 29 Mar 2007)
New Revision: 61870

Added:
   trunk/server/src/main/org/jboss/metadata/serviceref/VirtualFileAdaptor.java
Removed:
   trunk/server/src/main/org/jboss/metadata/serviceref/VirtualFileAdaptor.java
Modified:
   trunk/build/build-thirdparty.xml
   trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
   trunk/ejb3/src/main/org/jboss/ejb3/clientmodule/ClientENCInjectionContainer.java
   trunk/ejb3/src/main/org/jboss/injection/ServiceRefInjector.java
   trunk/server/build.xml
   trunk/server/src/main/org/jboss/deployment/ClientDeployer.java
   trunk/server/src/main/org/jboss/ejb/Container.java
   trunk/server/src/main/org/jboss/metadata/serviceref/ServiceRefDelegate.java
   trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployment.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment2.java
Log:
Add classloader to bindServiceRef. Cleanup thirdparty dependency hirachy

Modified: trunk/build/build-thirdparty.xml
===================================================================
--- trunk/build/build-thirdparty.xml	2007-03-29 22:27:08 UTC (rev 61869)
+++ trunk/build/build-thirdparty.xml	2007-03-29 23:00:25 UTC (rev 61870)
@@ -92,7 +92,7 @@
       <componentref name="jboss/common-logging-spi" version="2.0.2.GA"/>
       <componentref name="jboss/jaxr" version="1.2.0.GA"/>
       <componentref name="jboss/jbossxb" version="2.0.0.CR1"/>
-      <componentref name="jboss/jbossws-jboss50" version="2.0.0.CR5"/>
+      <componentref name="jboss/jbossws-jboss50" version="2.0.0.DEV"/>
       <componentref name="jboss/jbossws-wsconsume-impl" version="2.0.0"/>
       <componentref name="jboss/messaging" version="1.2.0.SP.snapshot.aop2beta"/>
       <componentref name="jboss/microcontainer" version="2.0.0.Beta3"/>
@@ -122,7 +122,6 @@
       <componentref name="sleepycat" version="3.0.12"/>
       <componentref name="spring" version="2.0"/>
       <componentref name="sun-jaf" version="1.1"/>
-      <componentref name="sun-jaxb" version="2.0.3"/>
       <componentref name="sun-jsf" version="1.2_03"/>
       <componentref name="sun-javacc" version="3.2"/>
       <componentref name="sun-javamail" version="1.4"/>
@@ -135,7 +134,6 @@
       <componentref name="wutka-dtdparser" version="1.2.1"/>
       <componentref name="xdoclet" version="1.2b3"/>
       <componentref name="xmlunit-xmlunit" version="1.0"/>
-	  <componentref name="stax-api" version="1.0"/>
    </build>
 
    <synchronizeinfo/>

Modified: trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java	2007-03-29 22:27:08 UTC (rev 61869)
+++ trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java	2007-03-29 23:00:25 UTC (rev 61870)
@@ -90,8 +90,8 @@
 import org.jboss.virtual.VirtualFile;
 import org.jboss.ws.integration.ServiceRefMetaData;
 import org.jboss.ws.integration.UnifiedVirtualFile;
+import org.jboss.metadata.serviceref.ServiceRefDelegate;
 import org.jboss.metadata.serviceref.VirtualFileAdaptor;
-import org.jboss.metadata.serviceref.ServiceRefDelegate;
 import org.jboss.util.StringPropertyReplacer;
 
 /**
@@ -358,7 +358,7 @@
                      Context encCtx = getEnc();
 
                      UnifiedVirtualFile vfsRoot = new VirtualFileAdaptor(getRootFile());
-                     new ServiceRefDelegate().bindServiceRef(encCtx, encName, vfsRoot, sref);
+                     new ServiceRefDelegate().bindServiceRef(encCtx, encName, vfsRoot, getClassloader(), sref);
 
                   }
                   catch (Exception e)

Modified: trunk/ejb3/src/main/org/jboss/ejb3/clientmodule/ClientENCInjectionContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/clientmodule/ClientENCInjectionContainer.java	2007-03-29 22:27:08 UTC (rev 61869)
+++ trunk/ejb3/src/main/org/jboss/ejb3/clientmodule/ClientENCInjectionContainer.java	2007-03-29 23:00:25 UTC (rev 61870)
@@ -65,8 +65,8 @@
 import org.jboss.virtual.VirtualFile;
 import org.jboss.ws.integration.ServiceRefMetaData;
 import org.jboss.ws.integration.UnifiedVirtualFile;
+import org.jboss.metadata.serviceref.ServiceRefDelegate;
 import org.jboss.metadata.serviceref.VirtualFileAdaptor;
-import org.jboss.metadata.serviceref.ServiceRefDelegate;
 
 /**
  * This class builds up the java:comp namespace for JavaEE 5 application clients.
@@ -334,7 +334,7 @@
                      Context encCtx = getEnc();
 
                      UnifiedVirtualFile vfsRoot = new VirtualFileAdaptor(getRootFile());
-                     new ServiceRefDelegate().bindServiceRef(encCtx, encName, vfsRoot, sref);
+                     new ServiceRefDelegate().bindServiceRef(encCtx, encName, vfsRoot, getClassloader(), sref);
 
                   }
                   catch (Exception e)

Modified: trunk/ejb3/src/main/org/jboss/injection/ServiceRefInjector.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/injection/ServiceRefInjector.java	2007-03-29 22:27:08 UTC (rev 61869)
+++ trunk/ejb3/src/main/org/jboss/injection/ServiceRefInjector.java	2007-03-29 23:00:25 UTC (rev 61870)
@@ -59,8 +59,9 @@
       try
       {
          Context envCtx = container.getEnc();
+         ClassLoader loader = container.getClassloader();
          UnifiedVirtualFile vfsRoot = new VirtualFileAdaptor(container.getRootFile());
-         new ServiceRefDelegate().bindServiceRef(envCtx, name, vfsRoot, sref);
+         new ServiceRefDelegate().bindServiceRef(envCtx, name, vfsRoot, loader, sref);
       }
       catch (Exception e)
       {

Modified: trunk/server/build.xml
===================================================================
--- trunk/server/build.xml	2007-03-29 22:27:08 UTC (rev 61869)
+++ trunk/server/build.xml	2007-03-29 23:00:25 UTC (rev 61870)
@@ -444,6 +444,7 @@
         <include name="org/jboss/invocation/pooled/interfaces/*.class"/>
         <include name="org/jboss/invocation/unified/interfaces/*.class"/>
         <include name="org/jboss/invocation/unified/marshall/*.class"/>
+        <include name="org/jboss/metadata/serviceref/VirtualFileAdaptor.class"/>
         <include name="org/jboss/monitor/client/*.class"/>
         <include name="org/jboss/naming/LinkRefPair.class"/>
         <include name="org/jboss/naming/LinkRefPairObjectFactory.class"/>
@@ -456,7 +457,6 @@
         <include name="org/jboss/tm/usertx/client/*.class"/>
         <include name="org/jboss/tm/usertx/interfaces/*.class"/>
         <include name="org/jboss/tm/usertx/server/*Stub.class"/>
-        <include name="org/jboss/webservice/metadata/**"/>
       </fileset>
     </jar>
 

Modified: trunk/server/src/main/org/jboss/deployment/ClientDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/ClientDeployer.java	2007-03-29 22:27:08 UTC (rev 61869)
+++ trunk/server/src/main/org/jboss/deployment/ClientDeployer.java	2007-03-29 23:00:25 UTC (rev 61870)
@@ -271,11 +271,12 @@
       }
 
       // Bind <service-ref> elements
+      ClassLoader loader = unit.getClassLoader();
       UnifiedVirtualFile vfsRoot = new VirtualFileAdaptor(unit.getDeploymentContext().getRoot());
       for (ServiceRefMetaData sref : metaData.getServiceRefs().values())
       {
          String refName = sref.getServiceRefName();
-         new ServiceRefDelegate().bindServiceRef(envCtx, refName, vfsRoot, sref);
+         new ServiceRefDelegate().bindServiceRef(envCtx, refName, vfsRoot, loader, sref);
       }
 
       // Bind resource references

Modified: trunk/server/src/main/org/jboss/ejb/Container.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/Container.java	2007-03-29 22:27:08 UTC (rev 61869)
+++ trunk/server/src/main/org/jboss/ejb/Container.java	2007-03-29 23:00:25 UTC (rev 61870)
@@ -1231,11 +1231,12 @@
       }
 
       // Bind service references
+      ClassLoader loader = unit.getClassLoader();
       UnifiedVirtualFile vfsRoot = new VirtualFileAdaptor(unit.getDeploymentContext().getRoot());
       for (ServiceRefMetaData sref : metaData.getServiceRefs().values())
       {
          String refName = sref.getServiceRefName();
-         new ServiceRefDelegate().bindServiceRef(envCtx, refName, vfsRoot, sref);
+         new ServiceRefDelegate().bindServiceRef(envCtx, refName, vfsRoot, loader, sref);
       }
 
       // Bind resource references

Modified: trunk/server/src/main/org/jboss/metadata/serviceref/ServiceRefDelegate.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/serviceref/ServiceRefDelegate.java	2007-03-29 22:27:08 UTC (rev 61869)
+++ trunk/server/src/main/org/jboss/metadata/serviceref/ServiceRefDelegate.java	2007-03-29 23:00:25 UTC (rev 61870)
@@ -100,10 +100,10 @@
          delegate.setValue(ref, navigator, namespaceURI, localName, value);
    }
 
-   public void bindServiceRef(Context encCtx, String encName, UnifiedVirtualFile vfsRoot, ServiceRefMetaData sref) throws NamingException
+   public void bindServiceRef(Context encCtx, String encName, UnifiedVirtualFile vfsRoot, ClassLoader loader, ServiceRefMetaData sref) throws NamingException
    {
       if (delegate != null)
-         delegate.bindServiceRef(encCtx, encName, vfsRoot, sref);
+         delegate.bindServiceRef(encCtx, encName, vfsRoot, loader, sref);
    }
 
    public static class DummyServiceRef extends ServiceRefMetaData

Deleted: trunk/server/src/main/org/jboss/metadata/serviceref/VirtualFileAdaptor.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/serviceref/VirtualFileAdaptor.java	2007-03-29 22:27:08 UTC (rev 61869)
+++ trunk/server/src/main/org/jboss/metadata/serviceref/VirtualFileAdaptor.java	2007-03-29 23:00:25 UTC (rev 61870)
@@ -1,66 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.metadata.serviceref;
-
-import java.io.IOException;
-import java.net.URL;
-
-import org.jboss.virtual.VirtualFile;
-import org.jboss.ws.integration.UnifiedVirtualFile;
-
-// $Id$
-
-/**
- * A JBoss50 VirtualFile adaptor
- *
- * @author Thomas.Diesler at jboss.org
- * @since 05-May-2006
- */
-public class VirtualFileAdaptor implements UnifiedVirtualFile
-{
-   private static final long serialVersionUID = 6547394037548338042L;
-
-   private VirtualFile root;
-
-   public VirtualFileAdaptor(VirtualFile root)
-   {
-      this.root = root;
-   }
-
-   public UnifiedVirtualFile findChild(String child) throws IOException
-   {
-      VirtualFile vf = root.findChild(child);
-      return new VirtualFileAdaptor(vf);
-   }
-
-   public URL toURL()
-   {
-      try
-      {
-         return root.toURL();
-      }
-      catch (Exception e)
-      {
-         return null;
-      }
-   }
-}

Added: trunk/server/src/main/org/jboss/metadata/serviceref/VirtualFileAdaptor.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/serviceref/VirtualFileAdaptor.java	                        (rev 0)
+++ trunk/server/src/main/org/jboss/metadata/serviceref/VirtualFileAdaptor.java	2007-03-29 23:00:25 UTC (rev 61870)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.metadata.serviceref;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.ws.integration.UnifiedVirtualFile;
+
+// $Id$
+
+/**
+ * A JBoss50 VirtualFile adaptor
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 05-May-2006
+ */
+public class VirtualFileAdaptor implements UnifiedVirtualFile
+{
+   private static final long serialVersionUID = 6547394037548338042L;
+
+   private VirtualFile root;
+
+   public VirtualFileAdaptor(VirtualFile root)
+   {
+      this.root = root;
+   }
+
+   public UnifiedVirtualFile findChild(String child) throws IOException
+   {
+      VirtualFile vf = root.findChild(child);
+      return new VirtualFileAdaptor(vf);
+   }
+
+   public URL toURL()
+   {
+      try
+      {
+         return root.toURL();
+      }
+      catch (Exception e)
+      {
+         return null;
+      }
+   }
+}

Modified: trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployment.java
===================================================================
--- trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployment.java	2007-03-29 22:27:08 UTC (rev 61869)
+++ trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployment.java	2007-03-29 23:00:25 UTC (rev 61870)
@@ -522,11 +522,12 @@
 
    private void linkServiceRefs(DeploymentUnit unit, Map<String, ServiceRefMetaData> serviceRefs, Context envCtx) throws NamingException
    {
+      ClassLoader loader = unit.getClassLoader();
       UnifiedVirtualFile vfsRoot = new VirtualFileAdaptor(unit.getDeploymentContext().getRoot());
       for (ServiceRefMetaData sref : serviceRefs.values())
       {
          String refName = sref.getServiceRefName();
-         new ServiceRefDelegate().bindServiceRef(envCtx, refName, vfsRoot, sref);
+         new ServiceRefDelegate().bindServiceRef(envCtx, refName, vfsRoot, loader, sref);
       }
    }
 

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java	2007-03-29 22:27:08 UTC (rev 61869)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java	2007-03-29 23:00:25 UTC (rev 61870)
@@ -485,7 +485,7 @@
                   ServiceRefMetaData injectedRef = envRefGroup.getServiceRef(refName);
                   if (injectedRef == null || injectedRef.isProcessed() == false)
                   {
-                     new ServiceRefDelegate().bindServiceRef(envCtx, refName, vfsRoot, sref);
+                     new ServiceRefDelegate().bindServiceRef(envCtx, refName, vfsRoot, loader, sref);
                   }
                }
             }

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment2.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment2.java	2007-03-29 22:27:08 UTC (rev 61869)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment2.java	2007-03-29 23:00:25 UTC (rev 61870)
@@ -156,17 +156,17 @@
 
       URL url = new URL(warUrl);
 
-      ClassLoader loader = Thread.currentThread().getContextClassLoader();
-      metaData.setContextLoader(loader);
+      ClassLoader threadContextLoader = Thread.currentThread().getContextClassLoader();
+      metaData.setContextLoader(threadContextLoader);
 
       injectionContainer = new TomcatInjectionContainer(webApp, webApp.getDeploymentUnit(), mainDeployer);
 
       Loader webLoader = webApp.getDeploymentUnit().getAttachment(Loader.class);
       if (webLoader == null)
-         webLoader = getWebLoader(webApp.getDeploymentUnit(), loader, url);
+         webLoader = getWebLoader(webApp.getDeploymentUnit(), threadContextLoader, url);
 
       webApp.setName(url.getPath());
-      webApp.setClassLoader(loader);
+      webApp.setClassLoader(threadContextLoader);
       webApp.setURL(url);
 
       String objectNameS = config.getCatalinaDomain() + ":j2eeType=WebModule,name=//" + ((hostName == null) ? "localhost" : hostName) + ctxPath
@@ -221,12 +221,12 @@
       }
       else
       {
-         server.setAttribute(objectName, new Attribute("parentClassLoader", loader));
+         server.setAttribute(objectName, new Attribute("parentClassLoader", threadContextLoader));
       }
 
       server.setAttribute(objectName, new Attribute("delegate", new Boolean(webApp.getJava2ClassLoadingCompliance())));
 
-      String[] jspCP = getCompileClasspath(loader);
+      String[] jspCP = getCompileClasspath(threadContextLoader);
       StringBuffer classpath = new StringBuffer();
       for (int u = 0; u < jspCP.length; u++)
       {
@@ -309,27 +309,28 @@
       server.invoke(objectName, "start", new Object[] {}, new String[] {});
       // Build the ENC
 
+      ClassLoader webappClassLoader = webLoader.getClassLoader();
       if (injectionContainer == null)
       {
-         super.processEnc(webLoader.getClassLoader(), webApp);
+         super.processEnc(webappClassLoader, webApp);
       }
       else
       {
          Thread currentThread = Thread.currentThread();
-         ClassLoader currentLoader = loader;
+         ClassLoader currentLoader = threadContextLoader;
          try
          {
             // Create a java:comp/env environment unique for the web application
-            log.debug("Creating ENC using ClassLoader: " + loader);
-            ClassLoader parent = loader.getParent();
+            log.debug("Creating ENC using ClassLoader: " + threadContextLoader);
+            ClassLoader parent = threadContextLoader.getParent();
             while (parent != null)
             {
                log.debug(".." + parent);
                parent = parent.getParent();
             }
             // TODO: The enc should be an input?
-            currentThread.setContextClassLoader(webLoader.getClassLoader());
-            metaData.setENCLoader(webLoader.getClassLoader());
+            currentThread.setContextClassLoader(webappClassLoader);
+            metaData.setENCLoader(webappClassLoader);
             InitialContext iniCtx = new InitialContext();
             Context envCtx = (Context)iniCtx.lookup("java:comp");
             // Add ORB/UserTransaction
@@ -355,10 +356,10 @@
             log.debug("Linked java:comp/UserTransaction to JNDI name: UserTransaction");
 
             envCtx = envCtx.createSubcontext("env");
-            injectionContainer.populateEnc(webLoader.getClassLoader());
+            injectionContainer.populateEnc(webappClassLoader);
 
             // TODO: this should be bindings in the metadata
-            currentThread.setContextClassLoader(webLoader.getClassLoader());
+            currentThread.setContextClassLoader(webappClassLoader);
             String securityDomain = metaData.getSecurityDomain();
             log.debug("linkSecurityDomain");
             linkSecurityDomain(securityDomain, envCtx);
@@ -372,7 +373,7 @@
                ServiceRefMetaData injectedRef = envRefGroup.getServiceRef(refName);
                if (injectedRef == null || injectedRef.isProcessed() == false)
                {
-                  new ServiceRefDelegate().bindServiceRef(envCtx, refName, vfsRoot, sref);
+                  new ServiceRefDelegate().bindServiceRef(envCtx, refName, vfsRoot, webappClassLoader, sref);
                }
             }
          }




More information about the jboss-cvs-commits mailing list