From a269e32a92195bf4ff20899a692d0bad3ded227b Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 9 Feb 2012 23:07:37 +0000 Subject: [PATCH] more easy REST method to delete a ProxyConnector git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1242594 13f79535-47bb-0310-9956-ffa450edef68 --- .../rest/api/services/ProxyConnectorService.java | 11 +++++++++++ .../rest/services/DefaultProxyConnectorService.java | 13 +++++++++++++ 2 files changed, 24 insertions(+) diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ProxyConnectorService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ProxyConnectorService.java index 818529b02..d37c422f3 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ProxyConnectorService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ProxyConnectorService.java @@ -72,6 +72,17 @@ public interface ProxyConnectorService Boolean deleteProxyConnector( ProxyConnector proxyConnector ) throws ArchivaRestServiceException; + @Path( "removeProxyConnector" ) + @GET + @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) + @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) + /** + * @since 1.4-M3 + */ + Boolean removeProxyConnector( @QueryParam( "sourceRepoId" ) String sourceRepoId, + @QueryParam( "targetRepoId" ) String targetRepoId ) + throws ArchivaRestServiceException; + /** * only for enabled/disable or changing bean values except target/source * diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultProxyConnectorService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultProxyConnectorService.java index 72aa44241..2573c7aa7 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultProxyConnectorService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultProxyConnectorService.java @@ -113,6 +113,19 @@ public class DefaultProxyConnectorService } } + public Boolean removeProxyConnector( String sourceRepoId, String targetRepoId ) + throws ArchivaRestServiceException + { + ProxyConnector proxyConnector = getProxyConnector( sourceRepoId, targetRepoId ); + if ( proxyConnector == null ) + { + throw new ArchivaRestServiceException( + "proxyConnector with sourceRepoId:" + sourceRepoId + " and targetRepoId:" + targetRepoId + + " not exists" ); + } + return deleteProxyConnector( proxyConnector ); + } + public Boolean updateProxyConnector( ProxyConnector proxyConnector ) throws ArchivaRestServiceException { -- 2.39.5