public void deleteNetworkProxy( String networkProxyId, AuditInformation auditInformation )
throws RepositoryAdminException
{
NetworkProxy networkProxy = getNetworkProxy( networkProxyId );
if ( networkProxy == null )
{
throw new RepositoryAdminException(
"cannot delete NetworkProxy with id " + networkProxyId + " as not exist" );
}
Configuration configuration = getArchivaConfiguration().getConfiguration();
NetworkProxyConfiguration networkProxyConfiguration = getNetworkProxyConfiguration( networkProxy );
configuration.removeNetworkProxy( networkProxyConfiguration );
for ( RemoteRepositoryConfiguration rrc : configuration.getRemoteRepositories())
{
if (StringUtils.equals( rrc.getRemoteDownloadNetworkProxyId(), networkProxyId ))
{
rrc.setRemoteDownloadNetworkProxyId( null );
}
}
triggerAuditEvent( networkProxy.getId(), null, AuditEvent.DELETE_NETWORK_PROXY, auditInformation );
saveConfiguration( configuration );
}