use of org.sonatype.aether.spi.connector.RepositoryConnectorFactory in project sonatype-aether by sonatype.
the class PlexusSupportTest method testExistenceOfPlexusComponentMetadata.
public void testExistenceOfPlexusComponentMetadata() throws Exception {
getContainer().addComponent(new SysoutLogger(), Logger.class, null);
getContainer().addComponent(new TestFileProcessor(), FileProcessor.class, null);
RepositoryConnectorFactory factory = lookup(RepositoryConnectorFactory.class, "async-http");
assertNotNull(factory);
assertEquals(AsyncRepositoryConnectorFactory.class, factory.getClass());
}
use of org.sonatype.aether.spi.connector.RepositoryConnectorFactory in project sonatype-aether by sonatype.
the class DefaultRemoteRepositoryManager method getRepositoryConnector.
public RepositoryConnector getRepositoryConnector(RepositorySystemSession session, RemoteRepository repository) throws NoRepositoryConnectorException {
if (repository == null) {
throw new IllegalArgumentException("remote repository has not been specified");
}
List<RepositoryConnectorFactory> factories = new ArrayList<RepositoryConnectorFactory>(connectorFactories);
Collections.sort(factories, COMPARATOR);
for (RepositoryConnectorFactory factory : factories) {
try {
RepositoryConnector connector = factory.newInstance(session, repository);
if (logger.isDebugEnabled()) {
StringBuilder buffer = new StringBuilder(256);
buffer.append("Using connector ").append(connector.getClass().getSimpleName());
buffer.append(" with priority ").append(factory.getPriority());
buffer.append(" for ").append(repository.getUrl());
Authentication auth = repository.getAuthentication();
if (auth != null) {
buffer.append(" as ").append(auth.getUsername());
}
Proxy proxy = repository.getProxy();
if (proxy != null) {
buffer.append(" via ").append(proxy.getHost()).append(':').append(proxy.getPort());
auth = proxy.getAuthentication();
if (auth != null) {
buffer.append(" as ").append(auth.getUsername());
}
}
logger.debug(buffer.toString());
}
return connector;
} catch (NoRepositoryConnectorException e) {
// continue and try next factory
}
}
StringBuilder buffer = new StringBuilder(256);
buffer.append("No connector available to access repository ");
buffer.append(repository.getId());
buffer.append(" (").append(repository.getUrl());
buffer.append(") of type ").append(repository.getContentType());
buffer.append(" using the available factories ");
for (ListIterator<RepositoryConnectorFactory> it = factories.listIterator(); it.hasNext(); ) {
RepositoryConnectorFactory factory = it.next();
buffer.append(factory.getClass().getSimpleName());
if (it.hasNext()) {
buffer.append(", ");
}
}
throw new NoRepositoryConnectorException(repository, buffer.toString());
}
use of org.sonatype.aether.spi.connector.RepositoryConnectorFactory in project sonatype-aether by sonatype.
the class PlexusSupportTest method testExistenceOfPlexusComponentMetadata.
public void testExistenceOfPlexusComponentMetadata() throws Exception {
getContainer().addComponent(new SysoutLogger(), Logger.class, null);
getContainer().addComponent(new TestFileProcessor(), FileProcessor.class, null);
RepositoryConnectorFactory factory = lookup(RepositoryConnectorFactory.class, "file");
assertNotNull(factory);
assertEquals(FileRepositoryConnectorFactory.class, factory.getClass());
}
use of org.sonatype.aether.spi.connector.RepositoryConnectorFactory in project sonatype-aether by sonatype.
the class PlexusSupportTest method testExistenceOfPlexusComponentMetadata.
public void testExistenceOfPlexusComponentMetadata() throws Exception {
getContainer().addComponent(new SysoutLogger(), Logger.class, null);
getContainer().addComponent(new TestFileProcessor(), FileProcessor.class, null);
RepositoryConnectorFactory factory = lookup(RepositoryConnectorFactory.class, "wagon");
assertNotNull(factory);
assertEquals(WagonRepositoryConnectorFactory.class, factory.getClass());
}
Aggregations