Package org.crsh.vfs

Examples of org.crsh.vfs.File


        case LIFECYCLE:
          if ("login".equals(resourceId) || "logout".equals(resourceId)) {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            long timestamp = Long.MIN_VALUE;
            for (File path : dirs) {
              File f = path.child(resourceId + ".groovy");
              if (f != null) {
                Resource sub = f.getResource();
                if (sub != null) {
                  buffer.write(sub.getContent());
                  buffer.write('\n');
                  timestamp = Math.max(timestamp, sub.getTimestamp());
                }
              }
            }
            return Collections.singleton(new Resource(resourceId + ".groovy", buffer.toByteArray(), timestamp));
          }
          break;
        case COMMAND:
          // Find the resource first, we find for the first found
          for (File path : dirs) {
            File f = path.child(resourceId);
            if (f != null) {
              return Collections.singleton(f.getResource());
            }
          }
          break;
        case CONFIG:
          String path = "/" + resourceId;
          File file = confFS.get(Path.get(path));
          if (file != null) {
            return Collections.singleton(loadConf(file));
          }
      }
    } catch (IOException e) {
View Full Code Here


   * Refresh the fs system view. This is normally triggered by the periodic job but it can be manually
   * invoked to trigger explicit refreshes.
   */
  void refresh() {
    try {
      File commands = cmdFS.get(Path.get("/"));
      List<File> newDirs = new ArrayList<File>();
      newDirs.add(commands);
      for (File path : commands.children()) {
        if (path.children().iterator().hasNext()) {
          newDirs.add(path);
        }
      }
      dirs = newDirs;
View Full Code Here

TOP

Related Classes of org.crsh.vfs.File

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.