/** * Checks the URL to see if this repository refers to an external repository. * * @param repository The repository to check, must not be {@code null}. * @return {@code true} if external, {@code false} otherwise. */ static boolean isExternalRepo( RemoteRepository repository ) { boolean local = "localhost".equals( repository.getHost() ) || "127.0.0.1".equals( repository.getHost() ) || "file".equalsIgnoreCase( repository.getProtocol() ); return !local; }
public RepositoryConnector newInstance( RepositorySystemSession session, RemoteRepository repository ) throws NoRepositoryConnectorException { if ( "file".equalsIgnoreCase( repository.getProtocol() ) ) { FileRepositoryConnector connector = new FileRepositoryConnector( session, repository, fileProcessor, logger ); return connector; } throw new NoRepositoryConnectorException( repository ); }
String protocol = repository.getProtocol().toLowerCase( Locale.ENGLISH );
if ( !repository.getProtocol().regionMatches( true, 0, "http", 0, "http".length() ) && !repository.getProtocol().regionMatches( true, 0, "dav", 0, "dav".length() ) )
if ( !repository.getProtocol().regionMatches( true, 0, "http", 0, "http".length() ) && !repository.getProtocol().regionMatches( true, 0, "dav", 0, "dav".length() ) )
/** * Create collect request. * @param root The root to start with * @return The request */ private CollectRequest request(final Dependency root) { final CollectRequest request = new CollectRequest(); request.setRoot(root); for (final Repository repo : this.remotes) { final RemoteRepository remote = repo.remote(); if (!remote.getProtocol().matches("https?|file|s3")) { Logger.warn( this, "%s ignored (only S3, HTTP/S, and FILE are supported)", repo ); continue; } request.addRepository(remote); } return request; }
private ProxyServer getProxy( RemoteRepository repository, String credentialEncoding ) { ProxyServer proxyServer = null; Proxy p = repository.getProxy(); if ( p != null ) { Authentication a = p.getAuthentication(); boolean useSSL = repository.getProtocol().equalsIgnoreCase( "https" ) || repository.getProtocol().equalsIgnoreCase( "dav:https" ); if ( a == null ) { proxyServer = new ProxyServer( useSSL ? Protocol.HTTPS : Protocol.HTTP, p.getHost(), p.getPort() ); } else { proxyServer = new ProxyServer( useSSL ? Protocol.HTTPS : Protocol.HTTP, p.getHost(), p.getPort(), a.getUsername(), a.getPassword() ); proxyServer.setEncoding( credentialEncoding ); } } return proxyServer; }
private ProxyServer getProxy( RemoteRepository repository, String credentialEncoding ) { ProxyServer proxyServer = null; Proxy p = repository.getProxy(); if ( p != null ) { Authentication a = p.getAuthentication(); boolean useSSL = repository.getProtocol().equalsIgnoreCase( "https" ) || repository.getProtocol().equalsIgnoreCase( "dav:https" ); if ( a == null ) { proxyServer = new ProxyServer( useSSL ? Protocol.HTTPS : Protocol.HTTP, p.getHost(), p.getPort() ); } else { proxyServer = new ProxyServer( useSSL ? Protocol.HTTPS : Protocol.HTTP, p.getHost(), p.getPort(), a.getUsername(), a.getPassword() ); proxyServer.setEncoding( credentialEncoding ); } } return proxyServer; }