Search in sources :

Example 1 with ArtifactIndexingTask

use of org.apache.archiva.scheduler.indexing.ArtifactIndexingTask 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 ArtifactIndexingTask

use of org.apache.archiva.scheduler.indexing.ArtifactIndexingTask in project archiva by apache.

the class DefaultRepositoriesService method scanRepositoryNow.

@Override
public Boolean scanRepositoryNow(String repositoryId, boolean fullScan) throws ArchivaRestServiceException {
    try {
        org.apache.archiva.repository.ManagedRepository repository = repositoryRegistry.getManagedRepository(repositoryId);
        ArtifactIndexingTask task = new ArtifactIndexingTask(repository, null, ArtifactIndexingTask.Action.FINISH, repository.getIndexingContext());
        task.setExecuteOnEntireRepo(true);
        task.setOnlyUpdate(!fullScan);
        archivaIndexingTaskExecutor.executeTask(task);
        scheduler.queueTask(new RepositoryTask(repositoryId, fullScan));
        return Boolean.TRUE;
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw new ArchivaRestServiceException(e.getMessage(), e);
    }
}
Also used : ArtifactIndexingTask(org.apache.archiva.scheduler.indexing.ArtifactIndexingTask) ArchivaRestServiceException(org.apache.archiva.rest.api.services.ArchivaRestServiceException) RepositoryTask(org.apache.archiva.scheduler.repository.model.RepositoryTask) ArchivaSecurityException(org.apache.archiva.security.ArchivaSecurityException) TaskQueueException(org.apache.archiva.redback.components.taskqueue.TaskQueueException) RepositoryScannerException(org.apache.archiva.repository.scanner.RepositoryScannerException) DownloadRemoteIndexException(org.apache.archiva.scheduler.indexing.DownloadRemoteIndexException) XMLException(org.apache.archiva.xml.XMLException) ArchivaRestServiceException(org.apache.archiva.rest.api.services.ArchivaRestServiceException) RepositoryAdminException(org.apache.archiva.admin.model.RepositoryAdminException) RepositoryException(org.apache.archiva.repository.RepositoryException) ContentNotFoundException(org.apache.archiva.repository.ContentNotFoundException) RepositoryNotFoundException(org.apache.archiva.repository.RepositoryNotFoundException) MetadataRepositoryException(org.apache.archiva.metadata.repository.MetadataRepositoryException) RepositoryMetadataException(org.apache.archiva.repository.metadata.RepositoryMetadataException) UserManagerException(org.apache.archiva.redback.users.UserManagerException) IOException(java.io.IOException) UserNotFoundException(org.apache.archiva.redback.users.UserNotFoundException) MetadataResolutionException(org.apache.archiva.metadata.repository.MetadataResolutionException) AuthorizationException(org.apache.archiva.redback.authorization.AuthorizationException)

Example 3 with ArtifactIndexingTask

use of org.apache.archiva.scheduler.indexing.ArtifactIndexingTask 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 4 with ArtifactIndexingTask

use of org.apache.archiva.scheduler.indexing.ArtifactIndexingTask 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)4 ArtifactIndexingTask (org.apache.archiva.scheduler.indexing.ArtifactIndexingTask)4 Path (java.nio.file.Path)2 ConsumerException (org.apache.archiva.consumers.ConsumerException)2 IOException (java.io.IOException)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 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 RepositoryScannerException (org.apache.archiva.repository.scanner.RepositoryScannerException)1 ArchivaRestServiceException (org.apache.archiva.rest.api.services.ArchivaRestServiceException)1 DownloadRemoteIndexException (org.apache.archiva.scheduler.indexing.DownloadRemoteIndexException)1 RepositoryTask (org.apache.archiva.scheduler.repository.model.RepositoryTask)1 ArchivaSecurityException (org.apache.archiva.security.ArchivaSecurityException)1