Package org.jboss.virtual.spi

Examples of org.jboss.virtual.spi.VirtualFileHandler


      // we cache handlers so that things like JARs are recreated (optimization)
      for (File file : files)
      {
         try
         {
            VirtualFileHandler handler;
            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

      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 == null || current.isLeaf())
            return null;

         if (PathTokenizer.isReverseToken(tokens[i]))
         {
            VirtualFileHandler parent = current.getParent();
            if (parent == null) // TODO - still IOE or null?
               throw new IOException("Using reverse path on top file handler: " + current + ", " + path);
            else
               current = parent;
         }
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

         TempInfo ti = context.getFurthestParentTemp(relativePath);
         if (ti != null)
         {
            String path = ti.getPath();
            String subpath = relativePath.substring(path.length());
            VirtualFileHandler child = findHandler(ti.getHandler(), subpath, true);
            if (child != null)
                  return child.getVirtualFile();
         }

         VirtualFileHandler root = context.getRoot();
         VirtualFileHandler child = findHandler(root, relativePath, false);
         return child.getVirtualFile();
      }
      return null;
   }
View Full Code Here

    * @param allowNotFound do we allow not found
    * @throws IOException for any error
    */
   protected VirtualFileHandler findHandler(VirtualFileHandler root, String path, boolean allowNotFound) throws IOException
   {
      VirtualFileHandler child = root.getChild(path);
      if (child == null && allowNotFound == false)
      {
         List<VirtualFileHandler> children = root.getChildren(true);
         throw new IOException("Child not found " + path + " for " + root + ", available children: " + children);
      }
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

    * @throws IllegalArgumentException if the path is null
    * @throws IllegalStateException if the file is closed or it is a leaf node
    */
   public VirtualFile findChild(String path) throws IOException
   {
      VirtualFileHandler handler = getHandler();

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

      path = VFSUtils.fixName(path);
      VirtualFileHandler child = handler.findChild(path);
      return child.getVirtualFile();
   }
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

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.