use of org.apache.archiva.components.taskqueue.TaskQueueException 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.components.taskqueue.TaskQueueException 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);
}
}
use of org.apache.archiva.components.taskqueue.TaskQueueException in project archiva by apache.
the class RepositoryTaskJob method execute.
/**
* Execute the discoverer and the indexer.
*
* @param context
* @throws org.quartz.JobExecutionException
*/
@SuppressWarnings("unchecked")
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
JobDataMap dataMap = context.getJobDetail().getJobDataMap();
setJobDataMap(dataMap);
TaskQueue taskQueue = (TaskQueue) dataMap.get(DefaultRepositoryArchivaTaskScheduler.TASK_QUEUE);
String repositoryId = (String) dataMap.get(DefaultRepositoryArchivaTaskScheduler.TASK_REPOSITORY);
RepositoryTask task = new RepositoryTask();
task.setRepositoryId(repositoryId);
try {
taskQueue.put(task);
} catch (TaskQueueException e) {
throw new JobExecutionException(e);
}
}
use of org.apache.archiva.components.taskqueue.TaskQueueException in project archiva by apache.
the class AbstractRestService method doScanRepository.
protected Boolean doScanRepository(String repositoryId, boolean fullScan) {
if (repositoryTaskScheduler.isProcessingRepositoryTask(repositoryId)) {
log.info("scanning of repository with id {} already scheduled", repositoryId);
return Boolean.FALSE;
}
RepositoryTask task = new RepositoryTask();
task.setRepositoryId(repositoryId);
task.setScanAll(fullScan);
try {
repositoryTaskScheduler.queueTask(task);
} catch (TaskQueueException e) {
log.error("failed to schedule scanning of repo with id {}", repositoryId, e);
return false;
}
return true;
}
use of org.apache.archiva.components.taskqueue.TaskQueueException in project archiva by apache.
the class DefaultRepositoryArchivaTaskScheduler method queueInitialRepoScan.
// MRM-848: Pre-configured repository initially appear to be empty
private synchronized void queueInitialRepoScan(ManagedRepositoryConfiguration repoConfig) {
String repoId = repoConfig.getId();
RepositoryTask task = new RepositoryTask();
task.setRepositoryId(repoId);
if (!queuedRepos.contains(repoId)) {
log.info("Repository [{}] is queued to be scanned as it hasn't been previously.", repoId);
try {
queuedRepos.add(repoConfig.getId());
this.queueTask(task);
} catch (TaskQueueException e) {
log.error("Error occurred while queueing repository [{}] task : {}", e.getMessage(), repoId);
}
}
}
Aggregations