Package play.vfs

Examples of play.vfs.VirtualFile


    }

   
  @SuppressWarnings("unchecked")
  public static void loadModels(String name) {
    VirtualFile yamlFile = null;
    try  {
      for (VirtualFile vf : Play.javaPath) {
              yamlFile = vf.child(name);
              if (yamlFile != null && yamlFile.exists()) {
                  break;
              }
          }
          if (yamlFile == null) {
              throw new RuntimeException("Cannot load fixture " + name + ", the file was not found");
View Full Code Here


        return (T)loadYaml(name, yaml);
    }

    @SuppressWarnings("unchecked")
    public static <T> T loadYaml(String name, Yaml yaml) {
        VirtualFile yamlFile = null;
        try {
            for (VirtualFile vf : Play.javaPath) {
                yamlFile = vf.child(name);
                if (yamlFile != null && yamlFile.exists()) {
                    break;
                }
            }
            InputStream is = Play.classloader.getResourceAsStream(name);
            if (is == null) {
View Full Code Here

                serialized.put(prefix + "." + key.toString(), r);
            } else if (value instanceof String && value.toString().matches("<<<\\s*\\{[^}]+}\\s*")) {
                Matcher m = Pattern.compile("<<<\\s*\\{([^}]+)}\\s*").matcher(value.toString());
                m.find();
                String file = m.group(1);
                VirtualFile f = Play.getVirtualFile(file);
                if (f != null && f.exists()) {
                    serialized.put(prefix + "." + key.toString(), new String[]{f.contentAsString()});
                }
            } else {
                serialized.put(prefix + "." + key.toString(), new String[]{value.toString()});
            }
        }
View Full Code Here

    private HashMap<String, Long> currentConfigFiles() {
        HashMap<String, Long> files = new HashMap<String, Long>();

        for (VirtualFile vf : Play.roots) {
            VirtualFile conf = vf.child("conf/greenscript.conf");
            if (conf.exists()) {
                files.put(conf.getRealFile().getAbsolutePath(), conf.getRealFile().lastModified());
            }
        }

        return files;
    }
View Full Code Here

    }

    public void loadDependencies() {
        Properties p = new Properties();
        for (VirtualFile vf : Play.roots) {
            VirtualFile conf = vf.child("conf/greenscript.conf");
            if (conf.exists()) {
                //info_("loading dependency configuration from %1$s", conf.getRealFile().getAbsolutePath());
                try {
                    Properties p0 = new Properties();
                    p0.load(new BufferedInputStream(conf.inputstream()));
                    for (String k : p0.stringPropertyNames()) {
                        //info_("loading property: %s", k);
                        if (!p.containsKey(k)) {
                            info_("loading property for %s: %s", k, p0.get(k));
                            p.put(k, p0.get(k));
View Full Code Here

        Properties p = Play.configuration;
        String urlPath = fetchProp_(p, "greenscript.url.minimized"), ctxPath = Play.ctxPath;
        if (!urlPath.endsWith("/"))
            urlPath = urlPath + "/";
        // add version info
        VirtualFile vf = Play.getVirtualFile(".version");
        if (null != vf) {
            String v = vf.contentAsString();
            urlPath = urlPath + v + "/";
        }
        if (urlPath.startsWith("/")) {
            return urlPath.startsWith(ctxPath) ? urlPath : ctxPath + urlPath;
        } else {
View Full Code Here

    private Minimizer initializeMinimizer_(Properties p, ResourceType type) {
        final Minimizer m = new Minimizer(type);
        m.setFileLocator(new IFileLocator() {
            @Override
            public File locate(String path) {
                VirtualFile vf = VirtualFile.search(Play.roots, path);
                return vf == null ? null : vf.getRealFile();
            }
        });
        m.setBufferLocator(bufferLocator_);

        boolean routerMapping = getBooleanProp_(p, "greenscript.router.mapping", false);
View Full Code Here

                        + fn.replaceFirst("/", "") : fn;
            } else {
                path = rootDir + File.separator + resourceDir + File.separator
                        + fn;
            }
            VirtualFile vf = VirtualFile.search(Play.roots, path);
            if (null != vf) {
                sb.append(vf.contentAsString());
            }
        }
        return sb.toString();
    }
View Full Code Here

    hasOrphan = removeOrphanedJavaFrom(appAbs);
   
    Collection<VirtualFile> modules = Play.modules.values();
    for (VirtualFile module: modules) {
      try {
        VirtualFile root = module.child(APP);
        VirtualFile japidViewDir = root.child(DirUtil.JAPIDVIEWS_ROOT);
        File japidFile = japidViewDir.getRealFile();
        if (japidFile.exists()) {
          String absoluteRootPath = root.getRealFile().getAbsolutePath();
          if( removeOrphanedJavaFrom(absoluteRootPath))
            hasOrphan = true;
        }
View Full Code Here

  public static List<File> reloadChanged() {
    List<File> reloadChanged = reloadChanged(new File(Play.applicationPath, APP).getAbsolutePath());
    Collection<VirtualFile> modules = Play.modules.values();
    for (VirtualFile module: modules) {
      try {
        VirtualFile root = module.child(APP);
        VirtualFile japidViewDir = root.child(DirUtil.JAPIDVIEWS_ROOT);
        File japidFile = japidViewDir.getRealFile();
        if (japidFile.exists()) {
          String absoluteRootPath = root.getRealFile().getAbsolutePath();
          reloadChanged.addAll(reloadChanged(absoluteRootPath));
        }
      }
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.