public void scheduleDownloadRemote( String repositoryId, boolean now, boolean fullDownload )
throws DownloadRemoteIndexException
{
try
{
RemoteRepository remoteRepository = remoteRepositoryAdmin.getRemoteRepository( repositoryId );
if ( remoteRepository == null )
{
log.warn( "ignore scheduleDownloadRemote for repo with id {} as not exists", repositoryId );
return;
}
NetworkProxy networkProxy = null;
if ( StringUtils.isNotBlank( remoteRepository.getRemoteDownloadNetworkProxyId( ) ) )
{
networkProxy = networkProxyAdmin.getNetworkProxy( remoteRepository.getRemoteDownloadNetworkProxyId( ) );
if ( networkProxy == null )
{
log.warn(
"your remote repository is configured to download remote index trought a proxy we cannot find id:{}",
remoteRepository.getRemoteDownloadNetworkProxyId( ) );
}
}
DownloadRemoteIndexTaskRequest downloadRemoteIndexTaskRequest =
new DownloadRemoteIndexTaskRequest( ).setRemoteRepository( remoteRepository ).setNetworkProxy(
networkProxy ).setFullDownload( fullDownload ).setWagonFactory( wagonFactory ).setNexusIndexer(
nexusIndexer ).setIndexUpdater( indexUpdater );
if ( now )
{
log.info( "schedule download remote index for repository {}", remoteRepository.getId( ) );
// do it in async
taskScheduler.schedule(
new DownloadRemoteIndexTask( downloadRemoteIndexTaskRequest, this.runningRemoteDownloadIds ),
new Date( ) );
}
else
{
log.info( "schedule download remote index for repository {} with cron expression {}",
remoteRepository.getId( ), remoteRepository.getCronExpression( ) );
taskScheduler.schedule(
new DownloadRemoteIndexTask( downloadRemoteIndexTaskRequest, this.runningRemoteDownloadIds ),
new CronTrigger( remoteRepository.getCronExpression( ) ) );
}
}
catch ( RepositoryAdminException e )
{