@Singleton @Named(value="groupId") public final class GroupIdRemoteRepositoryFilterSource extends RemoteRepositoryFilterSourceSupport implements ArtifactResolverPostProcessor
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.
Modifier and Type | Class and Description |
---|---|
private class |
GroupIdRemoteRepositoryFilterSource.GroupIdFilter |
RemoteRepositoryFilterSourceSupport.SimpleResult
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.ConcurrentHashMap<java.nio.file.Path,java.lang.Boolean> |
changedRules |
private static java.lang.String |
CONF_NAME_RECORD |
(package private) static java.lang.String |
GROUP_ID_FILE_PREFIX |
(package private) static java.lang.String |
GROUP_ID_FILE_SUFFIX |
private static org.slf4j.Logger |
LOGGER |
static java.lang.String |
NAME |
private static java.util.TreeSet<java.lang.String> |
NOT_PRESENT |
private static RemoteRepositoryFilter.Result |
NOT_PRESENT_RESULT |
private java.util.concurrent.atomic.AtomicBoolean |
onShutdownHandlerRegistered |
private RepositorySystemLifecycle |
repositorySystemLifecycle |
private java.util.concurrent.ConcurrentHashMap<java.nio.file.Path,java.util.Set<java.lang.String>> |
rules |
LOCAL_REPO_PREFIX_DIR
Constructor and Description |
---|
GroupIdRemoteRepositoryFilterSource(RepositorySystemLifecycle repositorySystemLifecycle) |
Modifier and Type | Method and Description |
---|---|
private java.util.Set<java.lang.String> |
cacheRules(RepositorySystemSession session,
RemoteRepository remoteRepository) |
private java.nio.file.Path |
filePath(java.nio.file.Path basedir,
java.lang.String remoteRepositoryId)
Returns the groupId path.
|
RemoteRepositoryFilter |
getRemoteRepositoryFilter(RepositorySystemSession session)
Provides the filter instance for given session, or
null if this instance wants to abstain from
participating in filtering. |
private boolean |
isRecord(RepositorySystemSession session)
Returns
true if given session is recording. |
private java.util.Set<java.lang.String> |
loadRepositoryRules(java.nio.file.Path filePath) |
void |
postProcess(RepositorySystemSession session,
java.util.List<ArtifactResult> artifactResults)
Receives resolver results just before it would return it to caller.
|
private void |
saveRecordedLines()
On-close handler that saves recorded rules, if any.
|
configPropKey, getBasedir, isEnabled
public static final java.lang.String NAME
private static final java.lang.String CONF_NAME_RECORD
static final java.lang.String GROUP_ID_FILE_PREFIX
static final java.lang.String GROUP_ID_FILE_SUFFIX
private static final org.slf4j.Logger LOGGER
private final RepositorySystemLifecycle repositorySystemLifecycle
private final java.util.concurrent.ConcurrentHashMap<java.nio.file.Path,java.util.Set<java.lang.String>> rules
private final java.util.concurrent.ConcurrentHashMap<java.nio.file.Path,java.lang.Boolean> changedRules
private final java.util.concurrent.atomic.AtomicBoolean onShutdownHandlerRegistered
private static final java.util.TreeSet<java.lang.String> NOT_PRESENT
private static final RemoteRepositoryFilter.Result NOT_PRESENT_RESULT
@Inject public GroupIdRemoteRepositoryFilterSource(RepositorySystemLifecycle repositorySystemLifecycle)
public RemoteRepositoryFilter getRemoteRepositoryFilter(RepositorySystemSession session)
RemoteRepositoryFilterSource
null
if this instance wants to abstain from
participating in filtering.getRemoteRepositoryFilter
in interface RemoteRepositoryFilterSource
null
.public void postProcess(RepositorySystemSession session, java.util.List<ArtifactResult> artifactResults)
ArtifactResolverPostProcessor
ArtifactResult
s (artifacts should be "unresolved" and exceptions added).
Implementations must be aware that the passed in list of ArtifactResult
s may have failed resolutions,
best to check that using ArtifactResult.isResolved()
method.
The implementations must be aware that this call may be "hot", so it directly affects the performance of resolver in general.
postProcess
in interface ArtifactResolverPostProcessor
private java.nio.file.Path filePath(java.nio.file.Path basedir, java.lang.String remoteRepositoryId)
private java.util.Set<java.lang.String> cacheRules(RepositorySystemSession session, RemoteRepository remoteRepository)
private java.util.Set<java.lang.String> loadRepositoryRules(java.nio.file.Path filePath)
private boolean isRecord(RepositorySystemSession session)
true
if given session is recording.private void saveRecordedLines()