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

@param repositoryGroup the repository group to remove
@throws RepositoryException if a error occurs during configuration save
Removes a repository group from the registry and configuration if it exists . The change is saved to the configuration immediately . @param repositoryGroup the repository group to remove @throws RepositoryException if a error occurs during configuration save
@Override
    public void removeRepositoryGroup( RepositoryGroup repositoryGroup ) throws RepositoryException {
        if (repositoryGroup == null) {
            return;
        }
        final String id = repositoryGroup.getId();
        RepositoryGroup repo = getRepositoryGroup(id);
        if (repo != null) {
            rwLock.writeLock().lock();
            try {
                repo = repositoryGroups.remove(id);
                if (repo != null) {
                    repo.close();
                    Configuration configuration = getArchivaConfiguration().getConfiguration();
                    RepositoryGroupConfiguration cfg = configuration.findRepositoryGroupById(id);
                    if (cfg != null) {
                        configuration.removeRepositoryGroup(cfg);
                    }
                    saveConfiguration(configuration);
                }
            } catch (RegistryException | IndeterminateConfigurationException e) {
                log.error("Could not save config after repository removal: {}", e.getMessage(), e);
                repositoryGroups.put(repo.getId(), repo);
                throw new RepositoryException("Could not save configuration after repository removal: " + e.getMessage());
            } finally {
                rwLock.writeLock().unlock();
            }
        }
    }
@ Override public void removeRepositoryGroup ( RepositoryGroup repositoryGroup ) throws RepositoryException { if ( repositoryGroup == null ) { return ; } final String id = repositoryGroup . getId ( ) ; RepositoryGroup repo = getRepositoryGroup ( id ) ; if ( repo != null ) { rwLock . writeLock ( ) . lock ( ) ; try { repo = repositoryGroups . remove ( id ) ; if ( repo != null ) { repo . close ( ) ; Configuration configuration = getArchivaConfiguration ( ) . getConfiguration ( ) ; RepositoryGroupConfiguration cfg = configuration . findRepositoryGroupById ( id ) ; if ( cfg != null ) { configuration . removeRepositoryGroup ( cfg ) ; } saveConfiguration ( configuration ) ; } } catch ( RegistryException | IndeterminateConfigurationException e ) { log . error ( "Could not save config after repository removal: {}" , e . getMessage ( ) , e ) ; repositoryGroups . put ( repo . getId ( ) , repo ) ; throw new RepositoryException ( "Could not save configuration after repository removal: " + e . getMessage ( ) ) ; } finally { rwLock . writeLock ( ) . unlock ( ) ; } } }
Removes a repository group from the registry and configuration, if it exists.
Removes a repository group from the registry and configuration if it exists .
// Rollback