use of org.apache.archiva.components.taskqueue.TaskQueueException in project archiva by apache.
the class DefaultRepositoryProxyHandler method queueRepositoryTask.
private void queueRepositoryTask(String repositoryId, StorageAsset 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.getName());
}
}
use of org.apache.archiva.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);
}
}
use of org.apache.archiva.components.taskqueue.TaskQueueException in project archiva by apache.
the class DefaultRepositoriesService method queueRepositoryTask.
private void queueRepositoryTask(String repositoryId, StorageAsset 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.getName());
}
}
use of org.apache.archiva.components.taskqueue.TaskQueueException in project archiva by apache.
the class DefaultRepositoryTaskAdministration method scheduleIndexScan.
@Override
public void scheduleIndexScan(String repositoryId, String relativePath) throws RepositoryAdminException {
if (StringUtils.isEmpty(repositoryId)) {
throw RepositoryAdminException.ofKey("repository.id.invalid", "");
}
try {
org.apache.archiva.repository.ManagedRepository repository = repositoryRegistry.getManagedRepository(repositoryId);
if (repository == null) {
throw RepositoryAdminException.ofKey("repository.not_found", repositoryId);
}
StorageAsset asset = repository.getAsset(relativePath);
if (!asset.exists()) {
throw RepositoryAdminException.ofKey("repository.file.not_found", repositoryId, relativePath);
}
ArtifactIndexingTask task = new ArtifactIndexingTask(repository, asset.getFilePath(), ArtifactIndexingTask.Action.FINISH, repository.getIndexingContext());
task.setExecuteOnEntireRepo(false);
task.setOnlyUpdate(true);
indexingArchivaTaskScheduler.queueTask(task);
} catch (TaskQueueException e) {
log.error("Could not queue the task: {}", e.getMessage(), e);
throw RepositoryAdminException.ofKey("repository.scan.task_queue_error", e, e.getMessage());
}
}
use of org.apache.archiva.components.taskqueue.TaskQueueException in project archiva by apache.
the class DefaultRepositoryTaskAdministration method scheduleMetadataUpdateScan.
@Override
public void scheduleMetadataUpdateScan(String repositoryId) throws RepositoryAdminException {
if (StringUtils.isEmpty(repositoryId)) {
throw RepositoryAdminException.ofKey("repository.id.invalid", "");
}
try {
org.apache.archiva.repository.ManagedRepository repository = repositoryRegistry.getManagedRepository(repositoryId);
if (repository == null) {
throw RepositoryAdminException.ofKey("repository.not_found", repositoryId);
}
repositoryArchivaTaskScheduler.queueTask(new RepositoryTask(repositoryId, false));
} catch (TaskQueueException e) {
log.error("Could not queue the task: {}", e.getMessage(), e);
throw RepositoryAdminException.ofKey("repository.scan.task_queue_error", e, e.getMessage());
}
}
Aggregations