Example usage for java.io File getCanonicalPath

List of usage examples for java.io File getCanonicalPath

Introduction

In this page you can find the example usage for java.io File getCanonicalPath.

Prototype

public String getCanonicalPath() throws IOException 

Source Link

Document

Returns the canonical pathname string of this abstract pathname.

Usage

From source file:com.lenovo.tensorhusky.common.utils.Shell.java

public static final String getSparkQualifiedBinPath(String executable) throws IOException {
    // construct hadoop bin path to the specified executable
    String fullExeName = SPARK_HOME_DIR + File.separator + "bin" + File.separator + executable;

    File exeFile = new File(fullExeName);
    if (!exeFile.exists()) {
        throw new IOException("Could not locate executable " + fullExeName + " in the Spark binaries.");
    }/*from  w ww .  java 2  s.  c  o  m*/

    return exeFile.getCanonicalPath();
}

From source file:ddf.security.pdp.realm.xacml.processor.PollingPolicyFinderModule.java

public void onDirectoryCreate(File createdDir) {
    try {//w  w  w.ja  va  2 s.  c  o m
        SecurityLogger.audit("Directory {} was created.", createdDir.getCanonicalPath());
    } catch (IOException e) {
        LOGGER.error(e.getMessage(), e);
    }
}

From source file:ddf.security.pdp.realm.xacml.processor.PollingPolicyFinderModule.java

public void onDirectoryDelete(File deletedDir) {
    try {/*  w w  w. j a  v a2  s  .  c om*/
        SecurityLogger.audit("Directory {} was deleted.", deletedDir.getCanonicalPath());
    } catch (IOException e) {
        LOGGER.error(e.getMessage(), e);
    }
}

From source file:com.lenovo.tensorhusky.common.utils.Shell.java

/**
 * fully qualify the path to a binary that should be in a known hadoop bin
 * location. This is primarily useful for disambiguating call-outs to
 * executable sub-components of Hadoop to avoid clashes with other
 * executables that may be in the path. Caveat: this call doesn't just format
 * the path to the bin directory. It also checks for file existence of the
 * composed path. The output of this call should be cached by callers.
 *//*from  w  ww .  jav a2s.com*/
public static final String getHadoopQualifiedBinPath(String executable) throws IOException {
    // construct hadoop bin path to the specified executable
    String fullExeName = HADOOP_HOME_DIR + File.separator + "bin" + File.separator + executable;

    File exeFile = new File(fullExeName);
    if (!exeFile.exists()) {
        throw new IOException("Could not locate executable " + fullExeName + " in the Hadoop binaries.");
    }

    return exeFile.getCanonicalPath();
}

From source file:ddf.security.pdp.realm.xacml.processor.PollingPolicyFinderModule.java

public void onFileChange(File changedFile) {
    try {//ww  w . j  a  va2 s .c  o  m
        SecurityLogger.audit("File {} changed to:\n{}", changedFile.getCanonicalPath(), new String(
                Files.readAllBytes(Paths.get(changedFile.getCanonicalPath())), StandardCharsets.UTF_8));
    } catch (IOException e) {
        LOGGER.error(e.getMessage(), e);
    }

    reloadPolicies();
}

From source file:com.adaptris.core.common.FileDataInputParameterTest.java

@Test
public void testExtractDestination() throws Exception {
    FileDataInputParameter p = new FileDataInputParameter();
    File f = TempFileUtils.createTrackedFile(testName.getMethodName(), "", p);
    p.setDestination(new ConfiguredProduceDestination("file:///" + f.getCanonicalPath()));
    FileUtils.write(f, TEXT, false);/*from   w  w w  .  jav a  2  s.c  om*/
    AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
    assertNotSame(TEXT, msg.getContent());
    assertEquals(TEXT, p.extract(msg));
}

From source file:com.adaptris.core.lms.FileBackedMessageFactoryTest.java

private String tempDir() throws IOException {
    File f = File.createTempFile(FileBackedMessageFactoryTest.class.getSimpleName(), "", null);
    f.delete();//from   w w  w.  j  a v a  2 s. c om
    cleaner.track(f, marker, FileDeleteStrategy.FORCE);
    return f.getCanonicalPath();
}

From source file:org.agiso.tempel.support.file.provider.AppTemplateProviderElement.java

@Override
protected Set<String> getRepositoryClassPath() {
    File[] libraries = new File(librariesPath).listFiles();
    if (libraries != null && libraries.length > 0) {
        Set<String> classPath = new LinkedHashSet<String>(libraries.length);
        for (File library : libraries)
            try {
                classPath.add(library.getCanonicalPath());
            } catch (Exception e) {
                throw new RuntimeException(e);
            }//  w ww  .  jav  a 2s  . com
        return classPath;
    }

    return Collections.emptySet();
}

From source file:common.email.MailServiceImpl.java

public void setPath(Resource res) {
    try {/*w w w.  j  av a 2  s. c om*/
        File f = res.getFile();
        this.templatePath = f.getCanonicalPath() + "/";
    } catch (IOException e) {
        throw new NullPointerException("folder not found for Email templates: " + res);
    }
    //System.out.println("----------------------------path = "+this.path);
}

From source file:ch.vorburger.exec.ManagedProcessBuilder.java

/**
 * Adds a single argument to the command, composed of a prefix, separated by a '=', followed by a file path.
 * The prefix and file path are independently escaped (see above), and then concatenated.
 *///from   w  ww .java  2  s .co m
public ManagedProcessBuilder addFileArgument(String arg, File file) throws IOException {
    return addArgument(arg, "=", file.getCanonicalPath());
}