[jboss-cvs] JBossAS SVN: r79720 - in projects/metadata/trunk/src/main/java/org/jboss/metadata: process/processor/ejb/jboss and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Oct 19 20:51:15 EDT 2008


Author: ALRubinger
Date: 2008-10-19 20:51:15 -0400 (Sun, 19 Oct 2008)
New Revision: 79720

Modified:
   projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/JBoss50Creator.java
   projects/metadata/trunk/src/main/java/org/jboss/metadata/process/processor/ejb/jboss/SetDefaultLocalBusinessInterfaceProcessor.java
Log:
[JBMETA-131] Require an explicit ClassLoader, not the TCL, in SetDefaultLocalBusinessInterfaceProcessor

Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/JBoss50Creator.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/JBoss50Creator.java	2008-10-19 23:19:01 UTC (rev 79719)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/JBoss50Creator.java	2008-10-20 00:51:15 UTC (rev 79720)
@@ -116,7 +116,7 @@
       ProcessorChain<JBoss50MetaData> chain = new JBossMetaDataProcessorChain<JBoss50MetaData>();
 
       // Implicit local business interface (JBMETA-40, JBMETA-122, EJBTHREE-1062)
-      chain.addProcessor(SetDefaultLocalBusinessInterfaceProcessor.INSTANCE);
+      chain.addProcessor(new SetDefaultLocalBusinessInterfaceProcessor(this.classLoader));
       // Validation Processor
       chain.addProcessor(JBoss50MetaDataValidatorChainProcessor.INSTANCE);
 

Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/process/processor/ejb/jboss/SetDefaultLocalBusinessInterfaceProcessor.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/process/processor/ejb/jboss/SetDefaultLocalBusinessInterfaceProcessor.java	2008-10-19 23:19:01 UTC (rev 79719)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/process/processor/ejb/jboss/SetDefaultLocalBusinessInterfaceProcessor.java	2008-10-20 00:51:15 UTC (rev 79720)
@@ -54,9 +54,32 @@
 
    private static final Logger log = Logger.getLogger(SetDefaultLocalBusinessInterfaceProcessor.class);
 
-   public static final SetDefaultLocalBusinessInterfaceProcessor INSTANCE = new SetDefaultLocalBusinessInterfaceProcessor();
+   // --------------------------------------------------------------------------------||
+   // Instance Members ---------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
 
+   /**
+    * The classloader to use in obtaining Classes from 
+    * specified metadata; required to check supertypes
+    */
+   private ClassLoader classLoader;
+
    // --------------------------------------------------------------------------------||
+   // Constructor --------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Sole Constructor
+    * 
+    * @param The ClassLoader with visibility to classes specified in
+    * the metadata to be processed
+    */
+   public SetDefaultLocalBusinessInterfaceProcessor(ClassLoader classLoader)
+   {
+      this.setClassLoader(classLoader);
+   }
+
+   // --------------------------------------------------------------------------------||
    // Required Implementations -------------------------------------------------------||
    // --------------------------------------------------------------------------------||
 
@@ -84,26 +107,18 @@
          // Cast
          JBossSessionBeanMetaData smd = (JBossSessionBeanMetaData) ejb;
 
-         /*
-          * Maintainer's note:
-          * 
-          * This processing check must be executed within the TCL
-          * for the deployment it's checking.  ie. The classes 
-          * specified in the metadata must be visible to the TCL
-          */
-
          // Load the EJB Implementation Class
          String ejbImplementationClassName = smd.getEjbClass();
-         ClassLoader tcl = Thread.currentThread().getContextClassLoader();
          Class<?> ejbImplementationClass = null;
+         ClassLoader cl = this.getClassLoader();
          try
          {
-            ejbImplementationClass = Class.forName(ejbImplementationClassName, false, tcl);
+            ejbImplementationClass = Class.forName(ejbImplementationClassName, false, cl);
          }
          catch (ClassNotFoundException e)
          {
-            throw new ProcessingException(this
-                  + " must be run on metadata while the deployment's ClassLoader is the Thread Context ClassLoader");
+            throw new ProcessingException(this + "Could not load EJB Implementation Class " + ejbImplementationClass
+                  + " from specified ClassLoader " + cl);
          }
 
          // If there are already local business interfaces specified
@@ -138,4 +153,18 @@
 
    }
 
+   // --------------------------------------------------------------------------------||
+   // Accessors / Mutators -----------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   public ClassLoader getClassLoader()
+   {
+      return classLoader;
+   }
+
+   protected void setClassLoader(ClassLoader classLoader)
+   {
+      this.classLoader = classLoader;
+   }
+
 }




More information about the jboss-cvs-commits mailing list