1 package org.apache.archiva.repository;
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.content.FilesystemStorage;
25 import org.apache.archiva.repository.content.RepositoryStorage;
26 import org.apache.archiva.repository.features.IndexCreationFeature;
27 import org.apache.archiva.repository.features.RemoteIndexFeature;
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;
37 * Just a helper class, mainly used for unit tests.
41 public class BasicRemoteRepository extends AbstractRemoteRepository
44 Logger log = LoggerFactory.getLogger(BasicRemoteRepository.class);
46 RemoteIndexFeature remoteIndexFeature = new RemoteIndexFeature();
47 IndexCreationFeature indexCreationFeature = new IndexCreationFeature(true);
50 static final StandardCapabilities CAPABILITIES = new StandardCapabilities( new ReleaseScheme[] {
51 ReleaseScheme.RELEASE, ReleaseScheme.SNAPSHOT
52 }, new String[] {"default"}, new String[0], new String[] {
53 RemoteIndexFeature.class.toString(),
54 IndexCreationFeature.class.toString()
55 }, true, true, true, true, true );
57 public BasicRemoteRepository( String id, String name, RepositoryStorage storage)
59 super( RepositoryType.MAVEN, id, name, storage);
63 public BasicRemoteRepository( Locale primaryLocale, RepositoryType type, String id, String name, RepositoryStorage storage )
65 super( primaryLocale, type, id, name, storage );
69 private void initFeatures() {
70 addFeature( remoteIndexFeature );
71 addFeature( indexCreationFeature );
75 public boolean hasIndex( )
81 public RepositoryCapabilities getCapabilities( )
87 public static BasicRemoteRepository newFilesystemInstance(String id, String name, Path basePath) throws IOException {
88 FileLockManager lockManager = new DefaultFileLockManager();
89 FilesystemStorage storage = new FilesystemStorage(basePath.resolve(id), lockManager);
90 return new BasicRemoteRepository(id, name, storage);