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;
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()
--- /dev/null
+<%--
+ ~ 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