aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-core/src
diff options
context:
space:
mode:
authorBrett Porter <brett@apache.org>2006-09-30 14:09:20 +0000
committerBrett Porter <brett@apache.org>2006-09-30 14:09:20 +0000
commit440c3baa309dad1d2019c73e5db0a6967500d7bd (patch)
tree07588c001c5e06f38e0ed135b9d72310b91b253e /archiva-core/src
parent8fe4a8ab7b47d06f667361ab6d951b39bb4c6c2f (diff)
downloadarchiva-440c3baa309dad1d2019c73e5db0a6967500d7bd.tar.gz
archiva-440c3baa309dad1d2019c73e5db0a6967500d7bd.zip
[MRM-191] don't allow proxy requests if no proxy configured
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@451603 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-core/src')
-rw-r--r--archiva-core/src/main/java/org/apache/maven/archiva/proxy/DefaultProxyManager.java25
1 files changed, 21 insertions, 4 deletions
diff --git a/archiva-core/src/main/java/org/apache/maven/archiva/proxy/DefaultProxyManager.java b/archiva-core/src/main/java/org/apache/maven/archiva/proxy/DefaultProxyManager.java
index fbd301829..53632ecac 100644
--- a/archiva-core/src/main/java/org/apache/maven/archiva/proxy/DefaultProxyManager.java
+++ b/archiva-core/src/main/java/org/apache/maven/archiva/proxy/DefaultProxyManager.java
@@ -23,6 +23,9 @@ import org.apache.maven.archiva.configuration.ConfiguredRepositoryFactory;
import org.apache.maven.archiva.configuration.ProxiedRepositoryConfiguration;
import org.apache.maven.archiva.configuration.Proxy;
import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+import org.apache.maven.archiva.configuration.ConfigurationChangeListener;
+import org.apache.maven.archiva.configuration.InvalidConfigurationException;
+import org.apache.maven.archiva.configuration.ConfigurationChangeException;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.wagon.ResourceDoesNotExistException;
import org.apache.maven.wagon.proxy.ProxyInfo;
@@ -46,7 +49,7 @@ import java.util.Map;
*/
public class DefaultProxyManager
extends AbstractLogEnabled
- implements ProxyManager
+ implements ProxyManager, ConfigurationChangeListener
{
/**
* @plexus.requirement
@@ -143,6 +146,8 @@ public class DefaultProxyManager
try
{
configuration = configurationStore.getConfigurationFromStore();
+
+ configurationStore.addChangeListener( this );
}
catch ( ConfigurationStoreException e )
{
@@ -153,7 +158,7 @@ public class DefaultProxyManager
}
private Map getProxyGroups()
- throws ProxyException
+ throws ProxyException, ResourceDoesNotExistException
{
if ( proxyGroups == null )
{
@@ -170,8 +175,11 @@ public class DefaultProxyManager
List proxiedRepositories = getProxiedRepositoriesForManagedRepository(
configuration.getProxiedRepositories(), repository.getId() );
- groups.put( repository.getId(),
- new ProxiedRepositoryGroup( proxiedRepositories, managedRepository, wagonProxy ) );
+ if ( !proxiedRepositories.isEmpty() )
+ {
+ groups.put( repository.getId(),
+ new ProxiedRepositoryGroup( proxiedRepositories, managedRepository, wagonProxy ) );
+ }
}
// TODO: ability to configure default proxy separately!
@@ -234,4 +242,13 @@ public class DefaultProxyManager
}
return proxyInfo;
}
+
+ public void notifyOfConfigurationChange( Configuration configuration )
+ throws InvalidConfigurationException, ConfigurationChangeException
+ {
+ // reinit
+ proxyGroups = null;
+ defaultProxyGroup = null;
+ getLogger().debug( "Re-initialising proxy configuration" );
+ }
}