/** * Creates a new repository instance with the same settings as this one. The cloned repository is not * registered or saved to the configuration. * * @param repo The origin repository * @return The cloned repository. */ public RemoteRepository clone( RemoteRepository repo, String newId) throws RepositoryException { if (managedRepositories.containsKey(newId) || remoteRepositories.containsKey(newId)) { throw new RepositoryException("The given id exists already "+newId); } RepositoryProvider provider = getProvider(repo.getType()); RemoteRepositoryConfiguration cfg = provider.getRemoteConfiguration(repo); cfg.setId(newId); RemoteRepository cloned = provider.createRemoteInstance(cfg); cloned.addListener(this); return cloned; }
@Override public RemoteRepositoryContent createRemoteContent( RemoteRepository repository ) throws RepositoryException { if (!supports( repository.getType() )) { throw new RepositoryException( "Repository type "+repository.getType()+" is not supported by this implementation." ); } if (!supportsLayout( repository.getLayout() )) { throw new RepositoryException( "Repository layout "+repository.getLayout()+" is not supported by this implementation." ); } RemoteDefaultRepositoryContent content = new RemoteDefaultRepositoryContent(artifactMappingProviders); content.setRepository( repository ); return content; }
originRepo.close(); final RepositoryProvider provider = getProvider( remoteRepository.getType() ); newCfg = provider.getRemoteConfiguration( remoteRepository ); updateRepositoryReferences( provider, remoteRepository, newCfg, configuration );
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; }
if (repo.getType()==RepositoryType.MAVEN) { try { IndexingContext context = repo.getIndexingContext() != null ? repo.getIndexingContext().getBaseContext(IndexingContext.class) : null;
throw new IndexNotFoundException("No index context set for repository "+remoteRepository.getId()); if (this.remoteRepository.getType()!= RepositoryType.MAVEN) { throw new RepositoryException("Bad repository type");
cfg.setType(remoteRepository.getType().toString()); cfg.setId(remoteRepository.getId()); cfg.setName(remoteRepository.getName());