Search in sources :

Example 6 with TaskQueueException

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

the class DefaultFileUploadService method queueRepositoryTask.

private void queueRepositoryTask(String repositoryId, Path localFile) {
    RepositoryTask task = new RepositoryTask();
    task.setRepositoryId(repositoryId);
    task.setResourceFile(localFile);
    task.setUpdateRelatedArtifacts(true);
    task.setScanAll(false);
    try {
        scheduler.queueTask(task);
    } catch (TaskQueueException e) {
        log.error("Unable to queue repository task to execute consumers on resource file ['{}" + "'].", localFile.getFileName());
    }
}
Also used : RepositoryTask(org.apache.archiva.scheduler.repository.model.RepositoryTask) TaskQueueException(org.apache.archiva.redback.components.taskqueue.TaskQueueException)

Example 7 with TaskQueueException

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

the class DefaultRepositoriesService method removeScanningTaskFromQueue.

@Override
public Boolean removeScanningTaskFromQueue(String repositoryId) {
    RepositoryTask task = new RepositoryTask();
    task.setRepositoryId(repositoryId);
    try {
        return repositoryTaskScheduler.unQueueTask(task);
    } catch (TaskQueueException e) {
        log.error("failed to unschedule scanning of repo with id {}", repositoryId, e);
        return false;
    }
}
Also used : RepositoryTask(org.apache.archiva.scheduler.repository.model.RepositoryTask) TaskQueueException(org.apache.archiva.redback.components.taskqueue.TaskQueueException)

Example 8 with TaskQueueException

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

the class DefaultRepositoriesService method queueRepositoryTask.

private void queueRepositoryTask(String repositoryId, Path localFile) {
    RepositoryTask task = new RepositoryTask();
    task.setRepositoryId(repositoryId);
    task.setResourceFile(localFile);
    task.setUpdateRelatedArtifacts(true);
    try {
        scheduler.queueTask(task);
    } catch (TaskQueueException e) {
        log.error("Unable to queue repository task to execute consumers on resource file ['{}" + "'].", localFile.getFileName());
    }
}
Also used : RepositoryTask(org.apache.archiva.scheduler.repository.model.RepositoryTask) TaskQueueException(org.apache.archiva.redback.components.taskqueue.TaskQueueException)

Example 9 with TaskQueueException

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

Example 10 with TaskQueueException

use of org.apache.archiva.redback.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);
        }
    }
}
Also used : 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