aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base
diff options
context:
space:
mode:
Diffstat (limited to 'archiva-modules/archiva-base')
-rw-r--r--archiva-modules/archiva-base/archiva-converter/pom.xml5
-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
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/pom.xml5
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java4
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java6
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/WagonDelegate.java37
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/test/resources/META-INF/plexus/components.xml28
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/test/resources/META-INF/spring-context.xml2
-rwxr-xr-xarchiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml2
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/pom.xml5
13 files changed, 69 insertions, 55 deletions
diff --git a/archiva-modules/archiva-base/archiva-converter/pom.xml b/archiva-modules/archiva-base/archiva-converter/pom.xml
index 6596badab..18ebf19d1 100644
--- a/archiva-modules/archiva-base/archiva-converter/pom.xml
+++ b/archiva-modules/archiva-base/archiva-converter/pom.xml
@@ -58,6 +58,11 @@
<artifactId>plexus-i18n</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-http</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
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
diff --git a/archiva-modules/archiva-base/archiva-proxy/pom.xml b/archiva-modules/archiva-base/archiva-proxy/pom.xml
index c3c231f97..f695b6364 100644
--- a/archiva-modules/archiva-base/archiva-proxy/pom.xml
+++ b/archiva-modules/archiva-base/archiva-proxy/pom.xml
@@ -75,6 +75,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>
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java
index e8be34ea0..055d103b7 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java
@@ -1042,8 +1042,8 @@ public class DefaultRepositoryProxyConnectors
{
boolean connected = false;
- final ProxyInfo networkProxy = this.networkProxyMap.get( connector.getProxyId() );
-
+ final ProxyInfo networkProxy =
+ connector.getProxyId() == null ? null : this.networkProxyMap.get( connector.getProxyId() );
if ( log.isDebugEnabled() )
{
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
index 14ed55352..2271b1c53 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
@@ -135,7 +135,7 @@ public abstract class AbstractProxyTestCase
protected ManagedRepositoryAdmin managedRepositoryAdmin;
@Inject
- PlexusSisuBridge plexusSisuBridge;
+ protected PlexusSisuBridge plexusSisuBridge;
@Before
public void setUp()
@@ -208,7 +208,7 @@ public abstract class AbstractProxyTestCase
wagonMockControl = MockControl.createNiceControl( Wagon.class );
wagonMock = (Wagon) wagonMockControl.getMock();
- delegate = (WagonDelegate) plexusSisuBridge.lookup( Wagon.class, "test" );
+ delegate = (WagonDelegate) applicationContext.getBean( "wagon#test", Wagon.class );
delegate.setDelegate( wagonMock );
@@ -221,7 +221,7 @@ public abstract class AbstractProxyTestCase
public void shutdown()
throws Exception
{
- removeMavenIndexes();
+ removeMavenIndexes();
}
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/WagonDelegate.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/WagonDelegate.java
index 6595a3fd5..341355c52 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/WagonDelegate.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/WagonDelegate.java
@@ -19,10 +19,6 @@ package org.apache.archiva.proxy;
* under the License.
*/
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
import org.apache.commons.io.FileUtils;
import org.apache.maven.wagon.ConnectionException;
import org.apache.maven.wagon.ResourceDoesNotExistException;
@@ -40,16 +36,21 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
/**
* A dummy wagon implementation
- *
*/
-@Service("wagon#test")
+@Service( "wagon#test" )
public class WagonDelegate
implements Wagon
{
private Logger log = LoggerFactory.getLogger( WagonDelegate.class );
-
+
private Wagon delegate;
private String contentToGet;
@@ -90,7 +91,7 @@ public class WagonDelegate
return delegate.resourceExists( resourceName );
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public List<String> getFileList( String destinationDirectory )
throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
{
@@ -102,15 +103,15 @@ public class WagonDelegate
return delegate.supportsDirectoryCopy();
}
- public void setTimeout(int val)
- {
- // ignore
- }
-
- public int getTimeout()
- {
- return 0;
- }
+ public void setTimeout( int val )
+ {
+ // ignore
+ }
+
+ public int getTimeout()
+ {
+ return 0;
+ }
public Repository getRepository()
{
@@ -153,7 +154,7 @@ public class WagonDelegate
delegate.connect( source, authenticationInfo, proxyInfoProvider );
}
- @SuppressWarnings("deprecation")
+ @SuppressWarnings( "deprecation" )
public void openConnection()
throws ConnectionException, AuthenticationException
{
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/META-INF/plexus/components.xml b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/META-INF/plexus/components.xml
deleted file mode 100644
index acd2872a4..000000000
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/META-INF/plexus/components.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-
-<component-set>
- <components>
- <component>
- <role>org.apache.maven.wagon.Wagon</role>
- <role-hint>test</role-hint>
- <implementation>org.apache.archiva.proxy.WagonDelegate</implementation>
- </component>
- </components>
-</component-set>
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/META-INF/spring-context.xml
index 011f375fb..0e0824920 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/META-INF/spring-context.xml
+++ b/archiva-modules/archiva-base/archiva-proxy/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">
+
+
</beans> \ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml
index e0b433c03..3964a5607 100755
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml
+++ b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml
@@ -80,5 +80,7 @@
<property name="timeToLiveSeconds" value="1800"/>
</bean>
+ <bean name="wagon#test" class="org.apache.archiva.proxy.WagonDelegate" scope="singleton"/>
+ <bean name="wagon#file" scope="prototype" class="org.apache.maven.wagon.providers.file.FileWagon"/>
</beans> \ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/pom.xml b/archiva-modules/archiva-base/archiva-repository-layer/pom.xml
index dff2fca68..89b99772c 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/pom.xml
+++ b/archiva-modules/archiva-base/archiva-repository-layer/pom.xml
@@ -75,6 +75,11 @@
<groupId>org.apache.archiva</groupId>
<artifactId>maven2-repository</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-http</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
<plugins>