Class GroupIdRemoteRepositoryFilterSource

  • All Implemented Interfaces:
    RemoteRepositoryFilterSource, ArtifactResolverPostProcessor

    @Singleton
    @Named("groupId")
    public final class GroupIdRemoteRepositoryFilterSource
    extends RemoteRepositoryFilterSourceSupport
    implements ArtifactResolverPostProcessor
    Remote repository filter source filtering on G coordinate. It is backed by a file that lists all allowed groupIds and groupId not present in this file are filtered out.

    The file can be authored manually: format is one groupId per line, comments starting with "#" (hash) amd empty lines for structuring are supported. The file can also be pre-populated by "record" functionality of this filter. When "recording", this filter will not filter out anything, but will instead populate the file with all encountered groupIds.

    The groupId file is expected on path "${basedir}/groupId-${repository.id}.txt".

    The groupId file once loaded are cached in component, so in-flight groupId file change during component existence are NOT noticed.

    Since:
    1.9.0
    • Field Detail

      • CONF_NAME_RECORD

        private static final java.lang.String CONF_NAME_RECORD
        See Also:
        Constant Field Values
      • GROUP_ID_FILE_PREFIX

        static final java.lang.String GROUP_ID_FILE_PREFIX
        See Also:
        Constant Field Values
      • GROUP_ID_FILE_SUFFIX

        static final java.lang.String GROUP_ID_FILE_SUFFIX
        See Also:
        Constant Field Values
      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • rules

        private final java.util.concurrent.ConcurrentHashMap<java.nio.file.Path,​java.util.Set<java.lang.String>> rules
      • changedRules

        private final java.util.concurrent.ConcurrentHashMap<java.nio.file.Path,​java.lang.Boolean> changedRules
      • onShutdownHandlerRegistered

        private final java.util.concurrent.atomic.AtomicBoolean onShutdownHandlerRegistered
      • NOT_PRESENT

        private static final java.util.TreeSet<java.lang.String> NOT_PRESENT
    • Constructor Detail

      • GroupIdRemoteRepositoryFilterSource

        @Inject
        public GroupIdRemoteRepositoryFilterSource​(RepositorySystemLifecycle repositorySystemLifecycle)
    • Method Detail

      • filePath

        private java.nio.file.Path filePath​(java.nio.file.Path basedir,
                                            java.lang.String remoteRepositoryId)
        Returns the groupId path. The file and parents may not exist, this method merely calculate the path.
      • loadRepositoryRules

        private java.util.Set<java.lang.String> loadRepositoryRules​(java.nio.file.Path filePath)
      • isRecord

        private boolean isRecord​(RepositorySystemSession session)
        Returns true if given session is recording.
      • saveRecordedLines

        private void saveRecordedLines()
        On-close handler that saves recorded rules, if any.