Package org.apache.ivy.core.cache
Interface RepositoryCacheManager
- All Known Implementing Classes:
DefaultRepositoryCacheManager
public interface RepositoryCacheManager
-
Method Summary
Modifier and TypeMethodDescriptioncacheModuleDescriptor
(DependencyResolver resolver, ResolvedResource originalMetadataRef, DependencyDescriptor dd, Artifact requestedMetadataArtifact, ResourceDownloader downloader, CacheMetadataOptions options) Caches an original module descriptor.void
clean()
Cleans the whole cache.download
(Artifact artifact, ArtifactResourceResolver resourceResolver, ResourceDownloader resourceDownloader, CacheDownloadOptions options) Downloads an artifact to this cache.downloadRepositoryResource
(Resource resource, String name, String type, String extension, CacheResourceOptions options, Repository repository) Download some repository resource and put it in the cache.findModuleInCache
(DependencyDescriptor dd, ModuleRevisionId requestedRevisionId, CacheMetadataOptions options, String expectedResolver) Search a module descriptor in cache for a mridgetName()
Returns the name of the repository cache manager.getSavedArtifactOrigin
(Artifact artifact) Returns the artifact origin of the given artifact as saved in this cache.void
originalToCachedModuleDescriptor
(DependencyResolver resolver, ResolvedResource originalMetadataRef, Artifact requestedMetadataArtifact, ResolvedModuleRevision rmr, ModuleDescriptorWriter writer) Stores a standardized version of an original module descriptor in the cache for later use.void
saveResolvedRevision
(String resolverName, ModuleRevisionId dynamicMrid, String revision) Caches a dynamic revision constraint resolution for a specific resolver.void
saveResolvedRevision
(ModuleRevisionId dynamicMrid, String revision) Deprecated.void
saveResolvers
(ModuleDescriptor descriptor, String metadataResolverName, String artifactResolverName) Saves the information of which resolvers were used to resolve a module (both for metadata and artifact), so that this info can be loaded later (even after a jvm restart) for the use offindModuleInCache(DependencyDescriptor, ModuleRevisionId, CacheMetadataOptions, String)
.
-
Method Details
-
getName
String getName()Returns the name of the repository cache manager.- Returns:
- the name of the repository cache manager.
-
saveResolvers
void saveResolvers(ModuleDescriptor descriptor, String metadataResolverName, String artifactResolverName) Saves the information of which resolvers were used to resolve a module (both for metadata and artifact), so that this info can be loaded later (even after a jvm restart) for the use offindModuleInCache(DependencyDescriptor, ModuleRevisionId, CacheMetadataOptions, String)
.- Parameters:
descriptor
- the module descriptor resolvedmetadataResolverName
- metadata resolver nameartifactResolverName
- artifact resolver name
-
getSavedArtifactOrigin
Returns the artifact origin of the given artifact as saved in this cache.If the origin is unknown, the returned ArtifactOrigin instance will return true when
ArtifactOrigin.isUnknown(ArtifactOrigin)
is called.- Parameters:
artifact
- the artifact for which the saved artifact origin should be returned.- Returns:
- the artifact origin of the given artifact as saved in this cache
-
findModuleInCache
ResolvedModuleRevision findModuleInCache(DependencyDescriptor dd, ModuleRevisionId requestedRevisionId, CacheMetadataOptions options, String expectedResolver) Search a module descriptor in cache for a mrid- Parameters:
dd
- the dependency descriptor identifying the module to searchrequestedRevisionId
- the requested dependency module revision id identifying the module to searchoptions
- options on how caching should be handledexpectedResolver
- the resolver with which the md in cache must have been resolved to be returned, null if this doesn't matter- Returns:
- the ResolvedModuleRevision corresponding to the module found, null if none correct has been found in cache
-
download
ArtifactDownloadReport download(Artifact artifact, ArtifactResourceResolver resourceResolver, ResourceDownloader resourceDownloader, CacheDownloadOptions options) Downloads an artifact to this cache.- Parameters:
artifact
- the artifact to downloadresourceResolver
- a resource resolver to use if the artifact needs to be resolved to a Resource for downloadingresourceDownloader
- a resource downloader to use if actual download of the resource is neededoptions
- a set of options to adjust the download- Returns:
- a report indicating how the download was performed
-
downloadRepositoryResource
ArtifactDownloadReport downloadRepositoryResource(Resource resource, String name, String type, String extension, CacheResourceOptions options, Repository repository) Download some repository resource and put it in the cache.If the cached version is considered enough up to date, no downloading is done.
- Parameters:
resource
- the resource of the file to put in cachename
- the descriptive name of the resource (helps while manually looking into the cache files)type
- the type of the resource (helps while manually looking into the cache files)extension
- the extension of the resource (helps while manually looking into the cache files)options
- a set of options to adjust the downloadrepository
- the repository which resolve the content of the resource- Returns:
- a report indicating how the download was performed
-
cacheModuleDescriptor
ResolvedModuleRevision cacheModuleDescriptor(DependencyResolver resolver, ResolvedResource originalMetadataRef, DependencyDescriptor dd, Artifact requestedMetadataArtifact, ResourceDownloader downloader, CacheMetadataOptions options) throws ParseException Caches an original module descriptor.After this call, the original module descriptor file (with no modification nor conversion) should be available as a local file.
- Parameters:
resolver
- the dependency resolver from which the cache request comes fromoriginalMetadataRef
- a resolved resource pointing to the remote original module descriptordd
- the dependency descriptor for which the module descriptor should be cachedrequestedMetadataArtifact
- the module descriptor artifact as requested originallydownloader
- a ResourceDownloader able to download the original module descriptor resource if required by this cache implementationoptions
- options to apply to cache this module descriptor- Returns:
- a
ResolvedModuleRevision
representing the local cached module descriptor, or null if it failed - Throws:
ParseException
- if an exception occurred while parsing the module descriptor
-
originalToCachedModuleDescriptor
void originalToCachedModuleDescriptor(DependencyResolver resolver, ResolvedResource originalMetadataRef, Artifact requestedMetadataArtifact, ResolvedModuleRevision rmr, ModuleDescriptorWriter writer) Stores a standardized version of an original module descriptor in the cache for later use.- Parameters:
resolver
- the dependency resolver from which the cache request comes fromoriginalMetadataRef
- a resolved resource pointing to the remote original module descriptorrequestedMetadataArtifact
- the module descriptor artifact as requested originallyrmr
- theResolvedModuleRevision
representing the local cached module descriptorwriter
- aModuleDescriptorWriter
able to write the module descriptor to a stream.
-
clean
void clean()Cleans the whole cache. -
saveResolvedRevision
Deprecated.SeesaveResolvedRevision(String, ModuleRevisionId, String)
which prevents cache + * thrashing when multiple resolvers store the same dynamicMridCaches a dynamic revision constraint resolution.- Parameters:
dynamicMrid
- the dynamic module revision idrevision
- the resolved revision
-
saveResolvedRevision
Caches a dynamic revision constraint resolution for a specific resolver.- Parameters:
resolverName
- the resolver in which this dynamic revision was resolveddynamicMrid
- the dynamic module revision idrevision
- the resolved revision
-
saveResolvedRevision(String, ModuleRevisionId, String)
which prevents cache + * thrashing when multiple resolvers store the same dynamicMrid