Package org.jboss.virtual.spi

Examples of org.jboss.virtual.spi.VirtualFileHandler


   }

   public void testVisitNullVisitor() throws Exception
   {
      VFSContext context = getVFSContext("children");
      VirtualFileHandler root = context.getRoot();
      try
      {
         context.visit(root, null);
         fail("Should not be here!");
      }
View Full Code Here


    * @return the root
    * @throws IOException for any problem accessing the VFS
    */
   public VirtualFile getRoot() throws IOException
   {
      VirtualFileHandler handler = context.getRoot();
      return handler.getVirtualFile();
   }
View Full Code Here

   public VirtualFile findChild(String path) throws IOException
   {
      if (path == null)
         throw new IllegalArgumentException("Null path");
     
      VirtualFileHandler handler = context.getRoot();
      VirtualFileHandler result = context.getChild(handler, VFSUtils.fixName(path));
      if (result == null)
         throw new IOException("Child not found " + path + " for " + handler);
      return result.getVirtualFile();
   }
View Full Code Here

   public VirtualFile getChild(String path) throws IOException
   {
      if (path == null)
         throw new IllegalArgumentException("Null path");

      VirtualFileHandler handler = context.getRoot();
      VirtualFileHandler result = context.getChild(handler, VFSUtils.fixName(path));
      return result != null ? result.getVirtualFile() : null;
   }
View Full Code Here

    * @throws IllegalArgumentException if the visitor is null
    * @throws IllegalStateException if the root is a leaf node
    */
   public void visit(VirtualFileVisitor visitor) throws IOException
   {
      VirtualFileHandler handler = context.getRoot();
      if (handler.isLeaf())
         throw new IllegalStateException("File cannot contain children: " + handler);
     
      WrappingVirtualFileHandlerVisitor wrapper = new WrappingVirtualFileHandlerVisitor(visitor);
      context.visit(handler, wrapper);
   }
View Full Code Here

   protected void visit(VirtualFile file, VirtualFileVisitor visitor) throws IOException
   {
      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

    * @throws IOException for any problem accessing the virtual file system
    * @throws IllegalStateException if the file is closed
    */
   public VirtualFile getParent() throws IOException
   {
      VirtualFileHandler parent = getHandler().getParent();
      if (parent != null)
         return parent.getVirtualFile();
      return null;
   }
View Full Code Here

   public VirtualFile findChild(String path) throws IOException
   {
      if (path == null)
         throw new IllegalArgumentException("Null path");

      VirtualFileHandler handler = getHandler();     
      if (handler.isLeaf())
         throw new IllegalStateException("File cannot contain children: " + this);

      VirtualFileHandler child = handler.getChild(VFSUtils.fixName(path));
      if (child == null)
         throw new IOException("Child not found " + path + " for " + handler);
      return child.getVirtualFile();
   }
View Full Code Here

   public VirtualFile getChild(String path) throws IOException
   {
      if (path == null)
         throw new IllegalArgumentException("Null path");

      VirtualFileHandler handler = getHandler();
      VirtualFileHandler child = handler.getChild(VFSUtils.fixName(path));
      return child != null ? child.getVirtualFile() : null;
   }
View Full Code Here

   protected abstract long getRealSize(String name, String path) throws Exception;
  
   public void testRootName() throws Exception
   {
      VFSContext context = getVFSContext("complex");
      VirtualFileHandler root = context.getRoot();
      String rootName = getRootName("complex");
      assertEquals(rootName, root.getName());
   }
View Full Code Here

TOP

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

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.