@Override public void doApplyConfiguration( final Repository repository, final ApplicationConfiguration configuration, final CRepositoryCoreConfiguration coreConfig) throws ConfigurationException { repository.setIndexable(false); super.doApplyConfiguration(repository, configuration, coreConfig); final CRemoteStorage remoteStorage = coreConfig.getConfiguration(true).getRemoteStorage(); if (remoteStorage != null) { // // FIXME: on the fly upgrade, if needed // // it will trigger if detects that nexus.xml contains remoteUrl _with_ OBR XML file // String[] siteAndPath = ObrUtils.splitObrSiteAndPath( remoteStorage.getUrl(), false ); // // if ( siteAndPath[1] != null ) // { // // upgrade needed! // ( (ObrProxyRepository) repository ).setObrPath( siteAndPath[1] ); // // // write back the stripped URL // remoteStorage.setUrl( siteAndPath[0] ); // } // FIXME: this should happen in this super's class: AbstractProxyRepositoryConfigurator try { ((ObrProxyRepository) repository).setRemoteUrl(remoteStorage.getUrl()); } catch (final StorageException e) { throw new ConfigurationException( "Cannot configure OBR Proxy Repository! " + remoteStorage.getUrl(), e); } } }
public synchronized void deleteRepository(String id) throws NoSuchRepositoryException, IOException, ConfigurationException { Repository repository = repositoryRegistry.getRepository(id); // put out of service so wont be accessed any longer repository.setLocalStatus(LocalStatus.OUT_OF_SERVICE); // disable indexing for same purpose repository.setIndexable(false); repository.setSearchable(false); // remove dependants too // ======= // shadows // (fail if any repo references the currently processing one) List<ShadowRepository> shadows = repositoryRegistry.getRepositoriesWithFacet(ShadowRepository.class); for (Iterator<ShadowRepository> i = shadows.iterator(); i.hasNext(); ) { ShadowRepository shadow = i.next(); if (repository.getId().equals(shadow.getMasterRepository().getId())) { throw new RepositoryDependentException(repository, shadow); } } // ====== // groups // (correction in config only, registry DOES handle it) // since NEXUS-1770, groups are "self maintaining" // =========== // pahMappings // (correction, since registry is completely unaware of this component) List<CPathMappingItem> pathMappings = getConfigurationModel().getRepositoryGrouping().getPathMappings(); for (Iterator<CPathMappingItem> i = pathMappings.iterator(); i.hasNext(); ) { CPathMappingItem item = i.next(); item.removeRepository(id); } // =========== // and finally // this cleans it properly from the registry (from reposes and repo groups) repositoryRegistry.removeRepository(id); List<CRepository> reposes = getConfigurationModel().getRepositories(); for (Iterator<CRepository> i = reposes.iterator(); i.hasNext(); ) { CRepository repo = i.next(); if (repo.getId().equals(id)) { i.remove(); saveConfiguration(); releaseRepository(repository, getConfigurationModel(), repo); return; } } throw new NoSuchRepositoryException(id); }