Example usage for org.apache.maven.artifact.manager WagonManager getWagon

List of usage examples for org.apache.maven.artifact.manager WagonManager getWagon

Introduction

In this page you can find the example usage for org.apache.maven.artifact.manager WagonManager getWagon.

Prototype

@Deprecated
    Wagon getWagon(String protocol) throws UnsupportedProtocolException;

Source Link

Usage

From source file:com.google.dart.util.WagonUtils.java

License:Apache License

/**
 * Convenient method to create a wagon/*from  w  w w.  j  ava2  s. co  m*/
 * 
 * @param id
 * @param url
 * @param wagonManager
 * @param settings
 * @param logger
 * @return
 * @throws MojoExecutionException
 */
public static Wagon createWagon(final String id, final String url, final WagonManager wagonManager,
        final Settings settings, final Log logger)
        throws WagonException, UnsupportedProtocolException, WagonConfigurationException {
    Wagon wagon = null;

    final Repository repository = new Repository(id, url);

    wagon = wagonManager.getWagon(repository);

    if (logger.isDebugEnabled()) {
        final Debug debug = new Debug();
        wagon.addSessionListener(debug);
        wagon.addTransferListener(debug);
    }

    final ProxyInfo proxyInfo = getProxyInfo(settings);
    if (proxyInfo != null) {
        wagon.connect(repository, wagonManager.getAuthenticationInfo(repository.getId()), proxyInfo);
    } else {
        wagon.connect(repository, wagonManager.getAuthenticationInfo(repository.getId()));
    }

    return wagon;
}

From source file:com.opoopress.maven.plugins.plugin.AbstractDeployMojo.java

License:Apache License

private static Wagon getWagon(final Repository repository, final WagonManager manager)
        throws MojoExecutionException {
    final Wagon wagon;

    try {/*from ww  w.j  a va  2  s .co  m*/
        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;
}

From source file:org.codehaus.mojo.versions.utils.WagonUtils.java

License:Apache License

/**
 * Convenience method to create a wagon.
 *
 * @param serverId     The serverId to use if the wagonManager needs help.
 * @param url          The url to create a wagon for.
 * @param wagonManager The wgaon manager to use.
 * @param settings     The settings to use.
 * @param logger       The logger to use.
 * @return The wagon to connect to the url.
 * @throws org.apache.maven.wagon.UnsupportedProtocolException
 *          if the protocol is not supported.
 * @throws org.apache.maven.artifact.manager.WagonConfigurationException
 *          if the wagon cannot be configured.
 * @throws org.apache.maven.wagon.ConnectionException
 *          If the connection cannot be established.
 * @throws org.apache.maven.wagon.authentication.AuthenticationException
 *          If the connection cannot be authenticated.
 *///w  w  w.  ja va 2  s. com
public static Wagon createWagon(String serverId, String url, WagonManager wagonManager, Settings settings,
        Log logger) throws UnsupportedProtocolException, WagonConfigurationException, ConnectionException,
        AuthenticationException {
    Repository repository = new Repository(serverId, url);
    Wagon wagon = wagonManager.getWagon(repository);

    if (logger.isDebugEnabled()) {
        Debug debug = new Debug();
        wagon.addSessionListener(debug);
        wagon.addTransferListener(debug);
    }

    ProxyInfo proxyInfo = getProxyInfo(settings);
    if (proxyInfo != null) {
        wagon.connect(repository, wagonManager.getAuthenticationInfo(repository.getId()), proxyInfo);
    } else {
        wagon.connect(repository, wagonManager.getAuthenticationInfo(repository.getId()));
    }
    return wagon;
}

From source file:org.codehaus.mojo.wagon.shared.WagonUtils.java

License:Apache License

/**
 * Convenient method to create a wagon//from ww w .j  a v  a2  s  .co m
 * 
 * @param id
 * @param url
 * @param wagonManager
 * @param settings
 * @param logger
 * @return
 * @throws MojoExecutionException
 */
public static Wagon createWagon(String id, String url, WagonManager wagonManager, Settings settings, Log logger)
        throws WagonException, UnsupportedProtocolException, WagonConfigurationException {
    Wagon wagon = null;

    final Repository repository = new Repository(id, url);

    wagon = wagonManager.getWagon(repository);

    if (logger.isDebugEnabled()) {
        Debug debug = new Debug();
        wagon.addSessionListener(debug);
        wagon.addTransferListener(debug);
    }

    ProxyInfo proxyInfo = getProxyInfo(settings);
    if (proxyInfo != null) {
        wagon.connect(repository, wagonManager.getAuthenticationInfo(repository.getId()), proxyInfo);
    } else {
        wagon.connect(repository, wagonManager.getAuthenticationInfo(repository.getId()));
    }

    return wagon;
}