org.apache.ivy.core.cache.CacheMetadataOptions Java Examples
The following examples show how to use
org.apache.ivy.core.cache.CacheMetadataOptions.
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: LocalFileRepositoryCacheManager.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public ResolvedModuleRevision cacheModuleDescriptor(DependencyResolver resolver, ResolvedResource resolvedResource, DependencyDescriptor dd, Artifact moduleArtifact, ResourceDownloader downloader, CacheMetadataOptions options) throws ParseException { if (!moduleArtifact.isMetadata()) { return null; } assert resolvedResource.getResource().isLocal(); File file = new File(resolvedResource.getResource().getName()); assert file.isFile(); ArtifactOrigin origin = new ArtifactOrigin(moduleArtifact, true, file.getAbsolutePath()); MetadataArtifactDownloadReport report = new MetadataArtifactDownloadReport(moduleArtifact); report.setDownloadStatus(DownloadStatus.NO); report.setArtifactOrigin(origin); report.setSize(file.length()); report.setLocalFile(file); report.setSearched(false); report.setOriginalLocalFile(file); ModuleDescriptor descriptor = parseModuleDescriptor(resolver, moduleArtifact, options, file, resolvedResource.getResource()); return new ResolvedModuleRevision(resolver, resolver, descriptor, report); }
Example #2
Source File: LocalFileRepositoryCacheManager.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public ResolvedModuleRevision cacheModuleDescriptor(DependencyResolver resolver, ResolvedResource resolvedResource, DependencyDescriptor dd, Artifact moduleArtifact, ResourceDownloader downloader, CacheMetadataOptions options) throws ParseException { if (!moduleArtifact.isMetadata()) { return null; } assert resolvedResource.getResource().isLocal(); File file = new File(resolvedResource.getResource().getName()); assert file.isFile(); ArtifactOrigin origin = new ArtifactOrigin(moduleArtifact, true, file.getAbsolutePath()); MetadataArtifactDownloadReport report = new MetadataArtifactDownloadReport(moduleArtifact); report.setDownloadStatus(DownloadStatus.NO); report.setArtifactOrigin(origin); report.setSize(file.length()); report.setLocalFile(file); report.setSearched(false); report.setOriginalLocalFile(file); ModuleDescriptor descriptor = parseModuleDescriptor(resolver, moduleArtifact, options, file, resolvedResource.getResource()); return new ResolvedModuleRevision(resolver, resolver, descriptor, report); }
Example #3
Source File: DownloadingRepositoryCacheManager.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
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 #4
Source File: AbstractRepositoryCacheManager.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
protected ModuleDescriptor parseModuleDescriptor(DependencyResolver resolver, Artifact moduleArtifact, CacheMetadataOptions options, File artifactFile, Resource resource) throws ParseException { ModuleRevisionId moduleRevisionId = moduleArtifact.getId().getModuleRevisionId(); try { IvySettings ivySettings = IvyContextualiser.getIvyContext().getSettings(); ParserSettings parserSettings = new LegacyResolverParserSettings(ivySettings, resolver, moduleRevisionId); ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(resource); return parser.parseDescriptor(parserSettings, new URL(artifactFile.toURI().toASCIIString()), resource, options.isValidate()); } catch (IOException e) { throw UncheckedException.throwAsUncheckedException(e); } }
Example #5
Source File: DownloadingRepositoryCacheManager.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
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 #6
Source File: AbstractRepositoryCacheManager.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
protected ModuleDescriptor parseModuleDescriptor(DependencyResolver resolver, Artifact moduleArtifact, CacheMetadataOptions options, File artifactFile, Resource resource) throws ParseException { ModuleRevisionId moduleRevisionId = moduleArtifact.getId().getModuleRevisionId(); try { IvySettings ivySettings = IvyContextualiser.getIvyContext().getSettings(); ParserSettings parserSettings = new LegacyResolverParserSettings(ivySettings, resolver, moduleRevisionId); ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(resource); return parser.parseDescriptor(parserSettings, new URL(artifactFile.toURI().toASCIIString()), resource, options.isValidate()); } catch (IOException e) { throw UncheckedException.throwAsUncheckedException(e); } }
Example #7
Source File: AbstractResolver.java From ant-ivy with Apache License 2.0 | 5 votes |
protected CacheMetadataOptions getCacheOptions(ResolveData data) { return (CacheMetadataOptions) new CacheMetadataOptions() .setChangingMatcherName(getChangingMatcherName()) .setChangingPattern(getChangingPattern()) .setCheckTTL(!data.getOptions().isUseCacheOnly()) .setCheckmodified( data.getOptions().isUseCacheOnly() ? Boolean.FALSE : checkmodified) .setValidate(doValidate(data)).setNamespace(getNamespace()) .setUseCacheOnly(data.getOptions().isUseCacheOnly()) .setForce(data.getOptions().isRefresh()) .setListener(getDownloadListener(getDownloadOptions(data.getOptions()))); }
Example #8
Source File: AbstractRepositoryCacheManager.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public ResolvedModuleRevision findModuleInCache(DependencyDescriptor dd, ModuleRevisionId requestedRevisionId, CacheMetadataOptions options, String expectedResolver) { return null; }
Example #9
Source File: AbstractRepositoryCacheManager.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public ResolvedModuleRevision findModuleInCache(DependencyDescriptor dd, ModuleRevisionId requestedRevisionId, CacheMetadataOptions options, String expectedResolver) { return null; }