use of org.apache.archiva.converter.RepositoryConversionException in project archiva by apache.
the class DefaultLegacyRepositoryConverter method convertLegacyRepository.
@Override
public void convertLegacyRepository(Path legacyRepositoryDirectory, Path repositoryDirectory, List<String> fileExclusionPatterns) throws RepositoryConversionException {
try {
String defaultRepositoryUrl = PathUtil.toUrl(repositoryDirectory);
BasicManagedRepository legacyRepository = new BasicManagedRepository("legacy", "Legacy Repository", repositoryDirectory.getParent());
legacyRepository.setLocation(legacyRepositoryDirectory.toAbsolutePath().toUri());
legacyRepository.setLayout("legacy");
ArtifactRepository repository = artifactRepositoryFactory.createArtifactRepository("default", defaultRepositoryUrl, defaultLayout, null, null);
legacyConverterConsumer.setExcludes(fileExclusionPatterns);
legacyConverterConsumer.setDestinationRepository(repository);
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<>(1);
knownConsumers.add(legacyConverterConsumer);
List<InvalidRepositoryContentConsumer> invalidConsumers = Collections.emptyList();
List<String> ignoredContent = new ArrayList<String>(Arrays.asList(RepositoryScanner.IGNORABLE_CONTENT));
repoScanner.scan(legacyRepository, knownConsumers, invalidConsumers, ignoredContent, RepositoryScanner.FRESH_SCAN);
} catch (RepositoryScannerException e) {
throw new RepositoryConversionException("Error convering legacy repository.", e);
}
}
Aggregations