Package java.io

Examples of java.io.File.canExecute()


     * @return The path of the validated program.
     */
    public String validateProgram(String path)
        throws NotAuthorizedException, IOException {
        File f = new File(path);
        if (f.canExecute()) {
            return f.getCanonicalPath();
        } else {
            throw new NotAuthorizedException("Unable to access program: " + path);
        }
    }
View Full Code Here


        for (String dataDir : dirs)
        {
            logger.debug("Checking directory {}", dataDir);
            File dir = new File(dataDir);
            if (dir.exists())
                assert dir.isDirectory() && dir.canRead() && dir.canWrite() && dir.canExecute()
                    : String.format("Directory %s is not accessible.", dataDir);
        }

        if (CacheService.instance == null) // should never happen
            throw new RuntimeException("Failed to initialize Cache Service.");
View Full Code Here

            return exe.getPath();
        }

        for (String s :paths) {
            File f = new File(s + SSH_KEYGEN);
            if (f.canExecute()) {
                return f.getAbsolutePath();
            }
        }
        return SSH_KEYGEN;
    }
View Full Code Here

      if (!parent.isDirectory()) return false;
      testFile = file;
    }
    try {
      new FileOutputStream(testFile).close();
      if (!testFile.canExecute()) return false;
      return true;
    } catch (Throwable ex) {
      return false;
    } finally {
      testFile.delete();
View Full Code Here

      if (!parent.isDirectory()) return false;
      testFile = file;
    }
    try {
      new FileOutputStream(testFile).close();
      if (!testFile.canExecute()) return false;
      return true;
    } catch (Throwable ex) {
      return false;
    } finally {
      testFile.delete();
View Full Code Here

        if ( ! f.canWrite() ) {
            throw new IllegalArgumentException("Log directory exists but cannot be written: " + f);
        }

        if ( ! f.canExecute() ) {
            throw new IllegalArgumentException("Log directory exists but cannot be accessed (must be writable and executable): " + f);
        }

        return log_directory;
    }
View Full Code Here

    }
   

    try
    {
      if (exe.isFile() && !exe.canExecute())
      {
        boolean ownerOnly = true;
        exe.setExecutable(true, ownerOnly);
      }
    }
View Full Code Here

    {
      logger.severe("Failed to set executable permission on: "+pathToExe);
    }
    finally
    {
      return exe.canExecute();
    }
  }
}

class ProcessOutputMonitor
View Full Code Here

  }
 
  @Before
  public void setup() {
    File f = new File("./src/test/resources/mock-container-executor");
    if(!f.canExecute()) {
      f.setExecutable(true);
    }
    String executorPath = f.getAbsolutePath();
    Configuration conf = new Configuration();
    conf.set(YarnConfiguration.NM_LINUX_CONTAINER_EXECUTOR_PATH, executorPath);
View Full Code Here

  @Test (timeout = 5000)
  public void testContainerLaunchWithPriority() throws IOException {

    // set the scheduler priority to make sure still works with nice -n prio
    File f = new File("./src/test/resources/mock-container-executor");
    if (!f.canExecute()) {
      f.setExecutable(true);
    }
    String executorPath = f.getAbsolutePath();
    Configuration conf = new Configuration();
    conf.set(YarnConfiguration.NM_LINUX_CONTAINER_EXECUTOR_PATH, executorPath);
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.