final Map<String, Object> env ) {
if ( configuredRepositories.containsKey( alias ) || SystemRepository.SYSTEM_REPO.getAlias().equals( alias ) ) {
throw new RepositoryAlreadyExistsException( alias );
}
final ConfigGroup repositoryConfig = configurationFactory.newConfigGroup( REPOSITORY, alias, "" );
repositoryConfig.addConfigItem( configurationFactory.newConfigItem( "security:roles", new ArrayList<String>() ) );
if ( !env.containsKey( SCHEME ) ) {
repositoryConfig.addConfigItem( configurationFactory.newConfigItem( SCHEME, scheme ) );
}
if ( env.containsKey( BRANCH ) ) {
repositoryConfig.addConfigItem( configurationFactory.newConfigItem( BRANCH, env.get( BRANCH ) ) );
}
for ( final Map.Entry<String, Object> entry : env.entrySet() ) {
if ( entry.getKey().startsWith( "crypt:" ) ) {
repositoryConfig.addConfigItem( configurationFactory.newSecuredConfigItem( entry.getKey(),
entry.getValue().toString() ) );
} else {
repositoryConfig.addConfigItem( configurationFactory.newConfigItem( entry.getKey(),
entry.getValue() ) );
}
}
final Repository repo = createRepository( repositoryConfig );