Example usage for java.io File pathSeparator

List of usage examples for java.io File pathSeparator

Introduction

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

Prototype

String pathSeparator

To view the source code for java.io File pathSeparator.

Click Source Link

Document

The system-dependent path-separator character, represented as a string for convenience.

Usage

From source file:eu.stratosphere.nephele.instance.local.LocalInstanceManager.java

/**
 * Creates a default instance type based on the hardware characteristics of the machine that calls this method. The
 * default instance type contains the machine's number of CPU cores and size of physical memory. The disc capacity
 * is calculated from the free space in the directory for temporary files.
 * //from ww  w  .j av  a2  s  .c  o m
 * @return the default instance type used for the local machine
 */
public static final InstanceType createDefaultInstanceType() {
    final HardwareDescription hardwareDescription = HardwareDescriptionFactory.extractFromSystem();

    int diskCapacityInGB = 0;
    final String[] tempDirs = GlobalConfiguration
            .getString(ConfigConstants.TASK_MANAGER_TMP_DIR_KEY, ConfigConstants.DEFAULT_TASK_MANAGER_TMP_PATH)
            .split(File.pathSeparator);

    for (final String tempDir : tempDirs) {
        if (tempDir != null) {
            File f = new File(tempDir);
            diskCapacityInGB = Math.max(diskCapacityInGB, (int) (f.getFreeSpace() / (1024L * 1024L * 1024L)));
        }
    }

    final int physicalMemory = (int) (hardwareDescription.getSizeOfPhysicalMemory() / (1024L * 1024L));

    return InstanceTypeFactory.construct("default", hardwareDescription.getNumberOfCPUCores(),
            hardwareDescription.getNumberOfCPUCores(), physicalMemory, diskCapacityInGB, 0);
}

From source file:org.asciidoctor.maven.AsciidoctorMojo.java

protected Asciidoctor getAsciidoctorInstance(String gemPath) throws MojoExecutionException {
    Asciidoctor asciidoctor = null;// www . java 2 s.c o m
    if (gemPath == null) {
        asciidoctor = Asciidoctor.Factory.create();
    } else {
        // Replace Windows path separator to avoid paths with mixed \ and /.
        // This happens for instance when setting: <gemPath>${project.build.directory}/gems-provided</gemPath>
        // because the project's path is converted to string.
        String normalizedGemPath = (File.separatorChar == '\\') ? gemPath.replaceAll("\\\\", "/") : gemPath;
        asciidoctor = Asciidoctor.Factory.create(normalizedGemPath);
    }

    String gemHome = JRubyRuntimeContext.get().evalScriptlet("ENV['GEM_HOME']").toString();
    String gemHomeExpected = (gemPath == null || "".equals(gemPath)) ? ""
            : gemPath.split(java.io.File.pathSeparator)[0];

    if (!"".equals(gemHome) && !gemHomeExpected.equals(gemHome)) {
        getLog().warn("Using inherited external environment to resolve gems (" + gemHome
                + "), i.e. build is platform dependent!");
    }

    return asciidoctor;
}

From source file:grakn.core.daemon.executor.Storage.java

private String getStorageClassPath() {
    return graknHome.resolve("server").resolve("services").resolve("lib").toString() + File.separator + "*"
            + File.pathSeparator + graknHome.resolve("server").resolve("services").resolve("cassandra");
}

From source file:com.adito.applications.types.JavasType.java

protected void addClasspathEntry(XMLElement e, String app) throws IOException {

    events.debug("Adding " + launcher.getInstallDir()
            + (e.getContent() != null ? File.separatorChar + e.getContent() : "") + " to CLASSPATH");

    classpath += (!classpath.equals("") ? File.pathSeparator : "") + launcher.getInstallDir()
            + (e.getContent() != null ? File.separatorChar + e.getContent() : "");
}

From source file:com.asakusafw.lang.compiler.cli.BatchCompilerCli.java

private static List<File> parseFiles(CommandLine cmd, Option option, boolean check) {
    String value = parse(cmd, option);
    if (value == null) {
        return Collections.emptyList();
    }/*from w  ww .  j a  va2 s .c  o  m*/
    List<File> results = new ArrayList<>();
    for (String segment : value.split(Pattern.quote(File.pathSeparator))) {
        String s = segment.trim();
        if (s.isEmpty()) {
            continue;
        }
        results.add(resolveFile(option, s, check));
    }
    return results;
}

From source file:org.hyperic.hq.plugin.tomcat.TomcatServerDetector.java

private String getBootstrapJar(String[] args) {
    String res = null;//w ww.ja  v a 2  s  .  co m
    for (int i = 0; (i < args.length) && (res == null); i++) {
        if (args[i].equalsIgnoreCase("-classpath")) {
            String[] cp = args[i + 1].split(File.pathSeparator);
            for (int c = 0; (c < cp.length) && (res == null); c++) {
                if (cp[c].endsWith("bootstrap.jar")) {
                    res = cp[c];
                }
            }
        }
    }
    log.debug("[getBootstrapJar] res='" + res + "'");
    return res;
}

From source file:backup.namenode.NameNodeBackupServicePlugin.java

private InputStream findInClassPath() throws Exception {
    String property = System.getProperty(JAVA_CLASS_PATH);
    for (String f : Splitter.on(File.pathSeparator).split(property)) {
        InputStream inputStream = null;
        File file = new File(f);
        if (file.exists()) {
            inputStream = findInPath(file);
        } else {//from   w  w  w .  j  a  v  a2  s  . c  o m
            inputStream = findInPath(file.getParentFile());
        }
        if (inputStream != null) {
            return inputStream;
        }
    }
    return null;
}

From source file:net.sourceforge.pmd.util.fxdesigner.SourceEditorController.java

@PersistentProperty
public String getAuxclasspathFiles() {
    return auxclasspathFiles.getValue().stream().map(File::getAbsolutePath)
            .collect(Collectors.joining(File.pathSeparator));
}

From source file:net.grinder.engine.agent.PropertyBuilder.java

/**
 * Build custom class path based on the jar files on given base path.
 *
 * @param useAbsolutePath true if the class path entries should be represented as
 *                        absolute path//from www  .j a  v a  2  s. c om
 * @return classpath string
 */
@SuppressWarnings("ResultOfMethodCallIgnored")
public String buildCustomClassPath(final boolean useAbsolutePath) {
    File baseFile = baseDirectory.getFile();
    File libFolder = new File(baseFile, "lib");
    final StringBuffer customClassPath = new StringBuffer();
    customClassPath.append(getPath(baseFile, useAbsolutePath));
    if (libFolder.exists()) {
        customClassPath.append(File.pathSeparator).append(getPath(new File(baseFile, "lib"), useAbsolutePath));
        libFolder.list(new FilenameFilter() {
            @Override
            public boolean accept(File dir, String name) {
                if (name.endsWith(".jar")) {
                    customClassPath.append(File.pathSeparator)
                            .append(getPath(new File(dir, name), useAbsolutePath));
                }
                return true;
            }
        });
    }
    return customClassPath.toString();
}