Examples of ArtifactDownloadReport


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

                .getContext().get(WorkspaceResolver.IVYDE_WORKSPACE_ARTIFACT_REPORTS);
        if (workspaceArtifacts != null) {
            // some artifact were 'forced' by the dependency declaration, whereas they should be
            // switch by the eclipse project reference
            for (int i = 0; i < artifactReports.length; i++) {
                ArtifactDownloadReport eclipseArtifactReport = (ArtifactDownloadReport) workspaceArtifacts
                        .get(artifactReports[i].getArtifact());
                if (eclipseArtifactReport != null) {
                    // let's switch.
                    artifactReports[i] = eclipseArtifactReport;
                }
View Full Code Here

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

        }

        // Not much to do here - downloads are not required for workspace projects.
        DownloadReport dr = new DownloadReport();
        for (int i = 0; i < artifacts.length; i++) {
            ArtifactDownloadReport adr = new ArtifactDownloadReport(artifacts[i]);
            dr.addArtifactReport(adr);
            // Only report java projects as downloaded
            if (artifacts[i].getType().equals(ECLIPSE_PROJECT_TYPE)) {
                adr.setDownloadStatus(DownloadStatus.NO);
                adr.setSize(0);
                Message.verbose("\t[IN WORKSPACE] " + artifacts[i]);
            } else if (workspaceArtifacts != null && workspaceArtifacts.containsKey(artifacts[i])) {
                adr.setDownloadStatus(DownloadStatus.NO);
                adr.setSize(0);
                // there is some 'forced' artifact by the dependency descriptor
                Artifact eclipseArtifact = (Artifact) workspaceArtifacts.get(artifacts[i]);
                ArtifactDownloadReport eclipseAdr = new ArtifactDownloadReport(eclipseArtifact);
                eclipseAdr.setDownloadStatus(DownloadStatus.NO);
                eclipseAdr.setSize(0);
                workspaceReports.put(artifacts[i], eclipseAdr);
                Message.verbose("\t[IN WORKSPACE] " + eclipseArtifact);
            } else {
                adr.setDownloadStatus(DownloadStatus.FAILED);
                Message.verbose("\t[Eclipse Workspace resolver] "
View Full Code Here

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

        Collection paths = new LinkedHashSet();

        IvyDEMessage.verbose("Building classpath from " + all.size() + " resolved artifact(s)");

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

            if (artifact.getType().equals(WorkspaceResolver.ECLIPSE_PROJECT_TYPE)) {
                IvyDEMessage.verbose("Found an workspace dependency on project " + artifact.getName());
                // This is a java project in the workspace, add project path
                // but only add it if it is not a self dependency
                if (javaProject == null
                        || !artifact.getName().equals(javaProject.getPath().toString())) {
                    IAccessRule[] rules = getAccessRules(javaProject);
                    paths.add(JavaCore.newProjectEntry(new Path(artifact.getName()), rules, true,
                        null, true));
                } else {
                    IvyDEMessage.verbose("Skipping self dependency on project " + artifact.getName());
                }
            } else if (artifact.getLocalFile() != null && accept(artifact.getArtifact())) {
                IvyDEMessage.verbose("Adding " + artifact.getName() + " to the classpath");

                IPath classpathArtifact = getArtifactPath(artifact);
                IPath sourcesArtifact = getArtifactPath(artifact, sourceArtifactMatcher,
                    mapping.isMapIfOnlyOneSource());
                IPath javadocArtifact = getArtifactPath(artifact, javadocArtifactMatcher,
View Full Code Here

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

    private Path getArtifactPath(ArtifactDownloadReport adr, ArtifactMatcher matcher,
            boolean mapIfOnlyOne) {
        Artifact artifact = adr.getArtifact();
        monitor.subTask("searching " + matcher.getName() + " for " + artifact);
        for (Iterator iter = all.iterator(); iter.hasNext();) {
            ArtifactDownloadReport otherAdr = (ArtifactDownloadReport) iter.next();
            Artifact a = otherAdr.getArtifact();
            if (otherAdr.getLocalFile() != null && matcher.matchName(artifact, a.getName())
                    && a.getModuleRevisionId().equals(artifact.getModuleRevisionId())
                    && matcher.match(a)) {
                return getArtifactPath(otherAdr);
            }
        }
        // we haven't found source artifact in resolved artifacts,
        // let's look in the module declaring the artifact
        ModuleRevisionId mrid = artifact.getId().getModuleRevisionId();
        Artifact[] artifacts = (Artifact[]) artifactsByDependency.get(mrid);
        if (artifacts != null) {
            Artifact foundArtifact = null;
            int nbFound = 0;
            for (int i = 0; i < artifacts.length; i++) {
                Artifact metaArtifact = artifacts[i];
                if (matcher.match(metaArtifact)) {
                    if (matcher.matchName(artifact, metaArtifact.getName())) {
                        // we've found a matching artifact, let's provision it
                        ArtifactDownloadReport metaAdr = ivy.getResolveEngine().download(
                            metaArtifact, new DownloadOptions());
                        if (metaAdr.getLocalFile() != null && metaAdr.getLocalFile().exists()) {
                            return getArtifactPath(metaAdr);
                        }
                    }
                    // keep a reference to the artifact so we could fall back
                    // to map-if-only-one
                    nbFound++;
                    foundArtifact = metaArtifact;
                }
            }
            if (mapIfOnlyOne) {
                // we haven't found artifact in the module declaring the artifact and having
                // a matching name.
                if (nbFound == 1) {
                    // If there is only 1 found artifact, it is the winner ;-)
                    ArtifactDownloadReport metaAdr = ivy.getResolveEngine().download(foundArtifact,
                        new DownloadOptions());
                    if (metaAdr.getLocalFile() != null && metaAdr.getLocalFile().exists()) {
                        return new Path(metaAdr.getLocalFile().getAbsolutePath());
                    }
                }
            }
        }
View Full Code Here

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

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

        for (int i = 0; i < 2; i++) {
            Artifact artifact = rmr.getDescriptor().getAllArtifacts()[i];
            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
            DownloadReport report2 = p2SourceResolver.download(new Artifact[] {artifact},
                new DownloadOptions());
            assertNotNull(report2);

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

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

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

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

        assertNotNull(report);

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

        Artifact artifact = rmr.getDescriptor().getAllArtifacts()[0];
        ArtifactDownloadReport ar = report.getArtifactReport(artifact);
        assertNotNull(ar);

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

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

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

        for (int i = 0; i < 2; i++) {
            Artifact artifact = rmr.getDescriptor().getAllArtifacts()[i];
            ArtifactDownloadReport ar = report.getArtifactReport(artifact);
            assertNotNull(ar);

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

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

        assertNotNull(report);

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

        Artifact artifact = rmr.getDescriptor().getAllArtifacts()[0];
        ArtifactDownloadReport ar = report.getArtifactReport(artifact);
        assertNotNull(ar);

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

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

        DownloadReport report = resolver.download(new Artifact[] {artifact}, new DownloadOptions());
        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());
        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

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

        assertNotNull(origin);
        assertTrue(origin.isLocal());
        assertEquals(artifactFile.getAbsolutePath(),
            new File(origin.getLocation()).getAbsolutePath());

        ArtifactDownloadReport r = engine.download(origin, new DownloadOptions());
        assertNotNull(r);
        assertEquals(DownloadStatus.SUCCESSFUL, r.getDownloadStatus());
        assertNotNull(r.getLocalFile());
        assertTrue(r.getLocalFile().exists());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.