]> source.dussan.org Git - archiva.git/commitdiff
[MRM-341] "delete proxy connector" page and action added.
authorFabrice Bellingard <bellingard@apache.org>
Wed, 16 May 2007 14:02:50 +0000 (14:02 +0000)
committerFabrice Bellingard <bellingard@apache.org>
Wed, 16 May 2007 14:02:50 +0000 (14:02 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@538601 13f79535-47bb-0310-9956-ffa450edef68

archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorAction.java
archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteProxyConnector.jsp [new file with mode: 0644]

index 7432b9bb985a920326d7ce49077b5c48a54455b1..da8de754e647c4543722e96a522943266e91e6b0 100644 (file)
@@ -30,6 +30,7 @@ import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
 import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
+import org.apache.maven.archiva.configuration.functors.NetworkProxySelectionPredicate;
 import org.apache.maven.archiva.configuration.functors.ProxyConnectorSelectionPredicate;
 import org.apache.maven.archiva.configuration.functors.RemoteRepositoryPredicate;
 import org.apache.maven.archiva.configuration.functors.RepositoryIdListClosure;
@@ -137,7 +138,35 @@ public class ConfigureProxyConnectorAction
 
     public String delete()
     {
-        return INPUT;
+        Configuration config = archivaConfiguration.getConfiguration();
+
+        String source = getSource();
+        if ( StringUtils.isBlank( source ) )
+        {
+            addActionError( "Unable to delete proxy connector with blank id for its source." );
+            return SUCCESS;
+        }
+
+        String target = getTarget();
+        if ( StringUtils.isBlank( target ) )
+        {
+            addActionError( "Unable to delete proxy connector with blank id for its target." );
+            return SUCCESS;
+        }
+
+        ProxyConnectorSelectionPredicate proxyConnectorSelection = new ProxyConnectorSelectionPredicate( source, target );
+        ProxyConnectorConfiguration proxyConnectorConfiguration = (ProxyConnectorConfiguration) CollectionUtils.find( config
+            .getProxyConnectors(), proxyConnectorSelection );
+        if ( proxyConnectorConfiguration == null )
+        {
+            addActionError( "Unable to remove proxy connector, proxy connector with source [" + source + "] and target ["
+                            + target + "] not found." );
+            return SUCCESS;
+        }
+
+        archivaConfiguration.getConfiguration().removeProxyConnector( proxyConnectorConfiguration );
+        addActionMessage( "Successfully removed proxy connector [" + source + " , " + target + " ]" );
+        return saveConfiguration();
     }
 
     public String addProperty()
diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteProxyConnector.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteProxyConnector.jsp
new file mode 100644 (file)
index 0000000..2535b80
--- /dev/null
@@ -0,0 +1,52 @@
+<%--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  --%>
+
+<%@ taglib prefix="ww" uri="/webwork" %>
+
+<html>
+<head>
+  <title>Admin: Delete Proxy Connector</title>
+  <ww:head/>
+</head>
+
+<body>
+
+<h1>Admin: Delete Proxy Connector</h1>
+
+<div id="contentArea">
+
+  <h2>Delete Proxy Connector</h2>
+
+  <blockquote>
+    <strong><span class="statusFailed">WARNING:</span> This operation can not be undone.</strong>
+  </blockquote>
+  
+  <p>
+  Are you sure you want to delete proxy connector <code>[ ${source} , ${target} ]</code> ?
+  </p>
+
+  <ww:form method="post" action="deleteProxyConnector!delete" namespace="/admin" validate="true">
+    <ww:hidden name="target"/>
+       <ww:hidden name="source"/>
+    <ww:submit value="Delete"/>
+  </ww:form>
+</div>
+
+</body>
+</html>
\ No newline at end of file