org.apache.ivy.core.cache

Interface RepositoryCacheManager

public interface RepositoryCacheManager

Method Summary
ResolvedModuleRevisioncacheModuleDescriptor(DependencyResolver resolver, ResolvedResource orginalMetadataRef, DependencyDescriptor dd, Artifact requestedMetadataArtifact, ResourceDownloader downloader, CacheMetadataOptions options)
Caches an original module descriptor.
voidclean()
Cleans the whole cache.
abstract ArtifactDownloadReportdownload(Artifact artifact, ArtifactResourceResolver resourceResolver, ResourceDownloader resourceDownloader, CacheDownloadOptions options)
Downloads an artifact to this cache.
abstract ResolvedModuleRevisionfindModuleInCache(DependencyDescriptor dd, ModuleRevisionId requestedRevisionId, CacheMetadataOptions options, String expectedResolver)
Search a module descriptor in cache for a mrid
abstract StringgetName()
Returns the name of the repository cache manager.
abstract ArtifactOrigingetSavedArtifactOrigin(Artifact artifact)
Returns the artifact origin of the given artifact as saved in this cache.
voidoriginalToCachedModuleDescriptor(DependencyResolver resolver, ResolvedResource orginalMetadataRef, Artifact requestedMetadataArtifact, ResolvedModuleRevision rmr, ModuleDescriptorWriter writer)
Stores a standardized version of an original module descriptor in the cache for later use.
voidsaveResolvedRevision(ModuleRevisionId dynamicMrid, String revision)
Caches a dynamic revision constraint resolution.
abstract voidsaveResolvers(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 of RepositoryCacheManager.

Method Detail

cacheModuleDescriptor

public ResolvedModuleRevision cacheModuleDescriptor(DependencyResolver resolver, ResolvedResource orginalMetadataRef, DependencyDescriptor dd, Artifact requestedMetadataArtifact, ResourceDownloader downloader, CacheMetadataOptions options)
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 from orginalMetadataRef a resolved resource pointing to the remote original module descriptor dd the dependency descriptor for which the module descriptor should be cached requestedMetadataArtifact the module descriptor artifact as requested originally downloader a ResourceDownloader able to download the original module descriptor resource if required by this cache implementation options 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 occured while parsing the module descriptor

clean

public void clean()
Cleans the whole cache.

download

public abstract ArtifactDownloadReport download(Artifact artifact, ArtifactResourceResolver resourceResolver, ResourceDownloader resourceDownloader, CacheDownloadOptions options)
Downloads an artifact to this cache.

Parameters: artifact the artifact to download resourceResolver a resource resolver to use if the artifact needs to be resolved to a Resource for downloading resourceDownloader a resource downloader to use if actual download of the resource is needed options a set of options to adjust the download

Returns: a report indicating how the download was performed

findModuleInCache

public abstract 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 search requestedRevisionId the requested dependency module revision id identifying the module to search options options on how caching should be handled expectedResolver 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

getName

public abstract String getName()
Returns the name of the repository cache manager.

Returns: the name of the repository cache manager.

getSavedArtifactOrigin

public abstract ArtifactOrigin getSavedArtifactOrigin(Artifact artifact)
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 isUnknown 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

originalToCachedModuleDescriptor

public void originalToCachedModuleDescriptor(DependencyResolver resolver, ResolvedResource orginalMetadataRef, 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 from orginalMetadataRef a resolved resource pointing to the remote original module descriptor requestedMetadataArtifact the module descriptor artifact as requested originally rmr the ResolvedModuleRevision representing the local cached module descriptor writer a ModuleDescriptorWriter able to write the module descriptor to a stream.

saveResolvedRevision

public void saveResolvedRevision(ModuleRevisionId dynamicMrid, String revision)
Caches a dynamic revision constraint resolution.

Parameters: dynamicMrid the dynamic module revision id revision the resolved revision

saveResolvers

public abstract 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 of RepositoryCacheManager.

Parameters: md the module descriptor resolved metadataResolverName metadata resolver name artifactResolverName artifact resolver name