Search in sources :

Example 11 with TaskQueueException

use of org.apache.archiva.redback.components.taskqueue.TaskQueueException in project archiva by apache.

the class DefaultManagedRepositoryAdmin method scanRepository.

public Boolean scanRepository(String repositoryId, boolean fullScan) {
    if (getRepositoryTaskScheduler().isProcessingRepositoryTask(repositoryId)) {
        log.info("scanning of repository with id {} already scheduled", repositoryId);
    }
    RepositoryTask task = new RepositoryTask();
    task.setRepositoryId(repositoryId);
    task.setScanAll(fullScan);
    try {
        getRepositoryTaskScheduler().queueTask(task);
    } catch (TaskQueueException e) {
        log.error("failed to schedule scanning of repo with id {}", repositoryId, e);
        return false;
    }
    return true;
}
Also used : RepositoryTask(org.apache.archiva.scheduler.repository.model.RepositoryTask) TaskQueueException(org.apache.archiva.redback.components.taskqueue.TaskQueueException)

Example 12 with TaskQueueException

use of org.apache.archiva.redback.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
 */
@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);
    }
}
Also used : JobDataMap(org.quartz.JobDataMap) JobExecutionException(org.quartz.JobExecutionException) TaskQueue(org.apache.archiva.redback.components.taskqueue.TaskQueue) RepositoryTask(org.apache.archiva.scheduler.repository.model.RepositoryTask) TaskQueueException(org.apache.archiva.redback.components.taskqueue.TaskQueueException)

Aggregations

TaskQueueException (org.apache.archiva.redback.components.taskqueue.TaskQueueException)12 RepositoryTask (org.apache.archiva.scheduler.repository.model.RepositoryTask)9 ArtifactIndexingTask (org.apache.archiva.scheduler.indexing.ArtifactIndexingTask)3 Path (java.nio.file.Path)2 ConsumerException (org.apache.archiva.consumers.ConsumerException)2 TaskQueue (org.apache.archiva.redback.components.taskqueue.TaskQueue)1 JobDataMap (org.quartz.JobDataMap)1 JobExecutionException (org.quartz.JobExecutionException)1