use of org.sonatype.aether.spi.localrepo.LocalRepositoryManagerFactory in project sonatype-aether by sonatype.
the class DefaultLocalRepositoryProvider method newLocalRepositoryManager.
public LocalRepositoryManager newLocalRepositoryManager(LocalRepository localRepository) throws NoLocalRepositoryManagerException {
List<LocalRepositoryManagerFactory> factories = new ArrayList<LocalRepositoryManagerFactory>(managerFactories);
Collections.sort(factories, COMPARATOR);
for (LocalRepositoryManagerFactory factory : factories) {
try {
LocalRepositoryManager manager = factory.newInstance(localRepository);
if (logger.isDebugEnabled()) {
StringBuilder buffer = new StringBuilder(256);
buffer.append("Using manager ").append(manager.getClass().getSimpleName());
buffer.append(" with priority ").append(factory.getPriority());
buffer.append(" for ").append(localRepository.getBasedir());
logger.debug(buffer.toString());
}
return manager;
} catch (NoLocalRepositoryManagerException e) {
// continue and try next factory
}
}
StringBuilder buffer = new StringBuilder(256);
buffer.append("No manager available for local repository ");
buffer.append(localRepository.getBasedir());
buffer.append(" of type ").append(localRepository.getContentType());
buffer.append(" using the available factories ");
for (ListIterator<LocalRepositoryManagerFactory> it = factories.listIterator(); it.hasNext(); ) {
LocalRepositoryManagerFactory factory = it.next();
buffer.append(factory.getClass().getSimpleName());
if (it.hasNext()) {
buffer.append(", ");
}
}
throw new NoLocalRepositoryManagerException(localRepository, buffer.toString());
}
use of org.sonatype.aether.spi.localrepo.LocalRepositoryManagerFactory in project sonatype-aether by sonatype.
the class PlexusSupportTest method testExistenceOfPlexusComponentMetadata.
public void testExistenceOfPlexusComponentMetadata() throws Exception {
getContainer().addComponent(new StubVersionRangeResolver(), VersionRangeResolver.class, null);
getContainer().addComponent(new StubVersionResolver(), VersionResolver.class, null);
getContainer().addComponent(new StubArtifactDescriptorReader(), ArtifactDescriptorReader.class, null);
RepositorySystem repoSystem = lookup(RepositorySystem.class);
assertNotNull(repoSystem);
assertSame(repoSystem, lookup(RepositorySystem.class));
List<LocalRepositoryManagerFactory> lrmfs = getContainer().lookupList(LocalRepositoryManagerFactory.class);
assertNotNull(lrmfs);
assertEquals(2, lrmfs.size());
}
Aggregations