## org.apache.ivy.core.cache
Class DefaultRepositoryCacheManager

    java.lang.Object
      org.apache.ivy.core.cache.DefaultRepositoryCacheManager

All Implemented Interfaces:
  RepositoryCacheManager, IvySettingsAware

    public class DefaultRepositoryCacheManager

extends java.lang.Object
implements RepositoryCacheManager, IvySettingsAware

Constructor Summary
`DefaultRepositoryCacheManager()`
`DefaultRepositoryCacheManager(java.lang.String name, IvySettings settings, java.io.File basedir)`

Method Summary
`void` `addConfiguredTtl(java.util.Map attributes)`
`void` `addTTL(java.util.Map attributes, PatternMatcher matcher, long duration)`
`ResolvedModuleRevision` `cacheModuleDescriptor(DependencyResolver resolver, ResolvedResource mdRef, DependencyDescriptor dd, Artifact moduleArtifact, ResourceDownloader downloader, CacheMetadataOptions options)` Caches an original module descriptor.
`void` `clean()` Cleans the whole cache.
`ArtifactDownloadReport` `download(Artifact artifact, ArtifactResourceResolver resourceResolver, ResourceDownloader resourceDownloader, CacheDownloadOptions options)` Downloads an artifact to this cache.
`ArtifactDownloadReport` `downloadRepositoryResource(Resource resource, java.lang.String name, java.lang.String type, java.lang.String extension, CacheResourceOptions options, Repository repository)` Download some repository resource and put it in the cache.
`void` `dumpSettings()`
`ResolvedModuleRevision` `findModuleInCache(DependencyDescriptor dd, ModuleRevisionId requestedRevisionId, CacheMetadataOptions options, java.lang.String expectedResolver)` Search a module descriptor in cache for a mrid
`java.io.File` `getArchiveFileInCache(Artifact artifact)` Returns a File object pointing to where the artifact can be found on the local file system.
`java.io.File` `getArchiveFileInCache(Artifact artifact, ArtifactOrigin origin)` Returns a File object pointing to where the artifact can be found on the local file system.
`java.lang.String` `getArchivePathInCache(Artifact artifact)`
`java.lang.String` `getArchivePathInCache(Artifact artifact, ArtifactOrigin origin)`
`java.lang.String` `getArtifactPattern()`
`java.io.File` `getBasedir()`
`java.lang.String` `getChangingMatcherName()`
`java.lang.String` `getChangingPattern()`
`java.lang.String` `getDataFilePattern()`
`long` `getDefaultTTL()`
`java.io.File` `getIvyFileInCache(ModuleRevisionId mrid)`
`java.lang.String` `getIvyPattern()`
`LockStrategy` `getLockStrategy()`
`org.apache.ivy.core.cache.ModuleDescriptorMemoryCache` `getMemoryCache()`
`java.lang.String` `getName()` Returns the name of the repository cache manager.
`Artifact` `getOriginalMetadataArtifact(Artifact moduleArtifact)`
`java.io.File` `getRepositoryCacheRoot()`
`ArtifactOrigin` `getSavedArtifactOrigin(Artifact artifact)` Returns the artifact origin of the given artifact as saved in this cache.
`IvySettings` `getSettings()`
`long` `getTTL(ModuleRevisionId mrid)`
`boolean` `isCheckmodified()` True if this cache should check lastmodified date to know if ivy files are up to date.
`boolean` `isUseOrigin()` True if this cache should use artifacts original location when possible, false if they should be copied to cache.
`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.
`void` `saveResolvedRevision(ModuleRevisionId mrid, java.lang.String revision)` Caches a dynamic revision constraint resolution.
`void` `saveResolvers(ModuleDescriptor md, java.lang.String metadataResolverName, java.lang.String artifactResolverName)` Saves the information of which resolver was used to resolve a md, so that this info can be retrieve later (even after a jvm restart) by getSavedArtResolverName(ModuleDescriptor md)
`void` `setArtifactPattern(java.lang.String artifactPattern)`
`void` `setBasedir(java.io.File cache)`
`void` `setChangingMatcher(java.lang.String changingMatcherName)`
`void` `setChangingPattern(java.lang.String changingPattern)`
`void` `setCheckmodified(boolean check)`
`void` `setDataFilePattern(java.lang.String dataFilePattern)`
`void` `setDefaultTTL(long defaultTTL)`
`void` `setDefaultTTL(java.lang.String defaultTTL)`
`void` `setIvyPattern(java.lang.String ivyPattern)`
`void` `setLockStrategy(LockStrategy lockStrategy)`
`void` `setLockStrategy(java.lang.String lockStrategyName)`
`void` `setMemorySize(int size)`
`void` `setName(java.lang.String name)`
`void` `setSettings(IvySettings settings)`
`void` `setUseOrigin(boolean b)`
`java.lang.String` `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### DefaultRepositoryCacheManager

    public DefaultRepositoryCacheManager()

### DefaultRepositoryCacheManager

    public DefaultRepositoryCacheManager(java.lang.String name,
                                         IvySettings settings,
                                         java.io.File basedir)

Method Detail

### getSettings

    public IvySettings getSettings()

### setSettings

    public void setSettings(IvySettings settings)

  Specified by:
    `setSettings` in interface `IvySettingsAware`

### getIvyFileInCache

    public java.io.File getIvyFileInCache(ModuleRevisionId mrid)

### getIvyPattern

    public java.lang.String getIvyPattern()

### getArtifactPattern

    public java.lang.String getArtifactPattern()

### setArtifactPattern

    public void setArtifactPattern(java.lang.String artifactPattern)

### getBasedir

    public java.io.File getBasedir()

### setBasedir

    public void setBasedir(java.io.File cache)

### getDefaultTTL

    public long getDefaultTTL()

### setDefaultTTL

    public void setDefaultTTL(long defaultTTL)

### setDefaultTTL

    public void setDefaultTTL(java.lang.String defaultTTL)

### getDataFilePattern

    public java.lang.String getDataFilePattern()

### setDataFilePattern

    public void setDataFilePattern(java.lang.String dataFilePattern)

### setIvyPattern

    public void setIvyPattern(java.lang.String ivyPattern)

### getName

    public java.lang.String getName()

  Description copied from interface: `RepositoryCacheManager`
  Returns the name of the repository cache manager.

  Specified by:
    `getName` in interface `RepositoryCacheManager`
  Returns:
    the name of the repository cache manager.

### setName

    public void setName(java.lang.String name)

### getChangingMatcherName

    public java.lang.String getChangingMatcherName()

### setChangingMatcher

    public void setChangingMatcher(java.lang.String changingMatcherName)

### getChangingPattern

    public java.lang.String getChangingPattern()

### setChangingPattern

    public void setChangingPattern(java.lang.String changingPattern)

### addTTL

    public void addTTL(java.util.Map attributes,
                       PatternMatcher matcher,
                       long duration)

### addConfiguredTtl

    public void addConfiguredTtl(java.util.Map attributes)

### setMemorySize

    public void setMemorySize(int size)

### getMemoryCache

    public org.apache.ivy.core.cache.ModuleDescriptorMemoryCache getMemoryCache()

### isCheckmodified

    public boolean isCheckmodified()

  True if this cache should check lastmodified date to know if ivy files are up to date.

  Returns:

### setCheckmodified

    public void setCheckmodified(boolean check)

### isUseOrigin

    public boolean isUseOrigin()

  True if this cache should use artifacts original location when possible, false if they should be copied to cache.

### setUseOrigin

    public void setUseOrigin(boolean b)

### getArchiveFileInCache

    public java.io.File getArchiveFileInCache(Artifact artifact)

  Returns a File object pointing to where the artifact can be found on the local file system. This is usually in the cache, but it can be directly in the repository if it is local and if the resolve has been done with useOrigin = true

### getArchiveFileInCache

    public java.io.File getArchiveFileInCache(Artifact artifact,
                                              ArtifactOrigin origin)

  Returns a File object pointing to where the artifact can be found on the local file system. This is usually in the cache, but it can be directly in the repository if it is local and if the resolve has been done with useOrigin = true

### getArchivePathInCache

    public java.lang.String getArchivePathInCache(Artifact artifact)

### getArchivePathInCache

    public java.lang.String getArchivePathInCache(Artifact artifact,
                                                  ArtifactOrigin origin)

### saveResolvers

    public void saveResolvers(ModuleDescriptor md,
                              java.lang.String metadataResolverName,
                              java.lang.String artifactResolverName)

  Saves the information of which resolver was used to resolve a md, so that this info can be retrieve later (even after a jvm restart) by getSavedArtResolverName(ModuleDescriptor md)

  Specified by:
    `saveResolvers` in interface `RepositoryCacheManager`
  Parameters:
    `md` - the module descriptor resolved
    `name` - artifact resolver name

### getSavedArtifactOrigin

    public ArtifactOrigin getSavedArtifactOrigin(Artifact artifact)

  Description copied from interface: `RepositoryCacheManager`
  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.

  Specified by:
    `getSavedArtifactOrigin` in interface `RepositoryCacheManager`
  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

    public ResolvedModuleRevision findModuleInCache(DependencyDescriptor dd,
                                                    ModuleRevisionId requestedRevisionId,
                                                    CacheMetadataOptions options,
                                                    java.lang.String expectedResolver)

  Description copied from interface: `RepositoryCacheManager`
  Search a module descriptor in cache for a mrid

  Specified by:
    `findModuleInCache` in interface `RepositoryCacheManager`
  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

### saveResolvedRevision

    public void saveResolvedRevision(ModuleRevisionId mrid,
                                     java.lang.String revision)

  Description copied from interface: `RepositoryCacheManager`
  Caches a dynamic revision constraint resolution.

  Specified by:
    `saveResolvedRevision` in interface `RepositoryCacheManager`
  Parameters:
    `mrid` - the dynamic module revision id
    `revision` - the resolved revision

### getTTL

    public long getTTL(ModuleRevisionId mrid)

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### getRepositoryCacheRoot

    public java.io.File getRepositoryCacheRoot()

### getLockStrategy

    public LockStrategy getLockStrategy()

### setLockStrategy

    public void setLockStrategy(LockStrategy lockStrategy)

### setLockStrategy

    public void setLockStrategy(java.lang.String lockStrategyName)

### download

    public ArtifactDownloadReport download(Artifact artifact,
                                           ArtifactResourceResolver resourceResolver,
                                           ResourceDownloader resourceDownloader,
                                           CacheDownloadOptions options)

  Description copied from interface: `RepositoryCacheManager`
  Downloads an artifact to this cache.

  Specified by:
    `download` in interface `RepositoryCacheManager`
  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

### downloadRepositoryResource

    public ArtifactDownloadReport downloadRepositoryResource(Resource resource,
                                                             java.lang.String name,
                                                             java.lang.String type,
                                                             java.lang.String extension,
                                                             CacheResourceOptions options,
                                                             Repository repository)

  Description copied from interface: `RepositoryCacheManager`
  Download some repository resource and put it in the cache.

  If the cached version is considered enough up to date, no downloading is done.

  Specified by:
    `downloadRepositoryResource` in interface `RepositoryCacheManager`
  Parameters:
    `resource` - the resource of the file to put in cache
    `name` - 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 download
    `repository` - the repository which resolve the content of the resource
  Returns:
    a report indicating how the download was performed

### originalToCachedModuleDescriptor

    public void originalToCachedModuleDescriptor(DependencyResolver resolver,
                                                 ResolvedResource orginalMetadataRef,
                                                 Artifact requestedMetadataArtifact,
                                                 ResolvedModuleRevision rmr,
                                                 ModuleDescriptorWriter writer)

  Description copied from interface: `RepositoryCacheManager`
  Stores a standardized version of an original module descriptor in the cache for later use.

  Specified by:
    `originalToCachedModuleDescriptor` in interface `RepositoryCacheManager`
  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.

### cacheModuleDescriptor

    public ResolvedModuleRevision cacheModuleDescriptor(DependencyResolver resolver,
                                                        ResolvedResource mdRef,
                                                        DependencyDescriptor dd,
                                                        Artifact moduleArtifact,
                                                        ResourceDownloader downloader,
                                                        CacheMetadataOptions options)
                                                 throws java.text.ParseException

  Description copied from interface: `RepositoryCacheManager`
  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.

  Specified by:
    `cacheModuleDescriptor` in interface `RepositoryCacheManager`
  Parameters:
    `resolver` - the dependency resolver from which the cache request comes from
    `mdRef` - a resolved resource pointing to the remote original module descriptor
    `dd` - the dependency descriptor for which the module descriptor should be cached
    `moduleArtifact` - 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:
    `java.text.ParseException` - if an exception occurred while parsing the module descriptor

### getOriginalMetadataArtifact

    public Artifact getOriginalMetadataArtifact(Artifact moduleArtifact)

### clean

    public void clean()

  Description copied from interface: `RepositoryCacheManager`
  Cleans the whole cache.

  Specified by:
    `clean` in interface `RepositoryCacheManager`

### dumpSettings

    public void dumpSettings()