Package org.apache.commons.vfs2.impl

Examples of org.apache.commons.vfs2.impl.VFSClassLoader


    cm.removeUnusedContexts(new HashSet<String>());
  }
 
  @Test
  public void testPostDelegation() throws Exception {
    final VFSClassLoader parent = new VFSClassLoader(new FileObject[] {vfs.resolveFile(uri1.toString())}, vfs);
   
    Class<?> pclass = parent.loadClass("test.HelloWorld");
   
    ContextManager cm = new ContextManager(vfs, new ReloadingClassLoader() {
      @Override
      public ClassLoader getClassLoader() {
        return parent;
View Full Code Here


      public ClassLoader getClassLoader() {
        return ClassLoader.getSystemClassLoader();
      }
    }, true);
   
    VFSClassLoader cl = (VFSClassLoader) arvcl.getClassLoader();
   
    FileObject[] files = cl.getFileObjects();
    Assert.assertArrayEquals(createFileSystems(dirContents), files);
   
    arvcl.close();
  }
View Full Code Here

   
    FileObject testDir = vfs.resolveFile(TEST_DIR.toUri().toString());
    FileObject[] dirContents = testDir.getChildren();

    //Point the VFSClassLoader to all of the objects in TEST_DIR
    this.cl = new VFSClassLoader(dirContents, vfs);
  }
View Full Code Here

            loader = localLoader;
            return localLoader.getClassLoader();
          }

          // Create the Accumulo Context ClassLoader using the DEFAULT_CONTEXT
          localLoader = createDynamicClassloader(new VFSClassLoader(vfsCP, vfs, parent));
          loader = localLoader;

          //An HDFS FileSystem and Configuration object were created for each unique HDFS namespace in the call to resolve above.
          //The HDFS Client did us a favor and cached these objects so that the next time someone calls FileSystem.get(uri), they
          //get the cached object. However, these objects were created not with the system VFS classloader, but the classloader above
View Full Code Here

            out.print("\t" + u.toExternalForm());
          }

        } else if (classLoader instanceof VFSClassLoader) {
          out.print("Level " + classLoaderDescription + " VFS classpaths items are:");
          VFSClassLoader vcl = (VFSClassLoader) classLoader;
          for (FileObject f : vcl.getFileObjects()) {
            out.print("\t" + f.getURL().toExternalForm());
          }
        } else {
          out.print("Unknown classloader configuration " + classLoader.getClass());
        }
View Full Code Here

        files = AccumuloVFSClassLoader.resolve(vfs, uris);

        log.debug("Rebuilding dynamic classloader using files- " + stringify(files));

        if (preDelegate)
          cl = new VFSClassLoader(files, vfs, parent.getClassLoader());
        else
          cl = new PostDelegatingVFSClassLoader(files, vfs, parent.getClassLoader());

      } catch (FileSystemException fse) {
        throw new RuntimeException(fse);
View Full Code Here

   
    ArrayList<FileObject> pathsToMonitor = new ArrayList<FileObject>();
    files = AccumuloVFSClassLoader.resolve(vfs, uris, pathsToMonitor);

    if (preDelegate)
      cl = new VFSClassLoader(files, vfs, parent.getClassLoader());
    else
      cl = new PostDelegatingVFSClassLoader(files, vfs, parent.getClassLoader());
   
    monitor = new DefaultFileMonitor(this);
    monitor.setDelay(monitorDelay);
View Full Code Here

              append(classpathBuilder, u);
            }

          } else if (classLoader instanceof VFSClassLoader) {

            VFSClassLoader vcl = (VFSClassLoader) classLoader;
            for (FileObject f : vcl.getFileObjects()) {
              append(classpathBuilder, f.getURL());
            }
          } else {
            throw new IllegalArgumentException("Unknown classloader type : " + classLoader.getClass().getName());
          }
View Full Code Here

     * Creates the classloader to use when testing.
     */
    private VFSClassLoader createClassLoader() throws FileSystemException
    {
        FileObject file = getBaseFolder();
        final VFSClassLoader loader =
            new VFSClassLoader(file , getManager());
        return loader;
    }
View Full Code Here

    /**
     * Tests loading a class.
     */
    public void testLoadClass() throws Exception
    {
        final VFSClassLoader loader = createClassLoader();

        final Class<?> testClass = loader.loadClass("code.ClassToLoad");
        final Package pack = testClass.getPackage();
        assertEquals("code", pack.getName());
        verifyPackage(pack, false);

        final Object testObject = testClass.newInstance();
View Full Code Here

TOP

Related Classes of org.apache.commons.vfs2.impl.VFSClassLoader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.