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.AuditInformation;
23 import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
24 import org.apache.archiva.admin.repository.RepositoryAdminException;
25 import org.apache.maven.archiva.configuration.Configuration;
26 import org.springframework.stereotype.Service;
28 import java.util.ArrayList;
29 import java.util.List;
32 * @author Olivier Lamy
34 @Service( "archivaAdministration#default" )
35 public class DefaultArchivaAdministration
36 extends AbstractRepositoryAdmin
37 implements ArchivaAdministration
39 public List<LegacyArtifactPath> getLegacyArtifactPaths()
40 throws RepositoryAdminException
42 List<LegacyArtifactPath> legacyArtifactPaths = new ArrayList<LegacyArtifactPath>();
43 for ( org.apache.maven.archiva.configuration.LegacyArtifactPath legacyArtifactPath : getArchivaConfiguration().getConfiguration().getLegacyArtifactPaths() )
45 legacyArtifactPaths.add(
46 new BeanReplicator().replicateBean( legacyArtifactPath, LegacyArtifactPath.class ) );
48 return legacyArtifactPaths;
51 public void addLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath, AuditInformation auditInformation )
52 throws RepositoryAdminException
54 Configuration configuration = getArchivaConfiguration().getConfiguration();
56 configuration.addLegacyArtifactPath( new BeanReplicator().replicateBean( legacyArtifactPath,
57 org.apache.maven.archiva.configuration.LegacyArtifactPath.class ) );
59 saveConfiguration( configuration );
62 public void deleteLegacyArtifactPath( String path, AuditInformation auditInformation )
63 throws RepositoryAdminException
65 Configuration configuration = getArchivaConfiguration().getConfiguration();
66 org.apache.maven.archiva.configuration.LegacyArtifactPath legacyArtifactPath =
67 new org.apache.maven.archiva.configuration.LegacyArtifactPath();
69 legacyArtifactPath.setPath( path );
70 configuration.removeLegacyArtifactPath( legacyArtifactPath );
72 saveConfiguration( configuration );