Package org.jboss.virtual.spi

Examples of org.jboss.virtual.spi.VFSContext


   public static VFS getVFS(URL rootURL) throws IOException
   {
      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(rootURL);
      if (factory == null)
         throw new IOException("No context factory for " + rootURL);
      VFSContext context = factory.getVFS(rootURL);
      return context.getVFS();
   }
View Full Code Here


      if (file == null)
         throw new IllegalArgumentException("Null file");

      VirtualFileHandler handler = file.getHandler();
      WrappingVirtualFileHandlerVisitor wrapper = new WrappingVirtualFileHandlerVisitor(visitor);
      VFSContext handlerContext = handler.getVFSContext();
      handlerContext.visit(handler, wrapper);
   }
View Full Code Here

   {
      try
      {
         String url = toURI().toASCIIString() + "!/" + wrapper.getName();
         URL jecURL = new URL(url);
         VFSContext context = parent.getVFSContext();
         byte[] contents = wrapper.getExtra();
         return new JarEntryContents(context, parent, wrapper.getEntry(), entryName, toURL(), jecURL, contents);
      }
      catch (Throwable t)
      {
View Full Code Here

   */

   public void testPathWithPluses() throws Exception
   {
      URL rootURL = getResource("/vfs/test/path+with+plusses/jar1.jar");
      VFSContext context = getVFSContext(rootURL);
      VFS vfs = context.getVFS();
      VirtualFile jar = vfs.getRoot();
      assertNotNull("jar != null", jar);
      assertNotNull(jar.getChild(JarFile.MANIFEST_NAME));
   }
View Full Code Here

   }

   @SuppressWarnings("deprecation")
   public void assertRealURL(String name, String path, String expectedEnd) throws Exception
   {
      VFSContext context = getVFSContext(name);
      VirtualFile root = context.getRoot().getVirtualFile();
      VirtualFile file = root;
      if (path != null && path.length() > 0)
         file = root.findChild(path);

      URL realURL = VFSUtils.getRealURL(file);
View Full Code Here

      assertEquals("Different real URL:", expectedRealURL, realURLString);
   }

   public void testGetVFS() throws Exception
   {
      VFSContext context = getVFSContext("simple");
      URI rootURI = context.getRootURI();
      VFS vfs = context.getVFS();
      VirtualFile rootFile = vfs.getRoot();

      URI uri = new URI("vfs" + rootURI);
      URI rfUri = rootFile.toURI();
      assertEquals(uri.getPath(), rfUri.getPath());
View Full Code Here

      assertEquals(uri.getPath(), rfUri.getPath());
   }
  
   public void testGetRoot() throws Exception
   {
      VFSContext context = getVFSContext("simple");
      URI rootURI = context.getRootURI();
      VirtualFileHandler rootHandler = context.getRoot();
      VFS vfs = context.getVFS();
      VirtualFile rootFile = vfs.getRoot();
     
      assertEquals(rootURI, rootHandler.toURI());
      assertEquals(rootHandler.getVirtualFile(), rootFile);
   }
View Full Code Here

   }
   */
  
   public void testGetChildren() throws Exception
   {
      VFSContext context = getVFSContext("children");
      VirtualFileHandler root = context.getRoot();
      List<VirtualFileHandler> children = context.getChildren(root, false);
     
      Set<String> expected = new HashSet<String>();
      expected.add("child1");
      expected.add("child2");
      expected.add("child3");
View Full Code Here

      assertEquals(expected, actual);
   }

   public void testGetChildrenNullFile() throws Exception
   {
      VFSContext context = getVFSContext("complex");
      try
      {
         context.getChildren(null, false);
         fail("Should not be here!");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
View Full Code Here

      }
   }

   public void testFindChildRoot() throws Exception
   {
      VFSContext context = getVFSContext("complex");
      VirtualFileHandler root = context.getRoot();
      VirtualFileHandler found = context.getChild(root, "");
      assertEquals(root, found);
   }
View Full Code Here

TOP

Related Classes of org.jboss.virtual.spi.VFSContext

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.