private RemoteRepository createNewRemoteRepository( RepositoryProvider provider, RemoteRepositoryConfiguration cfg ) throws RepositoryException { log.debug("Creating remote repo {}", cfg.getId()); RemoteRepository repo = provider.createRemoteInstance( cfg ); repo.addListener(this); updateRepositoryReferences( provider, repo, cfg , null); return repo; }
/** * 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; }
repo = getProvider( repoType ).createRemoteInstance( remoteRepositoryConfiguration ); repo.addListener(this); remoteRepositories.put(id, repo);