Example usage for java.util LinkedHashSet toString

List of usage examples for java.util LinkedHashSet toString

Introduction

In this page you can find the example usage for java.util LinkedHashSet toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:com.heliosapm.script.AbstractDeployedScript.java

protected static LinkedHashSet<File> locateConfigFiles(final File sourceFile, final String rootDir,
        final String[] pathSegments) {
    final LinkedHashSet<File> configs = new LinkedHashSet<File>();
    /*// ww w. j a  v a2s . c  o  m
     * root config:  root.config, root.*.config
     * for each dir:  foo.config, foo.*.config, dir.config, dir.*.config
     * 
     */
    final String deplName = URLHelper.getPlainFileName(sourceFile);
    final ConfigFileFilter cff = new ConfigFileFilter("root");
    final File root = new File(rootDir);
    for (File f : root.listFiles(cff)) {
        configs.add(f);
    }
    cff.plainName = deplName;
    File subDir = root;
    for (int i = 1; i < pathSegments.length; i++) {
        subDir = new File(subDir, pathSegments[i]);
        cff.plainName = pathSegments[i];
        for (File f : subDir.listFiles(cff)) {
            configs.add(f);
        }
        cff.plainName = deplName;
        for (File f : subDir.listFiles(cff)) {
            configs.add(f);
        }
    }
    System.out
            .println(String.format("Config Files for deployment [%s] --> %s", sourceFile, configs.toString()));
    return configs;
}

From source file:org.sonatype.plugin.nexus.testenvironment.AbstractEnvironmentMojo.java

@SuppressWarnings("unchecked")
private Collection<Artifact> getNonTransitivePlugins(Set<Artifact> projectArtifacts)
        throws MojoExecutionException {
    Collection<Artifact> deps = new LinkedHashSet<Artifact>();

    for (Artifact artifact : projectArtifacts) {
        Artifact pomArtifact = artifactFactory.createArtifact(artifact.getGroupId(), artifact.getArtifactId(),
                artifact.getVersion(), artifact.getClassifier(), "pom");
        Set<Artifact> result;
        try {//  www.  j a  va2  s.co m
            MavenProject pomProject = mavenProjectBuilder.buildFromRepository(pomArtifact, remoteRepositories,
                    localRepository);

            Set<Artifact> artifacts = pomProject.createArtifacts(artifactFactory, null, null);
            artifacts = filterOutSystemDependencies(artifacts);
            ArtifactResolutionResult arr = resolver.resolveTransitively(artifacts, pomArtifact, localRepository,
                    remoteRepositories, artifactMetadataSource, null);
            result = arr.getArtifacts();
        } catch (Exception e) {
            throw new MojoExecutionException("Failed to resolve non-transitive deps " + e.getMessage(), e);
        }

        LinkedHashSet<Artifact> plugins = new LinkedHashSet<Artifact>();
        plugins.addAll(filtterArtifacts(result, getFilters(null, null, "nexus-plugin", null)));
        plugins.addAll(filtterArtifacts(result, getFilters(null, null, "zip", "bundle")));

        plugins.addAll(getNonTransitivePlugins(plugins));

        if (!plugins.isEmpty()) {
            getLog().debug("Adding non-transitive dependencies for: " + artifact + " -\n"
                    + plugins.toString().replace(',', '\n'));
        }

        deps.addAll(plugins);
    }

    return deps;
}