Example #1
0
 public Path cd(String newPath) {
   PathInfo newPathInfo = new PathInfo(newPath);
   if (newPathInfo.absolute) {
     this.path = newPathInfo.toString();
     return this;
   }
   String p = this.path + (this.path.isEmpty() ? "" : "/") + newPath;
   newPathInfo = new PathInfo(p);
   if (newPathInfo.absolute
       && !newPathInfo.components.isEmpty()
       && newPathInfo.components.get(0).equals("..")) {
     throw new IllegalArgumentException("Cannot cd higher than the root directory");
   }
   this.path = newPathInfo.toString();
   return this;
 }
Example #2
0
 public List<String> getInputPaths(PathInfo pi) throws IOException {
   List<String> list = new ArrayList<String>();
   FileStatus[] fileStatuses;
   for (String branch : branches) {
     fileStatuses = fs.globStatus(new Path(pi.getFullPath() + branch), pathFilter);
     if (fileStatuses == null) {
       continue;
     }
     for (FileStatus f : fileStatuses) {
       list.add(f.getPath().toUri().getPath());
     }
   }
   return list;
 }