Examples of VFSContextFactory


Examples of org.jboss.virtual.spi.VFSContextFactory

    */
   public void testVFSContextFactory()
      throws Exception
   {
      URL root = getClass().getProtectionDomain().getCodeSource().getLocation();
      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(root);
      assertTrue("VFSContextFactory(CodeSource.Location) != null", factory != null);
   }
View Full Code Here

Examples of org.jboss.virtual.spi.VFSContextFactory

      File outerJar = new File(path);
      assertTrue(outerJar.getAbsolutePath()+" exists", outerJar.exists());
      JarFile jf = new JarFile(outerJar);

      URL rootURL = outerJar.getParentFile().toURI().toURL();
      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(rootURL);
      VFSContext context = factory.getVFS(rootURL);

      JarEntry jar1 = jf.getJarEntry("jar1.jar");
      URL jar1URL = new URL(outerJar.toURI().toURL(), "jar1.jar");
      VFSContextFactory pf1 = VFSContextFactoryLocator.getFactory(jar1URL);
      VFSContext parent1 = pf1.getVFS(jar1URL);

      ZipInputStream jis1 = new ZipInputStream(jf.getInputStream(jar1));
      NestedJarFromStream njfs = new NestedJarFromStream(context, parent1.getRoot(), jis1, jar1URL, jf, jar1, "jar1.jar");
      VirtualFileHandler e1 = njfs.getChild("org/jboss/test/vfs/support/jar1/ClassInJar1.class");
      assertNotNull(e1);
      log.info("org/jboss/test/vfs/support/CommonClass.class: "+e1);
      VirtualFileHandler mfe1 = njfs.getChild("META-INF/MANIFEST.MF");
      assertNotNull("jar1!/META-INF/MANIFEST.MF", mfe1);
      InputStream mfIS = mfe1.openStream();
      Manifest mf = new Manifest(mfIS);
      Attributes mainAttrs = mf.getMainAttributes();
      String title1 = mainAttrs.getValue(Attributes.Name.SPECIFICATION_TITLE);
      assertEquals("jar1", title1);
      mfIS.close();
      njfs.close();

      JarEntry jar2 = jf.getJarEntry("jar2.jar");
      URL jar2URL = new URL(outerJar.toURI().toURL(), "jar2.jar");
      VFSContextFactory pf2 = VFSContextFactoryLocator.getFactory(jar2URL);
      VFSContext parent2 = pf2.getVFS(jar2URL);

      ZipInputStream jis2 = new ZipInputStream(jf.getInputStream(jar2));
      NestedJarFromStream njfs2 = new NestedJarFromStream(context, parent2.getRoot(), jis2, jar2URL, jf, jar2, "jar2.jar");
      VirtualFileHandler e2 = njfs2.getChild("org/jboss/test/vfs/support/jar2/ClassInJar2.class");
      assertNotNull(e2);
View Full Code Here

Examples of org.jboss.virtual.spi.VFSContextFactory

   }
  
   protected VirtualFileHandler createLinkHandler(VirtualFileHandler parent, String name, URI linkURI)
      throws IOException
   {
      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(linkURI);
      VFSContext context = factory.getVFS(linkURI);
      VirtualFileHandler rootHandler = context.getRoot();
      // Wrap the handler in a delegate so we can change the parent and name
      // TODO: if the factory caches contexts the root handler may not point to the link
      return new DelegatingHandler(this.getVFSContext(), parent, name, rootHandler);
   }
View Full Code Here

Examples of org.jboss.virtual.spi.VFSContextFactory

   public void testSerializable() throws Exception
   {
      URI uri = new URI("vfsmemory://aopdomain");
      URL root = new URL("vfsmemory://aopdomain");
      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(uri);
      VFSContext ctx = factory.getVFS(uri);
      MemoryContextHandler parent = new MemoryContextHandler(ctx, null, root, "aopdomain");

      URI uri2 = new URI("vfsmemory://aopdomain/child");
      URL root2 = new URL("vfsmemory://aopdomain/child");
      VFSContextFactory factory2 = VFSContextFactoryLocator.getFactory(uri2);
      VFSContext ctx2 = factory2.getVFS(uri);
      MemoryContextHandler child = new MemoryContextHandler(ctx2, parent, root2, "child");

      serializeDeserialize(child, MemoryContextHandler.class);

      byte[] bytes = serialize(parent);
View Full Code Here

Examples of org.jboss.virtual.spi.VFSContextFactory

   }

   public void testContextFactory()throws Exception
   {
      URI uri = new URI("vfsmemory://aopdomain");
      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(uri);
      assertNotNull(factory);
   }
View Full Code Here

Examples of org.jboss.virtual.spi.VFSContextFactory

   }
  
   public void testContext() throws Exception
   {
      URI uri = new URI("vfsmemory://aopdomain");
      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(uri);
      VFSContext ctx = factory.getVFS(uri);
      assertNotNull(ctx);
     
      MemoryContextFactory mfactory = MemoryContextFactory.getInstance();
      assertNotNull(mfactory);
      assertSame(factory, mfactory);
View Full Code Here

Examples of org.jboss.virtual.spi.VFSContextFactory

    */
   public void testJarPath() throws Exception
   {
      // to circumvent another bug in VFS
      Map<String, VFSContextFactory> factoryByProtocol = getFactoryByProtocol();
      VFSContextFactory oldFactory = factoryByProtocol.put("jar", new JarContextFactory());
     
      VFSCache cache = createCache();
      cache.start();
      try
      {
View Full Code Here

Examples of org.jboss.virtual.spi.VFSContextFactory

      // Read in the serialPersistentFields
      GetField fields = in.readFields();
      URI rootURI = (URI) fields.get("rootURI", null);
      this.parent = (VirtualFileHandler) fields.get("parent", null);
      this.name = (String) fields.get("name", null);
      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(rootURI);
      this.context = factory.getVFS(rootURI);
      this.references = new AtomicInteger(0);
      this.vfsUrl = (URL)fields.get("vfsUrl", null);
   }
View Full Code Here

Examples of org.jboss.virtual.spi.VFSContextFactory

      // Read in the serialPersistentFields
      GetField fields = in.readFields();
      URI rootURI = (URI) fields.get("rootURI", null);
      this.parent = (VirtualFileHandler) fields.get("parent", null);
      this.name = (String) fields.get("name", null);
      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(rootURI);
      this.context = factory.getVFS(rootURI);
      this.references = new AtomicInteger(0);
      this.vfsUrl = (URL)fields.get("vfsUrl", null);
   }
View Full Code Here

Examples of org.jboss.virtual.spi.VFSContextFactory

   }
  
   protected VirtualFileHandler createLinkHandler(VirtualFileHandler parent, String name, URI linkURI)
      throws IOException
   {
      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(linkURI);
      VFSContext context = factory.getVFS(linkURI);
      VirtualFileHandler rootHandler = context.getRoot();
      // Wrap the handler in a delegate so we can change the parent and name
      // TODO: if the factory caches contexts the root handler may not point to the link
      return new DelegatingHandler(this.getVFSContext(), parent, name, rootHandler);
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.