Search in sources :

Example 6 with RepositoryTask

use of org.apache.archiva.scheduler.repository.model.RepositoryTask 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 RepositoryTask

use of org.apache.archiva.scheduler.repository.model.RepositoryTask 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 RepositoryTask

use of org.apache.archiva.scheduler.repository.model.RepositoryTask 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 RepositoryTask

use of org.apache.archiva.scheduler.repository.model.RepositoryTask 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 RepositoryTask

use of org.apache.archiva.scheduler.repository.model.RepositoryTask 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

RepositoryTask (org.apache.archiva.scheduler.repository.model.RepositoryTask)15 TaskQueueException (org.apache.archiva.redback.components.taskqueue.TaskQueueException)10 ArtifactReference (org.apache.archiva.model.ArtifactReference)5 Test (org.junit.Test)5 Path (java.nio.file.Path)3 DefaultRepositoryStatistics (org.apache.archiva.metadata.repository.stats.model.DefaultRepositoryStatistics)3 RepositoryStatistics (org.apache.archiva.metadata.repository.stats.model.RepositoryStatistics)3 IOException (java.io.IOException)1 Date (java.util.Date)1 RepositoryAdminException (org.apache.archiva.admin.model.RepositoryAdminException)1 MetadataRepositoryException (org.apache.archiva.metadata.repository.MetadataRepositoryException)1 MetadataResolutionException (org.apache.archiva.metadata.repository.MetadataResolutionException)1 AuthorizationException (org.apache.archiva.redback.authorization.AuthorizationException)1 TaskQueue (org.apache.archiva.redback.components.taskqueue.TaskQueue)1 UserManagerException (org.apache.archiva.redback.users.UserManagerException)1 UserNotFoundException (org.apache.archiva.redback.users.UserNotFoundException)1 ContentNotFoundException (org.apache.archiva.repository.ContentNotFoundException)1 RepositoryException (org.apache.archiva.repository.RepositoryException)1 RepositoryNotFoundException (org.apache.archiva.repository.RepositoryNotFoundException)1 RepositoryMetadataException (org.apache.archiva.repository.metadata.RepositoryMetadataException)1