@Override public String getId( ) { return repository.getId( ); }
public void removeRepository( RemoteRepository remoteRepository, Configuration configuration) throws RepositoryException { final String id = remoteRepository.getId(); RemoteRepository repo = getRemoteRepository( id ); if (repo!=null) { rwLock.writeLock().lock(); try { repo = remoteRepositories.remove( id ); if (repo!=null) { doRemoveRepo(repo, configuration); } } finally { rwLock.writeLock().unlock(); } } }
private void doRemoveRepo(RemoteRepository repo, Configuration configuration) { repo.close(); RemoteRepositoryConfiguration cfg = configuration.findRemoteRepositoryById(repo.getId()); if (cfg != null) { configuration.removeRemoteRepository(cfg); } List<ProxyConnectorConfiguration> proxyConnectors = new ArrayList<>(configuration.getProxyConnectors()); for (ProxyConnectorConfiguration proxyConnector : proxyConnectors) { if (StringUtils.equals(proxyConnector.getTargetRepoId(), repo.getId())) { configuration.removeProxyConnector(proxyConnector); } } }
public RemoteRepositoryContent getRemoteRepositoryContent( RemoteRepository mRepo ) throws RepositoryException { final String id = mRepo.getId(); RemoteRepositoryContent content = remoteContentMap.get( id ); if ( content != null && content.getRepository()==mRepo) { return content; } RepositoryContentProvider contentProvider = getProvider( mRepo.getLayout( ), mRepo.getType( ) ); content = contentProvider.createRemoteContent( mRepo ); if (content==null) { throw new RepositoryException( "Could not create repository content instance for "+mRepo.getId() ); } RemoteRepositoryContent previousContent = remoteContentMap.put( id, content ); if (previousContent!=null) { previousContent.setRepository( null ); } return content; }
content.getRepository().getId(), Keys.toKey( artifact ), exception.getMessage() ); log.debug( "Full stack trace", exception );
@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 ); } } }
targetRepository.getRepository().getId() ); targetRepository.getRepository().getId() ); targetRepository.getRepository().getId(), path, e.getMessage() ); log.debug( MarkerFactory.getDetachedMarker( "transfer.error" ), "Transfer error from repository \"{}" + "\" for resource {}, continuing to next repository. Error message: {}", targetRepository.getRepository().getId(), path, e.getMessage(), e ); targetRepository.getRepository().getId(), path, e.getMessage(), e ); log.debug( MarkerFactory.getDetachedMarker( "transfer.error" ), "Full stack trace", e );
try final String id = remoteRepository.getId(); if (managedRepositories.containsKey( id )) { throw new RepositoryException( "There exists a managed repository with id "+id+". Could not update with remote repository." );
if ( this.runningRemoteDownloadIds.contains( this.remoteRepository.getId() ) ) this.remoteRepository.getId() ); return; this.runningRemoteDownloadIds.add( this.remoteRepository.getId() ); try log.info( "start download remote index for remote repository {}", this.remoteRepository.getId() ); if (this.remoteRepository.getIndexingContext()==null) { throw new IndexNotFoundException("No index context set for repository "+remoteRepository.getId()); throw new RepositoryException("Repository does not support RemotIndexFeature "+remoteRepository.getId()); log.debug("Connection to {}, authInfo={}", this.remoteRepository.getId(), authenticationInfo); wagon.connect( new Repository( this.remoteRepository.getId(), baseIndexUrl ), authenticationInfo, proxyInfo ); log.debug("Update result success: {}", result.isSuccessful()); stopWatch.stop(); log.info( "time update index from remote for repository {}: {}ms", this.remoteRepository.getId(), ( stopWatch.getTime() ) ); this.runningRemoteDownloadIds.remove( this.remoteRepository.getId() ); log.info( "end download remote index for remote repository {}", this.remoteRepository.getId() );
final NetworkProxy networkProxy = this.networkProxyMap.get( remoteRepository.getId() );
private void resolve( ResolveRequest resolveRequest ) { RepositorySystem system = mavenSystemManager.getRepositorySystem(); RepositorySystemSession session = MavenSystemManager.newRepositorySystemSession( resolveRequest.localRepoDir ); org.eclipse.aether.artifact.Artifact artifact = new DefaultArtifact( resolveRequest.groupId + ":" + resolveRequest.artifactId + ":" + resolveRequest.version ); CollectRequest collectRequest = new CollectRequest(); collectRequest.setRoot( new Dependency( artifact, "" ) ); // add remote repositories for ( RemoteRepository remoteRepository : resolveRequest.remoteRepositories ) { org.eclipse.aether.repository.RemoteRepository repo = new org.eclipse.aether.repository.RemoteRepository.Builder( remoteRepository.getId( ), "default", remoteRepository.getLocation( ).toString() ).build( ); collectRequest.addRepository(repo); } collectRequest.setRequestContext( "project" ); //collectRequest.addRepository( repo ); try { CollectResult collectResult = system.collectDependencies( session, collectRequest ); collectResult.getRoot().accept( resolveRequest.dependencyVisitor ); log.debug("Collected dependency results for resolve"); } catch ( DependencyCollectionException e ) { log.error( "Error while collecting dependencies (resolve): {}", e.getMessage(), e ); } }
cfg.setId(remoteRepository.getId()); cfg.setName(remoteRepository.getName()); cfg.setDescription(remoteRepository.getDescription());
@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; }