[jboss-cvs] JBossAS SVN: r76291 - projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/support.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jul 28 05:54:16 EDT 2008
Author: alesj
Date: 2008-07-28 05:54:16 -0400 (Mon, 28 Jul 2008)
New Revision: 76291
Added:
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/support/SimpleVFSResourceLoader.java
Modified:
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java
Log:
Use simple classloader; based on VFS, using current archive as root to do resources lookup.
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java 2008-07-28 09:20:13 UTC (rev 76290)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java 2008-07-28 09:54:16 UTC (rev 76291)
@@ -314,7 +314,7 @@
private Integer determineType(VirtualFile archive)
{
- ClassLoader classLoader = getClass().getClassLoader();
+ ClassLoader classLoader = new SimpleVFSResourceLoader(Thread.currentThread().getContextClassLoader(), archive);
GenericAnnotationResourceVisitor visitor = new GenericAnnotationResourceVisitor(classLoader);
ClassFilter included = null;
ClassFilter excluded = null;
Added: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/support/SimpleVFSResourceLoader.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/support/SimpleVFSResourceLoader.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/support/SimpleVFSResourceLoader.java 2008-07-28 09:54:16 UTC (rev 76291)
@@ -0,0 +1,56 @@
+/*
+* 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.test.deployers.vfs.structure.ear.support;
+
+import java.net.URL;
+
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SimpleVFSResourceLoader extends ClassLoader
+{
+ private VirtualFile root;
+
+ public SimpleVFSResourceLoader(ClassLoader parent, VirtualFile root)
+ {
+ super(parent);
+ this.root = root;
+ }
+
+ public URL getResource(String name)
+ {
+ try
+ {
+ VirtualFile child = root.getChild(name);
+ if (child != null)
+ return child.toURL();
+ else
+ return null;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+}
More information about the jboss-cvs-commits
mailing list