1 package org.apache.maven.archiva.web.action.admin.legacy;
\r
4 * Licensed to the Apache Software Foundation (ASF) under one
\r
5 * or more contributor license agreements. See the NOTICE file
\r
6 * distributed with this work for additional information
\r
7 * regarding copyright ownership. The ASF licenses this file
\r
8 * to you under the Apache License, Version 2.0 (the
\r
9 * "License"); you may not use this file except in compliance
\r
10 * with the License. You may obtain a copy of the License at
\r
12 * http://www.apache.org/licenses/LICENSE-2.0
\r
14 * Unless required by applicable law or agreed to in writing,
\r
15 * software distributed under the License is distributed on an
\r
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
\r
17 * KIND, either express or implied. See the License for the
\r
18 * specific language governing permissions and limitations
\r
19 * under the License.
\r
22 import java.util.Iterator;
\r
24 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
\r
25 import org.apache.maven.archiva.configuration.Configuration;
\r
26 import org.apache.maven.archiva.configuration.IndeterminateConfigurationException;
\r
27 import org.apache.maven.archiva.configuration.LegacyArtifactPath;
\r
28 import org.apache.maven.archiva.web.action.PlexusActionSupport;
\r
29 import org.codehaus.plexus.registry.RegistryException;
\r
32 * Delete a LegacyArtifactPath to archiva configuration
\r
36 * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="deleteLegacyArtifactPathAction"
\r
38 public class DeleteLegacyArtifactPathAction
\r
39 extends PlexusActionSupport
\r
42 * @plexus.requirement
\r
44 private ArchivaConfiguration archivaConfiguration;
\r
46 private String path;
\r
48 public String delete()
\r
50 getLogger().info( "remove [" + path + "] from legacy artifact path resolution" );
\r
51 Configuration configuration = archivaConfiguration.getConfiguration();
\r
52 for ( Iterator iterator = configuration.getLegacyArtifactPaths().iterator(); iterator.hasNext(); )
\r
54 LegacyArtifactPath legacyArtifactPath = (LegacyArtifactPath) iterator.next();
\r
55 if (legacyArtifactPath.match( path ))
\r
60 return saveConfiguration( configuration );
\r
63 protected String saveConfiguration( Configuration configuration )
\r
67 archivaConfiguration.save( configuration );
\r
68 addActionMessage( "Successfully saved configuration" );
\r
70 catch ( IndeterminateConfigurationException e )
\r
72 addActionError( e.getMessage() );
\r
75 catch ( RegistryException e )
\r
77 addActionError( "Configuration Registry Exception: " + e.getMessage() );
\r
84 public String getPath()
\r
89 public void setPath( String path )
\r