@Override @Deprecated public Wagon getWagon( Repository repository ) throws UnsupportedProtocolException { return getWagon( repository.getProtocol() ); }
private static Wagon getWagon(final Repository repository, final WagonManager manager) throws MojoExecutionException { final Wagon wagon; try { wagon = manager.getWagon(repository); } catch (UnsupportedProtocolException e) { throw new MojoExecutionException("Unsupported protocol: '" + repository.getProtocol() + "'", e); } catch (WagonConfigurationException e) { throw new MojoExecutionException("Unable to configure Wagon: '" + repository.getProtocol() + "'", e); } if (!wagon.supportsDirectoryCopy()) { throw new MojoExecutionException("Wagon protocol '" + repository.getProtocol() + "' doesn't support directory copying"); } return wagon; }
private Wagon getWagon( Repository repository ) throws UnsupportedProtocolException { return getWagon( repository.getProtocol() ); }
public static ProxyInfo getProxyInfo(Repository repository, WagonManager wagonManager) { ProxyInfo proxyInfo = wagonManager.getProxy(repository.getProtocol());
private Wagon getWagon( final Repository repository, final WagonManager manager ) throws MojoExecutionException { final Wagon wagon; try { wagon = manager.getWagon( repository ); } catch ( UnsupportedProtocolException e ) { String shortMessage = "Unsupported protocol: '" + repository.getProtocol() + "' for site deployment to " + "distributionManagement.site.url=" + repository.getUrl() + "."; String longMessage = "\n" + shortMessage + "\n" + "Currently supported protocols are: " + getSupportedProtocols() + ".\n" + " Protocols may be added through wagon providers.\n" + " For more information, see " + "http://maven.apache.org/plugins/maven-site-plugin/examples/adding-deploy-protocol.html"; getLog().error( longMessage ); throw new MojoExecutionException( shortMessage ); } catch ( TransferFailedException e ) { throw new MojoExecutionException( "Unable to configure Wagon: '" + repository.getProtocol() + "'", e ); } if ( !wagon.supportsDirectoryCopy() ) { throw new MojoExecutionException( "Wagon protocol '" + repository.getProtocol() + "' doesn't support directory copying" ); } return wagon; }
public Wagon getWagon( Repository repository ) throws UnsupportedProtocolException, WagonConfigurationException { String protocol = repository.getProtocol(); if ( protocol == null ) { throw new UnsupportedProtocolException( "The repository " + repository + " does not specify a protocol" ); } Wagon wagon = getWagon( protocol, repository.getId() ); return wagon; }
throw new MojoExecutionException( "Unsupported protocol: '" + repository.getProtocol() + "'", e ); throw new MojoExecutionException( "Unable to configure Wagon: '" + repository.getProtocol() + "'", e );
private HttpHost getTargetHost() { String protocol = getRepository().getProtocol(); if (protocol.contains("https")) { return new HttpHost(getRepository().getHost(), getRepository().getPort(), "https"); } else { return new HttpHost(getRepository().getHost(), getRepository().getPort(), "http"); } }
public WagonHttpRepository(Log log,WagonManager wagonManager) throws ConnectionException, AuthenticationException, WagonConfigurationException, UnsupportedProtocolException { this.log = log; this.rep = new Repository(URL_REPO, URL_REPO); this.w = wagonManager.getWagon(rep); w.connect(rep, wagonManager.getProxy(rep.getProtocol())); }
private ProxyInfo getProxyInfo( Repository repository ) { Settings settings = getSettings(); if ( settings.getProxies() != null && !settings.getProxies().isEmpty() ) { for ( Iterator i = settings.getProxies().iterator(); i.hasNext(); ) { Proxy p = (Proxy) i.next(); wagonManager.addProxy( p.getProtocol(), p.getHost(), p.getPort(), p.getUsername(), p.getPassword(), p.getNonProxyHosts() ); } } return wagonManager.getProxy( repository.getProtocol() ); }
private Wagon createAndConfigureWagon( String repositoryId, Settings settings, Repository repository ) throws WagonException { Wagon wagon = null; for ( Server server : settings.getServers() ) { String id = server.getId(); if ( id != null && id.equals( repositoryId ) ) { Xpp3Dom configuration = (Xpp3Dom) server.getConfiguration(); String url = configuration == null ? null : configuration.getAttribute( "url" ); if ( StringUtils.isBlank( url ) ) { throw new NullPointerException( "url cannot be null" ); } repository.setUrl( url ); wagon = getWagon( repository.getProtocol() ); configureWagon( wagon, repositoryId, server ); break; } } return wagon; }
private void deploy(SiteImpl site, File directory, Repository repository) throws MojoExecutionException, MojoFailureException { // TODO: work on moving this into the deployer like the other deploy // methods final Wagon wagon = getWagon(repository, wagonManager); try { configureWagon(wagon, repository.getId(), settings, container, getLog()); } catch (WagonConfigurationException e) { throw new MojoExecutionException("Unable to configure Wagon: '" + repository.getProtocol() + "'", e); } String relativeDir = site.getRoot(); if ("".equals(relativeDir)) { relativeDir = "./"; } else if (relativeDir.startsWith("/")) { relativeDir = relativeDir.substring(1); } try { final ProxyInfo proxyInfo = getProxyInfo(repository, wagonManager); push(directory, repository, wagonManager, wagon, proxyInfo, relativeDir, getLog()); if (chmod) { chmod(wagon, repository, chmodOptions, chmodMode); } } finally { try { wagon.disconnect(); } catch (ConnectionException e) { getLog().error("Error disconnecting wagon - ignored", e); } } }
private int doMkCol( String url ) throws IOException { Repository repo = getRepository(); HttpHost targetHost = new HttpHost( repo.getHost(), repo.getPort(), repo.getProtocol() ); AuthScope targetScope = getBasicAuthScope().getScope( targetHost ); if ( getCredentialsProvider().getCredentials( targetScope ) != null ) { BasicScheme targetAuth = new BasicScheme(); getAuthCache().put( targetHost, targetAuth ); } HttpMkcol method = new HttpMkcol( url ); try ( CloseableHttpResponse closeableHttpResponse = execute( method ) ) { return closeableHttpResponse.getStatusLine().getStatusCode(); } catch ( HttpException e ) { throw new IOException( e.getMessage(), e ); } finally { if ( method != null ) { method.releaseConnection(); } } }
wagonRepo.setPermissions( getPermissions( repository.getId(), session ) ); wagonHint = wagonRepo.getProtocol().toLowerCase( Locale.ENGLISH ); if ( wagonHint == null || wagonHint.length() <= 0 )
private int doMkCol( String url ) throws IOException { Repository repo = getRepository(); HttpHost targetHost = new HttpHost( repo.getHost(), repo.getPort(), repo.getProtocol() ); AuthScope targetScope = getBasicAuthScope().getScope( targetHost ); if ( getCredentialsProvider().getCredentials( targetScope ) != null ) { BasicScheme targetAuth = new BasicScheme(); getAuthCache().put( targetHost, targetAuth ); } HttpMkcol method = new HttpMkcol( url ); try ( CloseableHttpResponse closeableHttpResponse = execute( method ) ) { return closeableHttpResponse.getStatusLine().getStatusCode(); } catch ( HttpException e ) { throw new IOException( e.getMessage(), e ); } finally { if ( method != null ) { method.releaseConnection(); } } }
private ProxyInfo getProxyInfo( Repository repository ) { Settings settings = getSettings(); if ( settings.getProxies() != null && !settings.getProxies().isEmpty() ) { for ( Proxy p : (List<Proxy>) settings.getProxies() ) { wagonManager.addProxy( p.getProtocol(), p.getHost(), p.getPort(), p.getUsername(), p.getPassword(), p.getNonProxyHosts() ); } } return wagonManager.getProxy( repository.getProtocol() ); }
ProxyInfo proxyInfo = getProxyInfo( getRepository().getProtocol(), getRepository().getHost() ); if ( proxyInfo != null )
private ArchetypeCatalog downloadCatalog( ArtifactRepository repository ) throws WagonException, IOException, ArchetypeDataSourceException { getLogger().debug( "Searching for remote catalog: " + repository.getUrl() + "/" + ARCHETYPE_CATALOG_FILENAME ); // We use wagon to take advantage of a Proxy that has already been setup in a Maven environment. Repository wagonRepository = new Repository( repository.getId(), repository.getUrl() ); AuthenticationInfo authInfo = getAuthenticationInfo( wagonRepository.getId() ); ProxyInfo proxyInfo = getProxy( wagonRepository.getProtocol() ); Wagon wagon = getWagon( wagonRepository ); File catalog = File.createTempFile( "archetype-catalog", ".xml" ); try { wagon.connect( wagonRepository, authInfo, proxyInfo ); wagon.get( ARCHETYPE_CATALOG_FILENAME, catalog ); return readCatalog( ReaderFactory.newXmlReader( catalog ) ); } finally { disconnectWagon( wagon ); catalog.delete(); } }
@Override public Wagon create( String url, String serverId, Settings settings ) throws WagonException { final Repository repository = new Repository( serverId, url == null ? "" : url ); repository.setPermissions( getPermissions( serverId, settings ) ); Wagon wagon; if ( url == null ) { wagon = createAndConfigureWagon( serverId, settings, repository ); } else { wagon = getWagon( repository.getProtocol() ); configureWagon( wagon, serverId, settings ); } if ( logger.isDebugEnabled() ) { Debug debug = new Debug(); wagon.addSessionListener( debug ); wagon.addTransferListener( debug ); } AuthenticationInfo authInfo = getAuthenticationInfo( serverId, settings ); ProxyInfo proxyInfo = getProxyInfo( settings ); wagon.connect( repository, authInfo, proxyInfo ); return wagon; }
String basedir = repository.getBasedir(); String baseUrl = repository.getProtocol() + "://" + repository.getHost(); if ( repository.getPort() != WagonConstants.UNKNOWN_PORT )