summaryrefslogtreecommitdiffstats
path: root/archiva-base/archiva-proxy
diff options
context:
space:
mode:
authorJoakim Erdfelt <joakime@apache.org>2007-05-05 00:05:23 +0000
committerJoakim Erdfelt <joakime@apache.org>2007-05-05 00:05:23 +0000
commitf8b9e076b351db6cb2aca0243fcb364e25ae7039 (patch)
tree74a1a9382f43d88acec758bc3a828c58361ca04e /archiva-base/archiva-proxy
parent42b480187801079925071ee9634a3755a2ddbc1f (diff)
downloadarchiva-f8b9e076b351db6cb2aca0243fcb364e25ae7039.tar.gz
archiva-f8b9e076b351db6cb2aca0243fcb364e25ae7039.zip
* Updates to repositories and proxy connector configuration / admin screens.
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@535418 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-base/archiva-proxy')
-rw-r--r--archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java7
-rw-r--r--archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java20
2 files changed, 14 insertions, 13 deletions
diff --git a/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java b/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
index 1d1295df4..dae8e55da 100644
--- a/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
+++ b/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
@@ -20,6 +20,7 @@ package org.apache.maven.archiva.proxy;
*/
import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.ConfigurationNames;
import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
@@ -494,7 +495,7 @@ public class DefaultRepositoryProxyConnectors
}
}
- private boolean applyPolicies( Properties policySettings, Map downloadPolicies, Properties request, File localFile )
+ private boolean applyPolicies( Map policySettings, Map downloadPolicies, Properties request, File localFile )
{
Iterator it = downloadPolicies.entrySet().iterator();
while ( it.hasNext() )
@@ -502,8 +503,8 @@ public class DefaultRepositoryProxyConnectors
Map.Entry entry = (Entry) it.next();
String key = (String) entry.getKey();
DownloadPolicy policy = (DownloadPolicy) entry.getValue();
- String defaultSetting = policy.getDefaultPolicySetting();
- String setting = policySettings.getProperty( key, defaultSetting );
+ String defaultSetting = policy.getDefaultOption();
+ String setting = StringUtils.defaultString( (String) policySettings.get( key ), defaultSetting );
getLogger().debug( "Applying [" + key + "] policy with [" + setting + "]" );
if ( !policy.applyPolicy( setting, request, localFile ) )
diff --git a/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java b/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java
index 978b6396c..a7b4d9b81 100644
--- a/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java
+++ b/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java
@@ -22,9 +22,9 @@ package org.apache.maven.archiva.proxy;
import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.archiva.repository.connector.RepositoryConnector;
-import java.util.Enumeration;
+import java.util.Iterator;
import java.util.List;
-import java.util.Properties;
+import java.util.Map;
/**
* This represents a connector for a repository to repository proxy.
@@ -45,7 +45,7 @@ public class ProxyConnector
private String proxyId;
- private Properties policies;
+ private Map policies;
public List getBlacklist()
{
@@ -87,12 +87,12 @@ public class ProxyConnector
this.whitelist = whitelist;
}
- public Properties getPolicies()
+ public Map getPolicies()
{
return policies;
}
- public void setPolicies( Properties policies )
+ public void setPolicies( Map policies )
{
this.policies = policies;
}
@@ -116,12 +116,12 @@ public class ProxyConnector
sb.append( " target:" ).append( this.targetRepository ).append( "\n" );
sb.append( " proxyId:" ).append( this.proxyId ).append( "\n" );
- Enumeration keys = this.policies.propertyNames();
- while ( keys.hasMoreElements() )
+ Iterator keys = this.policies.keySet().iterator();
+ while ( keys.hasNext() )
{
- String name = (String) keys.nextElement();
+ String name = (String) keys.next();
sb.append( " policy[" ).append( name ).append( "]:" );
- sb.append( this.policies.getProperty( name ) ).append( "\n" );
+ sb.append( this.policies.get( name ) ).append( "\n" );
}
sb.append( "]" );
@@ -131,6 +131,6 @@ public class ProxyConnector
public void setPolicy( String policyId, String policySetting )
{
- // TODO Auto-generated method stub
+ this.policies.put( policyId, policySetting );
}
}