Package java.util

Examples of java.util.SortedSet


        ListableRepository[] repos = PortletManager.getCurrentServer(request).getRepositories();
        for (int i = 0; i < repos.length; i++) {
            ListableRepository repo = repos[i];
            // if the artifact is not fully resolved then try to resolve it
            if (!artifact.isResolved()) {
                SortedSet results = repo.list(artifact);
                if (!results.isEmpty()) {
                    artifact = (org.apache.geronimo.kernel.repository.Artifact) results.first();
                }
            }
            File url = repo.getLocation(artifact);
            if (url != null) {
                if (url.exists() && url.canRead() && !url.isDirectory()) {
View Full Code Here


        try {
            List list = new ArrayList();
            ListableRepository[] repos = PortletManager.getCurrentServer(request).getRepositories();
            for (int i = 0; i < repos.length; i++) {
                ListableRepository repo = repos[i];
                final SortedSet artifacts = repo.list();
                for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
                    String fileName = iterator.next().toString();
                    list.add(fileName);
                }
            }
            Collections.sort(list);
View Full Code Here

                rarPath);
        ListableRepository[] repos = PortletManager.getCurrentServer(request).getRepositories();
        for (ListableRepository repo : repos) {
            // if the artifact is not fully resolved then try to resolve it
            if (!artifact.isResolved()) {
                SortedSet results = repo.list(artifact);
                if (!results.isEmpty()) {
                    artifact = (Artifact) results.first();
                } else {
                    continue;
                }
            }
            File url = repo.getLocation(artifact);
View Full Code Here

        List list = new ArrayList();
        ListableRepository[] repos = PortletManager.getCurrentServer(renderRequest).getRepositories();
        for (int i = 0; i < repos.length; i++) {
            ListableRepository repo = repos[i];

            SortedSet artifacts = repo.list();
            outer:
            for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
                Artifact artifact = (Artifact) iterator.next();
                String test = artifact.toString();
                // todo should only test groupId and should check for long (org.apache.geronimo) and short form
                for (int k = 0; k < SKIP_ENTRIES_WITH.length; k++) {
                    String skip = SKIP_ENTRIES_WITH[k];
View Full Code Here

        // List the available RARs
        List list = new ArrayList();
        ListableRepository[] repos = PortletManager.getCurrentServer(renderRequest).getRepositories();
        for (int i = 0; i < repos.length; i++) {
            ListableRepository repo = repos[i];
            final SortedSet artifacts = repo.list();
            outer:
            for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
              Artifact artifact = (Artifact)iterator.next();
                String test = artifact.toString();
                if (!test.endsWith("/rar")) { //todo: may need to change this logic if configId format changes
                    continue;
                } else if (repo.getLocation(artifact).isDirectory()) {
View Full Code Here

        List list = new ArrayList();
        ListableRepository[] repos = PortletManager.getCurrentServer(renderRequest).getRepositories();
        for (int i = 0; i < repos.length; i++) {
            ListableRepository repo = repos[i];

            SortedSet artifacts = repo.list();
            outer:
            for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
                Artifact artifact = (Artifact) iterator.next();
                String test = artifact.toString();
                // todo should only test groupId and should check for long (org.apache.geronimo) and short form
                for (int k = 0; k < SKIP_ENTRIES_WITH.length; k++) {
                    String skip = SKIP_ENTRIES_WITH[k];
View Full Code Here

        return path;
    }

    public SortedSet list(Artifact query) {
        SortedSet artifacts = new TreeSet();
        if(query.getGroupId() != null && query.getArtifactId() != null && query.getType() != null) {

            File path = new File(rootFile, query.getGroupId());
            path = new File(path, query.getType() + "s");

            File[] files = path.listFiles();
            for (int i = 0; i < files.length; i++) {
                File file = files[i];
                String fileName = file.getName();
                if (fileName.startsWith(query.getArtifactId() + "-") && fileName.endsWith("." + query.getType())) {
                    String version = fileName.substring(query.getArtifactId().length() + 1);
                    version = version.substring(0, version.length() - 1 - query.getType().length());
                    if(query.getVersion() != null && !query.getVersion().toString().equals(version)) {
                        continue;
                    }
                    artifacts.add(new Artifact(query.getGroupId(), query.getArtifactId(), version, query.getType()));
                }
            }
        } else {
            // todo: not very efficient
            SortedSet set = list();
            String targetGroup = query.getGroupId();
            String targetArtifact = query.getArtifactId();
            Version targetVersion = query.getVersion();
            String targetType = query.getType();
            for (Iterator it = set.iterator(); it.hasNext();) {
                Artifact candidate = (Artifact) it.next();
                if(targetGroup != null && !targetGroup.equals(candidate.getGroupId())) {
                    continue;
                }
                if(targetArtifact != null && !targetArtifact.equals(candidate.getArtifactId())) {
View Full Code Here

    //thanks to Brett Porter for this regex lifted from a maven1-2 porting tool
    private static final Pattern MAVEN_1_PATTERN = Pattern.compile("(.+)/(.+)s/(.+)-([0-9].+)\\.([^0-9]+)");

    public SortedSet list() {
        SortedSet artifacts = new TreeSet();
        String[] names = getFiles(rootFile, "");
        Matcher matcher = MAVEN_1_PATTERN.matcher("");
        for (int i = 0; i < names.length; i++) {
            matcher.reset(names[i]);
            if (matcher.matches()) {
                String groupId = matcher.group(1);
                String artifactId = matcher.group(3);
                String version = matcher.group(4);
                String type = matcher.group(2);
                if(groupId.indexOf('/') > -1 || artifactId.indexOf('/') > -1 || type.indexOf('/') > -1 ||
                    version.indexOf('/') > -1) {
                    log.warn("could not resolve URI for malformed repository entry: " + names[i] +
                    " - the filename should look like: <groupId>/<type>s/<artifactId>-<version>.<type>   "+
                    "Perhaps you put in a file without a version number in the name?");
                } else {
                    artifacts.add(new Artifact(groupId, artifactId, version, type));
                }
            } else {
              log.warn("could not resolve URI for malformed repository entry: " + names[i] +
              " - the filename should look like: <groupId>/<type>s/<artifactId>-<version>.<type>   "+
                "Perhaps you put in a file without a version number in the name?");
View Full Code Here

        };
        installer = new PluginInstallerGBean(null, destRepo, store, info, null, null);
    }

    public void execute() throws IOException {
        SortedSet list = sourceRepo.list();
        try {
            for (Iterator it = list.iterator(); it.hasNext();) {
                Artifact artifact = (Artifact) it.next();
                if(((artifact.getGroupId().equals("geronimo")) ||
                        artifact.getGroupId().equals("activemq") ||
                        artifact.getGroupId().equals("openejb") ||
                        artifact.getGroupId().equals("tranql")
View Full Code Here

            return new TreeSet();
        }

        public SortedSet list(Artifact query) {
            System.out.println("LOOKING FOR "+query);
            SortedSet set = new TreeSet();
            if(query.getGroupId() != null && query.getArtifactId() != null && query.getVersion() != null && query.getType() == null) {
                set.add(new Artifact(query.getGroupId(), query.getArtifactId(), query.getVersion(), "jar"));
            }
            return set;
        }
View Full Code Here

TOP

Related Classes of java.util.SortedSet

Copyright © 2018 www.massapicom. 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.