Package org.apache.ivy.core.report

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


    protected ResourceMDParser getDefaultRMDParser(final ModuleId mid) {
        return new ResourceMDParser() {
            public MDResolvedResource parse(Resource resource, String rev) {
                DefaultModuleDescriptor md = DefaultModuleDescriptor
                        .newDefaultInstance(new ModuleRevisionId(mid, rev));
                MetadataArtifactDownloadReport madr = new MetadataArtifactDownloadReport(
                        md.getMetadataArtifact());
                madr.setDownloadStatus(DownloadStatus.NO);
                madr.setSearched(true);
                return new MDResolvedResource(resource, rev, new ResolvedModuleRevision(
                        BasicResolver.this, BasicResolver.this, md, madr, isForce()));
            }
        };
    }
View Full Code Here


                                    artifacts[j].getLocalFile(), options.isOverwrite());
                            }
                        }

                        // publish metadata
                        MetadataArtifactDownloadReport artifactDownloadReport = dependencies[i]
                                .getModuleRevision().getReport();
                        File localIvyFile = artifactDownloadReport.getLocalFile();
                        toResolver.publish(depmd.getMetadataArtifact(), localIvyFile,
                            options.isOverwrite());

                        if (options.isInstallOriginalMetadata()) {
                            if (artifactDownloadReport.getArtifactOrigin() != null
                                    && artifactDownloadReport.getArtifactOrigin().isExists()
                                    && !ArtifactOrigin.isUnknown(artifactDownloadReport
                                            .getArtifactOrigin())
                                    && artifactDownloadReport.getArtifactOrigin().getArtifact() != null
                                    && artifactDownloadReport.getArtifactOrigin().getArtifact()
                                            .getType().endsWith(".original")
                                    && !artifactDownloadReport
                                            .getArtifactOrigin()
                                            .getArtifact()
                                            .getType()
                                            .equals(
                                                depmd.getMetadataArtifact().getType() + ".original")) {
                                // publish original metadata artifact, too, as it has a different
                                // type
                                toResolver.publish(artifactDownloadReport.getArtifactOrigin()
                                        .getArtifact(), artifactDownloadReport
                                        .getOriginalLocalFile(), options.isOverwrite());
                            }
                        }

                        // end module publish
View Full Code Here

                        if (isDefault) {
                            defaultMrids.add(mrid);
                        } else {
                            Artifact metadataArtifact = DefaultArtifact.newIvyArtifact(mrid,
                                pubdate);
                            MetadataArtifactDownloadReport madr = new MetadataArtifactDownloadReport(
                                    metadataArtifact);
                            metadataReports.put(mrid, madr);
                            realMrids.add(mrid);
                        }
                        try {
                            String pubDateAttr = attributes.getValue("pubdate");
                            if (pubDateAttr != null) {
                                pubdate = DateUtil.parse(pubDateAttr);
                            }
                            skip = false;
                        } catch (ParseException e) {
                            throw new IllegalArgumentException("invalid publication date for "
                                    + organisation + " " + module + " " + revision + ": "
                                    + attributes.getValue("pubdate"));
                        }
                    }
                } else if ("metadata-artifact".equals(qName)) {
                    if (skip) {
                        return;
                    }
                    MetadataArtifactDownloadReport madr = metadataReports.get(mrid);
                    if (madr != null) {
                        madr.setDownloadStatus(DownloadStatus.fromString(attributes
                                .getValue("status")));
                        madr.setDownloadDetails(attributes.getValue("details"));
                        madr.setSize(Long.parseLong(attributes.getValue("size")));
                        madr.setDownloadTimeMillis(Long.parseLong(attributes.getValue("time")));
                        madr.setSearched(parseBoolean(attributes.getValue("searched")));
                        if (attributes.getValue("location") != null) {
                            madr.setLocalFile(new File(attributes.getValue("location")));
                        }
                        if (attributes.getValue("original-local-location") != null) {
                            madr.setOriginalLocalFile(new File(attributes
                                    .getValue("original-local-location")));
                        }
                        if (attributes.getValue("origin-location") != null) {
                            if (ArtifactOrigin.isUnknown(attributes.getValue("origin-location"))) {
                                madr.setArtifactOrigin(ArtifactOrigin.unkwnown(madr.getArtifact()));
                            } else {
                                madr.setArtifactOrigin(new ArtifactOrigin(madr.getArtifact(),
                                        parseBoolean(attributes.getValue("origin-is-local")),
                                        attributes.getValue("origin-location")));
                            }
                        }
                    }
View Full Code Here

                        IvyContext.pushContext(currentContext);
                    }

                    DefaultModuleDescriptor workspaceMd = cloneMd(md, af);

                    MetadataArtifactDownloadReport madr = new MetadataArtifactDownloadReport(af);
                    madr.setDownloadStatus(DownloadStatus.SUCCESSFUL);
                    madr.setSearched(true);

                    return new ResolvedModuleRevision(this, this, workspaceMd, madr);
                } else {
                    IvyDEMessage.verbose("\t\treject as version didn't match");
                }
View Full Code Here

                    if (resolver != null) {
                        Message.debug("\tfound ivy file in cache for " + mrid + " (resolved by "
                            + resolver.getName() + "): " + ivyFile);
                        if (expectedResolver == null
                                || expectedResolver.equals(resolver.getName())) {
                            MetadataArtifactDownloadReport madr
                            = new MetadataArtifactDownloadReport(
                                depMD.getMetadataArtifact());
                            madr.setDownloadStatus(DownloadStatus.NO);
                            madr.setSearched(false);
                            madr.setLocalFile(ivyFile);
                            madr.setSize(ivyFile.length());
                            madr.setArtifactOrigin(
                                getSavedArtifactOrigin(depMD.getMetadataArtifact()));
                            return new ResolvedModuleRevision(
                                resolver, artResolver, depMD, madr);
                        } else {
                            Message.debug(
View Full Code Here

                } else if (isChanging(dd, mrid, options)) {
                    Message.verbose(mrid
                        + " is changing, but has not changed: will trust cached artifacts if any");
                }
               
                MetadataArtifactDownloadReport madr
                    = new MetadataArtifactDownloadReport(md.getMetadataArtifact());
                madr.setSearched(true);
                madr.setDownloadStatus(report.getDownloadStatus());
                madr.setDownloadDetails(report.getDownloadDetails());
                madr.setArtifactOrigin(report.getArtifactOrigin());
                madr.setDownloadTimeMillis(report.getDownloadTimeMillis());
                madr.setOriginalLocalFile(report.getLocalFile());
                madr.setSize(report.getSize());
                saveArtifactOrigin(md.getMetadataArtifact(), report.getArtifactOrigin());
               
                return new ResolvedModuleRevision(resolver, resolver, md, madr);
            } catch (IOException ex) {
                Message.warn("io problem while parsing ivy file: " + mdRef.getResource() + ": "
View Full Code Here

                            if (isDefault) {
                                defaultMrids.add(mrid);
                            } else {
                                Artifact metadataArtifact =
                                    DefaultArtifact.newIvyArtifact(mrid, pubdate);
                                MetadataArtifactDownloadReport madr =
                                    new MetadataArtifactDownloadReport(metadataArtifact);
                                metadataReports.put(mrid, madr);
                                realMrids.add(mrid);
                            }
                            try {
                                pubdate = Ivy.DATE_FORMAT.parse(attributes.getValue("pubdate"));
                                skip = false;
                            } catch (ParseException e) {
                                throw new IllegalArgumentException("invalid publication date for "
                                        + organisation + " " + module + " " + revision + ": "
                                        + attributes.getValue("pubdate"));
                            }
                        }
                    } else if ("metadata-artifact".equals(qName)) {
                        if (skip) {
                            return;
                        }
                        MetadataArtifactDownloadReport madr =
                            (MetadataArtifactDownloadReport) metadataReports.get(mrid);
                        if (madr != null) {
                            madr.setDownloadStatus(
                                DownloadStatus.fromString(attributes.getValue("status")));
                            madr.setDownloadDetails(attributes.getValue("details"));
                            madr.setSize(Long.parseLong(attributes.getValue("size")));
                            madr.setDownloadTimeMillis(Long.parseLong(attributes.getValue("time")));
                            madr.setSearched(parseBoolean(attributes.getValue("searched")));
                            if (attributes.getValue("location") != null) {
                                madr.setLocalFile(new File(attributes.getValue("location")));
                            }
                            if (attributes.getValue("original-local-location") != null) {
                                madr.setOriginalLocalFile(
                                    new File(attributes.getValue("original-local-location")));
                            }
                            if (attributes.getValue("origin-location") != null) {
                                if (ArtifactOrigin.UNKNOWN.getLocation().equals(
                                        attributes.getValue("origin-location"))) {
                                    madr.setArtifactOrigin(ArtifactOrigin.UNKNOWN);
                                } else {
                                    madr.setArtifactOrigin(
                                        new ArtifactOrigin(
                                            parseBoolean(attributes.getValue("origin-is-local")),
                                            attributes.getValue("origin-location")));
                                }
                            }
View Full Code Here

                    if (isDynamic) {
                        nsMd.setResolvedModuleRevisionId(ModuleRevisionId.newInstance(nsMrid,
                            artifactRef.getRevision()));
                    }
                    systemMd = toSystem(nsMd);
                    MetadataArtifactDownloadReport madr =
                        new MetadataArtifactDownloadReport(systemMd.getMetadataArtifact());
                    madr.setDownloadStatus(DownloadStatus.NO);
                    madr.setSearched(true);
                    rmr = new ResolvedModuleRevision(this, this, systemMd, madr, isForce());
                }
            } else {
                if (ivyRef instanceof MDResolvedResource) {
                    rmr = ((MDResolvedResource) ivyRef).getResolvedModuleRevision();
View Full Code Here

    protected ResourceMDParser getDefaultRMDParser(final ModuleId mid) {
        return new ResourceMDParser() {
            public MDResolvedResource parse(Resource resource, String rev) {
                DefaultModuleDescriptor md =
                    DefaultModuleDescriptor.newDefaultInstance(new ModuleRevisionId(mid, rev));
                MetadataArtifactDownloadReport madr =
                    new MetadataArtifactDownloadReport(md.getMetadataArtifact());
                madr.setDownloadStatus(DownloadStatus.NO);
                madr.setSearched(true);
                return new MDResolvedResource(resource, rev, new ResolvedModuleRevision(
                        BasicResolver.this, BasicResolver.this, md, madr, isForce()));
            }
        };
    }
View Full Code Here

                    + XMLHelper.escape(licenses[i].getName()) + "\""
                        + lurl + "/>");
            }
        }
        if (dep.getModuleRevision() != null) {
            MetadataArtifactDownloadReport madr = dep.getModuleRevision().getReport();
            out.print("\t\t\t\t<metadata-artifact");
            out.print(" status=\""
                + XMLHelper.escape(madr.getDownloadStatus().toString()) + "\"");
            out.print(" details=\"" + XMLHelper.escape(madr.getDownloadDetails()) + "\"");
            out.print(" size=\"" + madr.getSize() + "\"");
            out.print(" time=\"" + madr.getDownloadTimeMillis() + "\"");
            if (madr.getLocalFile() != null) {
                out.print(" location=\""
                    + XMLHelper.escape(madr.getLocalFile().getAbsolutePath()) + "\"");
            }

            out.print(" searched=\"" + madr.isSearched() + "\"");
            if (madr.getOriginalLocalFile() != null) {
                out.print(" original-local-location=\""
                    + XMLHelper.escape(madr.getOriginalLocalFile().getAbsolutePath()) + "\"");
            }

            ArtifactOrigin origin = madr.getArtifactOrigin();
            if (origin != null) {
                out.print(" origin-is-local=\"" + String.valueOf(origin.isLocal()) + "\"");
                out.print(" origin-location=\"" + XMLHelper.escape(origin.getLocation()) + "\"");
            }
            out.println("/>");
View Full Code Here

TOP

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

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.