if (repo.getType()==RepositoryType.MAVEN) { try { IndexingContext context = repo.getIndexingContext() != null ? repo.getIndexingContext().getBaseContext(IndexingContext.class) : null; if (context!=null && context.isSearchable()) { ids.add(remoteId);
@SuppressWarnings( "unchecked" ) private void updateRepositoryReferences( RepositoryProvider provider, RemoteRepository repo, RemoteRepositoryConfiguration cfg, Configuration configuration) throws RepositoryException { if ( repo instanceof EditableRemoteRepository && repo.getContent() == null) { EditableRemoteRepository editableRepo = (EditableRemoteRepository) repo; editableRepo.setContent( repositoryContentFactory.getRemoteRepositoryContent( repo ) ); if (repo.supportsFeature(IndexCreationFeature.class) && repo.getIndexingContext()==null ) { createIndexingContext(editableRepo); } } }
@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 ); } } }
if (this.remoteRepository.getIndexingContext()==null) { throw new IndexNotFoundException("No index context set for repository "+remoteRepository.getId()); IndexingContext indexingContext = this.remoteRepository.getIndexingContext().getBaseContext(IndexingContext.class);