Package de.matrixweb.vfs

Examples of de.matrixweb.vfs.VFS


      for (final String envName : configFile.getBuildServer().getEnvironments()) {
        final Environment env = configFile.getEnvironments().get(envName);
        final ProcessDescription processDescription = getProcessDescription(env, manifest);

        final ServiceHolder holder = new ServiceHolder();
        holder.vfs = new VFS();
        setupVfs(holder.vfs, env);
        holder.servlet = new Servlet(holder.vfs, this.pipeline, processDescription);
       
        String alias = processDescription.getOutputFile();
        if (alias.contains("{hash}")) {
View Full Code Here


    task.setIn(resources.toArray(new String[resources.size()]));
    task.setOut(new String[] { "output.js", "output.css" });
    task.setOptionsDefinition(options);
    final ProcessorFactory processorFactory = new JavaEEProcessorFactory();
    try {
      final VFS vfs = new VFS();
      try {
        vfs.mount(vfs.find("/"), new ServletFile(getServletContext(), "/"));
        this.result = new Pipeline(processorFactory).execute(
            Version.getCurrentVersion(), vfs, new VFSResourceResolver(vfs),
            task);
      } finally {
        vfs.dispose();
      }
    } catch (final IOException e) {
      throw new ServletException("Failed to setup vfs", e);
    } finally {
      processorFactory.dispose();
View Full Code Here

          final String host, final String port, final String proxyhost,
          final String proxyport, final ConfigFile configFile)
          throws ExecutionException {
        final ProcessorFactory processorFactory = new JavaEEProcessorFactory();
        try {
          final VFS vfs = new VFS(new Logger() {
            @Override
            public void debug(final String message) {
              getLog().debug(message);
            }

            @Override
            public void info(final String messsage) {
              getLog().info(messsage);
            }

            @Override
            public void error(final String message, final Exception e) {
              getLog().error(message, e);
            }
          });
          try {
            getLog().info("MVN: Adding " + base + " to VFS");
            vfs.mount(vfs.find("/"), new JavaFile(base));
            final ResourceResolver resolver = new VFSResourceResolver(vfs);
            final Manifest manifest = Manifest.fromConfigFile(configFile);
            final Pipeline pipeline = new Pipeline(processorFactory);
            pipeline.execute(Version.getCurrentVersion(), vfs, resolver,
                manifest, target);
          } finally {
            vfs.dispose();
          }
        } catch (final IOException e) {
          throw new ExecutionException("Embedded smaller failed", e);
        } finally {
          processorFactory.dispose();
View Full Code Here

  }

  /** */
  @Test
  public void testOutputTypeExistOnlyOnce() {
    final VFS vfs = new VFS();
    try {
      final Task task = new Task();
      task.setIn(new String[] {});
      task.setOut(new String[] { "test.js", "test2.js" });

      this.pipeline.execute(Version._1_0_0, vfs, this.resourceResolver, task);
    } catch (final SmallerException e) {
      assertThat(e.getMessage(), is("Each output type must exist only once"));
    } finally {
      vfs.dispose();
    }
  }
View Full Code Here

        target.mkdirs();

        // copyManifest(source);
        final Manifest manifest = getManifest(source);
        executeCallback.execute(manifest, source, target);
        final VFS vfs = new VFS();
        try {
          vfs.mount(vfs.find("/"), new JavaFile(target));
          if (testCallback != null) {
            testCallback.test(vfs, manifest);
          }
        } finally {
          vfs.dispose();
        }
      } finally {
        if (target.exists()) {
          FileUtils.deleteDirectory(target);
        }
View Full Code Here

      try {
        assertTrue(target.delete());
        assertTrue(target.mkdir());
        final File source = FileUtils.toFile(this.getClass().getResource(
            "/" + file));
        final VFS vfs = new VFS();
        try {
          vfs.mount(vfs.find("/"), new JavaFile(source));
          final ResourceResolver resolver = new VFSResourceResolver(vfs);
          final Manifest manifest = getManifest(source);
          new Pipeline(processorFactory).execute(Version.getCurrentVersion(),
              vfs, resolver, manifest, target);
          callback.test(vfs, manifest);
        } finally {
          vfs.dispose();
        }
      } finally {
        processorFactory.dispose();
        FileUtils.deleteDirectory(target);
      }
View Full Code Here

  /**
   * @throws IOException
   */
  @Before
  public void setUp() throws IOException {
    this.vfs = new VFS();
    this.vfs.mount(this.vfs.find("/"), new JavaFile(new File(
        absoluteResourcesPath)));

    this.resolver = new VFSResourceResolver(this.vfs);
  }
View Full Code Here

  /**
   * @throws Exception
   */
  @Test
  public void testRelativeFileResolving() throws Exception {
    final VFS vfs = new VFS();
    try {
      final Field field = vfs.getClass().getDeclaredField("host");
      field.setAccessible(true);
      final String host = (String) field.get(vfs);

      vfs.mount(vfs.find("/"),
          new JavaFile(new File(System.getProperty("java.io.tmpdir"))));
      final ResourceResolver resolver = new VFSResourceResolver(vfs);
      final Resource abc = resolver.resolve("/abc.txt");
      assertThat(abc.getPath(), is("/abc.txt"));
      assertThat(abc.getURL().toString(), is("vfs://" + host + "/abc.txt"));

      final Resource def = abc.getResolver().resolve("subfolder/def.txt");
      assertThat(def.getPath(), is("/subfolder/def.txt"));
      assertThat(def.getURL().toString(), is("vfs://" + host
          + "/subfolder/def.txt"));

      final Resource ghi = def.getResolver().resolve("../subfolder2/ghi.txt");
      assertThat(ghi.getPath(), is("/subfolder2/ghi.txt"));
      assertThat(ghi.getURL().toString(), is("vfs://" + host
          + "/subfolder2/ghi.txt"));

      final Resource jkl = ghi.getResolver().resolve("/jkl.txt");
      assertThat(jkl.getPath(), is("/jkl.txt"));
      assertThat(jkl.getURL().toString(), is("vfs://" + host + "/jkl.txt"));
    } finally {
      vfs.dispose();
    }
  }
View Full Code Here

              includedFiles.add(include);
            }
          }
        }

        final VFS vfs = new VFS();
        try {
          vfs.mount(vfs.find("/"), new JavaFile(temp));
          final ResourceResolver resolver = new VFSResourceResolver(vfs);

          final Manifest manifest = Manifest.fromConfigFile(configFile);
          final Pipeline pipeline = new Pipeline(processorFactory);
          pipeline.execute(Version.getCurrentVersion(), vfs, resolver,
              manifest, this.target);
        } finally {
          vfs.dispose();
        }

      } finally {
        FileUtils.deleteDirectory(temp);
      }
View Full Code Here

TOP

Related Classes of de.matrixweb.vfs.VFS

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.