archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistry.java
/**
     * Adds a new repository group or updates the repository group with the same id. The given configuration object is updated, but
     * the configuration is not saved.
     *
     * @param repositoryGroupConfiguration The configuration of the new or changed repository group.
     * @param configuration                The configuration object. If it is <code>null</code>, the configuration is not saved.
     * @return The new or updated repository group
     * @throws RepositoryException if the configuration cannot be saved or updated
     */
Adds a new repository group or updates the repository group with the same id. The given configuration object is updated, but
the configuration is not saved.

@param repositoryGroupConfiguration The configuration of the new or changed repository group.
@param configuration                The configuration object. If it is null, the configuration is not saved.
@return The new or updated repository group
@throws RepositoryException if the configuration cannot be saved or updated
Adds a new repository group or updates the repository group with the same id . The given configuration object is updated but the configuration is not saved . @param repositoryGroupConfiguration The configuration of the new or changed repository group . @param configuration The configuration object . If it is null the configuration is not saved . @return The new or updated repository group @throws RepositoryException if the configuration cannot be saved or updated
@Override
    public RepositoryGroup putRepositoryGroup( RepositoryGroupConfiguration repositoryGroupConfiguration, Configuration configuration ) throws RepositoryException {
        rwLock.writeLock().lock();
        try {
            final String id = repositoryGroupConfiguration.getId();
            final RepositoryType repoType = RepositoryType.valueOf(repositoryGroupConfiguration.getType());
            RepositoryGroup repo;
            setRepositoryGroupDefaults(repositoryGroupConfiguration);
            if (repositoryGroups.containsKey(id)) {
                repo = repositoryGroups.get(id);
                if (repo instanceof EditableRepositoryGroup) {
                    getProvider(repoType).updateRepositoryGroupInstance((EditableRepositoryGroup) repo, repositoryGroupConfiguration);
                } else {
                    throw new RepositoryException("The repository is not editable " + id);
                }
            } else {
                repo = getProvider(repoType).createRepositoryGroup(repositoryGroupConfiguration);
                repositoryGroups.put(id, repo);
            }
            updateRepositoryReferences(getProvider(repoType), repo, repositoryGroupConfiguration);
            replaceOrAddRepositoryConfig(repositoryGroupConfiguration, configuration);
            return repo;
        } finally {
            rwLock.writeLock().unlock();
        }
    }
@ Override public RepositoryGroup putRepositoryGroup ( RepositoryGroupConfiguration repositoryGroupConfiguration , Configuration configuration ) throws RepositoryException { rwLock . writeLock ( ) . lock ( ) ; try { final String id = repositoryGroupConfiguration . getId ( ) ; final RepositoryType repoType = RepositoryType . valueOf ( repositoryGroupConfiguration . getType ( ) ) ; RepositoryGroup repo ; setRepositoryGroupDefaults ( repositoryGroupConfiguration ) ; if ( repositoryGroups . containsKey ( id ) ) { repo = repositoryGroups . get ( id ) ; if ( repo instanceof EditableRepositoryGroup ) { getProvider ( repoType ) . updateRepositoryGroupInstance ( ( EditableRepositoryGroup ) repo , repositoryGroupConfiguration ) ; } else { throw new RepositoryException ( "The repository is not editable " + id ) ; } } else { repo = getProvider ( repoType ) . createRepositoryGroup ( repositoryGroupConfiguration ) ; repositoryGroups . put ( id , repo ) ; } updateRepositoryReferences ( getProvider ( repoType ) , repo , repositoryGroupConfiguration ) ; replaceOrAddRepositoryConfig ( repositoryGroupConfiguration , configuration ) ; return repo ; } finally { rwLock . writeLock ( ) . unlock ( ) ; } }
Adds a new repository group or updates the repository group with the same id.
Adds a new repository group or updates the repository group with the same id .