Package org.wildfly.prospero.galleon
Class ArtifactCache
java.lang.Object
org.wildfly.prospero.galleon.ArtifactCache
Manages artifact cache located in
installationDir/CACHE_FOLDER.
Cached artifacts are listed in CACHE_FOLDER/CACHE_FILENAME. Each artifact is identified by its GAV
and specifies an SHA-1 hash of the file and a relative path were the artifact can be found within installationDir.
If the artifact cannot be found within Galleon-provisioned installationDir, the artifact can be added to the
CACHE_FOLDER.
The cache is rebuild during update and only current artifacts are stored.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidcache(org.wildfly.channel.MavenArtifact artifact) caches the artifact inCACHE_FOLDER.voidcache(org.wildfly.prospero.metadata.ManifestVersionRecord manifestRecord, org.eclipse.aether.repository.LocalRepositoryManager localRepositoryManager) detects and caches the manifests frommanifestRecordinCACHE_FOLDER.static voidfinds a file associated with theGAVin the localinstallationDir.static ArtifactCachegetInstance(Path installationDir) returns artifact cache located atinstallationDir/{code CACHE_FOLDER}voidrecords file in the cache descriptor.
-
Field Details
-
CACHE_FOLDER
-
-
Method Details
-
getInstance
returns artifact cache located atinstallationDir/{code CACHE_FOLDER}- Parameters:
installationDir-- Returns:
- Throws:
IOException- if the cache descriptor is corrupt and cannot be read
-
cleanInstancesCache
public static void cleanInstancesCache() -
getArtifact
public Optional<File> getArtifact(String groupId, String artifactId, String extension, String classifier, String version) finds a file associated with theGAVin the localinstallationDir. The file is only matched if it'sGAVis recorded in cache descriptor and the file has not been modified since the cache was created.- Parameters:
groupId-artifactId-extension-classifier-version-- Returns:
- empty
Optionalif the file has not been matched, otherwise the matchingFile
-
record
public void record(org.wildfly.channel.MavenArtifact artifact, Path pathToArtifact) throws IOException records file in the cache descriptor. The recorded path is relative toinstallationDir- Parameters:
artifact- - artifact to be recordedpathToArtifact- - location in the installation where the artifact can be found- Throws:
IOException
-
cache
caches the artifact inCACHE_FOLDER. The cached artifact is then recorded in the cache list.- Parameters:
artifact-- Throws:
IOException
-
cache
public void cache(org.wildfly.prospero.metadata.ManifestVersionRecord manifestRecord, org.eclipse.aether.repository.LocalRepositoryManager localRepositoryManager) throws IOException detects and caches the manifests frommanifestRecordinCACHE_FOLDER. The version and content of the manifest is resolved usingresolvedArtifacts. NOTE: only manifests identified by maven coordinates are cached.- Parameters:
manifestRecord- - record containing all manifest used in installation.localRepositoryManager- - Maven manager for the local repository.- Throws:
IOException
-