@Service(value="knownRepositoryContentConsumer#index-content") @Scope(value="prototype") public class NexusIndexerConsumer extends AbstractMonitoredConsumer implements KnownRepositoryContentConsumer, org.apache.archiva.redback.components.registry.RegistryListener
Modifier and Type | Field and Description |
---|---|
private List<? extends org.apache.maven.index.context.IndexCreator> |
allIndexCreators |
private ArchivaConfiguration |
configuration |
private FileTypes |
filetypes |
private List<String> |
includes |
private org.apache.maven.index.context.IndexingContext |
indexingContext |
private org.slf4j.Logger |
log |
private File |
managedRepository |
private ManagedRepositoryAdmin |
managedRepositoryAdmin |
private org.apache.maven.index.NexusIndexer |
nexusIndexer |
private ManagedRepository |
repository |
private ArchivaTaskScheduler<ArtifactIndexingTask> |
scheduler |
Constructor and Description |
---|
NexusIndexerConsumer(ArchivaTaskScheduler<ArtifactIndexingTask> scheduler,
ArchivaConfiguration configuration,
FileTypes filetypes,
PlexusSisuBridge plexusSisuBridge,
MavenIndexerUtils mavenIndexerUtils,
ManagedRepositoryAdmin managedRepositoryAdmin) |
Modifier and Type | Method and Description |
---|---|
void |
afterConfigurationChange(org.apache.archiva.redback.components.registry.Registry registry,
String propertyName,
Object propertyValue) |
void |
beforeConfigurationChange(org.apache.archiva.redback.components.registry.Registry registry,
String propertyName,
Object propertyValue) |
void |
beginScan(ManagedRepository repository,
Date whenGathered)
Event that triggers at the beginning of a scan.
|
void |
beginScan(ManagedRepository repository,
Date whenGathered,
boolean executeOnEntireRepo)
Event that triggers at the beginning of a scan, where you can also indicate whether the consumers will be
executed on an entire repository or on a specific resource.
|
void |
completeScan()
Event that triggers on the completion of a scan.
|
void |
completeScan(boolean executeOnEntireRepo) |
String |
getDescription()
The human readable description for this consumer.
|
List<String> |
getExcludes()
Get the list of excluded file patterns for this consumer.
|
String |
getId()
This is the id for the consumer.
|
List<String> |
getIncludes()
Get the list of included file patterns for this consumer.
|
private org.apache.maven.index.context.IndexingContext |
getIndexingContext() |
void |
initialize() |
private void |
initIncludes() |
void |
processFile(String path)
Event indicating a file is to be processed by this consumer.
|
void |
processFile(String path,
boolean executeOnEntireRepo) |
addConsumerMonitor, getDefaultArtifactExclusions, isProcessUnmodified, removeConsumerMonitor, triggerConsumerError, triggerConsumerInfo, triggerConsumerWarning
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isProcessUnmodified
addConsumerMonitor, removeConsumerMonitor
private org.slf4j.Logger log
private ArchivaConfiguration configuration
private File managedRepository
private ArchivaTaskScheduler<ArtifactIndexingTask> scheduler
private org.apache.maven.index.context.IndexingContext indexingContext
private org.apache.maven.index.NexusIndexer nexusIndexer
private ManagedRepository repository
private List<? extends org.apache.maven.index.context.IndexCreator> allIndexCreators
private ManagedRepositoryAdmin managedRepositoryAdmin
@Inject public NexusIndexerConsumer(@Named(value="archivaTaskScheduler#indexing") ArchivaTaskScheduler<ArtifactIndexingTask> scheduler, @Named(value="archivaConfiguration") ArchivaConfiguration configuration, FileTypes filetypes, PlexusSisuBridge plexusSisuBridge, MavenIndexerUtils mavenIndexerUtils, ManagedRepositoryAdmin managedRepositoryAdmin) throws PlexusSisuBridgeException
PlexusSisuBridgeException
public String getDescription()
Consumer
getDescription
in interface Consumer
public String getId()
Consumer
public void beginScan(ManagedRepository repository, Date whenGathered) throws ConsumerException
RepositoryContentConsumer
Event that triggers at the beginning of a scan.
NOTE: This would be a good place to initialize the consumer, to lock any resources, and to generally start tracking the scan as a whole.
beginScan
in interface RepositoryContentConsumer
repository
- the repository that this consumer is being used for.whenGathered
- the start of the repository scanConsumerException
- if there was a problem with using the provided repository with the consumer.public void beginScan(ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo) throws ConsumerException
RepositoryContentConsumer
Event that triggers at the beginning of a scan, where you can also indicate whether the consumers will be executed on an entire repository or on a specific resource.
beginScan
in interface RepositoryContentConsumer
repository
- the repository that this consumer is being used for.whenGathered
- the start of the repository scanexecuteOnEntireRepo
- flags whether the consumer will be executed on an entire repository or just on a specific resourceConsumerException
- if there was a problem with using the provided repository with the consumer.RepositoryContentConsumer.beginScan(ManagedRepository, java.util.Date)
public void processFile(String path) throws ConsumerException
RepositoryContentConsumer
Event indicating a file is to be processed by this consumer.
NOTE: The consumer does not need to process the file immediately, can can opt to queue and/or track
the files to be processed in batch. Just be sure to complete the processing by the RepositoryContentConsumer.completeScan()
event.
processFile
in interface RepositoryContentConsumer
path
- the relative file path (in the repository) to process.ConsumerException
- if there was a problem processing this file.public void processFile(String path, boolean executeOnEntireRepo) throws Exception
processFile
in interface RepositoryContentConsumer
path
- the relative file path (in the repository) to process.executeOnEntireRepo
- flags whether the consumer will be executed on an entire repository or just on a specific resourceException
- if there was a problem processing this file.public void completeScan()
RepositoryContentConsumer
Event that triggers on the completion of a scan.
NOTE: If the consumer opted to batch up processing requests in the RepositoryContentConsumer.processFile(String)
event
this would be the last opportunity to drain any processing queue's.
completeScan
in interface RepositoryContentConsumer
public void completeScan(boolean executeOnEntireRepo)
completeScan
in interface RepositoryContentConsumer
executeOnEntireRepo
- flags whether the consumer will be executed on an entire repository or just on a specific resourcepublic List<String> getExcludes()
RepositoryContentConsumer
getExcludes
in interface RepositoryContentConsumer
String
patterns. (example: "**/*.pom"
) - (can be null for no exclusions)public void afterConfigurationChange(org.apache.archiva.redback.components.registry.Registry registry, String propertyName, Object propertyValue)
afterConfigurationChange
in interface org.apache.archiva.redback.components.registry.RegistryListener
public void beforeConfigurationChange(org.apache.archiva.redback.components.registry.Registry registry, String propertyName, Object propertyValue)
beforeConfigurationChange
in interface org.apache.archiva.redback.components.registry.RegistryListener
private void initIncludes()
@PostConstruct public void initialize()
public List<String> getIncludes()
RepositoryContentConsumer
getIncludes
in interface RepositoryContentConsumer
String
patterns. (example: "**/*.pom"
)private org.apache.maven.index.context.IndexingContext getIndexingContext() throws ConsumerException
ConsumerException
Copyright © 2006–2022 The Apache Software Foundation. All rights reserved.