summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base/archiva-proxy-common
diff options
context:
space:
mode:
Diffstat (limited to 'archiva-modules/archiva-base/archiva-proxy-common')
-rw-r--r--archiva-modules/archiva-base/archiva-proxy-common/pom.xml7
-rwxr-xr-xarchiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/DefaultWagonFactory.java18
-rw-r--r--archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml3
-rw-r--r--archiva-modules/archiva-base/archiva-proxy-common/src/test/resources/META-INF/spring-context.xml2
4 files changed, 26 insertions, 4 deletions
diff --git a/archiva-modules/archiva-base/archiva-proxy-common/pom.xml b/archiva-modules/archiva-base/archiva-proxy-common/pom.xml
index 88446fd9d..898bf1ed5 100644
--- a/archiva-modules/archiva-base/archiva-proxy-common/pom.xml
+++ b/archiva-modules/archiva-base/archiva-proxy-common/pom.xml
@@ -38,6 +38,11 @@
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-http</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-file</artifactId>
<scope>test</scope>
</dependency>
@@ -79,6 +84,8 @@
org.apache.archiva.common.plexusbridge;version=${project.version},
org.apache.commons.lang;version="[2.4,3)",
org.springframework.stereotype;version="[3,4)",
+ org.springframework.context;version="[3,4)",
+ org.springframework.beans;version="[3,4)",
org.apache.maven.wagon*,
org.slf4j;resolution:=optional
</Import-Package>
diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/DefaultWagonFactory.java b/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/DefaultWagonFactory.java
index 3f8f311b9..1e9d6cdf4 100755
--- a/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/DefaultWagonFactory.java
+++ b/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/DefaultWagonFactory.java
@@ -23,6 +23,8 @@ import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.wagon.Wagon;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import javax.inject.Inject;
@@ -38,12 +40,15 @@ public class DefaultWagonFactory
private PlexusSisuBridge plexusSisuBridge;
+ private ApplicationContext applicationContext;
+
private DebugTransferListener debugTransferListener = new DebugTransferListener();
@Inject
- public DefaultWagonFactory( PlexusSisuBridge plexusSisuBridge )
+ public DefaultWagonFactory( PlexusSisuBridge plexusSisuBridge, ApplicationContext applicationContext )
{
this.plexusSisuBridge = plexusSisuBridge;
+ this.applicationContext = applicationContext;
}
public Wagon getWagon( String protocol )
@@ -53,12 +58,17 @@ public class DefaultWagonFactory
{
// with sisu inject bridge hint is file or http
// so remove wagon#
- protocol = StringUtils.remove( protocol, "wagon#" );
- Wagon wagon = plexusSisuBridge.lookup( Wagon.class, protocol );
+ //protocol = StringUtils.remove( protocol, "wagon#" );
+ // spring beans will be named wagon#protocol (http, https, file )
+ protocol = StringUtils.startsWith( protocol, "wagon#" ) ? protocol : "wagon#" + protocol;
+ //Wagon wagon = plexusSisuBridge.lookup( Wagon.class, protocol );
+
+ Wagon wagon = applicationContext.getBean( protocol, Wagon.class );
wagon.addTransferListener( debugTransferListener );
return wagon;
}
- catch ( PlexusSisuBridgeException e )
+ //catch ( PlexusSisuBridgeException e )
+ catch ( BeansException e )
{
throw new WagonFactoryException( e.getMessage(), e );
}
diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml
index eaf7b4146..ef68e5561 100644
--- a/archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml
+++ b/archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml
@@ -30,5 +30,8 @@
<context:annotation-config/>
<context:component-scan base-package="org.apache.archiva.proxy.common"/>
+ <bean name="wagon#http" scope="prototype" class="org.apache.maven.wagon.providers.http.HttpWagon"/>
+
+ <bean name="wagon#https" scope="prototype" class="org.apache.maven.wagon.providers.http.HttpWagon"/>
</beans> \ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/test/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-proxy-common/src/test/resources/META-INF/spring-context.xml
index 011f375fb..c19b3e867 100644
--- a/archiva-modules/archiva-base/archiva-proxy-common/src/test/resources/META-INF/spring-context.xml
+++ b/archiva-modules/archiva-base/archiva-proxy-common/src/test/resources/META-INF/spring-context.xml
@@ -27,4 +27,6 @@
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-lazy-init="true">
+ <bean name="wagon#file" scope="prototype" class="org.apache.maven.wagon.providers.file.FileWagon"/>
+
</beans> \ No newline at end of file