use of org.apache.archiva.scheduler.indexing.ArtifactIndexingTask in project archiva by apache.
the class NexusIndexerConsumer method processFile.
@Override
public void processFile(String path) throws ConsumerException {
Path artifactFile = managedRepository.resolve(path);
ArtifactIndexingTask task = new ArtifactIndexingTask(repository, artifactFile, ArtifactIndexingTask.Action.ADD, repository.getIndexingContext());
try {
log.debug("Queueing indexing task '{}' to add or update the artifact in the index.", task);
scheduler.queueTask(task);
} catch (TaskQueueException e) {
throw new ConsumerException(e.getMessage(), e);
}
}
use of org.apache.archiva.scheduler.indexing.ArtifactIndexingTask in project archiva by apache.
the class DefaultRepositoriesService method scanRepositoryNow.
@Override
public Boolean scanRepositoryNow(String repositoryId, boolean fullScan) throws ArchivaRestServiceException {
try {
org.apache.archiva.repository.ManagedRepository repository = repositoryRegistry.getManagedRepository(repositoryId);
ArtifactIndexingTask task = new ArtifactIndexingTask(repository, null, ArtifactIndexingTask.Action.FINISH, repository.getIndexingContext());
task.setExecuteOnEntireRepo(true);
task.setOnlyUpdate(!fullScan);
archivaIndexingTaskExecutor.executeTask(task);
scheduler.queueTask(new RepositoryTask(repositoryId, fullScan));
return Boolean.TRUE;
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new ArchivaRestServiceException(e.getMessage(), e);
}
}
use of org.apache.archiva.scheduler.indexing.ArtifactIndexingTask in project archiva by apache.
the class NexusIndexerConsumer method processFile.
@Override
public void processFile(String path, boolean executeOnEntireRepo) throws Exception {
if (executeOnEntireRepo) {
processFile(path);
} else {
Path artifactFile = managedRepository.resolve(path);
// specify in indexing task that this is not a repo scan request!
ArtifactIndexingTask task = new ArtifactIndexingTask(repository, artifactFile, ArtifactIndexingTask.Action.ADD, repository.getIndexingContext(), false);
// only update index we don't need to scan the full repo here
task.setOnlyUpdate(true);
try {
log.debug("Queueing indexing task '{}' to add or update the artifact in the index.", task);
scheduler.queueTask(task);
} catch (TaskQueueException e) {
throw new ConsumerException(e.getMessage(), e);
}
}
}
use of org.apache.archiva.scheduler.indexing.ArtifactIndexingTask in project archiva by apache.
the class NexusIndexerConsumer method completeScan.
@Override
public void completeScan() {
ArtifactIndexingTask task = new ArtifactIndexingTask(repository, null, ArtifactIndexingTask.Action.FINISH, repository.getIndexingContext());
try {
log.debug("Queueing indexing task '{}' to finish indexing.", task);
scheduler.queueTask(task);
} catch (TaskQueueException e) {
log.error("Error queueing task: {}: {}", task, e.getMessage(), e);
}
}
Aggregations