Package org.jboss.virtual.spi

Examples of org.jboss.virtual.spi.VirtualFileHandler


   public VirtualFile findChild(String path) throws IOException
   {
      if (path == null)
         throw new IllegalArgumentException("Null path");
     
      VirtualFileHandler handler = context.getRoot();
      path = VFSUtils.fixName(path);
      VirtualFileHandler result = context.findChild(handler, path);
      return result.getVirtualFile();
   }
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

      if (tokens == null || tokens.length == 0)
         return this;

      // Go through each context starting from ours
      // check the parents are not leaves.
      VirtualFileHandler current = this;
      for (int i = 0; i < tokens.length; ++i)
      {
         if (current.isLeaf())
            throw new IOException("File cannot have children: " + current);
         if (current instanceof StructuredVirtualFileHandler)
         {
            StructuredVirtualFileHandler structured = (StructuredVirtualFileHandler) current;
            current = structured.createChildHandler(tokens[i]);
         }
         else
         {
            String remainingPath = PathTokenizer.getRemainingPath(tokens, i);
            return current.findChild(remainingPath);
         }
      }
     
      // The last one is the result
      return current;
View Full Code Here

   {
      if (this == obj)
         return true;
      if (obj == null || obj instanceof VirtualFileHandler == false)
         return false;
      VirtualFileHandler other = (VirtualFileHandler) obj;
      if (getVFSContext().equals(other.getVFSContext()) == false)
         return false;
      if (getPathName().equals(other.getPathName()) == false)
         return false;
      return true;
   }
View Full Code Here

      // we cache handlers so that things like JARs are recreated (optimization)
      for (File file : files)
      {
         try
         {
            VirtualFileHandler handler = null;
            handler = oldCache.get(file.getName());
            // if underlying file has been modified then create a new handler instead of using the cached one
            if (handler != null && handler.hasBeenModified())
            {
               handler = null;
            }
            if (handler == null)
            {
View Full Code Here

   public VirtualFileHandler createChildHandler(String name) throws IOException
   {
      FileSystemContext context = getVFSContext();
      File parentFile = getFile();
      File child = new File(parentFile, name);
      VirtualFileHandler handler = childCache.get(name);
      // if a child has already been created use that
      // if the child has been modified on disk then create a new handler
      if (handler != null && handler.hasBeenModified())
      {
         handler = null;
      }
      if (handler == null)
      {
View Full Code Here

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

      VirtualFileHandler handler = null;
      if( VFSUtils.isLink(file.getName()) )
      {
         Properties props = new Properties();
         FileInputStream fis = new FileInputStream(file);
         try
View Full Code Here

         return children;
      }

      public VirtualFileHandler findChild(String path) throws IOException
      {
         VirtualFileHandler child;
         if (isJar)
         {
            initNestedJar();
            child = njar.findChild(path);
         }
View Full Code Here

      {
         entryMap = new HashMap<String, VirtualFileHandler>();
         for(VirtualFileHandler child : entryChildren)
            entryMap.put(child.getName(), child);
      }
      VirtualFileHandler child = entryMap.get(name);
      if( child == null )
         throw new FileNotFoundException(this+" has no child: "+name);
      return child;
   }
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.