archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistry.java
/**
     * Removes the remote repository from the registry and configuration.
     * The change is saved to the configuration immediately.
     *
     * @param remoteRepository the remote repository to remove
     * @throws RepositoryException if a error occurs during configuration save
     */
Removes the remote repository from the registry and configuration.
The change is saved to the configuration immediately.

@param remoteRepository the remote repository to remove
@throws RepositoryException if a error occurs during configuration save
Removes the remote repository from the registry and configuration . The change is saved to the configuration immediately . @param remoteRepository the remote repository to remove @throws RepositoryException if a error occurs during configuration save
@Override
    public void removeRepository( RemoteRepository remoteRepository ) throws RepositoryException {
        if (remoteRepository == null) {
            return;
        }
        final String id = remoteRepository.getId();
        RemoteRepository repo = getRemoteRepository(id);
        if (repo != null) {
            rwLock.writeLock().lock();
            try {
                repo = remoteRepositories.remove(id);
                if (repo != null) {
                    Configuration configuration = getArchivaConfiguration().getConfiguration();
                    doRemoveRepo(repo, configuration);
                    saveConfiguration(configuration);
                }
                pushEvent(new LifecycleEvent(LifecycleEvent.UNREGISTERED, this, repo));
            } catch (RegistryException | IndeterminateConfigurationException e) {
                log.error("Could not save config after repository removal: {}", e.getMessage(), e);
                remoteRepositories.put(repo.getId(), repo);
                throw new RepositoryException("Could not save configuration after repository removal: " + e.getMessage());
            } finally {
                rwLock.writeLock().unlock();
            }
        }
    }
@ Override public void removeRepository ( RemoteRepository remoteRepository ) throws RepositoryException { if ( remoteRepository == null ) { return ; } final String id = remoteRepository . getId ( ) ; RemoteRepository repo = getRemoteRepository ( id ) ; if ( repo != null ) { rwLock . writeLock ( ) . lock ( ) ; try { repo = remoteRepositories . remove ( id ) ; if ( repo != null ) { Configuration configuration = getArchivaConfiguration ( ) . getConfiguration ( ) ; doRemoveRepo ( repo , configuration ) ; saveConfiguration ( configuration ) ; } pushEvent ( new LifecycleEvent ( LifecycleEvent . UNREGISTERED , this , repo ) ) ; } catch ( RegistryException | IndeterminateConfigurationException e ) { log . error ( "Could not save config after repository removal: {}" , e . getMessage ( ) , e ) ; remoteRepositories . put ( repo . getId ( ) , repo ) ; throw new RepositoryException ( "Could not save configuration after repository removal: " + e . getMessage ( ) ) ; } finally { rwLock . writeLock ( ) . unlock ( ) ; } } }
Removes the remote repository from the registry and configuration.
Removes the remote repository from the registry and configuration .
// Rollback