1 package org.apache.archiva.admin.repository.admin;
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
21 import net.sf.beanlib.provider.replicator.BeanReplicator;
22 import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
23 import org.apache.archiva.admin.repository.RepositoryAdminException;
24 import org.apache.maven.archiva.configuration.Configuration;
25 import org.springframework.stereotype.Service;
27 import java.util.ArrayList;
28 import java.util.List;
31 * @author Olivier Lamy
33 @Service("archivaAdministration#default")
34 public class DefaultArchivaAdministration
35 extends AbstractRepositoryAdmin
36 implements ArchivaAdministration
38 public List<LegacyArtifactPath> getLegacyArtifactPaths()
39 throws RepositoryAdminException
41 List<LegacyArtifactPath> legacyArtifactPaths = new ArrayList<LegacyArtifactPath>();
42 for ( org.apache.maven.archiva.configuration.LegacyArtifactPath legacyArtifactPath : getArchivaConfiguration().getConfiguration().getLegacyArtifactPaths() )
44 legacyArtifactPaths.add(
45 new BeanReplicator().replicateBean( legacyArtifactPath, LegacyArtifactPath.class ) );
47 return legacyArtifactPaths;
50 public void addLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath )
51 throws RepositoryAdminException
53 Configuration configuration = getArchivaConfiguration().getConfiguration();
55 configuration.addLegacyArtifactPath( new BeanReplicator().replicateBean( legacyArtifactPath,
56 org.apache.maven.archiva.configuration.LegacyArtifactPath.class ) );
58 saveConfiguration( configuration );
61 public void deleteLegacyArtifactPath( String path )
62 throws RepositoryAdminException
64 Configuration configuration = getArchivaConfiguration().getConfiguration();
65 org.apache.maven.archiva.configuration.LegacyArtifactPath legacyArtifactPath =
66 new org.apache.maven.archiva.configuration.LegacyArtifactPath();
68 legacyArtifactPath.setPath( path );
69 configuration.removeLegacyArtifactPath( legacyArtifactPath );
71 saveConfiguration( configuration );