This project has retired. For details please refer to its
Attic page.
BasicRemoteRepository xref
1 package org.apache.archiva.repository.base;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.archiva.common.filelock.DefaultFileLockManager;
23 import org.apache.archiva.common.filelock.FileLockManager;
24 import org.apache.archiva.repository.ReleaseScheme;
25 import org.apache.archiva.repository.RepositoryCapabilities;
26 import org.apache.archiva.repository.RepositoryType;
27 import org.apache.archiva.repository.StandardCapabilities;
28 import org.apache.archiva.repository.storage.FilesystemStorage;
29 import org.apache.archiva.repository.storage.RepositoryStorage;
30 import org.apache.archiva.repository.features.IndexCreationFeature;
31 import org.apache.archiva.repository.features.RemoteIndexFeature;
32 import org.slf4j.Logger;
33 import org.slf4j.LoggerFactory;
34
35 import java.io.IOException;
36 import java.nio.file.Path;
37 import java.util.Locale;
38
39
40
41
42
43
44
45 public class BasicRemoteRepository extends AbstractRemoteRepository
46
47 {
48 Logger log = LoggerFactory.getLogger(BasicRemoteRepository.class);
49
50 RemoteIndexFeaturexFeature.html#RemoteIndexFeature">RemoteIndexFeature remoteIndexFeature = new RemoteIndexFeature();
51 IndexCreationFeatureeature.html#IndexCreationFeature">IndexCreationFeature indexCreationFeature = new IndexCreationFeature(true);
52
53
54 static final StandardCapabilitiesities.html#StandardCapabilities">StandardCapabilities CAPABILITIES = new StandardCapabilities( new ReleaseScheme[] {
55 ReleaseScheme.RELEASE, ReleaseScheme.SNAPSHOT
56 }, new String[] {"default"}, new String[0], new String[] {
57 RemoteIndexFeature.class.toString(),
58 IndexCreationFeature.class.toString()
59 }, true, true, true, true, true );
60
61 public BasicRemoteRepository( String id, String name, RepositoryStorage storage)
62 {
63 super( RepositoryType.MAVEN, id, name, storage);
64 initFeatures();
65 }
66
67 public BasicRemoteRepository( Locale primaryLocale, RepositoryType type, String id, String name, RepositoryStorage storage )
68 {
69 super( primaryLocale, type, id, name, storage );
70 initFeatures();
71 }
72
73 private void initFeatures() {
74 addFeature( remoteIndexFeature );
75 addFeature( indexCreationFeature );
76 }
77
78 @Override
79 public boolean hasIndex( )
80 {
81 return true;
82 }
83
84 @Override
85 public RepositoryCapabilities getCapabilities( )
86 {
87 return CAPABILITIES;
88 }
89
90
91 public static BasicRemoteRepository newFilesystemInstance(String id, String name, Path basePath) throws IOException {
92 FileLockManager lockManager = new DefaultFileLockManager();
93 FilesystemStorage/FilesystemStorage.html#FilesystemStorage">FilesystemStorage storage = new FilesystemStorage(basePath.resolve(id), lockManager);
94 return new BasicRemoteRepository(id, name, storage);
95 }
96 }