Class 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 Detail

      • trackingFilename

        private final java.lang.String trackingFilename
    • 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 interface LocalRepositoryManager
        Overrides:
        getPathForLocalArtifact in class SimpleLocalRepositoryManager
        Parameters:
        artifact - The artifact for which to determine the path, must not be null.
        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 interface LocalRepositoryManager
        Overrides:
        getPathForRemoteArtifact in class SimpleLocalRepositoryManager
        Parameters:
        artifact - The artifact for which to determine the path, must not be null.
        repository - The source repository of the artifact, must not be null.
        context - The resolution context in which the artifact is being requested, may be null.
        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 interface LocalRepositoryManager
        Overrides:
        getPathForLocalMetadata in class SimpleLocalRepositoryManager
        Parameters:
        metadata - The metadata for which to determine the path, must not be null.
        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 interface LocalRepositoryManager
        Overrides:
        getPathForRemoteMetadata in class SimpleLocalRepositoryManager
        Parameters:
        metadata - The metadata for which to determine the path, must not be null.
        repository - The source repository of the metadata, must not be null.
        context - The resolution context in which the metadata is being requested, may be null.
        Returns:
        The path, relative to the local repository's base directory.
      • 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 interface LocalRepositoryManager
        Overrides:
        add in class SimpleLocalRepositoryManager
        Parameters:
        session - The repository system session during which the registration is made, must not be null.
        request - The registration request, must not be null.
      • 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)