Boolean copyArtifact( ArtifactTransferRequest artifactTransferRequest )
throws ArchivaRestServiceException;
+ @Path( "scheduleDownloadRemoteIndex" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_RUN_INDEXER )
+ Boolean scheduleDownloadRemoteIndex( @QueryParam( "repositoryId" ) String repositoryId,
+ @QueryParam( "now" ) boolean now,
+ @QueryParam( "fullDownload" ) boolean fullDownload )
+ throws ArchivaRestServiceException;
+
}
import org.apache.archiva.scheduler.ArchivaTaskScheduler;
import org.apache.archiva.scheduler.indexing.ArchivaIndexingTaskExecutor;
import org.apache.archiva.scheduler.indexing.ArtifactIndexingTask;
+import org.apache.archiva.scheduler.indexing.DownloadRemoteIndexException;
+import org.apache.archiva.scheduler.indexing.DownloadRemoteIndexScheduler;
import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
import org.apache.archiva.scheduler.repository.RepositoryTask;
import org.apache.archiva.security.common.ArchivaRoleConstants;
import javax.inject.Inject;
import javax.inject.Named;
-import javax.ws.rs.PathParam;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@Named( value = "archivaTaskScheduler#repository" )
private ArchivaTaskScheduler scheduler;
+ @Inject
+ private DownloadRemoteIndexScheduler downloadRemoteIndexScheduler;
+
private ChecksumAlgorithm[] algorithms = new ChecksumAlgorithm[]{ ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5 };
public Boolean scanRepository( String repositoryId, boolean fullScan )
}
}
+ public Boolean scheduleDownloadRemoteIndex( String repositoryId, boolean now, boolean fullDownload )
+ throws ArchivaRestServiceException
+ {
+ try
+ {
+ downloadRemoteIndexScheduler.scheduleDownloadRemote( repositoryId, now, fullDownload );
+ }
+ catch ( DownloadRemoteIndexException e )
+ {
+ log.error( e.getMessage(), e );
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
+ return Boolean.TRUE;
+ }
+
public Boolean copyArtifact( ArtifactTransferRequest artifactTransferRequest )
throws ArchivaRestServiceException
{