1 package org.apache.archiva.rest.services;
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.RepositoryAdminException;
23 import org.apache.archiva.admin.repository.admin.ArchivaAdministration;
24 import org.apache.archiva.rest.api.model.LegacyArtifactPath;
25 import org.apache.archiva.rest.api.services.ArchivaAdministrationService;
26 import org.springframework.stereotype.Service;
28 import javax.inject.Inject;
29 import java.util.ArrayList;
30 import java.util.List;
33 * @author Olivier Lamy
36 @Service( "archivaAdministrationService#default" )
37 public class DefaultArchivaAdministrationService
38 extends AbstractRestService
39 implements ArchivaAdministrationService
42 private ArchivaAdministration archivaAdministration;
44 public List<LegacyArtifactPath> getLegacyArtifactPaths()
45 throws RepositoryAdminException
47 List<LegacyArtifactPath> legacyArtifactPaths = new ArrayList<LegacyArtifactPath>();
48 for ( org.apache.archiva.admin.repository.admin.LegacyArtifactPath legacyArtifactPath : archivaAdministration.getLegacyArtifactPaths() )
50 legacyArtifactPaths.add(
51 new BeanReplicator().replicateBean( legacyArtifactPath, LegacyArtifactPath.class ) );
53 return legacyArtifactPaths;
56 public void addLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath )
57 throws RepositoryAdminException
59 archivaAdministration.addLegacyArtifactPath( new BeanReplicator().replicateBean( legacyArtifactPath,
60 org.apache.archiva.admin.repository.admin.LegacyArtifactPath.class ),
61 getAuditInformation() );
64 public Boolean deleteLegacyArtifactPath( String path )
65 throws RepositoryAdminException
67 archivaAdministration.deleteLegacyArtifactPath( path, getAuditInformation() );