Package org.jboss.virtual.spi

Examples of org.jboss.virtual.spi.VFSContext


      assertEquals(expected, actual);
   }

   public void testVisitNullHandler() throws Exception
   {
      VFSContext context = getVFSContext("children");
      MockVirtualFileHandlerVisitor visitor = new MockVirtualFileHandlerVisitor();
      try
      {
         context.visit(null, visitor);
         fail("Should not be here!");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
View Full Code Here


      }
   }

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

   public VFSContext getVFS(URI rootURI) throws IOException
   {
      throwIOException("getVFSURI");
      throwIOException("getVFSURL"); // simplify / no_duplicate in VFS
      VFSContext context = contexts.get(rootURI);
      if (context == null)
         throw new IOException("No such context " + rootURI);
      return context;
   }
View Full Code Here

      return null;
   }

   protected void testCachedContexts(Iterable<VFSContext> iter)
   {
      VFSContext context = iter.iterator().next();
      assertNotNull(context);
   }
View Full Code Here

      return null;
   }

   protected void testCachedContexts(Iterable<VFSContext> iter)
   {
      VFSContext context = iter.iterator().next();
      assertNotNull(context);
   }
View Full Code Here

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

      VirtualFileHandler handler = file.getHandler();
      VFSContext context = handler.getVFSContext();
      return context.getOptions();
   }
View Full Code Here

   private static Options getOptions(VFS vfs)
   {
      if (vfs == null)
         throw new IllegalArgumentException("Null vfs");

      VFSContext context = vfs.getContext();
      return context.getOptions();
   }
View Full Code Here

    * @return the VFS
    * @throws IllegalStateException if the file is closed
    */
   public VFS getVFS()
   {
      VFSContext context = getHandler().getVFSContext();
      return context.getVFS();
   }
View Full Code Here

    * @param file the file
    */
   static void cleanup(VirtualFile file)
   {
      VirtualFileHandler fileHandler = file.getHandler();
      VFSContext context = fileHandler.getVFSContext();

      try
      {
         context.cleanupTempInfo(fileHandler.getPathName());
      }
      catch (Exception e)
      {
         log.debug("Exception cleaning temp info, file=" + file, e);
      }

      try
      {
         VirtualFileHandler contextHandler = context.getRoot();
         // the file is the context root, hence possible registry candidate
         if (fileHandler.equals(contextHandler))
         {
            VFSRegistry registry = VFSRegistry.getInstance();
            registry.removeContext(context);

            TempStore store = context.getTempStore();
            if (store != null)
            {
               store.clear();
            }
         }
View Full Code Here

      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(rootURI);
      if (factory == null)
         throw new IOException("No context factory for " + rootURI);

      VFSRegistry registry = VFSRegistry.getInstance();
      VFSContext context = registry.getContext(rootURI);
      if (context != null && createNew == false)
         return context.getVFS();

      if (context != null)
      {
         registry.removeContext(context);
         context.cleanup();
      }

      context = factory.getVFS(rootURI); // create new
      VFSRegistry.getInstance().addContext(context);
      return context.getVFS();
   }
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.