[jboss-cvs] JBossAS SVN: r109558 - trunk/webservices/src/main/java/org/jboss/webservices/integration/injection.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Nov 30 10:53:40 EST 2010


Author: richard.opalka at jboss.com
Date: 2010-11-30 10:53:40 -0500 (Tue, 30 Nov 2010)
New Revision: 109558

Modified:
   trunk/webservices/src/main/java/org/jboss/webservices/integration/injection/ServiceRefResourceProvider.java
Log:
refactoring - removing ugly hack

Modified: trunk/webservices/src/main/java/org/jboss/webservices/integration/injection/ServiceRefResourceProvider.java
===================================================================
--- trunk/webservices/src/main/java/org/jboss/webservices/integration/injection/ServiceRefResourceProvider.java	2010-11-30 14:26:52 UTC (rev 109557)
+++ trunk/webservices/src/main/java/org/jboss/webservices/integration/injection/ServiceRefResourceProvider.java	2010-11-30 15:53:40 UTC (rev 109558)
@@ -43,6 +43,7 @@
 
 import org.jboss.classloader.spi.base.BaseClassLoader;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
 import org.jboss.logging.Logger;
 import org.jboss.switchboard.javaee.environment.Addressing;
 import org.jboss.switchboard.javaee.environment.Handler;
@@ -143,26 +144,19 @@
     */
    private UnifiedVirtualFile getUnifiedVirtualFile(final DeploymentUnit deploymentUnit)
    {
-      final ClassLoader loader = deploymentUnit.getClassLoader();
-      VirtualFile virtualFile = null;
-      if (loader instanceof BaseClassLoader)
+      DeploymentUnit du = deploymentUnit;
+      while (du.isComponent())
+         du = du.getParent();
+
+      if (du instanceof VFSDeploymentUnit)
       {
-         try
-         {
-            virtualFile = VFS.getChild(new URL(((BaseClassLoader) loader).getName()));
-         }
-         catch (URISyntaxException e)
-         {
-            throw new RuntimeException(e);
-         }
-         catch (MalformedURLException e)
-         {
-            throw new RuntimeException(e);
-         }
-         return new VirtualFileAdaptor(virtualFile);
+         VFSDeploymentUnit vdu = (VFSDeploymentUnit) du;
+         return new VirtualFileAdaptor(vdu.getRoot());
       }
-
-      throw new UnsupportedOperationException();
+      else
+      {
+         throw new IllegalArgumentException("Can only handle real VFS deployments: " + du);
+      }
    }
 
    /**



More information about the jboss-cvs-commits mailing list