This project has retired. For details please refer to its
Attic page.
MavenRepositoryProvider xref
1 package org.apache.archiva.repository.maven2;
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.FileLockManager;
23 import org.apache.archiva.configuration.*;
24 import org.apache.archiva.repository.*;
25 import org.apache.archiva.event.Event;
26 import org.apache.archiva.repository.features.ArtifactCleanupFeature;
27 import org.apache.archiva.repository.features.IndexCreationFeature;
28 import org.apache.archiva.repository.features.RemoteIndexFeature;
29 import org.apache.archiva.repository.features.StagingRepositoryFeature;
30 import org.apache.archiva.repository.base.BasicManagedRepository;
31 import org.apache.archiva.repository.base.PasswordCredentials;
32 import org.apache.archiva.repository.storage.FilesystemStorage;
33 import org.apache.commons.lang3.StringUtils;
34 import org.slf4j.Logger;
35 import org.slf4j.LoggerFactory;
36 import org.springframework.stereotype.Service;
37
38 import javax.inject.Inject;
39 import java.io.IOException;
40 import java.net.URI;
41 import java.net.URISyntaxException;
42 import java.nio.file.Files;
43 import java.nio.file.Path;
44 import java.nio.file.Paths;
45 import java.time.Duration;
46 import java.time.Period;
47 import java.time.temporal.ChronoUnit;
48 import java.util.HashSet;
49 import java.util.Set;
50 import java.util.stream.Collectors;
51
52 import static org.apache.archiva.indexer.ArchivaIndexManager.DEFAULT_INDEX_PATH;
53 import static org.apache.archiva.indexer.ArchivaIndexManager.DEFAULT_PACKED_INDEX_PATH;
54
55
56
57
58 @Service("mavenRepositoryProvider")
59 public class MavenRepositoryProvider implements RepositoryProvider {
60
61
62 @Inject
63 private ArchivaConfiguration archivaConfiguration;
64
65 @Inject
66 private FileLockManager fileLockManager;
67
68 private static final Logger log = LoggerFactory.getLogger(MavenRepositoryProvider.class);
69
70 static final Set<RepositoryType> TYPES = new HashSet<>();
71
72 static {
73 TYPES.add(RepositoryType.MAVEN);
74 }
75
76 @Override
77 public Set<RepositoryType> provides() {
78 return TYPES;
79 }
80
81 @Override
82 public MavenManagedRepository createManagedInstance(String id, String name) {
83 return createManagedInstance(id, name, archivaConfiguration.getRemoteRepositoryBaseDir());
84 }
85
86 public MavenManagedRepository createManagedInstance(String id, String name, Path baseDir) {
87 FilesystemStorage storage = null;
88 try {
89 storage = new FilesystemStorage(baseDir.resolve(id), fileLockManager);
90 } catch (IOException e) {
91 log.error("Could not initialize fileystem for repository {}", id);
92 throw new RuntimeException(e);
93 }
94 return new MavenManagedRepository(id, name, storage);
95 }
96
97 @Override
98 public MavenRemoteRepository createRemoteInstance(String id, String name) {
99 return createRemoteInstance(id, name, archivaConfiguration.getRemoteRepositoryBaseDir());
100 }
101
102 public MavenRemoteRepository createRemoteInstance(String id, String name, Path baseDir) {
103 FilesystemStorage storage = null;
104 try {
105 storage = new FilesystemStorage(baseDir.resolve(id), fileLockManager);
106 } catch (IOException e) {
107 log.error("Could not initialize fileystem for repository {}", id);
108 throw new RuntimeException(e);
109 }
110 return new MavenRemoteRepository(id, name, storage);
111 }
112
113 @Override
114 public EditableRepositoryGroup createRepositoryGroup(String id, String name) {
115 return createRepositoryGroup(id, name, archivaConfiguration.getRepositoryBaseDir());
116 }
117
118 public MavenRepositoryGroup createRepositoryGroup(String id, String name, Path baseDir) {
119 FilesystemStorage storage = null;
120 try {
121 storage = new FilesystemStorage(baseDir.resolve(id), fileLockManager);
122 } catch (IOException e) {
123 log.error("Could not initialize fileystem for repository {}", id);
124 throw new RuntimeException(e);
125 }
126 return new MavenRepositoryGroup(id, name, storage);
127 }
128
129 private URI getURIFromString(String uriStr) throws RepositoryException {
130 URI uri;
131 try {
132 if (StringUtils.isEmpty(uriStr)) {
133 return new URI("");
134 }
135 if (uriStr.startsWith("/")) {
136
137 uri = new URI("file://" + uriStr);
138 } else {
139 uri = new URI(uriStr);
140 }
141 if (uri.getScheme() != null && !"file".equals(uri.getScheme())) {
142 log.error("Bad URI scheme found: {}, URI={}", uri.getScheme(), uri);
143 throw new RepositoryException("The uri " + uriStr + " is not valid. Only file:// URI is allowed for maven.");
144 }
145 } catch (URISyntaxException e) {
146 String newCfg = "file://" + uriStr;
147 try {
148 uri = new URI(newCfg);
149 } catch (URISyntaxException e1) {
150 log.error("Could not create URI from {} -> ", uriStr, newCfg);
151 throw new RepositoryException("The config entry " + uriStr + " cannot be converted to URI.");
152 }
153 }
154 log.debug("Setting location uri: {}", uri);
155 return uri;
156 }
157
158 @Override
159 public ManagedRepository createManagedInstance(ManagedRepositoryConfiguration cfg) throws RepositoryException {
160 MavenManagedRepository repo = createManagedInstance(cfg.getId(), cfg.getName(), Paths.get(cfg.getLocation()).getParent());
161 updateManagedInstance(repo, cfg);
162 return repo;
163 }
164
165 @Override
166 public void updateManagedInstance(EditableManagedRepository repo, ManagedRepositoryConfiguration cfg) throws RepositoryException {
167 try {
168 repo.setLocation(getURIFromString(cfg.getLocation()));
169 } catch (UnsupportedURIException e) {
170 throw new RepositoryException("The location entry is not a valid uri: " + cfg.getLocation());
171 }
172 setBaseConfig(repo, cfg);
173 Path repoDir = repo.getAsset("").getFilePath();
174 if (!Files.exists(repoDir)) {
175 log.debug("Creating repo directory {}", repoDir);
176 try {
177 Files.createDirectories(repoDir);
178 } catch (IOException e) {
179 log.error("Could not create directory {} for repository {}", repoDir, repo.getId(), e);
180 throw new RepositoryException("Could not create directory for repository " + repoDir);
181 }
182 }
183 repo.setSchedulingDefinition(cfg.getRefreshCronExpression());
184 repo.setBlocksRedeployment(cfg.isBlockRedeployments());
185 repo.setScanned(cfg.isScanned());
186 if (cfg.isReleases()) {
187 repo.addActiveReleaseScheme(ReleaseScheme.RELEASE);
188 } else {
189 repo.removeActiveReleaseScheme(ReleaseScheme.RELEASE);
190 }
191 if (cfg.isSnapshots()) {
192 repo.addActiveReleaseScheme(ReleaseScheme.SNAPSHOT);
193 } else {
194 repo.removeActiveReleaseScheme(ReleaseScheme.SNAPSHOT);
195 }
196
197 StagingRepositoryFeature stagingRepositoryFeature = repo.getFeature(StagingRepositoryFeature.class).get();
198 stagingRepositoryFeature.setStageRepoNeeded(cfg.isStageRepoNeeded());
199
200 IndexCreationFeature indexCreationFeature = repo.getFeature(IndexCreationFeature.class).get();
201 indexCreationFeature.setSkipPackedIndexCreation(cfg.isSkipPackedIndexCreation());
202 String indexDir = StringUtils.isEmpty( cfg.getIndexDir() ) ? DEFAULT_INDEX_PATH : cfg.getIndexDir();
203 String packedIndexDir = StringUtils.isEmpty( cfg.getPackedIndexDir() ) ? DEFAULT_PACKED_INDEX_PATH : cfg.getPackedIndexDir();
204 indexCreationFeature.setIndexPath(getURIFromString(indexDir));
205 indexCreationFeature.setPackedIndexPath(getURIFromString(packedIndexDir));
206
207 ArtifactCleanupFeature artifactCleanupFeature = repo.getFeature(ArtifactCleanupFeature.class).get();
208
209 artifactCleanupFeature.setDeleteReleasedSnapshots(cfg.isDeleteReleasedSnapshots());
210 artifactCleanupFeature.setRetentionCount(cfg.getRetentionCount());
211 artifactCleanupFeature.setRetentionPeriod(Period.ofDays(cfg.getRetentionPeriod()));
212 }
213
214
215 @Override
216 public ManagedRepository createStagingInstance(ManagedRepositoryConfiguration baseConfiguration) throws RepositoryException {
217 log.debug("Creating staging instance for {}", baseConfiguration.getId());
218 return createManagedInstance(getStageRepoConfig(baseConfiguration));
219 }
220
221
222 @Override
223 public RemoteRepository createRemoteInstance(RemoteRepositoryConfiguration cfg) throws RepositoryException {
224 MavenRemoteRepository repo = createRemoteInstance(cfg.getId(), cfg.getName(), archivaConfiguration.getRemoteRepositoryBaseDir());
225 updateRemoteInstance(repo, cfg);
226 return repo;
227 }
228
229 private String convertUriToPath(URI uri) {
230 if (uri.getScheme() == null) {
231 return uri.getPath();
232 } else if ("file".equals(uri.getScheme())) {
233 return Paths.get(uri).toString();
234 } else {
235 return uri.toString();
236 }
237 }
238
239 @Override
240 public void updateRemoteInstance(EditableRemoteRepository repo, RemoteRepositoryConfiguration cfg) throws RepositoryException {
241 setBaseConfig(repo, cfg);
242 repo.setCheckPath(cfg.getCheckPath());
243 repo.setSchedulingDefinition(cfg.getRefreshCronExpression());
244 try {
245 repo.setLocation(new URI(cfg.getUrl()));
246 } catch (UnsupportedURIException | URISyntaxException e) {
247 log.error("Could not set remote url " + cfg.getUrl());
248 throw new RepositoryException("The url config is not a valid uri: " + cfg.getUrl());
249 }
250 repo.setTimeout(Duration.ofSeconds(cfg.getTimeout()));
251 RemoteIndexFeature remoteIndexFeature = repo.getFeature(RemoteIndexFeature.class).get();
252 remoteIndexFeature.setDownloadRemoteIndex(cfg.isDownloadRemoteIndex());
253 remoteIndexFeature.setDownloadRemoteIndexOnStartup(cfg.isDownloadRemoteIndexOnStartup());
254 remoteIndexFeature.setDownloadTimeout(Duration.ofSeconds(cfg.getRemoteDownloadTimeout()));
255 remoteIndexFeature.setProxyId(cfg.getRemoteDownloadNetworkProxyId());
256 if (cfg.isDownloadRemoteIndex()) {
257 try {
258 remoteIndexFeature.setIndexUri(new URI(cfg.getRemoteIndexUrl()));
259 } catch (URISyntaxException e) {
260 log.error("Could not set remote index url " + cfg.getRemoteIndexUrl());
261 remoteIndexFeature.setDownloadRemoteIndex(false);
262 remoteIndexFeature.setDownloadRemoteIndexOnStartup(false);
263 }
264 }
265 for ( Object key : cfg.getExtraHeaders().keySet() ) {
266 repo.addExtraHeader( key.toString(), cfg.getExtraHeaders().get(key).toString() );
267 }
268 for ( Object key : cfg.getExtraParameters().keySet() ) {
269 repo.addExtraParameter( key.toString(), cfg.getExtraParameters().get(key).toString() );
270 }
271 PasswordCredentialsCredentials.html#PasswordCredentials">PasswordCredentials credentials = new PasswordCredentials("", new char[0]);
272 if (cfg.getPassword() != null && cfg.getUsername() != null) {
273 credentials.setPassword(cfg.getPassword().toCharArray());
274 credentials.setUsername(cfg.getUsername());
275 repo.setCredentials(credentials);
276 } else {
277 credentials.setPassword(new char[0]);
278 }
279 IndexCreationFeature indexCreationFeature = repo.getFeature(IndexCreationFeature.class).get();
280 if (cfg.getIndexDir() != null) {
281 indexCreationFeature.setIndexPath(getURIFromString(cfg.getIndexDir()));
282 }
283 if (cfg.getPackedIndexDir() != null) {
284 indexCreationFeature.setPackedIndexPath(getURIFromString(cfg.getPackedIndexDir()));
285 }
286 log.debug("Updated remote instance {}", repo);
287 }
288
289 @Override
290 public RepositoryGroup createRepositoryGroup(RepositoryGroupConfiguration configuration) throws RepositoryException {
291 Path repositoryGroupBase = getArchivaConfiguration().getRepositoryGroupBaseDir();
292 MavenRepositoryGroup newGrp = createRepositoryGroup(configuration.getId(), configuration.getName(),
293 repositoryGroupBase);
294 updateRepositoryGroupInstance(newGrp, configuration);
295 return newGrp;
296 }
297
298 @Override
299 public void updateRepositoryGroupInstance(EditableRepositoryGroup repositoryGroup, RepositoryGroupConfiguration configuration) throws RepositoryException {
300 repositoryGroup.setName(repositoryGroup.getPrimaryLocale(), configuration.getName());
301 repositoryGroup.setMergedIndexTTL(configuration.getMergedIndexTtl());
302 repositoryGroup.setSchedulingDefinition(configuration.getCronExpression());
303 if (repositoryGroup.supportsFeature( IndexCreationFeature.class )) {
304 IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ).get();
305 indexCreationFeature.setIndexPath( getURIFromString(configuration.getMergedIndexPath()) );
306 Path localPath = Paths.get(configuration.getMergedIndexPath());
307 Path repoGroupPath = repositoryGroup.getAsset("").getFilePath().toAbsolutePath();
308 if (localPath.isAbsolute() && !localPath.startsWith(repoGroupPath)) {
309 try {
310 FilesystemStorage/FilesystemStorage.html#FilesystemStorage">FilesystemStorage storage = new FilesystemStorage(localPath.getParent(), fileLockManager);
311 indexCreationFeature.setLocalIndexPath(storage.getAsset(localPath.getFileName().toString()));
312 } catch (IOException e) {
313 throw new RepositoryException("Could not initialize storage for index path "+localPath);
314 }
315 } else if (localPath.isAbsolute()) {
316 indexCreationFeature.setLocalIndexPath(repositoryGroup.getAsset(repoGroupPath.relativize(localPath).toString()));
317 } else
318 {
319 indexCreationFeature.setLocalIndexPath(repositoryGroup.getAsset(localPath.toString()));
320 }
321 }
322
323 }
324
325 @Override
326 public RemoteRepositoryConfiguration getRemoteConfiguration(RemoteRepository remoteRepository) throws RepositoryException {
327 if (!(remoteRepository instanceof MavenRemoteRepository)) {
328 log.error("Wrong remote repository type " + remoteRepository.getClass().getName());
329 throw new RepositoryException("The given repository type cannot be handled by the maven provider: " + remoteRepository.getClass().getName());
330 }
331 RemoteRepositoryConfigurationtoryConfiguration.html#RemoteRepositoryConfiguration">RemoteRepositoryConfiguration cfg = new RemoteRepositoryConfiguration();
332 cfg.setType(remoteRepository.getType().toString());
333 cfg.setId(remoteRepository.getId());
334 cfg.setName(remoteRepository.getName());
335 cfg.setDescription(remoteRepository.getDescription());
336 cfg.setUrl(remoteRepository.getLocation().toString());
337 cfg.setTimeout((int) remoteRepository.getTimeout().toMillis() / 1000);
338 cfg.setCheckPath(remoteRepository.getCheckPath());
339 RepositoryCredentials creds = remoteRepository.getLoginCredentials();
340 if (creds != null) {
341 if (creds instanceof PasswordCredentials) {
342 PasswordCredentials./org/apache/archiva/repository/base/PasswordCredentials.html#PasswordCredentials">PasswordCredentials pCreds = (PasswordCredentials) creds;
343 cfg.setPassword(new String(pCreds.getPassword()));
344 cfg.setUsername(pCreds.getUsername());
345 }
346 }
347 cfg.setLayout(remoteRepository.getLayout());
348 cfg.setExtraParameters(remoteRepository.getExtraParameters());
349 cfg.setExtraHeaders(remoteRepository.getExtraHeaders());
350 cfg.setRefreshCronExpression(remoteRepository.getSchedulingDefinition());
351
352 IndexCreationFeature indexCreationFeature = remoteRepository.getFeature(IndexCreationFeature.class).get();
353 cfg.setIndexDir(convertUriToPath(indexCreationFeature.getIndexPath()));
354 cfg.setPackedIndexDir(convertUriToPath(indexCreationFeature.getPackedIndexPath()));
355
356 RemoteIndexFeature remoteIndexFeature = remoteRepository.getFeature(RemoteIndexFeature.class).get();
357 if (remoteIndexFeature.getIndexUri() != null) {
358 cfg.setRemoteIndexUrl(remoteIndexFeature.getIndexUri().toString());
359 }
360 cfg.setRemoteDownloadTimeout((int) remoteIndexFeature.getDownloadTimeout().get(ChronoUnit.SECONDS));
361 cfg.setDownloadRemoteIndexOnStartup(remoteIndexFeature.isDownloadRemoteIndexOnStartup());
362 cfg.setDownloadRemoteIndex(remoteIndexFeature.isDownloadRemoteIndex());
363 cfg.setRemoteDownloadNetworkProxyId(remoteIndexFeature.getProxyId());
364 if (!StringUtils.isEmpty(remoteIndexFeature.getProxyId())) {
365 cfg.setRemoteDownloadNetworkProxyId(remoteIndexFeature.getProxyId());
366 } else {
367 cfg.setRemoteDownloadNetworkProxyId("");
368 }
369
370
371
372
373 return cfg;
374
375 }
376
377 @Override
378 public ManagedRepositoryConfiguration getManagedConfiguration(ManagedRepository managedRepository) throws RepositoryException {
379 if (!(managedRepository instanceof MavenManagedRepository || managedRepository instanceof BasicManagedRepository )) {
380 log.error("Wrong remote repository type " + managedRepository.getClass().getName());
381 throw new RepositoryException("The given repository type cannot be handled by the maven provider: " + managedRepository.getClass().getName());
382 }
383 ManagedRepositoryConfigurationtoryConfiguration.html#ManagedRepositoryConfiguration">ManagedRepositoryConfiguration cfg = new ManagedRepositoryConfiguration();
384 cfg.setType(managedRepository.getType().toString());
385 cfg.setId(managedRepository.getId());
386 cfg.setName(managedRepository.getName());
387 cfg.setDescription(managedRepository.getDescription());
388 cfg.setLocation(convertUriToPath(managedRepository.getLocation()));
389 cfg.setLayout(managedRepository.getLayout());
390 cfg.setRefreshCronExpression(managedRepository.getSchedulingDefinition());
391 cfg.setScanned(managedRepository.isScanned());
392 cfg.setBlockRedeployments(managedRepository.blocksRedeployments());
393 StagingRepositoryFeature stagingRepositoryFeature = managedRepository.getFeature(StagingRepositoryFeature.class).get();
394 cfg.setStageRepoNeeded(stagingRepositoryFeature.isStageRepoNeeded());
395 IndexCreationFeature indexCreationFeature = managedRepository.getFeature(IndexCreationFeature.class).get();
396 cfg.setIndexDir(convertUriToPath(indexCreationFeature.getIndexPath()));
397 cfg.setPackedIndexDir(convertUriToPath(indexCreationFeature.getPackedIndexPath()));
398 cfg.setSkipPackedIndexCreation(indexCreationFeature.isSkipPackedIndexCreation());
399
400 ArtifactCleanupFeature artifactCleanupFeature = managedRepository.getFeature(ArtifactCleanupFeature.class).get();
401 cfg.setRetentionCount(artifactCleanupFeature.getRetentionCount());
402 cfg.setRetentionPeriod(artifactCleanupFeature.getRetentionPeriod().getDays());
403 cfg.setDeleteReleasedSnapshots(artifactCleanupFeature.isDeleteReleasedSnapshots());
404
405 if (managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.RELEASE)) {
406 cfg.setReleases(true);
407 } else {
408 cfg.setReleases(false);
409 }
410 if (managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.SNAPSHOT)) {
411 cfg.setSnapshots(true);
412 } else {
413 cfg.setSnapshots(false);
414 }
415 return cfg;
416
417 }
418
419 @Override
420 public RepositoryGroupConfiguration getRepositoryGroupConfiguration(RepositoryGroup repositoryGroup) throws RepositoryException {
421 if (repositoryGroup.getType() != RepositoryType.MAVEN) {
422 throw new RepositoryException("The given repository group is not of MAVEN type");
423 }
424 RepositoryGroupConfigurationroupConfiguration.html#RepositoryGroupConfiguration">RepositoryGroupConfiguration cfg = new RepositoryGroupConfiguration();
425 cfg.setId(repositoryGroup.getId());
426 cfg.setName(repositoryGroup.getName());
427 if (repositoryGroup.supportsFeature( IndexCreationFeature.class ))
428 {
429 IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ).get();
430
431 cfg.setMergedIndexPath( indexCreationFeature.getIndexPath().toString() );
432 }
433 cfg.setMergedIndexTtl(repositoryGroup.getMergedIndexTTL());
434 cfg.setRepositories(repositoryGroup.getRepositories().stream().map(r -> r.getId()).collect(Collectors.toList()));
435 cfg.setCronExpression(repositoryGroup.getSchedulingDefinition());
436 return cfg;
437 }
438
439 private ManagedRepositoryConfiguration/configuration/ManagedRepositoryConfiguration.html#ManagedRepositoryConfiguration">ManagedRepositoryConfiguration getStageRepoConfig(ManagedRepositoryConfiguration repository) {
440 ManagedRepositoryConfigurationion.html#ManagedRepositoryConfiguration">ManagedRepositoryConfiguration stagingRepository = new ManagedRepositoryConfiguration();
441 stagingRepository.setId(repository.getId() + StagingRepositoryFeature.STAGING_REPO_POSTFIX);
442 stagingRepository.setLayout(repository.getLayout());
443 stagingRepository.setName(repository.getName() + StagingRepositoryFeature.STAGING_REPO_POSTFIX);
444 stagingRepository.setBlockRedeployments(repository.isBlockRedeployments());
445 stagingRepository.setRetentionPeriod(repository.getRetentionPeriod());
446 stagingRepository.setDeleteReleasedSnapshots(repository.isDeleteReleasedSnapshots());
447 stagingRepository.setStageRepoNeeded(false);
448
449 String path = repository.getLocation();
450 int lastIndex = path.replace('\\', '/').lastIndexOf('/');
451 stagingRepository.setLocation(path.substring(0, lastIndex) + "/" + stagingRepository.getId());
452
453 if (StringUtils.isNotBlank(repository.getIndexDir())) {
454 Path indexDir = null;
455 try {
456 indexDir = Paths.get(new URI(repository.getIndexDir().startsWith("file://") ? repository.getIndexDir() : "file://" + repository.getIndexDir()));
457 if (indexDir.isAbsolute()) {
458 Path newDir = indexDir.getParent().resolve(indexDir.getFileName() + StagingRepositoryFeature.STAGING_REPO_POSTFIX);
459 log.debug("Changing index directory {} -> {}", indexDir, newDir);
460 stagingRepository.setIndexDir(newDir.toString());
461 } else {
462 log.debug("Keeping index directory {}", repository.getIndexDir());
463 stagingRepository.setIndexDir(repository.getIndexDir());
464 }
465 } catch (URISyntaxException e) {
466 log.error("Could not parse index path as uri {}", repository.getIndexDir());
467 stagingRepository.setIndexDir("");
468 }
469
470 }
471 if (StringUtils.isNotBlank(repository.getPackedIndexDir())) {
472 Path packedIndexDir = null;
473 packedIndexDir = Paths.get(repository.getPackedIndexDir());
474 if (packedIndexDir.isAbsolute()) {
475 Path newDir = packedIndexDir.getParent().resolve(packedIndexDir.getFileName() + StagingRepositoryFeature.STAGING_REPO_POSTFIX);
476 log.debug("Changing index directory {} -> {}", packedIndexDir, newDir);
477 stagingRepository.setPackedIndexDir(newDir.toString());
478 } else {
479 log.debug("Keeping index directory {}", repository.getPackedIndexDir());
480 stagingRepository.setPackedIndexDir(repository.getPackedIndexDir());
481 }
482
483 }
484 stagingRepository.setRefreshCronExpression(repository.getRefreshCronExpression());
485 stagingRepository.setReleases(repository.isReleases());
486 stagingRepository.setRetentionCount(repository.getRetentionCount());
487 stagingRepository.setScanned(repository.isScanned());
488 stagingRepository.setSnapshots(repository.isSnapshots());
489 stagingRepository.setSkipPackedIndexCreation(repository.isSkipPackedIndexCreation());
490
491
492 return stagingRepository;
493 }
494
495 private void setBaseConfig(EditableRepository repo, AbstractRepositoryConfiguration cfg) throws RepositoryException {
496
497 URI baseUri = archivaConfiguration.getRepositoryBaseDir().toUri();
498 repo.setBaseUri(baseUri);
499
500 repo.setName(repo.getPrimaryLocale(), cfg.getName());
501 repo.setDescription(repo.getPrimaryLocale(), cfg.getDescription());
502 repo.setLayout(cfg.getLayout());
503 }
504
505 public ArchivaConfiguration getArchivaConfiguration() {
506 return archivaConfiguration;
507 }
508
509 public void setArchivaConfiguration(ArchivaConfiguration archivaConfiguration) {
510 this.archivaConfiguration = archivaConfiguration;
511 }
512
513 @Override
514 public void handle(Event event) {
515
516 }
517
518 }