1 package org.apache.archiva.repository.maven2;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.archiva.common.filelock.FileLockManager;
23 import org.apache.archiva.repository.*;
24 import org.apache.archiva.repository.content.FilesystemStorage;
25 import org.apache.archiva.repository.features.ArtifactCleanupFeature;
26 import org.apache.archiva.repository.features.IndexCreationFeature;
27 import org.apache.archiva.repository.features.StagingRepositoryFeature;
28 import org.slf4j.Logger;
29 import org.slf4j.LoggerFactory;
31 import java.io.IOException;
32 import java.nio.file.Path;
33 import java.util.Locale;
35 public class MavenRepositoryGroup extends AbstractRepositoryGroup implements EditableRepositoryGroup {
37 private static final RepositoryCapabilities CAPABILITIES = new StandardCapabilities(
38 new ReleaseScheme[] { ReleaseScheme.RELEASE, ReleaseScheme.SNAPSHOT },
39 new String[] { MavenManagedRepository.DEFAULT_LAYOUT, MavenManagedRepository.LEGACY_LAYOUT},
41 new String[] {ArtifactCleanupFeature.class.getName(), IndexCreationFeature.class.getName(),
42 StagingRepositoryFeature.class.getName()},
50 private final Logger log = LoggerFactory.getLogger(MavenRepositoryGroup.class);
52 private FileLockManager lockManager;
53 private FilesystemStorage fsStorage;
55 public MavenRepositoryGroup(String id, String name, Path repositoryBase, FileLockManager lockManager) {
56 super(RepositoryType.MAVEN, id, name, repositoryBase);
57 this.lockManager = lockManager;
61 public MavenRepositoryGroup(Locale primaryLocale, String id, String name, Path repositoryBase, FileLockManager lockManager) {
62 super(primaryLocale, RepositoryType.MAVEN, id, name, repositoryBase);
63 this.lockManager = lockManager;
67 private Path getRepositoryPath() {
68 return getRepositoryBase().resolve(getId());
72 setCapabilities(CAPABILITIES);
74 fsStorage = new FilesystemStorage(getRepositoryPath(), lockManager);
75 } catch (IOException e) {
76 log.error("IOException while initializing repository group with path {}",getRepositoryBase());
77 throw new RuntimeException("Fatal error while accessing repository path "+ getRepositoryBase(), e);
79 setStorage(fsStorage);