Package org.apache.ivy.core.report

Examples of org.apache.ivy.core.report.ArtifactDownloadReport


                parser.parse(report);

                all.addAll(Arrays.asList(parser.getArtifactReports()));
            }
            for (Iterator iter = all.iterator(); iter.hasNext();) {
                ArtifactDownloadReport artifact = (ArtifactDownloadReport) iter.next();

                if (artifact.getLocalFile() != null) {
                    urls.add(artifact.getLocalFile().toURL());
                }
            }
        } catch (Exception ex) {
            throw new RuntimeException(
                "impossible to build ivy cache path: " + ex.getMessage(), ex);
View Full Code Here


     * Default implementation actually download the artifact Subclasses should overwrite this to
     * avoid the download
     */
    public boolean exists(Artifact artifact) {
        DownloadReport dr = download(new Artifact[] {artifact}, new DownloadOptions());
        ArtifactDownloadReport adr = dr.getArtifactReport(artifact);
        return adr.getDownloadStatus() != DownloadStatus.FAILED;
    }
View Full Code Here

                pattern,
                new RetrieveOptions().setConfs(confs).setResolveId(getResolveId()));

            Map moduleRevToArtifactsMap = new HashMap();
            for (Iterator iter = artifactsToCopy.keySet().iterator(); iter.hasNext();) {
                ArtifactDownloadReport artifact = (ArtifactDownloadReport) iter.next();
                Set moduleRevArtifacts = (Set) moduleRevToArtifactsMap.get(artifact.getArtifact()
                        .getModuleRevisionId());
                if (moduleRevArtifacts == null) {
                    moduleRevArtifacts = new HashSet();
                    moduleRevToArtifactsMap.put(
                        artifact.getArtifact().getModuleRevisionId(), moduleRevArtifacts);
                }
                moduleRevArtifacts.add(artifact);
            }

            generateXml(dependencies, moduleRevToArtifactsMap, artifactsToCopy);
View Full Code Here

                    Set artifactsOfModuleRev = (Set) moduleRevToArtifactsMap.get(dependency
                            .getModuleRevision().getId());
                    if (artifactsOfModuleRev != null) {
                        for (Iterator iter = artifactsOfModuleRev.iterator(); iter.hasNext();) {
                            ArtifactDownloadReport artifact = (ArtifactDownloadReport) iter.next();
                           
                            RepositoryCacheManager cache = dependency.getModuleRevision()
                                .getArtifactResolver().getRepositoryCacheManager();

                            startArtifact(saxHandler, artifact.getArtifact());

                            writeOriginLocationIfPresent(cache, saxHandler, artifact);

                            writeCacheLocation(cache, saxHandler, artifact);
View Full Code Here

            getProject().addReference(setid, fileset);

            List paths = getArtifactReports();
            File base = null;
            for (Iterator iter = paths.iterator(); iter.hasNext();) {
                ArtifactDownloadReport a = (ArtifactDownloadReport) iter.next();
                if (a.getLocalFile() != null) {
                    base = getBaseDir(base, a.getLocalFile());
                }
            }
            if (base == null) {
                fileset.setDir(new File("."));
                NameEntry ne = fileset.createExclude();
                ne.setName("**/*");
            } else {
                fileset.setDir(base);
                for (Iterator iter = paths.iterator(); iter.hasNext();) {
                    ArtifactDownloadReport a = (ArtifactDownloadReport) iter.next();
                    if (a.getLocalFile() != null) {
                        NameEntry ne = fileset.createInclude();
                        ne.setName(getPath(base, a.getLocalFile()));
                    }
                }
            }
        } catch (Exception ex) {
            throw new BuildException("impossible to build ivy cache fileset: " + ex, ex);
View Full Code Here

                        + " dependencies between java projects won't be used", e);
            }
        }

        for (Iterator iter = all.iterator(); iter.hasNext();) {
            ArtifactDownloadReport artifact = (ArtifactDownloadReport) iter.next();

            boolean usedProject = false;
            if (conf.isResolveInWorkspace()) {
                ModuleId moduleId = artifact.getArtifact().getModuleRevisionId().getModuleId();
                String moduleName = moduleId.getName();
                ModuleRevisionId moduleRevisionId = (ModuleRevisionId) dependencies.get(moduleName);
                if (moduleRevisionId != null) {
                    IJavaProject project = (IJavaProject) idToJProject.get(moduleId);
                    if (project != null && project.exists()) {
                        IClasspathEntry entry = JavaCore.newProjectEntry(project.getPath());
                        if (entry != null && !paths.contains(entry)) {
                            paths.add(entry);
                        }
                        usedProject = true;
                    }
                }
            }

            if (!usedProject) {
                if (artifact.getLocalFile() != null && accept(artifact.getArtifact())) {
                    Path classpathArtifact = new Path(artifact.getLocalFile().getAbsolutePath());
                    Path sourcesArtifact = getSourcesArtifactPath(artifact, all);
                    Path javadocArtifact = getJavadocArtifactPath(artifact, all);
                    paths.add(JavaCore.newLibraryEntry(classpathArtifact, getSourceAttachment(
                        classpathArtifact, sourcesArtifact), getSourceAttachmentRoot(
                        classpathArtifact, sourcesArtifact), null, getExtraAttribute(
View Full Code Here

    private Path getSourcesArtifactPath(ArtifactDownloadReport adr, Collection all) {
        Artifact artifact = adr.getArtifact();
        monitor.subTask("searching sources for " + artifact);
        for (Iterator iter = all.iterator(); iter.hasNext();) {
            ArtifactDownloadReport otherAdr = (ArtifactDownloadReport) iter.next();
            Artifact a = otherAdr.getArtifact();
            if (otherAdr.getLocalFile() != null
                    && isSourceArtifactName(artifact.getName(), a.getName())
                    && a.getId().getRevision().equals(artifact.getId().getRevision())
                    && isSources(a)) {
                return new Path(otherAdr.getLocalFile().getAbsolutePath());
            }
        }
        return null;
    }
View Full Code Here

    private Path getJavadocArtifactPath(ArtifactDownloadReport adr, Collection all) {
        Artifact artifact = adr.getArtifact();
        monitor.subTask("searching javadoc for " + artifact);
        for (Iterator iter = all.iterator(); iter.hasNext();) {
            ArtifactDownloadReport otherAdr = (ArtifactDownloadReport) iter.next();
            Artifact a = otherAdr.getArtifact();
            if (otherAdr.getLocalFile() != null
                    && isJavadocArtifactName(artifact.getName(), a.getName())
                    && a.getModuleRevisionId().equals(artifact.getModuleRevisionId())
                    && a.getId().equals(artifact.getId()) && isJavadoc(a)) {
                return new Path(otherAdr.getLocalFile().getAbsolutePath());
            }
        }
        return null;
    }
View Full Code Here

                _settings, new CacheManager(_settings, _cache), null, true));
        assertNotNull(report);

        assertEquals(1, report.getArtifactsReports().length);

        ArtifactDownloadReport ar = report.getArtifactReport(artifact);
        assertNotNull(ar);

        assertEquals(artifact, ar.getArtifact());
        assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());

        // test to ask to download again, should use cache
        // report = resolver.download(new Artifact[] {artifact}, _data.getIvy(), _cache);
        // assertNotNull(report);
        //       
View Full Code Here

                _settings, _cache));
        assertNotNull(report);

        assertEquals(1, report.getArtifactsReports().length);

        ArtifactDownloadReport ar = report.getArtifactReport(artifact);
        assertNotNull(ar);

        assertEquals(artifact, ar.getArtifact());
        assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());

        // test to ask to download again, should use cache
        report = resolver.download(new Artifact[] {artifact},
            new DownloadOptions(_settings, _cache));
        assertNotNull(report);

        assertEquals(1, report.getArtifactsReports().length);

        ar = report.getArtifactReport(artifact);
        assertNotNull(ar);

        assertEquals(artifact, ar.getArtifact());
        assertEquals(DownloadStatus.NO, ar.getDownloadStatus());
    }
View Full Code Here

TOP

Related Classes of org.apache.ivy.core.report.ArtifactDownloadReport

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.