fix MRM-667 thanks to James William Dumay pacth

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@615848 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nicolas De Loof 2008-01-28 10:39:48 +00:00
parent 913039e58f
commit ef81ce7ee6
6 changed files with 38 additions and 3 deletions

View File

@ -334,6 +334,15 @@
The Password for this repository.
</description>
</field>
<field>
<name>timeout</name>
<version>1.0.1+</version>
<type>int</type>
<description>
Timeout in seconds for connections to this repository
</description>
<defaultValue>60</defaultValue>
</field>
</fields>
</class>
<class>

View File

@ -21,6 +21,7 @@ package org.apache.maven.archiva.proxy;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.ConfigurationNames;
@ -64,6 +65,8 @@ import org.codehaus.plexus.util.SelectorUtils;
import java.io.File;
import java.io.IOException;
import java.net.URLClassLoader;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@ -829,6 +832,12 @@ public class DefaultRepositoryProxyConnectors
getLogger().debug( "No authentication for remote repository needed" );
}
//Convert seconds to milliseconds
int timeoutInMilliseconds = remoteRepository.getRepository().getTimeout() * 1000;
//Set timeout
wagon.setTimeout(timeoutInMilliseconds);
Repository wagonRepository = new Repository( remoteRepository.getId(), remoteRepository.getURL().toString() );
if ( networkProxy != null )
{

View File

@ -96,6 +96,16 @@ public class WagonDelegate
{
return delegate.supportsDirectoryCopy();
}
public void setTimeout(int val)
{
// ignore
}
public int getTimeout()
{
return 0;
}
public Repository getRepository()
{

View File

@ -125,7 +125,7 @@
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http-lightweight</artifactId>
<artifactId>wagon-http</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>

View File

@ -23,5 +23,6 @@
<ww:textfield name="repository.url" label="URL" size="50" required="true"/>
<ww:textfield name="repository.username" label="Username" size="25" required="false"/>
<ww:password name="repository.password" label="Password" size="25" required="false"/>
<ww:textfield name="repository.timeout" label="Timeout in seconds" size="3" required="false"/>
<ww:select list="#@java.util.LinkedHashMap@{'default' : 'Maven 2.x Repository', 'legacy' : 'Maven 1.x Repository'}"
name="repository.layout" label="Type"/>

10
pom.xml
View File

@ -436,6 +436,12 @@
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-app-configuration-web</artifactId>
<version>1.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http-lightweight</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
@ -671,7 +677,7 @@
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http-lightweight</artifactId>
<artifactId>wagon-http</artifactId>
<version>${wagon.version}</version>
</dependency>
<dependency>
@ -873,7 +879,7 @@
</profiles>
<properties>
<maven.version>2.0.5</maven.version>
<wagon.version>1.0-beta-2</wagon.version>
<wagon.version>1.0-rc1-SNAPSHOT</wagon.version>
<redback.version>1.0-alpha-4</redback.version>
</properties>
<distributionManagement>