Package org.eclipse.aether.internal.impl
Class EnhancedLocalRepositoryManager
- java.lang.Object
-
- org.eclipse.aether.internal.impl.SimpleLocalRepositoryManager
-
- org.eclipse.aether.internal.impl.EnhancedLocalRepositoryManager
-
- All Implemented Interfaces:
LocalRepositoryManager
class EnhancedLocalRepositoryManager extends SimpleLocalRepositoryManager
These are implementation details for enhanced local repository manager, subject to change without prior notice. Repositories from which a cached artifact was resolved are tracked in a properties file named_remote.repositories
, with content key as filename>repo_id and value as empty string. If a file has been installed in the repository, but not downloaded from a remote repository, it is tracked as empty repository id and always resolved. For example:artifact-1.0.pom>= artifact-1.0.jar>= artifact-1.0.pom>central= artifact-1.0.jar>central= artifact-1.0.zip>central= artifact-1.0-classifier.zip>central= artifact-1.0.pom>my_repo_id=
- See Also:
EnhancedLocalRepositoryManagerFactory
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
LOCAL_REPO_ID
private LocalPathPrefixComposer
localPathPrefixComposer
private TrackingFileManager
trackingFileManager
private java.lang.String
trackingFilename
-
Constructor Summary
Constructors Constructor Description EnhancedLocalRepositoryManager(java.io.File basedir, LocalPathComposer localPathComposer, java.lang.String trackingFilename, TrackingFileManager trackingFileManager, LocalPathPrefixComposer localPathPrefixComposer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(RepositorySystemSession session, LocalArtifactRegistration request)
Registers an installed or resolved artifact with the local repository.private void
addArtifact(Artifact artifact, java.util.Collection<java.lang.String> repositories, RemoteRepository repository, java.lang.String context)
private void
addRepo(java.io.File artifactFile, java.util.Collection<java.lang.String> repositories)
private void
checkFind(java.io.File file, LocalArtifactResult result)
private java.lang.String
concatPaths(java.lang.String prefix, java.lang.String artifactPath)
LocalArtifactResult
find(RepositorySystemSession session, LocalArtifactRequest request)
Queries for the existence of an artifact in the local repository.private java.lang.String
getKey(java.io.File file, java.lang.String repository)
java.lang.String
getPathForLocalArtifact(Artifact artifact)
Gets the relative path for a locally installed artifact.java.lang.String
getPathForLocalMetadata(Metadata metadata)
Gets the relative path for locally installed metadata.java.lang.String
getPathForRemoteArtifact(Artifact artifact, RemoteRepository repository, java.lang.String context)
Gets the relative path for an artifact cached from a remote repository.java.lang.String
getPathForRemoteMetadata(Metadata metadata, RemoteRepository repository, java.lang.String context)
Gets the relative path for metadata cached from a remote repository.private java.util.Collection<java.lang.String>
getRepositoryKeys(RemoteRepository repository, java.util.Collection<java.lang.String> contexts)
private java.io.File
getTrackingFile(java.io.File artifactFile)
private boolean
isTracked(java.util.Properties props, java.io.File file)
private java.util.Properties
readRepos(java.io.File artifactFile)
-
Methods inherited from class org.eclipse.aether.internal.impl.SimpleLocalRepositoryManager
add, find, getRepository, getRepositoryKey, toString
-
-
-
-
Field Detail
-
LOCAL_REPO_ID
private static final java.lang.String LOCAL_REPO_ID
- See Also:
- Constant Field Values
-
trackingFilename
private final java.lang.String trackingFilename
-
trackingFileManager
private final TrackingFileManager trackingFileManager
-
localPathPrefixComposer
private final LocalPathPrefixComposer localPathPrefixComposer
-
-
Constructor Detail
-
EnhancedLocalRepositoryManager
EnhancedLocalRepositoryManager(java.io.File basedir, LocalPathComposer localPathComposer, java.lang.String trackingFilename, TrackingFileManager trackingFileManager, LocalPathPrefixComposer localPathPrefixComposer)
-
-
Method Detail
-
concatPaths
private java.lang.String concatPaths(java.lang.String prefix, java.lang.String artifactPath)
-
getPathForLocalArtifact
public java.lang.String getPathForLocalArtifact(Artifact artifact)
Description copied from interface:LocalRepositoryManager
Gets the relative path for a locally installed artifact. Note that the artifact need not actually exist yet at the returned location, the path merely indicates where the artifact would eventually be stored. The path uses the forward slash as directory separator regardless of the underlying file system.- Specified by:
getPathForLocalArtifact
in interfaceLocalRepositoryManager
- Overrides:
getPathForLocalArtifact
in classSimpleLocalRepositoryManager
- Parameters:
artifact
- The artifact for which to determine the path, must not benull
.- Returns:
- The path, relative to the local repository's base directory.
-
getPathForRemoteArtifact
public java.lang.String getPathForRemoteArtifact(Artifact artifact, RemoteRepository repository, java.lang.String context)
Description copied from interface:LocalRepositoryManager
Gets the relative path for an artifact cached from a remote repository. Note that the artifact need not actually exist yet at the returned location, the path merely indicates where the artifact would eventually be stored. The path uses the forward slash as directory separator regardless of the underlying file system.- Specified by:
getPathForRemoteArtifact
in interfaceLocalRepositoryManager
- Overrides:
getPathForRemoteArtifact
in classSimpleLocalRepositoryManager
- Parameters:
artifact
- The artifact for which to determine the path, must not benull
.repository
- The source repository of the artifact, must not benull
.context
- The resolution context in which the artifact is being requested, may benull
.- Returns:
- The path, relative to the local repository's base directory.
-
getPathForLocalMetadata
public java.lang.String getPathForLocalMetadata(Metadata metadata)
Description copied from interface:LocalRepositoryManager
Gets the relative path for locally installed metadata. Note that the metadata need not actually exist yet at the returned location, the path merely indicates where the metadata would eventually be stored. The path uses the forward slash as directory separator regardless of the underlying file system.- Specified by:
getPathForLocalMetadata
in interfaceLocalRepositoryManager
- Overrides:
getPathForLocalMetadata
in classSimpleLocalRepositoryManager
- Parameters:
metadata
- The metadata for which to determine the path, must not benull
.- Returns:
- The path, relative to the local repository's base directory.
-
getPathForRemoteMetadata
public java.lang.String getPathForRemoteMetadata(Metadata metadata, RemoteRepository repository, java.lang.String context)
Description copied from interface:LocalRepositoryManager
Gets the relative path for metadata cached from a remote repository. Note that the metadata need not actually exist yet at the returned location, the path merely indicates where the metadata would eventually be stored. The path uses the forward slash as directory separator regardless of the underlying file system.- Specified by:
getPathForRemoteMetadata
in interfaceLocalRepositoryManager
- Overrides:
getPathForRemoteMetadata
in classSimpleLocalRepositoryManager
- Parameters:
metadata
- The metadata for which to determine the path, must not benull
.repository
- The source repository of the metadata, must not benull
.context
- The resolution context in which the metadata is being requested, may benull
.- Returns:
- The path, relative to the local repository's base directory.
-
find
public LocalArtifactResult find(RepositorySystemSession session, LocalArtifactRequest request)
Description copied from interface:LocalRepositoryManager
Queries for the existence of an artifact in the local repository. The request could be satisfied by a locally installed artifact or a previously downloaded artifact.- Specified by:
find
in interfaceLocalRepositoryManager
- Overrides:
find
in classSimpleLocalRepositoryManager
- Parameters:
session
- The repository system session during which the request is made, must not benull
.request
- The artifact request, must not benull
.- Returns:
- The result of the request, never
null
.
-
checkFind
private void checkFind(java.io.File file, LocalArtifactResult result)
-
add
public void add(RepositorySystemSession session, LocalArtifactRegistration request)
Description copied from interface:LocalRepositoryManager
Registers an installed or resolved artifact with the local repository. Note that artifact registration is merely concerned about updating the local repository's internal state, not about actually installing the artifact or its accompanying metadata.- Specified by:
add
in interfaceLocalRepositoryManager
- Overrides:
add
in classSimpleLocalRepositoryManager
- Parameters:
session
- The repository system session during which the registration is made, must not benull
.request
- The registration request, must not benull
.
-
getRepositoryKeys
private java.util.Collection<java.lang.String> getRepositoryKeys(RemoteRepository repository, java.util.Collection<java.lang.String> contexts)
-
addArtifact
private void addArtifact(Artifact artifact, java.util.Collection<java.lang.String> repositories, RemoteRepository repository, java.lang.String context)
-
readRepos
private java.util.Properties readRepos(java.io.File artifactFile)
-
addRepo
private void addRepo(java.io.File artifactFile, java.util.Collection<java.lang.String> repositories)
-
getTrackingFile
private java.io.File getTrackingFile(java.io.File artifactFile)
-
getKey
private java.lang.String getKey(java.io.File file, java.lang.String repository)
-
isTracked
private boolean isTracked(java.util.Properties props, java.io.File file)
-
-