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.DefaultFileLockManager;
23 import org.apache.archiva.common.filelock.FileLockManager;
24 import org.apache.archiva.repository.*;
25 import org.apache.archiva.repository.base.AbstractRepositoryGroup;
26 import org.apache.archiva.repository.storage.fs.FilesystemStorage;
27 import org.apache.archiva.repository.features.IndexCreationFeature;
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[] {IndexCreationFeature.class.getName()},
49 private final Logger log = LoggerFactory.getLogger(MavenRepositoryGroup.class);
51 private IndexCreationFeature indexCreationFeature;
54 public MavenRepositoryGroup(String id, String name, FilesystemStorage storage) {
55 super(RepositoryType.MAVEN, id, name, storage);
59 public MavenRepositoryGroup(Locale primaryLocale, String id, String name, FilesystemStorage storage) {
60 super(primaryLocale, RepositoryType.MAVEN, id, name, storage);
64 private Path getRepositoryPath() {
65 return getStorage().getAsset("").getFilePath();
69 setCapabilities(CAPABILITIES);
70 this.indexCreationFeature = new IndexCreationFeature(this, this);
71 addFeature( this.indexCreationFeature );
74 public static MavenRepositoryGroup newLocalInstance(String id, String name, Path basePath) throws IOException {
75 FileLockManager lockManager = new DefaultFileLockManager();
76 FilesystemStorage storage = new FilesystemStorage(basePath.resolve(id), lockManager);
77 return new MavenRepositoryGroup(id, name, storage);