Java Code Examples for org.apache.ivy.core.report.MetadataArtifactDownloadReport#setSize()

The following examples show how to use org.apache.ivy.core.report.MetadataArtifactDownloadReport#setSize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NameSpaceHelper.java    From ant-ivy with Apache License 2.0 6 votes vote down vote up
public static MetadataArtifactDownloadReport transform(MetadataArtifactDownloadReport report,
        NamespaceTransformer t) {
    if (t.isIdentity()) {
        return report;
    }
    MetadataArtifactDownloadReport madr = new MetadataArtifactDownloadReport(transform(
        report.getArtifact(), t));
    madr.setSearched(report.isSearched());
    madr.setDownloadStatus(report.getDownloadStatus());
    madr.setDownloadDetails(report.getDownloadDetails());
    madr.setArtifactOrigin(report.getArtifactOrigin());
    madr.setDownloadTimeMillis(report.getDownloadTimeMillis());
    madr.setOriginalLocalFile(report.getOriginalLocalFile());
    madr.setLocalFile(report.getLocalFile());
    madr.setSize(report.getSize());
    return madr;
}
 
Example 2
Source File: DownloadingRepositoryCacheManager.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public ResolvedModuleRevision cacheModuleDescriptor(DependencyResolver resolver, final ResolvedResource resolvedResource, DependencyDescriptor dd, Artifact moduleArtifact, ResourceDownloader downloader, CacheMetadataOptions options) throws ParseException {
    if (!moduleArtifact.isMetadata()) {
        return null;
    }

    ArtifactResourceResolver artifactResourceResolver = new ArtifactResourceResolver() {
        public ResolvedResource resolve(Artifact artifact) {
            return resolvedResource;
        }
    };
    ArtifactDownloadReport report = download(moduleArtifact, artifactResourceResolver, downloader, new CacheDownloadOptions().setListener(options.getListener()).setForce(true));

    if (report.getDownloadStatus() == DownloadStatus.FAILED) {
        LOGGER.warn("problem while downloading module descriptor: {}: {} ({} ms)", resolvedResource.getResource(), report.getDownloadDetails(), report.getDownloadTimeMillis());
        return null;
    }

    ModuleDescriptor md = parseModuleDescriptor(resolver, moduleArtifact, options, report.getLocalFile(), resolvedResource.getResource());
    LOGGER.debug("\t{}: parsed downloaded md file for {}; parsed={}" + getName(), moduleArtifact.getModuleRevisionId(), md.getModuleRevisionId());

    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());

    return new ResolvedModuleRevision(resolver, resolver, md, madr);
}
 
Example 3
Source File: DownloadingRepositoryCacheManager.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public ResolvedModuleRevision cacheModuleDescriptor(DependencyResolver resolver, final ResolvedResource resolvedResource, DependencyDescriptor dd, Artifact moduleArtifact, ResourceDownloader downloader, CacheMetadataOptions options) throws ParseException {
    if (!moduleArtifact.isMetadata()) {
        return null;
    }

    ArtifactResourceResolver artifactResourceResolver = new ArtifactResourceResolver() {
        public ResolvedResource resolve(Artifact artifact) {
            return resolvedResource;
        }
    };
    ArtifactDownloadReport report = download(moduleArtifact, artifactResourceResolver, downloader, new CacheDownloadOptions().setListener(options.getListener()).setForce(true));

    if (report.getDownloadStatus() == DownloadStatus.FAILED) {
        LOGGER.warn("problem while downloading module descriptor: {}: {} ({} ms)", resolvedResource.getResource(), report.getDownloadDetails(), report.getDownloadTimeMillis());
        return null;
    }

    ModuleDescriptor md = parseModuleDescriptor(resolver, moduleArtifact, options, report.getLocalFile(), resolvedResource.getResource());
    LOGGER.debug("\t{}: parsed downloaded md file for {}; parsed={}" + getName(), moduleArtifact.getModuleRevisionId(), md.getModuleRevisionId());

    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());

    return new ResolvedModuleRevision(resolver, resolver, md, madr);
}