Examples of DiskFileSystem


Examples of fitnesse.wiki.fs.DiskFileSystem

  public SymbolicLinkResponder(FileSystem fileSystem) {
    this.fileSystem = fileSystem;
  }

  public SymbolicLinkResponder() {
    this(new DiskFileSystem());
  }
View Full Code Here

Examples of juzu.impl.fs.spi.disk.DiskFileSystem

  @Override
  public void processAnnotationChange(ModuleMetaModel metaModel, AnnotationChange change) {
    ElementHandle<?> elt = change.getKey().getElement();
    if (elt instanceof ElementHandle.Package) {
      ElementHandle.Package pkgElt = (ElementHandle.Package)elt;
      DiskFileSystem fs = metaModel.getProcessingContext().getSourcePath(pkgElt);
      if (fs != null) {
        metaModel.root = fs.getRoot();
      }
    }
    super.processAnnotationChange(metaModel, change);
  }
View Full Code Here

Examples of juzu.impl.fs.spi.disk.DiskFileSystem

  public final ReadFileSystem<?> getSourcePath() {
    if (sourcePath == null) {
      String sourcePathParam = getInitParameter(SOURCE_PATH);
      if (sourcePathParam != null) {
        sourcePath = new DiskFileSystem(new File(sourcePathParam));
      } else {
        try {
          URL configURL = getClassLoader().getResource("juzu/config.json");
          if (configURL != null) {
            String configValue = Tools.read(configURL);
            JSON config = (JSON)JSON.parse(configValue);
            String sourcePathValue = config.getString("sourcepath");
            if (sourcePathValue != null) {
              File sourcePathRoot = new File(sourcePathValue);
              if (sourcePathRoot.isDirectory() && sourcePathRoot.exists()) {
                sourcePath = new DiskFileSystem(sourcePathRoot);
              }
            }
          }
        }
        catch (IOException e) {
View Full Code Here

Examples of juzu.impl.fs.spi.disk.DiskFileSystem

      }
      catch (URISyntaxException e) {
        throw new IOException(e);
      }
      if (f.isDirectory()) {
        return new DiskFileSystem(f);
      } else {
        return new JarFileSystem(url);
      }
    } else {
      throw new IOException("Unsupported URL: " + url);
View Full Code Here

Examples of juzu.impl.fs.spi.disk.DiskFileSystem

  protected final void init(String pkg) throws Exception {
    File root = new File(AbstractInjectTestCase.class.getProtectionDomain().getCodeSource().getLocation().toURI());
    assertTrue(root.exists());
    assertTrue(root.isDirectory());
    init(new DiskFileSystem(root, pkg), Thread.currentThread().getContextClassLoader());
  }
View Full Code Here

Examples of juzu.impl.fs.spi.disk.DiskFileSystem

    }
  }

  public static DiskFileSystem diskFS(Name packageName) {
    File root = new File(System.getProperty("juzu.test.resources.path"));
    return new DiskFileSystem(root, packageName);
  }
View Full Code Here

Examples of juzu.impl.fs.spi.disk.DiskFileSystem

    return new DiskFileSystem(root, packageName);
  }

  public static DiskFileSystem diskFS(String packageName) {
    File root = new File(System.getProperty("juzu.test.resources.path"));
    return new DiskFileSystem(root, packageName);
  }
View Full Code Here

Examples of juzu.impl.fs.spi.disk.DiskFileSystem

    }

    //
    File sourceOutputDir = new File(f2, "source-output");
    assertTrue(sourceOutputDir.mkdir());
    DiskFileSystem sourceOutput = new DiskFileSystem(sourceOutputDir);

    //
    File classOutputDir = new File(f2, "class-output");
    assertTrue(classOutputDir.mkdir());
    DiskFileSystem classOutput = new DiskFileSystem(classOutputDir);

    //
    File sourcePathDir = new File(f2, "source-path");
    String relativePath = packageName.toString().replace('.', '/') + '/';
    assertTrue(new File(sourcePathDir, relativePath).mkdirs());
    DiskFileSystem sourcePath = new DiskFileSystem(sourcePathDir);
    URL url = Thread.currentThread().getContextClassLoader().getResource(relativePath);
    if (url == null) {
      throw failure("Could not resolve resource " + relativePath);
    }
    try {
      URLFileSystem fs = new URLFileSystem();
      fs.add(url);
      fs.copy(sourcePath, sourcePath.getPath(packageName));
    }
    catch (Exception e) {
      throw failure(e);
    }
View Full Code Here

Examples of juzu.impl.fs.spi.disk.DiskFileSystem

      if (classOutput.size(ReadFileSystem.FILE) > 0) {
        File root = File.createTempFile("juzu", "");
        Assert.assertTrue(root.delete());
        Assert.assertTrue(root.mkdirs());
        root.deleteOnExit();
        ReadWriteFileSystem classes = new DiskFileSystem(root);
        classOutput.copy(new Filter.Default<O>() {
          @Override
          public boolean acceptFile(O file, String name) throws IOException {
            return name.endsWith(".class");
          }
View Full Code Here

Examples of juzu.impl.fs.spi.disk.DiskFileSystem

    //
    ClassLoader serviceCL = baseCL;

    //
    DiskFileSystem sourcePath = null;
    try {
      // As first attempt we tried to use the classpath since eclipse would copy the template to this location
      // but that could a chicken egg problem as a template is coped in the classpath only if the compilation
      // is successfull and sometimes a controller references a template literal that is generated from the
      // template source
      ClassLoader cl = env.getClass().getClassLoader();
      Class eclipseImplClass = cl.loadClass("org.eclipse.jdt.internal.apt.pluggable.core.dispatch.IdeProcessingEnvImpl");
      if (eclipseImplClass.isInstance(env)) {
        Method getJavaProject = eclipseImplClass.getMethod("getJavaProject");
        Object javaProject = getJavaProject.invoke(env);
        Class aptConfigClass = cl.loadClass("org.eclipse.jdt.apt.core.util.AptConfig");
        Class javaProjectClass = cl.loadClass("org.eclipse.jdt.core.IJavaProject");
        Method getProcessorOptionsMethod = aptConfigClass.getMethod("getProcessorOptions", javaProjectClass);
        Map<String, String> options = (Map<String, String>)getProcessorOptionsMethod.invoke(null, javaProject);
        log.info("Retrieved options " + options);

        //
        String sp = options.get("-sourcepath");
        log.info("Found sourcepath " + sp);
        if (sp != null) {
          // We take the first value
          Spliterator split = new Spliterator(sp, PATH_SEPARATOR_CHAR);
          if (split.hasNext()) {
            File root = new File(split.next());
            if (root.isDirectory()) {
              sourcePath = new DiskFileSystem(root);
            }
          }
        }

        // Building service class loader, this works better in eclipse specially with m2e and
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.