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;
*/
public class DefaultProxyManager
extends AbstractLogEnabled
- implements ProxyManager
+ implements ProxyManager, ConfigurationChangeListener
{
/**
* @plexus.requirement
try
{
configuration = configurationStore.getConfigurationFromStore();
+
+ configurationStore.addChangeListener( this );
}
catch ( ConfigurationStoreException e )
{
}
private Map getProxyGroups()
- throws ProxyException
+ throws ProxyException, ResourceDoesNotExistException
{
if ( proxyGroups == null )
{
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!
}
return proxyInfo;
}
+
+ public void notifyOfConfigurationChange( Configuration configuration )
+ throws InvalidConfigurationException, ConfigurationChangeException
+ {
+ // reinit
+ proxyGroups = null;
+ defaultProxyGroup = null;
+ getLogger().debug( "Re-initialising proxy configuration" );
+ }
}