archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistry.java
/**
     * Adds a remote repository, or overwrites the repository definition with the same id, if it exists already.
     * The modification is saved to the configuration immediately.
     *
     * @param remoteRepository the remote repository to add
     * @throws RepositoryException if an error occurs during configuration save
     */
Adds a remote repository, or overwrites the repository definition with the same id, if it exists already.
The modification is saved to the configuration immediately.

@param remoteRepository the remote repository to add
@throws RepositoryException if an error occurs during configuration save
Adds a remote repository or overwrites the repository definition with the same id if it exists already . The modification is saved to the configuration immediately . @param remoteRepository the remote repository to add @throws RepositoryException if an error occurs during configuration save
@Override
    public RemoteRepository putRepository( RemoteRepository remoteRepository ) throws RepositoryException {
        rwLock.writeLock().lock();
        try {
            Configuration configuration = getArchivaConfiguration().getConfiguration();
            try {
                RemoteRepository repo = putRepository(remoteRepository, configuration);
                saveConfiguration(configuration);
                return repo;
            } catch (RegistryException | IndeterminateConfigurationException e) {
                log.error("Error while saving remote repository {}", e.getMessage(), e);
                throw new RepositoryException("Could not save the configuration" + (e.getMessage() == null ? "" : ": " + e.getMessage()));
            }
        } finally {
            rwLock.writeLock().unlock();
        }
    }
@ Override public RemoteRepository putRepository ( RemoteRepository remoteRepository ) throws RepositoryException { rwLock . writeLock ( ) . lock ( ) ; try { Configuration configuration = getArchivaConfiguration ( ) . getConfiguration ( ) ; try { RemoteRepository repo = putRepository ( remoteRepository , configuration ) ; saveConfiguration ( configuration ) ; return repo ; } catch ( RegistryException | IndeterminateConfigurationException e ) { log . error ( "Error while saving remote repository {}" , e . getMessage ( ) , e ) ; throw new RepositoryException ( "Could not save the configuration" + ( e . getMessage ( ) == null ? "" : ": " + e . getMessage ( ) ) ) ; } } finally { rwLock . writeLock ( ) . unlock ( ) ; } }
Adds a remote repository, or overwrites the repository definition with the same id, if it exists already.
Adds a remote repository or overwrites the repository definition with the same id if it exists already .