<groupId>org.apache.archiva</groupId>
<artifactId>archiva-plexus-bridge</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-repository-admin-api</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-provider-api</artifactId>
org.springframework.stereotype;version="[3,4)",
org.springframework.context;version="[3,4)",
org.springframework.beans;version="[3,4)",
+ org.apache.archiva.admin.model.beans;version=${project.version},
org.apache.maven.wagon*,
org.slf4j;resolution:=optional
</Import-Package>
? wagonFactoryRequest.getProtocol()
: "wagon#" + wagonFactoryRequest.getProtocol();
+ // if it's a ntlm proxy we have to lookup the wagon light which support thats
+ // wagon http client doesn't support that
+ if ( wagonFactoryRequest.getNetworkProxy() != null && wagonFactoryRequest.getNetworkProxy().isUseNtlm() )
+ {
+ protocol = protocol + "-ntlm";
+ }
+
Wagon wagon = applicationContext.getBean( protocol, Wagon.class );
wagon.addTransferListener( debugTransferListener );
configureUserAgent( wagon, wagonFactoryRequest );
* under the License.
*/
+import org.apache.archiva.admin.model.beans.NetworkProxy;
+
import java.util.HashMap;
import java.util.Map;
private String userAgent = "Java-Archiva";
+ private NetworkProxy networkProxy;
+
public WagonFactoryRequest()
{
// no op
return this;
}
+ public NetworkProxy getNetworkProxy()
+ {
+ return networkProxy;
+ }
+
+ public void setNetworkProxy( NetworkProxy networkProxy )
+ {
+ this.networkProxy = networkProxy;
+ }
+
+ public WagonFactoryRequest networkProxy( NetworkProxy networkProxy )
+ {
+ this.networkProxy = networkProxy;
+ return this;
+ }
+
@Override
public boolean equals( Object o )
{
tempIndexDirectory.deleteOnExit();
String baseIndexUrl = indexingContext.getIndexUpdateUrl();
- String wagonProtocol =
- new URL( this.remoteRepository.getUrl() ).getProtocol() + ( ( this.networkProxy != null
- && this.networkProxy.isUseNtlm() ) ? "-ntlm" : "" );
+ String wagonProtocol = new URL( this.remoteRepository.getUrl() ).getProtocol();
final StreamWagon wagon = (StreamWagon) wagonFactory.getWagon(
- new WagonFactoryRequest( wagonProtocol, this.remoteRepository.getExtraHeaders() ) );
+ new WagonFactoryRequest( wagonProtocol, this.remoteRepository.getExtraHeaders() ).networkProxy(
+ this.networkProxy ) );
int timeoutInMilliseconds = remoteRepository.getTimeout() * 1000;
// FIXME olamy having 2 config values
wagon.setReadTimeout( timeoutInMilliseconds );
String protocol = getProtocol( remoteRepository.getUrl() );
final NetworkProxy networkProxy = this.networkProxyMap.get( remoteRepository.getId() );
- // if it's a ntlm proxy we have to lookup the wagon light which support thats
- // wagon http client doesn't support that
- wagon = ( networkProxy != null && networkProxy.isUseNtlm() )
- ? wagonFactory.getWagon(
- new WagonFactoryRequest( "wagon#" + protocol + "-ntlm", remoteRepository.getExtraHeaders() ) )
- : wagonFactory.getWagon(
- new WagonFactoryRequest( "wagon#" + protocol, remoteRepository.getExtraHeaders() ) );
- if ( wagon == null )
- {
- wagon = wagonFactory.getWagon(
- new WagonFactoryRequest( "wagon#" + protocol, remoteRepository.getExtraHeaders() ) );
- }
+ wagon = wagonFactory.getWagon(
+ new WagonFactoryRequest( "wagon#" + protocol, remoteRepository.getExtraHeaders() ).networkProxy(
+ networkProxy ) );
+
if ( wagon == null )
{
throw new RuntimeException( "Unsupported remote repository protocol: " + protocol );