@PostConstruct public void startup() throws DownloadRemoteIndexException, UnsupportedBaseContextException { archivaConfiguration.addListener( this ); // TODO add indexContexts even if null for ( org.apache.archiva.repository.RemoteRepository remoteRepository : repositoryRegistry.getRemoteRepositories() ) { String contextKey = "remote-" + remoteRepository.getId(); IndexingContext context = remoteRepository.getIndexingContext().getBaseContext(IndexingContext.class); if ( context == null ) { continue; } RemoteIndexFeature rif = remoteRepository.getFeature(RemoteIndexFeature.class).get(); // TODO record jobs from configuration if ( rif.isDownloadRemoteIndex() && StringUtils.isNotEmpty( remoteRepository.getSchedulingDefinition() ) ) { boolean fullDownload = context.getIndexDirectoryFile().list().length == 0; scheduleDownloadRemote( remoteRepository.getId(), false, fullDownload ); } } }
remoteRepo.getId(), remoteRepo.getSchedulingDefinition()); try CronTrigger cronTrigger = new CronTrigger( remoteRepo.getSchedulingDefinition()); taskScheduler.schedule( new DownloadRemoteIndexTask( downloadRemoteIndexTaskRequest, this.runningRemoteDownloadIds ),
cfg.setExtraParameters(remoteRepository.getExtraParameters()); cfg.setExtraHeaders(remoteRepository.getExtraHeaders()); cfg.setRefreshCronExpression(remoteRepository.getSchedulingDefinition());
@Override public RemoteRepositoryConfiguration getRemoteConfiguration( RemoteRepository remoteRepository ) { RemoteRepositoryConfiguration configuration = new RemoteRepositoryConfiguration( ); configuration.setId( remoteRepository.getId( ) ); configuration.setName( remoteRepository.getName( ) ); configuration.setDescription( remoteRepository.getDescription( ) ); configuration.setLayout( remoteRepository.getLayout( ) ); configuration.setRefreshCronExpression( remoteRepository.getSchedulingDefinition( ) ); configuration.setCheckPath( remoteRepository.getCheckPath( ) ); configuration.setExtraHeaders( remoteRepository.getExtraHeaders( ) ); configuration.setExtraParameters( remoteRepository.getExtraParameters( ) ); configuration.setTimeout( (int) remoteRepository.getTimeout( ).getSeconds( ) ); RepositoryCredentials creds = remoteRepository.getLoginCredentials( ); if (creds!=null) { PasswordCredentials pwdCreds = (PasswordCredentials) creds; configuration.setUsername( pwdCreds.getUsername( ) ); configuration.setPassword( new String( pwdCreds.getPassword( ) ) ); } configuration.setUrl( remoteRepository.getLocation( ) == null ? "" : remoteRepository.getLocation().toString( ) ); RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( ); configuration.setDownloadRemoteIndex( rif.isDownloadRemoteIndex( ) ); configuration.setDownloadRemoteIndexOnStartup( rif.isDownloadRemoteIndexOnStartup( ) ); configuration.setIndexDir( rif.getIndexUri( )==null ? "" : rif.getIndexUri().toString( ) ); configuration.setRemoteDownloadNetworkProxyId( rif.getProxyId( ) ); return configuration; }