Search in sources :

Example 1 with TaskQueueException

use of org.apache.archiva.redback.components.taskqueue.TaskQueueException 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);
    }
}
Also used : Path(java.nio.file.Path) ArtifactIndexingTask(org.apache.archiva.scheduler.indexing.ArtifactIndexingTask) ConsumerException(org.apache.archiva.consumers.ConsumerException) TaskQueueException(org.apache.archiva.redback.components.taskqueue.TaskQueueException)

Example 2 with TaskQueueException

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

the class DefaultRepositoryProxyConnectors method queueRepositoryTask.

private void queueRepositoryTask(String repositoryId, Path localFile) {
    RepositoryTask task = new RepositoryTask();
    task.setRepositoryId(repositoryId);
    task.setResourceFile(localFile);
    task.setUpdateRelatedArtifacts(true);
    task.setScanAll(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 3 with TaskQueueException

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

the class ArchivaDavResource method queueRepositoryTask.

private void queueRepositoryTask(Path localFile) {
    RepositoryTask task = new RepositoryTask();
    task.setRepositoryId(repository.getId());
    task.setResourceFile(localFile);
    task.setUpdateRelatedArtifacts(false);
    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 4 with TaskQueueException

use of org.apache.archiva.redback.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);
        }
    }
}
Also used : Path(java.nio.file.Path) ArtifactIndexingTask(org.apache.archiva.scheduler.indexing.ArtifactIndexingTask) ConsumerException(org.apache.archiva.consumers.ConsumerException) TaskQueueException(org.apache.archiva.redback.components.taskqueue.TaskQueueException)

Example 5 with TaskQueueException

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