Package java.io

Examples of java.io.File.canExecute()


          File file = RegainToolkit.urlToFile(url);
          // Check whether the file is readable.
          if (!file.canRead()) {
            mCrawlerJobProfiler.abortMeasuring();
            mLog.debug("File rights: canRead: " + file.canRead() +
                    " canExecute: " + file.canExecute() +
                    " canWrite: " + file.canWrite() + " exists: " + file.exists() +
                    " for url: " + url + ", canonical url: " + file.getCanonicalPath());
            logError("File is not readable: '" + url + "'", null, false);
            continue;
          } else if (file.isDirectory()) {
View Full Code Here


            } else return false;
        }

        private File findShell() {
            File f = new File("/bin/sh");
            if(f.exists() && f.canExecute()) return f;
            f = new File("/bin/bash");
            if(f.exists() && f.canExecute()) return f;
            System.err.println("Unable to find system shell");
            return null;
        }
View Full Code Here

        private File findShell() {
            File f = new File("/bin/sh");
            if(f.exists() && f.canExecute()) return f;
            f = new File("/bin/bash");
            if(f.exists() && f.canExecute()) return f;
            System.err.println("Unable to find system shell");
            return null;
        }
     
        static final String RESTART_SCRIPT_NAME = "tempRestartFreenet.sh";
View Full Code Here

       
        private File createRestartScript() throws IOException {
            // FIXME use nodeDir
            File runsh = new File("run.sh");
            String runshNoNice = "run.nonice-for-update.sh";
            if(!(runsh.exists() && runsh.canExecute())) {
                System.err.println("Cannot find run.sh so cannot deploy multi-file update for "+name);
                return null;
            }
            // EVIL HACK
            if(!createRunShNoNice(runsh, new File(runshNoNice))) {
View Full Code Here

    private File which(String cmd) throws IOException {
        String path = System.getenv("PATH");
        if (path != null) {
          for (String dir : path.split(Pattern.quote(File.pathSeparator))) {
              File command = new File(dir.trim(), cmd);
              if (command.canExecute()) {
                  return command.getAbsoluteFile();
              }
          }
        }
        throw new IOException("No command '" + cmd + "' on path " + path);
View Full Code Here

        javaExecs.add(System.getProperty("java.home") + "/bin/java");

        List<JavaInfo> result = Lists.newArrayList();
        for (String javaPath : javaExecs) {
            File javaFile = new File(javaPath);
            if (!javaFile.exists() || !javaFile.canExecute()) {
                continue;
            }

            try {
                result.add(new JavaInfo(javaPath));
View Full Code Here

        String path=System.getenv("PATH");
        String fileSeparator=System.getProperty("file.separator");
        String pathSeparator=System.getProperty("path.separator");
        for(String dir:Splitter.on(pathSeparator).split(path)) {
            File target=new File(dir,cmd);
            if(target.canExecute()) {
                return target.getAbsolutePath();
            }
        }
        return null;
    }
View Full Code Here

    @Test
    public void executeCommand_delegate() {
        Assume.assumeTrue("not unix-like", SystemUtils.IS_OS_MAC_OSX || SystemUtils.IS_OS_LINUX);

        File touch = new File("/usr/bin/touch");
        Assume.assumeTrue("no 'touch' command", touch.isFile() && touch.canExecute());

        final AtomicBoolean call = new AtomicBoolean();
        MockCommandEmulator.callback(new MockCommandEmulator.Callback() {
            @Override
            public void run(List<String> args) throws IOException, InterruptedException {
View Full Code Here

                File bin = new File(p);
                if (bin.isDirectory() == false) {
                    continue;
                }
                File command = new File(bin, PATH_HADOOP_COMMAND_FILE);
                if (command.canExecute()) {
                    return command;
                }
            }
        }
        return null;
View Full Code Here

        Map<String, String> envp = new HashMap<String, String>();
        envp.put("HADOOP_HOME", folder.getRoot().getAbsolutePath());

        File file = ConfigurationProvider.findHadoopCommand(envp);
        assertThat(file, is(notNullValue()));
        assertThat(file.toString(), file.canExecute(), is(true));
    }

    /**
     * search for hadoop command from PATH.
     */
 
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.