Class RemoteRepositoryLoadingHelper

  • All Implemented Interfaces:
    IRepositoryIdManager

    class RemoteRepositoryLoadingHelper
    extends java.lang.Object
    implements IRepositoryIdManager
    Helper class for the Remote*RepositoryManagers taking care of mapping repository URLs to the settings.xml-configured mirrors and setting passwords.
    • Field Detail

      • knownMavenRepositoryIds

        private java.util.Map<java.net.URI,​java.lang.String> knownMavenRepositoryIds
    • Method Detail

      • addMapping

        public void addMapping​(java.lang.String mavenRepositoryId,
                               java.net.URI location)
        Specified by:
        addMapping in interface IRepositoryIdManager
      • normalize

        private static java.net.URI normalize​(java.net.URI location)
      • getEffectiveLocation

        public java.net.URI getEffectiveLocation​(java.net.URI location)
      • getEffectiveLocationAndPrepareLoad

        public java.net.URI getEffectiveLocationAndPrepareLoad​(java.net.URI location)
                                                        throws org.eclipse.equinox.p2.core.ProvisionException
        Throws:
        org.eclipse.equinox.p2.core.ProvisionException
      • effectiveLocationFor

        private MavenRepositoryLocation effectiveLocationFor​(java.net.URI location,
                                                             boolean forLoading)
      • setPasswordForLoading

        private void setPasswordForLoading​(MavenRepositoryLocation location)
                                    throws org.eclipse.equinox.p2.core.ProvisionException
        Sets passwords configured in the Maven settings in p2.

        Warning: This method heavily relies on side-effects. Instead of remembering the credentials just for the given location, p2 associates the password with the host. This allows to load children of a composite repository with the same credentials as the parent, without having to specify all children in the Maven settings. This feature can easily break if repositories are loaded in parallel. If this shall be supported, a lock is needed here (TODO).

        Throws:
        org.eclipse.equinox.p2.core.ProvisionException
      • certainlyNoRemoteURL

        private static boolean certainlyNoRemoteURL​(java.net.URI location)