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:org.apache.ambari.server.controller.KerberosHelper.java

/**
 * Creates a new stage/*from w ww .j  a  v  a 2 s. c om*/
 *
 * @param id              the new stage's id
 * @param cluster         the relevant Cluster
 * @param requestId       the relevant request Id
 * @param requestContext  a String describing the stage
 * @param clusterHostInfo JSON-encoded clusterHostInfo structure
 * @param commandParams   JSON-encoded command parameters
 * @param hostParams      JSON-encoded host parameters
 * @return a newly created Stage
 */
private Stage createNewStage(long id, Cluster cluster, long requestId, String requestContext,
        String clusterHostInfo, String commandParams, String hostParams) {
    Stage stage = stageFactory.createNew(requestId, BASE_LOG_DIR + File.pathSeparator + requestId,
            cluster.getClusterName(), cluster.getClusterId(), requestContext, clusterHostInfo, commandParams,
            hostParams);

    stage.setStageId(id);
    return stage;
}

From source file:org.apache.maven.plugin.javadoc.AbstractJavadocMojo.java

/**
 * Method to format the specified source paths that will be accepted by the javadoc tool.
 *
 * @param sourcePaths the list of paths to the source files that will be included in the javadoc.
 * @return a String that contains the formatted source path argument, separated by the System pathSeparator
 *         string (colon (<code>:</code>) on Solaris or semi-colon (<code>;</code>) on Windows).
 * @see File#pathSeparator//w w w.j  a  v  a  2 s .c  om
 */
private String getSourcePath(List<String> sourcePaths) {
    String sourcePath = null;

    if (StringUtils.isEmpty(subpackages) || StringUtils.isNotEmpty(sourcepath)) {
        sourcePath = StringUtils.join(sourcePaths.iterator(), File.pathSeparator);
    }

    return sourcePath;
}

From source file:org.apache.maven.plugin.javadoc.AbstractJavadocMojo.java

/**
 * Method that sets the classpath elements that will be specified in the javadoc <code>-classpath</code>
 * parameter.//from  w w  w.  j ava2 s  . co  m
 *
 * @return a String that contains the concatenated classpath elements, separated by the System pathSeparator
 *         string (colon (<code>:</code>) on Solaris or semi-colon (<code>;</code>) on Windows).
 * @throws MavenReportException if any.
 * @see File#pathSeparator
 */
private String getClasspath() throws MavenReportException {
    List<String> classpathElements = new ArrayList<String>();
    Map<String, Artifact> compileArtifactMap = new HashMap<String, Artifact>();

    classpathElements.addAll(getProjectBuildOutputDirs(project));

    populateCompileArtifactMap(compileArtifactMap, getProjectArtifacts(project));

    if (isAggregator() && project.isExecutionRoot()) {
        try {
            for (MavenProject subProject : reactorProjects) {
                if (subProject != project) {
                    classpathElements.addAll(getProjectBuildOutputDirs(subProject));

                    Set<Artifact> dependencyArtifacts = subProject.createArtifacts(factory, null, null);
                    if (!dependencyArtifacts.isEmpty()) {
                        ArtifactResolutionResult result = null;
                        try {
                            result = resolver.resolveTransitively(dependencyArtifacts, subProject.getArtifact(),
                                    subProject.getManagedVersionMap(), localRepository,
                                    subProject.getRemoteArtifactRepositories(), artifactMetadataSource);
                        } catch (MultipleArtifactsNotFoundException e) {
                            if (checkMissingArtifactsInReactor(dependencyArtifacts, e.getMissingArtifacts())) {
                                getLog().warn("IGNORED to add some artifacts in the classpath. See above.");
                            } else {
                                // we can't find all the artifacts in the reactor so bubble the exception up.
                                throw new MavenReportException(e.getMessage(), e);
                            }
                        } catch (ArtifactNotFoundException e) {
                            throw new MavenReportException(e.getMessage(), e);
                        } catch (ArtifactResolutionException e) {
                            throw new MavenReportException(e.getMessage(), e);
                        }

                        if (result == null) {
                            continue;
                        }

                        populateCompileArtifactMap(compileArtifactMap, getCompileArtifacts(result));

                        if (getLog().isDebugEnabled()) {
                            StringBuilder sb = new StringBuilder();

                            sb.append("Compiled artifacts for ");
                            sb.append(subProject.getGroupId()).append(":");
                            sb.append(subProject.getArtifactId()).append(":");
                            sb.append(subProject.getVersion()).append('\n');
                            for (Artifact a : compileArtifactMap.values()) {
                                sb.append(a.getFile()).append('\n');
                            }

                            getLog().debug(sb.toString());
                        }
                    }
                }
            }
        } catch (InvalidDependencyVersionException e) {
            throw new MavenReportException(e.getMessage(), e);
        }
    }

    for (Artifact a : compileArtifactMap.values()) {
        classpathElements.add(a.getFile().toString());
    }

    if (additionalDependencies != null) {
        for (Dependency dependency : additionalDependencies) {
            Artifact artifact = resolveDependency(dependency);
            String path = artifact.getFile().toString();
            getLog().debug("add additional artifact with path " + path);
            classpathElements.add(path);
        }
    }

    return StringUtils.join(classpathElements.iterator(), File.pathSeparator);
}

From source file:org.domainmath.gui.MainFrame.java

public void saveCurrentDir() {
    String s = "";
    ArrayList<String> l = new ArrayList<>();

    for (int i = 0; i < dirComboBox.getItemCount(); i++) {
        // s+=dirComboBox.getItemAt(i).toString()+File.pathSeparator;
        l.add(dirComboBox.getItemAt(i).toString());
    }//ww  w  .  j a  v a2 s  . com

    if (l.contains(worksDir.getAbsolutePath())) {
        l.remove(worksDir.getAbsolutePath());
    }

    System.out.println("Directory list:" + l);

    for (String st : l) {
        s += st + File.pathSeparator;
    }
    Preferences pr2 = Preferences.userNodeForPackage(this.getClass());
    if (s != null) {
        pr2.put("DomainMath_CurrentDir", s);
        System.out.println("Saved current directory list:" + s);
    } else {
        pr2.put("DomainMath_CurrentDir", worksDir.getAbsolutePath());

    }

    pr2.put("DomainMath_StartUpDir", worksDir.getAbsolutePath());

}

From source file:org.domainmath.gui.MainFrame.java

public void setDirComboContent() {
    Preferences pr2 = Preferences.userNodeForPackage(this.getClass());
    String s = pr2.get("DomainMath_CurrentDir", "");
    ArrayList<String> l = new ArrayList<>();
    if (s != null) {
        StringTokenizer t = new StringTokenizer(s, File.pathSeparator);
        while (t.hasMoreTokens()) {

            // System.out.println(t.nextToken());
            l.add(t.nextToken());/* w  ww . ja v  a  2 s . c  o  m*/

        }
        System.out.println("Open:" + l);

        File _f;
        for (String st : l) {
            _f = new File(st);
            if (_f.exists()) {
                addDirList(st);
            }
        }
        if (worksDir.exists()) {
            addDirList(worksDir.getAbsolutePath());
            cd(worksDir.getAbsolutePath());
        } else {
            worksDir.mkdir();
            addDirList(worksDir.getAbsolutePath());
            cd(worksDir.getAbsolutePath());
        }

    }
    //    else{
    //        addDirList(worksDir.getAbsolutePath());
    //    }

}

From source file:org.apache.maven.plugin.javadoc.AbstractJavadocMojo.java

/**
 * Method to get the path of the bootclass artifacts used in the <code>-bootclasspath</code> option.
 *
 * @return a string that contains bootclass path, separated by the System pathSeparator string
 *         (colon (<code>:</code>) on Solaris or semi-colon (<code>;</code>) on Windows).
 * @throws MavenReportException if any/*from  www . j  a  va 2  s.c  o m*/
 * @see File#pathSeparator
 */
private String getBootclassPath() throws MavenReportException {
    Set<BootclasspathArtifact> bootclasspathArtifacts = collectBootClasspathArtifacts();

    List<String> bootclassPath = new ArrayList<String>();
    for (BootclasspathArtifact aBootclasspathArtifact : bootclasspathArtifacts) {
        if ((StringUtils.isNotEmpty(aBootclasspathArtifact.getGroupId()))
                && (StringUtils.isNotEmpty(aBootclasspathArtifact.getArtifactId()))
                && (StringUtils.isNotEmpty(aBootclasspathArtifact.getVersion()))) {
            bootclassPath.addAll(getArtifactsAbsolutePath(aBootclasspathArtifact));
        }
    }

    bootclassPath = JavadocUtil.pruneFiles(bootclassPath);

    StringBuilder path = new StringBuilder();
    path.append(StringUtils.join(bootclassPath.iterator(), File.pathSeparator));

    if (StringUtils.isNotEmpty(bootclasspath)) {
        path.append(JavadocUtil.unifyPathSeparator(bootclasspath));
    }

    return path.toString();
}

From source file:org.apache.maven.plugin.javadoc.AbstractJavadocMojo.java

/**
 * Method to get the path of the doclet artifacts used in the <code>-docletpath</code> option.
 * <p/>/*from   ww w.  jav a  2  s.  com*/
 * Either docletArtifact or doclectArtifacts can be defined and used, not both, docletArtifact
 * takes precedence over doclectArtifacts. docletPath is always appended to any result path
 * definition.
 *
 * @return a string that contains doclet path, separated by the System pathSeparator string
 *         (colon (<code>:</code>) on Solaris or semi-colon (<code>;</code>) on Windows).
 * @throws MavenReportException if any
 * @see File#pathSeparator
 */
private String getDocletPath() throws MavenReportException {
    Set<DocletArtifact> docletArtifacts = collectDocletArtifacts();
    List<String> pathParts = new ArrayList<String>();

    for (DocletArtifact docletArtifact : docletArtifacts) {
        if (!isDocletArtifactEmpty(docletArtifact)) {
            pathParts.addAll(getArtifactsAbsolutePath(docletArtifact));
        }
    }

    if (!StringUtils.isEmpty(docletPath)) {
        pathParts.add(JavadocUtil.unifyPathSeparator(docletPath));
    }

    String path = StringUtils.join(pathParts.iterator(), File.pathSeparator);

    if (StringUtils.isEmpty(path) && getLog().isWarnEnabled()) {
        getLog().warn("No docletpath option was found. Please review <docletpath/> or <docletArtifact/>"
                + " or <doclets/>.");
    }

    return path;
}

From source file:org.apache.maven.plugin.javadoc.AbstractJavadocMojo.java

/**
 * Method to get the path of the taglet artifacts used in the <code>-tagletpath</code> option.
 *
 * @return a string that contains taglet path, separated by the System pathSeparator string
 *         (colon (<code>:</code>) on Solaris or semi-colon (<code>;</code>) on Windows).
 * @throws MavenReportException if any//from   w  w  w.  j  av  a  2s  . c o  m
 * @see File#pathSeparator
 */
private String getTagletPath() throws MavenReportException {
    Set<TagletArtifact> tArtifacts = collectTagletArtifacts();
    List<String> pathParts = new ArrayList<String>();

    for (TagletArtifact tagletArtifact : tArtifacts) {
        if ((tagletArtifact != null) && (StringUtils.isNotEmpty(tagletArtifact.getGroupId()))
                && (StringUtils.isNotEmpty(tagletArtifact.getArtifactId()))
                && (StringUtils.isNotEmpty(tagletArtifact.getVersion()))) {
            pathParts.addAll(getArtifactsAbsolutePath(tagletArtifact));
        }
    }

    Set<Taglet> taglets = collectTaglets();
    for (Taglet taglet : taglets) {
        if (taglet == null) {
            continue;
        }

        if ((taglet.getTagletArtifact() != null)
                && (StringUtils.isNotEmpty(taglet.getTagletArtifact().getGroupId()))
                && (StringUtils.isNotEmpty(taglet.getTagletArtifact().getArtifactId()))
                && (StringUtils.isNotEmpty(taglet.getTagletArtifact().getVersion()))) {
            pathParts.addAll(getArtifactsAbsolutePath(taglet.getTagletArtifact()));

            pathParts = JavadocUtil.pruneFiles(pathParts);
        } else if (StringUtils.isNotEmpty(taglet.getTagletpath())) {
            pathParts.add(taglet.getTagletpath());

            pathParts = JavadocUtil.pruneDirs(project, pathParts);
        }
    }

    StringBuilder path = new StringBuilder();
    path.append(StringUtils.join(pathParts.iterator(), File.pathSeparator));

    if (StringUtils.isNotEmpty(tagletpath)) {
        path.append(JavadocUtil.unifyPathSeparator(tagletpath));
    }

    return path.toString();
}

From source file:org.apache.maven.plugin.javadoc.AbstractJavadocMojo.java

/**
 * Add Standard Javadoc Options.//from w w w. j  a  v a 2 s.  c o m
 * <br/>
 * The <a href="package-summary.html#Standard_Javadoc_Options">package documentation</a> details the
 * Standard Javadoc Options wrapped by this Plugin.
 *
 * @param arguments   not null
 * @param sourcePaths not null
 * @throws MavenReportException if any
 * @see <a href="http://docs.oracle.com/javase/1.4.2/docs/tooldocs/windows/javadoc.html#javadocoptions">http://docs.oracle.com/javase/1.4.2/docs/tooldocs/windows/javadoc.html#javadocoptions</a>
 */
private void addJavadocOptions(List<String> arguments, List<String> sourcePaths) throws MavenReportException {
    validateJavadocOptions();

    // see com.sun.tools.javadoc.Start#parseAndExecute(String argv[])
    addArgIfNotEmpty(arguments, "-locale", JavadocUtil.quotedArgument(this.locale));

    // all options in alphabetical order

    if (old && isJavaDocVersionAtLeast(SINCE_JAVADOC_1_4)) {
        if (getLog().isWarnEnabled()) {
            getLog().warn("Javadoc 1.4+ doesn't support the -1.1 switch anymore. Ignore this option.");
        }
    } else {
        addArgIf(arguments, old, "-1.1");
    }

    addArgIfNotEmpty(arguments, "-bootclasspath", JavadocUtil.quotedPathArgument(getBootclassPath()));

    if (isJavaDocVersionAtLeast(SINCE_JAVADOC_1_5)) {
        addArgIf(arguments, breakiterator, "-breakiterator", SINCE_JAVADOC_1_5);
    }

    addArgIfNotEmpty(arguments, "-classpath", JavadocUtil.quotedPathArgument(getClasspath()));

    if (StringUtils.isNotEmpty(doclet)) {
        addArgIfNotEmpty(arguments, "-doclet", JavadocUtil.quotedArgument(doclet));
        addArgIfNotEmpty(arguments, "-docletpath", JavadocUtil.quotedPathArgument(getDocletPath()));
    }

    if (StringUtils.isEmpty(encoding)) {
        getLog().warn("Source files encoding has not been set, using platform encoding "
                + ReaderFactory.FILE_ENCODING + ", i.e. build is platform dependent!");
    }
    addArgIfNotEmpty(arguments, "-encoding", JavadocUtil.quotedArgument(getEncoding()));

    addArgIfNotEmpty(arguments, "-exclude", getExcludedPackages(sourcePaths), SINCE_JAVADOC_1_4);

    addArgIfNotEmpty(arguments, "-extdirs",
            JavadocUtil.quotedPathArgument(JavadocUtil.unifyPathSeparator(extdirs)));

    if ((getOverview() != null) && (getOverview().exists())) {
        addArgIfNotEmpty(arguments, "-overview",
                JavadocUtil.quotedPathArgument(getOverview().getAbsolutePath()));
    }

    arguments.add(getAccessLevel());

    if (isJavaDocVersionAtLeast(SINCE_JAVADOC_1_5)) {
        addArgIf(arguments, quiet, "-quiet", SINCE_JAVADOC_1_5);
    }

    addArgIfNotEmpty(arguments, "-source", JavadocUtil.quotedArgument(source), SINCE_JAVADOC_1_4);

    if ((StringUtils.isEmpty(sourcepath)) && (StringUtils.isNotEmpty(subpackages))) {
        sourcepath = StringUtils.join(sourcePaths.iterator(), File.pathSeparator);
    }
    addArgIfNotEmpty(arguments, "-sourcepath", JavadocUtil.quotedPathArgument(getSourcePath(sourcePaths)));

    if (StringUtils.isNotEmpty(sourcepath) && isJavaDocVersionAtLeast(SINCE_JAVADOC_1_5)) {
        addArgIfNotEmpty(arguments, "-subpackages", subpackages, SINCE_JAVADOC_1_5);
    }

    addArgIf(arguments, verbose, "-verbose");

    addArgIfNotEmpty(arguments, null, additionalparam);
}

From source file:org.skt.runtime.original.Storage.java

/**
 * Open database.//from  w w w.  ja  va 2 s.  c om
 * 
 * @param db
 *            The name of the database
 * @param version
 *            The version
 * @param display_name
 *            The display name
 * @param size
 *            The size in bytes
 */
public void openDatabase(String db, String version, String display_name, long size) {

    // If database is open, then close it
    if (this.myDb != null) {
        this.myDb.close();
    }

    // If no database path, generate from application package
    if (this.path == null) {
        this.path = this.ctx.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
    }

    this.dbName = this.path + File.pathSeparator + db + ".db";
    this.myDb = SQLiteDatabase.openOrCreateDatabase(this.dbName, null);
}