[jboss-cvs] JBossAS SVN: r63912 - in projects/integration/trunk: build and 9 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jul 9 12:49:57 EDT 2007


Author: adrian at jboss.org
Date: 2007-07-09 12:49:57 -0400 (Mon, 09 Jul 2007)
New Revision: 63912

Added:
   projects/integration/trunk/jboss-classloading-spi/
   projects/integration/trunk/jboss-classloading-spi/.classpath
   projects/integration/trunk/jboss-classloading-spi/.project
   projects/integration/trunk/jboss-classloading-spi/.settings/
   projects/integration/trunk/jboss-classloading-spi/.settings/org.eclipse.jdt.core.prefs
   projects/integration/trunk/jboss-classloading-spi/pom.xml
   projects/integration/trunk/jboss-classloading-spi/src/
   projects/integration/trunk/jboss-classloading-spi/src/main/
   projects/integration/trunk/jboss-classloading-spi/src/main/org/
   projects/integration/trunk/jboss-classloading-spi/src/main/org/jboss/
   projects/integration/trunk/jboss-classloading-spi/src/main/org/jboss/classloading/
   projects/integration/trunk/jboss-classloading-spi/src/main/org/jboss/classloading/spi/
   projects/integration/trunk/jboss-classloading-spi/src/main/org/jboss/classloading/spi/DelegatingClassLoader.java
   projects/integration/trunk/jboss-classloading-spi/src/main/org/jboss/classloading/spi/RealClassLoader.java
Modified:
   projects/integration/trunk/build/assembly/bin.xml
   projects/integration/trunk/build/assembly/sources.xml
   projects/integration/trunk/build/pom.xml
Log:
[JBMICROCONT-31] - Make a start on the classloading abstraction

Modified: projects/integration/trunk/build/assembly/bin.xml
===================================================================
--- projects/integration/trunk/build/assembly/bin.xml	2007-07-09 13:22:53 UTC (rev 63911)
+++ projects/integration/trunk/build/assembly/bin.xml	2007-07-09 16:49:57 UTC (rev 63912)
@@ -5,6 +5,10 @@
   <includeBaseDirectory>false</includeBaseDirectory>
   <fileSets>
     <fileSet>
+      <directory>../jboss-classloading-spi/target/classes</directory>
+      <outputDirectory>/</outputDirectory>
+    </fileSet>
+    <fileSet>
       <directory>../jboss-transaction-spi/target/classes</directory>
       <outputDirectory>/</outputDirectory>
     </fileSet>

Modified: projects/integration/trunk/build/assembly/sources.xml
===================================================================
--- projects/integration/trunk/build/assembly/sources.xml	2007-07-09 13:22:53 UTC (rev 63911)
+++ projects/integration/trunk/build/assembly/sources.xml	2007-07-09 16:49:57 UTC (rev 63912)
@@ -6,6 +6,10 @@
   <includeBaseDirectory>false</includeBaseDirectory>
   <fileSets>
     <fileSet>
+      <directory>../jboss-classloading-spi/src/main</directory>
+      <outputDirectory>/</outputDirectory>
+    </fileSet>
+    <fileSet>
       <directory>../jboss-transaction-spi/src/main</directory>
       <outputDirectory>/</outputDirectory>
     </fileSet>

Modified: projects/integration/trunk/build/pom.xml
===================================================================
--- projects/integration/trunk/build/pom.xml	2007-07-09 13:22:53 UTC (rev 63911)
+++ projects/integration/trunk/build/pom.xml	2007-07-09 16:49:57 UTC (rev 63912)
@@ -101,6 +101,7 @@
     </repository>
   </repositories>
   <modules>
+    <module>../jboss-classloading-spi</module>
     <module>../jboss-transaction-spi</module>
   </modules>
   <reporting>

Added: projects/integration/trunk/jboss-classloading-spi/.classpath
===================================================================
--- projects/integration/trunk/jboss-classloading-spi/.classpath	                        (rev 0)
+++ projects/integration/trunk/jboss-classloading-spi/.classpath	2007-07-09 16:49:57 UTC (rev 63912)
@@ -0,0 +1,12 @@
+<classpath>
+  <classpathentry kind="src" path="src/main"/>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+  <classpathentry kind="var" path="M2_REPO/jboss/jboss-javaee/5.0.0-SNAPSHOT/jboss-javaee-5.0.0-SNAPSHOT.jar"/>
+  <classpathentry kind="var" path="M2_REPO/apache-httpclient/commons-httpclient/2.0.2/commons-httpclient-2.0.2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/apache-xerces/xml-apis/2.7.1/xml-apis-2.7.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA.jar"/>
+  <classpathentry kind="var" path="M2_REPO/apache-slide/webdavlib/2.0/webdavlib-2.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-core/2.0.4.GA/jboss-common-core-2.0.4.GA.jar"/>
+  <classpathentry kind="var" path="M2_REPO/oswego-concurrent/concurrent/1.3.4/concurrent-1.3.4.jar"/>
+</classpath>
\ No newline at end of file

Added: projects/integration/trunk/jboss-classloading-spi/.project
===================================================================
--- projects/integration/trunk/jboss-classloading-spi/.project	                        (rev 0)
+++ projects/integration/trunk/jboss-classloading-spi/.project	2007-07-09 16:49:57 UTC (rev 63912)
@@ -0,0 +1,13 @@
+<projectDescription>
+  <name>jboss-classloading-spi</name>
+  <comment>The Java ClassLoading 5.0.0 SPI classes</comment>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file

Added: projects/integration/trunk/jboss-classloading-spi/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/integration/trunk/jboss-classloading-spi/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ projects/integration/trunk/jboss-classloading-spi/.settings/org.eclipse.jdt.core.prefs	2007-07-09 16:49:57 UTC (rev 63912)
@@ -0,0 +1,5 @@
+#Mon Jul 09 18:53:36 CEST 2007
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5

Added: projects/integration/trunk/jboss-classloading-spi/pom.xml
===================================================================
--- projects/integration/trunk/jboss-classloading-spi/pom.xml	                        (rev 0)
+++ projects/integration/trunk/jboss-classloading-spi/pom.xml	2007-07-09 16:49:57 UTC (rev 63912)
@@ -0,0 +1,17 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>jboss</groupId>
+    <artifactId>jboss-integration</artifactId>
+    <version>5.0.0-SNAPSHOT</version>
+    <relativePath>../build/pom.xml</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>jboss</groupId>
+  <artifactId>jboss-classloading-spi</artifactId>
+  <version>5.0.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>JBoss ClassLoading 5.0.0 SPI</name>
+  <url>http://www.jboss.org</url>
+  <description>The Java ClassLoading 5.0.0 SPI classes</description>
+</project>

Added: projects/integration/trunk/jboss-classloading-spi/src/main/org/jboss/classloading/spi/DelegatingClassLoader.java
===================================================================
--- projects/integration/trunk/jboss-classloading-spi/src/main/org/jboss/classloading/spi/DelegatingClassLoader.java	                        (rev 0)
+++ projects/integration/trunk/jboss-classloading-spi/src/main/org/jboss/classloading/spi/DelegatingClassLoader.java	2007-07-09 16:49:57 UTC (rev 63912)
@@ -0,0 +1,110 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.classloading.spi;
+
+import java.net.URL;
+
+/**
+ * DelegatingClassLoader.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class DelegatingClassLoader extends ClassLoader
+{
+   /** The parent classloader */
+   private RealClassLoader parent;
+
+   /** Whether to use standard loading */
+   protected boolean standard = false;
+
+   /**
+    * Check the parent really is a classloader
+    * 
+    * @param parent the parent
+    * @return the classloader
+    */
+   private static ClassLoader checkParent(RealClassLoader parent)
+   {
+      if (parent == null)
+         throw new IllegalArgumentException("Null parent");
+      if (parent instanceof ClassLoader == false)
+         throw new IllegalArgumentException("Parent is not a classloader");
+      
+      return ClassLoader.class.cast(parent);
+   }
+   
+   /**
+    * Create a new DelegatingClassLoader.
+    * 
+    * @param parent the parent
+    */
+   public DelegatingClassLoader(RealClassLoader parent)
+   {
+      super(checkParent(parent));
+      this.parent = parent;
+   }
+
+   protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
+   {
+      // First see if we already know it
+      Class<?> clazz = findLoadedClass(name);
+
+      // Next see if it is cached at a more global level
+      if (clazz == null)
+         clazz = parent.getCachedClass(name);
+
+      // Not cached
+      if (clazz == null)
+      {
+         // Standard loading looks at the bootstrap classloader
+         if  (standard)
+            clazz = super.loadClass(name, resolve);
+         // We should really let the parent decide to do that
+         else
+            clazz = getParent().loadClass(name);
+      }
+      
+      // Do we need to resolve the class?
+      if (resolve)
+         resolveClass(clazz);
+      return clazz;
+   }
+
+   public URL getResource(String name)
+   {
+      // See if it is cached at a global level
+      URL resource = parent.getCachedResource(name);
+
+      // Not cached
+      if (resource == null)
+      {
+         // Standard loading looks at the bootstrap classloader
+         if  (standard)
+            resource = super.getResource(name);
+         // We should really let the parent decide to do that
+         else
+            resource = getParent().getResource(name);
+      }
+      return resource;
+   }
+}

Added: projects/integration/trunk/jboss-classloading-spi/src/main/org/jboss/classloading/spi/RealClassLoader.java
===================================================================
--- projects/integration/trunk/jboss-classloading-spi/src/main/org/jboss/classloading/spi/RealClassLoader.java	                        (rev 0)
+++ projects/integration/trunk/jboss-classloading-spi/src/main/org/jboss/classloading/spi/RealClassLoader.java	2007-07-09 16:49:57 UTC (rev 63912)
@@ -0,0 +1,51 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.classloading.spi;
+
+import java.net.URL;
+
+/**
+ * RealClassLoader.<p>
+ * 
+ * A tagging interface for RealClassLoaders
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface RealClassLoader
+{
+   /**
+    * Check the cache to see if the class is already loaded
+    * 
+    * @param name the class name
+    * @return the class or null if not cached
+    */
+   Class<?> getCachedClass(String name);
+
+   /**
+    * Check the cache to see if the resource is already loaded
+    * 
+    * @param name the name of the resource
+    * @return the resource url or null if not cached
+    */
+   URL getCachedResource(String name);
+}




More information about the jboss-cvs-commits mailing list