Package play.vfs

Examples of play.vfs.VirtualFile


        return e;
      }

      String viewSourceFilePath = DirUtil.mapJavaToSrc(srcFilePath);
      // File file = new File(viewSourceFilePath);
      VirtualFile vf = VirtualFile.fromRelativePath(viewSourceFilePath);

      int oriLineNumber = mapJavaErrorLineToSrcLine(e.getSourceVirtualFile().contentAsString(), e.getLineNumber());
      e = new CompilationException(vf, "\"" + e.getMessage() + "\"", oriLineNumber, 0, 0);
      return e;
    }
View Full Code Here


      String tempName = e.getTemplateName();
      if (tempName.startsWith(defaultTemplateRoot)) {
      } else {
        tempName = defaultTemplateRoot + File.separator + tempName;
      }
      VirtualFile vf = VirtualFile.fromRelativePath(tempName);
      CompilationException ce = new CompilationException(vf, "\"" + e.getMessage() + "\"", e.getLineNumber(), 0,
          0);
      throw ce;
    } catch (Exception e) {
      throw new RuntimeException(e);
View Full Code Here

      JapidPlayTemplate jpt = new JapidPlayTemplate();
      jpt.name = e.getTemplateName();
      jpt.source = e.getTemplateSrc();
      // throw new TemplateExecutionException(jpt, e.getLineNumber(),
      // e.getMessage(), e);
      VirtualFile vf = VirtualFile.fromRelativePath("/app/" + e.getTemplateName());
      throw new CompilationException(vf, "\"" + e.getMessage() + "\"", e.getLineNumber(), 0, 0);
    } catch (RuntimeException e) {
      // TODO Auto-generated catch block
      // e.printStackTrace();
      throw e;
View Full Code Here

   public TemplateFactory newTemplateFactory(String templatePath, TemplateModifier modifier) throws TemplateLoadingException {
      return newTemplateFactory(templatePath, DefaultEncoding, modifier);
   }

   public TemplateFactory newTemplateFactory(String templatePath, String encoding, TemplateModifier modifier) throws TemplateLoadingException {
      VirtualFile file = getTemplateFile(templatePath);
      TemplateDocument document = parseTemplate(file.getRealFile(), encoding);
      if (modifier != null) {
         modifier.modifyTemplate(document);
      }

      try {
         if (document.getIncludes() != null) {
            return new FileTemplateFactory(this, document.normalize(), file.getRealFile(), encoding, modifier, getFiles(document.getIncludes()), changeDetectionInterval);
         }

         return new FileTemplateFactory(this, document.normalize(), file.getRealFile(), encoding, modifier, null, changeDetectionInterval);
      } catch (BehaviorInstantiationException e) {
         throw new TemplateLoadingException(e);
      }
   }
View Full Code Here

         throw new TemplateLoadingException(e);
      }
   }

   public TemplateDocument parseTemplate(String templatePath) throws TemplateLoadingException {
      VirtualFile file = getTemplateFile(templatePath);
      return parseTemplate(file.getRealFile(), DefaultEncoding);
   }
View Full Code Here

      VirtualFile file = getTemplateFile(templatePath);
      return parseTemplate(file.getRealFile(), DefaultEncoding);
   }

   public TemplateDocument parseTemplate(String templatePath, String encoding) throws TemplateLoadingException {
      VirtualFile file = getTemplateFile(templatePath);
      return parseTemplate(file.getRealFile(), encoding);
   }
View Full Code Here

   }

   public HashSet<File> getFiles(HashSet<String> fileNames) {
      HashSet<File> files = new HashSet<File>();
      for (String s : fileNames) {
         VirtualFile f = getTemplateFile(s);
         if (f.exists()) {
            files.add(f.getRealFile());
         }
      }

      if (files.size() != 0) {
         return files;
View Full Code Here

   private VirtualFile getTemplateFile(String path) {
      for (VirtualFile vf : Play.templatesPath) {
         if (vf == null) {
            continue;
         }
         VirtualFile tf = vf.child(path);
         if (tf.exists()) {
            return tf;
         }
      }

      VirtualFile tf = Play.getVirtualFile(path);
      if (tf != null && tf.exists()) {
         return tf;
      } else {
         throw new TemplateNotFoundException(path);
      }
   }
View Full Code Here

    InternshipFamiliar internshipFamiliar = new InternshipFamiliar(internship, familiar);
    internshipFamiliar.insert();
  }
 
  protected static File locateFile(String filename) {
    VirtualFile vfFile;
    for (VirtualFile vf : Play.javaPath) {
      vfFile = vf.child(filename);
      if(vfFile!=null && vfFile.exists()) {
        return vfFile.getRealFile();
      }
    }
    return null;
  }
View Full Code Here

    Type dataType = new TypeToken<Data<Photo>>(){}.getType();
    Data<Photo> data = new Gson().fromJson(reader, dataType);
    assertTrue("La usuario eva perez no tiene ninguna foto", data.data.size()==0);
    Map<String, String> parameters = new HashMap<String, String>();
    Map<java.lang.String, java.io.File> files = new HashMap<java.lang.String, java.io.File>();
    VirtualFile vfFile;
    File image = null;
    for (VirtualFile vf : Play.javaPath) {
      vfFile = vf.child("atom-1.jpeg");
      if(vfFile!=null && vfFile.exists()) {
        image = vfFile.getRealFile();
        break;
      }
    }
    assertNotNull("El fichero atom-1.jpeg especificado no existe", image);
    System.out.println("Exists: " + image.getAbsolutePath());
View Full Code Here

TOP

Related Classes of play.vfs.VirtualFile

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.