You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2011/06/02 05:13:05 UTC

svn commit: r1130392 [1/2] - in /maven/maven-3/branches/mirror-group-routing: maven-compat/src/main/java/org/apache/maven/repository/ maven-core/src/main/java/org/apache/maven/ maven-core/src/main/java/org/apache/maven/execution/ maven-embedder/src/mai...

Author: jdcasey
Date: Thu Jun  2 03:13:03 2011
New Revision: 1130392

URL: http://svn.apache.org/viewvc?rev=1130392&view=rev
Log:
Filling out the loading of router data, including booting up the loader session, etc. in the maven cli.

Added:
    maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/RouterSource.java   (with props)
    maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/loader/ArtifactRouterReader.java   (with props)
    maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/loader/DefaultArtifactRouterReader.java   (with props)
    maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/loader/discovery/
    maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/loader/discovery/ArtifactRouterDiscoveryStrategy.java   (with props)
    maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/loader/discovery/DNSDiscoveryStrategy.java   (with props)
    maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/session/
    maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/session/ArtifactRouterSession.java   (with props)
    maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/session/DefaultArtifactRouterSession.java   (with props)
Removed:
    maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/discovery/ArtifactRouterDiscoveryStrategy.java
    maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/discovery/DNSDiscoveryStrategy.java
Modified:
    maven/maven-3/branches/mirror-group-routing/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java
    maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
    maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
    maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java
    maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
    maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
    maven/maven-3/branches/mirror-group-routing/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
    maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/ArtifactRouter.java
    maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/ArtifactRouterException.java
    maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/GroupPattern.java
    maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/GroupRoute.java
    maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/MirrorRoute.java
    maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/io/ArtifactRouteSerializer.java
    maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/io/ArtifactRouterModelException.java
    maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/GroupPatternTest.java
    maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/GroupRouteTest.java
    maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/MirrorRouteTest.java
    maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/MirrorRoutingTableTest.java
    maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/io/ArtifactRouteSerializerTest.java
    maven/maven-3/branches/mirror-group-routing/maven-routem-impl/pom.xml
    maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/ArtifactRouterConfiguration.java
    maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/ArtifactRouterConfigurationException.java
    maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/ArtifactRouterOption.java
    maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/FileRouterConfigBuilder.java
    maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/RouterConfigBuilder.java
    maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/loader/ArtifactRouterLoader.java
    maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/loader/DefaultRouterLoader.java

Modified: maven/maven-3/branches/mirror-group-routing/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java Thu Jun  2 03:13:03 2011
@@ -75,7 +75,7 @@ public class DefaultMirrorSelector
         {
             final String repoUrl = repository.getUrl();
 
-            ArtifactRouter router = legacySupport.getSession().getMirrorRouter();
+            ArtifactRouter router = legacySupport.getSession().getArtifactRouter();
             final MirrorRoute rMirror = router.getMirror( repoUrl );
 
             if ( rMirror != null )

Modified: maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/DefaultMaven.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/DefaultMaven.java Thu Jun  2 03:13:03 2011
@@ -34,7 +34,11 @@ import java.util.Properties;
 import org.apache.maven.artifact.ArtifactUtils;
 import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
 import org.apache.maven.artifact.router.ArtifactRouter;
+import org.apache.maven.artifact.router.ArtifactRouterException;
+import org.apache.maven.artifact.router.loader.ArtifactRouterLoader;
 import org.apache.maven.artifact.router.mirror.RoutingMirrorSelector;
+import org.apache.maven.artifact.router.session.ArtifactRouterSession;
+import org.apache.maven.artifact.router.session.DefaultArtifactRouterSession;
 import org.apache.maven.eventspy.internal.EventSpyDispatcher;
 import org.apache.maven.execution.DefaultMavenExecutionResult;
 import org.apache.maven.execution.ExecutionEvent;
@@ -147,6 +151,9 @@ public class DefaultMaven
 
     @Requirement
     private EventSpyDispatcher eventSpyDispatcher;
+    
+    @Requirement
+    private ArtifactRouterLoader artifactRouterLoader;
 
     public MavenExecutionResult execute( MavenExecutionRequest request )
     {
@@ -332,7 +339,6 @@ public class DefaultMaven
     public RepositorySystemSession newRepositorySession( MavenExecutionRequest request )
     {
         DefaultRepositorySystemSession session = new DefaultRepositorySystemSession();
-        session.getData().set( ArtifactRouter.SESSION_KEY, request.getArtifactRouter() );
 
         session.setCache( request.getRepositoryCache() );
 
@@ -378,6 +384,24 @@ public class DefaultMaven
             }
         }
 
+        if ( request.getArtifactRouter() == null )
+        {
+            ArtifactRouterSession routerSession =
+                new DefaultArtifactRouterSession( request.getArtifactRouterConfiguration(), decrypted.getServers(),
+                                                  decrypted.getProxies() );
+            
+            try
+            {
+                request.setArtifactRouter( artifactRouterLoader.load( routerSession ) );
+            }
+            catch ( ArtifactRouterException e )
+            {
+                logger.debug( e.getMessage(), e );
+            }
+        }
+        
+        session.getData().set( ArtifactRouter.SESSION_KEY, request.getArtifactRouter() );
+        
         final RoutingMirrorSelector mirrorSelector =
             new RoutingMirrorSelector( request.getArtifactRouter(), logger );
         

Modified: maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java Thu Jun  2 03:13:03 2011
@@ -19,14 +19,9 @@ package org.apache.maven.execution;
  * under the License.
  */
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Properties;
-
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.router.ArtifactRouter;
+import org.apache.maven.artifact.router.conf.ArtifactRouterConfiguration;
 import org.apache.maven.model.Profile;
 import org.apache.maven.project.DefaultProjectBuildingRequest;
 import org.apache.maven.project.ProjectBuildingRequest;
@@ -38,6 +33,12 @@ import org.sonatype.aether.repository.Wo
 import org.sonatype.aether.transfer.TransferListener;
 import org.sonatype.aether.util.DefaultRepositoryCache;
 
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Properties;
+
 /**
  * @author Jason van Zyl
  */
@@ -1081,6 +1082,8 @@ public class DefaultMavenExecutionReques
 
     private ArtifactRouter artifactRouter;
 
+    private ArtifactRouterConfiguration artifactRouterConfig;
+
     public synchronized ArtifactRouter getArtifactRouter()
     {
         if ( artifactRouter == null )
@@ -1091,10 +1094,21 @@ public class DefaultMavenExecutionReques
         return artifactRouter;
     }
 
-    public MavenExecutionRequest setArtifactRouter( final ArtifactRouter mirrorRouter )
+    public MavenExecutionRequest setArtifactRouter( final ArtifactRouter artifactRouter )
+    {
+        this.artifactRouter = artifactRouter;
+        return this;
+    }
+
+    public MavenExecutionRequest setArtifactRouterConfiguration( ArtifactRouterConfiguration artifactRouterConfig )
     {
-        this.artifactRouter = mirrorRouter;
+        this.artifactRouterConfig = artifactRouterConfig;
         return this;
     }
 
+    public ArtifactRouterConfiguration getArtifactRouterConfiguration()
+    {
+        return artifactRouterConfig;
+    }
+
 }

Modified: maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java Thu Jun  2 03:13:03 2011
@@ -26,6 +26,7 @@ import java.util.Set;
 
 import org.apache.maven.artifact.InvalidRepositoryException;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.router.conf.ArtifactRouterConfiguration;
 import org.apache.maven.repository.RepositorySystem;
 import org.apache.maven.settings.Mirror;
 import org.apache.maven.settings.Proxy;
@@ -265,8 +266,18 @@ public class DefaultMavenExecutionReques
         injectDefaultPluginRepositories( request );
 
         processRepositoriesInSettings( request );
+        
+        injectDefaultArtifactRouterConfiguration( request );
 
         return request;
     }
 
+    private void injectDefaultArtifactRouterConfiguration( MavenExecutionRequest request )
+    {
+        if ( request.getArtifactRouter() == null && request.getArtifactRouterConfiguration() == null )
+        {
+            request.setArtifactRouterConfiguration( new ArtifactRouterConfiguration() );
+        }
+    }
+
 }

Modified: maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java Thu Jun  2 03:13:03 2011
@@ -27,6 +27,8 @@ import java.util.Properties;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
 import org.apache.maven.artifact.router.ArtifactRouter;
+import org.apache.maven.artifact.router.conf.ArtifactRouterConfiguration;
+import org.apache.maven.artifact.router.session.ArtifactRouterSession;
 import org.apache.maven.model.Profile;
 import org.apache.maven.project.ProjectBuildingRequest;
 import org.apache.maven.settings.Mirror;
@@ -288,4 +290,8 @@ public interface MavenExecutionRequest
 
     MavenExecutionRequest setArtifactRouter( ArtifactRouter router );
 
+    MavenExecutionRequest setArtifactRouterConfiguration( ArtifactRouterConfiguration routerConfig );
+    
+    ArtifactRouterConfiguration getArtifactRouterConfiguration();
+
 }

Modified: maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java Thu Jun  2 03:13:03 2011
@@ -394,7 +394,7 @@ public class MavenSession
         return repositorySession;
     }
 
-    public ArtifactRouter getMirrorRouter()
+    public ArtifactRouter getArtifactRouter()
     {
         return request.getArtifactRouter();
     }

Modified: maven/maven-3/branches/mirror-group-routing/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java Thu Jun  2 03:13:03 2011
@@ -42,6 +42,8 @@ import org.apache.maven.artifact.router.
 import org.apache.maven.artifact.router.conf.FileRouterConfigBuilder;
 import org.apache.maven.artifact.router.conf.ArtifactRouterConfiguration;
 import org.apache.maven.artifact.router.loader.ArtifactRouterLoader;
+import org.apache.maven.artifact.router.session.ArtifactRouterSession;
+import org.apache.maven.artifact.router.session.DefaultArtifactRouterSession;
 import org.apache.maven.eventspy.internal.EventSpyDispatcher;
 import org.apache.maven.exception.DefaultExceptionHandler;
 import org.apache.maven.exception.ExceptionHandler;
@@ -126,8 +128,6 @@ public class MavenCli
 
     private DefaultSecDispatcher dispatcher;
 
-    private ArtifactRouterConfiguration routerConfig;
-
     public MavenCli()
     {
         this( null );
@@ -552,7 +552,8 @@ public class MavenCli
 
         try
         {
-            routerLoader.save( cliRequest.request.getArtifactRouter(), routerConfig );
+            ArtifactRouterSession session = new DefaultArtifactRouterSession( cliRequest.request.getArtifactRouterConfiguration() );
+            routerLoader.save( cliRequest.request.getArtifactRouter(), session );
         }
         catch ( ArtifactRouterException e )
         {
@@ -937,7 +938,9 @@ public class MavenCli
             userToolchainsFile = MavenCli.DEFAULT_USER_TOOLCHAINS_FILE;
         }
 
-        routerConfig = new FileRouterConfigBuilder( DEFAULT_USER_EXT_CONF_DIR, logger ).build();
+        ArtifactRouterConfiguration routerConfig =
+            new FileRouterConfigBuilder( DEFAULT_USER_EXT_CONF_DIR, dispatcher, logger ).build();
+        
         if ( commandLine.hasOption( CLIManager.ROUTER_OPTIONS ) )
         {
             routerConfig.setOptions( ArtifactRouterOption.parse( commandLine.getOptionValues( CLIManager.ROUTER_OPTIONS ) ) );
@@ -945,8 +948,6 @@ public class MavenCli
         
         routerConfig.setOffline( request.isOffline() );
         
-        ArtifactRouter router = routerLoader.load( routerConfig );
-        
         request.setBaseDirectory( baseDirectory ).setGoals( goals )
             .setSystemProperties( cliRequest.systemProperties )
             .setUserProperties( cliRequest.userProperties )
@@ -961,7 +962,7 @@ public class MavenCli
             .setNoSnapshotUpdates( noSnapshotUpdates ) // default: false
             .setGlobalChecksumPolicy( globalChecksumPolicy ) // default: warn
             .setUserToolchainsFile( userToolchainsFile )
-            .setArtifactRouter( router );
+            .setArtifactRouterConfiguration( routerConfig );
 
         if ( alternatePomFile != null )
         {
@@ -1158,6 +1159,8 @@ public class MavenCli
         extends Exception
     {
 
+        private static final long serialVersionUID = 1L;
+        
         public int exitCode;
 
         public ExitException( int exitCode )

Modified: maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/ArtifactRouter.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/ArtifactRouter.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/ArtifactRouter.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/ArtifactRouter.java Thu Jun  2 03:13:03 2011
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 package org.apache.maven.artifact.router;
 
 /*

Modified: maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/ArtifactRouterException.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/ArtifactRouterException.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/ArtifactRouterException.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/ArtifactRouterException.java Thu Jun  2 03:13:03 2011
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 package org.apache.maven.artifact.router;
 
 /*

Modified: maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/GroupPattern.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/GroupPattern.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/GroupPattern.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/GroupPattern.java Thu Jun  2 03:13:03 2011
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 package org.apache.maven.artifact.router;
 
 /*

Modified: maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/GroupRoute.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/GroupRoute.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/GroupRoute.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/GroupRoute.java Thu Jun  2 03:13:03 2011
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 package org.apache.maven.artifact.router;
 
 /*

Modified: maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/MirrorRoute.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/MirrorRoute.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/MirrorRoute.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/MirrorRoute.java Thu Jun  2 03:13:03 2011
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 package org.apache.maven.artifact.router;
 
 /*

Modified: maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/io/ArtifactRouteSerializer.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/io/ArtifactRouteSerializer.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/io/ArtifactRouteSerializer.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/io/ArtifactRouteSerializer.java Thu Jun  2 03:13:03 2011
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 package org.apache.maven.artifact.router.io;
 
 /*

Modified: maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/io/ArtifactRouterModelException.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/io/ArtifactRouterModelException.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/io/ArtifactRouterModelException.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/main/java/org/apache/maven/artifact/router/io/ArtifactRouterModelException.java Thu Jun  2 03:13:03 2011
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 package org.apache.maven.artifact.router.io;
 
 import org.apache.maven.artifact.router.ArtifactRouterException;

Modified: maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/GroupPatternTest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/GroupPatternTest.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/GroupPatternTest.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/GroupPatternTest.java Thu Jun  2 03:13:03 2011
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 package org.apache.maven.artifact.router;
 
 /*

Modified: maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/GroupRouteTest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/GroupRouteTest.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/GroupRouteTest.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/GroupRouteTest.java Thu Jun  2 03:13:03 2011
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 package org.apache.maven.artifact.router;
 
 /*

Modified: maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/MirrorRouteTest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/MirrorRouteTest.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/MirrorRouteTest.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/MirrorRouteTest.java Thu Jun  2 03:13:03 2011
@@ -1,18 +1,20 @@
 /*
- *  Copyright (C) 2011 John Casey.
- *  
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU Affero General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *  
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Affero General Public License for more details.
- *  
- *  You should have received a copy of the GNU Affero General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * 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.
  */
 
 package org.apache.maven.artifact.router;

Modified: maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/MirrorRoutingTableTest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/MirrorRoutingTableTest.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/MirrorRoutingTableTest.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/MirrorRoutingTableTest.java Thu Jun  2 03:13:03 2011
@@ -1,18 +1,20 @@
 /*
- *  Copyright (C) 2011 John Casey.
- *  
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU Affero General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *  
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Affero General Public License for more details.
- *  
- *  You should have received a copy of the GNU Affero General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * 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.
  */
 
 package org.apache.maven.artifact.router;

Modified: maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/io/ArtifactRouteSerializerTest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/io/ArtifactRouteSerializerTest.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/io/ArtifactRouteSerializerTest.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-api/src/test/java/org/apache/maven/artifact/router/io/ArtifactRouteSerializerTest.java Thu Jun  2 03:13:03 2011
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 package org.apache.maven.artifact.router.io;
 
 /*

Modified: maven/maven-3/branches/mirror-group-routing/maven-routem-impl/pom.xml
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-impl/pom.xml?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-impl/pom.xml (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-impl/pom.xml Thu Jun  2 03:13:03 2011
@@ -21,10 +21,6 @@
     	<artifactId>maven-routem-api</artifactId>
     </dependency>
     <dependency>
-    	<groupId>org.apache.httpcomponents</groupId>
-    	<artifactId>httpclient</artifactId>
-    </dependency>
-    <dependency>
     	<groupId>org.codehaus.plexus</groupId>
     	<artifactId>plexus-component-annotations</artifactId>
     </dependency>
@@ -32,6 +28,14 @@
     	<groupId>org.sonatype.sisu</groupId>
     	<artifactId>sisu-inject-plexus</artifactId>
     </dependency>
+    <dependency>
+    	<groupId>org.apache.maven</groupId>
+    	<artifactId>maven-settings</artifactId>
+    </dependency>
+    <dependency>
+    	<groupId>org.sonatype.plexus</groupId>
+    	<artifactId>plexus-sec-dispatcher</artifactId>
+    </dependency>
   </dependencies>
   
   <build>

Modified: maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/ArtifactRouterConfiguration.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/ArtifactRouterConfiguration.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/ArtifactRouterConfiguration.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/ArtifactRouterConfiguration.java Thu Jun  2 03:13:03 2011
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 package org.apache.maven.artifact.router.conf;
 
 /*
@@ -19,18 +38,17 @@ package org.apache.maven.artifact.router
  * under the License.
  */
 
-import org.apache.http.auth.UsernamePasswordCredentials;
-
 import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 
 public final class ArtifactRouterConfiguration
 {
 
-    private static final String CANONICAL_MIRRORS_URL = "http://repository.apache.org/router/mirrors.json";
-
-    private static final String CANONICAL_GROUPS_URL = "http://repository.apache.org/router/groups.json";
+    private static final RouterSource CANONICAL_SOURCE = new RouterSource( "default", "http://repository.apache.org/router/routes.json" );
 
     public static final String ALL_DISCOVERY_STRATEGIES = "all";
 
@@ -38,53 +56,35 @@ public final class ArtifactRouterConfigu
     
     private File routesFile;
 
-    private String routerMirrorsUrl;
-
-    private UsernamePasswordCredentials routerCredentials;
-
     private boolean disabled = false;
 
     private String[] discoveryStrategies = { ALL_DISCOVERY_STRATEGIES };
 
-    private String routerGroupsUrl;
-
     private final Set<ArtifactRouterOption> routerOptions = new HashSet<ArtifactRouterOption>();
     
+    private final List<RouterSource> routerSources = new ArrayList<RouterSource>();
+    
     public ArtifactRouterConfiguration()
     {
         setUpdate( true );
     }
-
-    public ArtifactRouterConfiguration setRouterCredentials( final String user, final String password )
-    {
-        routerCredentials = new UsernamePasswordCredentials( user, password );
-        return this;
-    }
-
-    public UsernamePasswordCredentials getRouterCredentials()
-    {
-        return routerCredentials;
-    }
-
-    public ArtifactRouterConfiguration setRouterMirrorsUrl( final String routerMirrorsUrl )
+    
+    public ArtifactRouterConfiguration addSource( String id, String url, String username, String password )
     {
-        this.routerMirrorsUrl = routerMirrorsUrl;
+        routerSources.add( new RouterSource( id, url, username, password ) );
         return this;
     }
-
-    public String getRouterMirrorsUrl()
-    {
-        return routerMirrorsUrl;
-    }
-
-    public void setRouterGroupsUrl( String routerGroupsUrl )
-    {
-        this.routerGroupsUrl = routerGroupsUrl;
-    }
     
-    public String getRouterGroupsUrl()
+    public List<RouterSource> getSources()
     {
-        return routerGroupsUrl;
+        if ( routerSources.isEmpty() )
+        {
+            return Collections.singletonList( CANONICAL_SOURCE );
+        }
+        else
+        {
+            return routerSources;
+        }
     }
 
     public boolean isDisabled()
@@ -98,16 +98,6 @@ public final class ArtifactRouterConfigu
         return this;
     }
 
-    public String getCanonicalMirrorsUrl()
-    {
-        return CANONICAL_MIRRORS_URL;
-    }
-
-    public String getCanonicalGroupsUrl()
-    {
-        return CANONICAL_GROUPS_URL;
-    }
-
     public String[] getDiscoveryStrategies()
     {
         return discoveryStrategies == null ? new String[0] : discoveryStrategies;

Modified: maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/ArtifactRouterConfigurationException.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/ArtifactRouterConfigurationException.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/ArtifactRouterConfigurationException.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/ArtifactRouterConfigurationException.java Thu Jun  2 03:13:03 2011
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 package org.apache.maven.artifact.router.conf;
 
 import org.apache.maven.artifact.router.ArtifactRouterException;

Modified: maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/ArtifactRouterOption.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/ArtifactRouterOption.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/ArtifactRouterOption.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/ArtifactRouterOption.java Thu Jun  2 03:13:03 2011
@@ -1,18 +1,20 @@
 /*
- *  Copyright (C) 2011 John Casey.
- *  
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU Affero General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *  
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Affero General Public License for more details.
- *  
- *  You should have received a copy of the GNU Affero General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * 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.
  */
 
 package org.apache.maven.artifact.router.conf;

Modified: maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/FileRouterConfigBuilder.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/FileRouterConfigBuilder.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/FileRouterConfigBuilder.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/FileRouterConfigBuilder.java Thu Jun  2 03:13:03 2011
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 package org.apache.maven.artifact.router.conf;
 
 /*
@@ -20,9 +39,12 @@ package org.apache.maven.artifact.router
  */
 
 import static org.codehaus.plexus.util.IOUtil.close;
+import static org.codehaus.plexus.util.StringUtils.isBlank;
 import static org.codehaus.plexus.util.StringUtils.isNotBlank;
 
 import org.codehaus.plexus.logging.Logger;
+import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher;
+import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -34,31 +56,34 @@ public class FileRouterConfigBuilder
     implements RouterConfigBuilder
 {
 
-    private static final String KEY_ROUTER_MIRRORS_URL = "router-mirrors-url";
-
-    private static final String KEY_ROUTER_GROUPS_URL = "router-groups-url";
+    private static final String KEY_ID = "id";
     
+    private static final String KEY_URL = "url";
+
     private static final String KEY_ROUTES_FILE = "routing-tables-file";
 
-    private static final String KEY_ROUTER_USER = "router-user";
+    private static final String KEY_USER = "user";
 
-    private static final String KEY_ROUTER_PASSWORD = "router-password";
+    private static final String KEY_PASSWORD = "password";
 
     private static final String KEY_DISABLED = "disabled";
 
     private static final String KEY_DISCOVERY_STRATEGIES = "discovery-strategies";
 
     private static final String ROUTES_FILE = "artifact-routes.json";
-    
+
     private static final String CONFIG_FILENAME = "router.properties";
-    
+
     private Logger logger;
-    
+
     private File confDir;
-    
-    public FileRouterConfigBuilder( File confDir, Logger logger )
+
+    private final SecDispatcher secDispatcher;
+
+    public FileRouterConfigBuilder( File confDir, SecDispatcher secDispatcher, Logger logger )
     {
         this.confDir = confDir;
+        this.secDispatcher = secDispatcher;
         this.logger = logger;
     }
 
@@ -82,9 +107,6 @@ public class FileRouterConfigBuilder
                 final Properties p = new Properties();
                 p.load( stream );
 
-                config.setRouterMirrorsUrl( p.getProperty( KEY_ROUTER_MIRRORS_URL ) );
-                config.setRouterGroupsUrl( p.getProperty( KEY_ROUTER_GROUPS_URL ) );
-                
                 String path = p.getProperty( KEY_ROUTES_FILE );
                 if ( path != null )
                 {
@@ -93,19 +115,11 @@ public class FileRouterConfigBuilder
 
                 config.setDisabled( Boolean.parseBoolean( p.getProperty( KEY_DISABLED, "false" ) ) );
 
-                final String user = p.getProperty( KEY_ROUTER_USER );
-                final String pass = p.getProperty( KEY_ROUTER_PASSWORD );
-
                 final String[] strat =
                     p.getProperty( KEY_DISCOVERY_STRATEGIES, ArtifactRouterConfiguration.ALL_DISCOVERY_STRATEGIES )
                      .split( "\\s*,\\s*" );
 
                 config.setDiscoveryStrategies( strat );
-
-                if ( isNotBlank( user ) && isNotBlank( pass ) )
-                {
-                    config.setRouterCredentials( user, pass );
-                }
             }
             catch ( final IOException e )
             {
@@ -130,6 +144,52 @@ public class FileRouterConfigBuilder
         {
             config.setRoutesFile( new File( confDir, ROUTES_FILE ) );
         }
+        
+        File routesD = new File( confDir, "routes.d" );
+        if ( routesD.exists() && routesD.isDirectory() )
+        {
+            for ( File src : routesD.listFiles() )
+            {
+                InputStream stream = null;
+                try
+                {
+                    stream = new FileInputStream( src );
+                    final Properties p = new Properties();
+                    p.load( stream );
+                    
+                    String id = p.getProperty( KEY_ID );
+
+                    String url = p.getProperty( KEY_URL );
+                    if ( isBlank( url ) )
+                    {
+                        continue;
+                    }
+                    
+                    String user = p.getProperty( KEY_USER );
+                    String pass = p.getProperty( KEY_PASSWORD );
+                    
+                    if ( isNotBlank( user ) && isNotBlank( pass ) )
+                    {
+                        pass = secDispatcher.decrypt( pass );
+                        config.addSource( id, url, user, pass );
+                    }
+                }
+                catch ( final IOException e )
+                {
+                    throw new ArtifactRouterConfigurationException( "Failed to read router config properties from: '"
+                        + src + "'.", e );
+                }
+                catch ( SecDispatcherException e )
+                {
+                    throw new ArtifactRouterConfigurationException( "Failed to read router config properties from: '"
+                        + src + "'.", e );
+                }
+                finally
+                {
+                    close( stream );
+                }
+            }
+        }
 
         return config;
     }

Modified: maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/RouterConfigBuilder.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/RouterConfigBuilder.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/RouterConfigBuilder.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/RouterConfigBuilder.java Thu Jun  2 03:13:03 2011
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 package org.apache.maven.artifact.router.conf;
 
 /*
@@ -25,4 +44,4 @@ public interface RouterConfigBuilder
     ArtifactRouterConfiguration build()
         throws ArtifactRouterConfigurationException;
 
-}
\ No newline at end of file
+}

Added: maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/RouterSource.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/RouterSource.java?rev=1130392&view=auto
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/RouterSource.java (added)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/RouterSource.java Thu Jun  2 03:13:03 2011
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+
+package org.apache.maven.artifact.router.conf;
+
+import java.net.PasswordAuthentication;
+
+public class RouterSource
+{
+
+    private final String url;
+
+    private final PasswordAuthentication credentials;
+
+    private final String id;
+
+    public RouterSource( String id, String url )
+    {
+        this.id = id;
+        this.url = url;
+        this.credentials = null;
+    }
+
+    public RouterSource( String id, String url, String username, String password )
+    {
+        this.id = id;
+        this.url = url;
+        this.credentials = new PasswordAuthentication( username, password.toCharArray() );
+    }
+    
+    public String getId()
+    {
+        return id;
+    }
+
+    public String getUrl()
+    {
+        return url;
+    }
+
+    public PasswordAuthentication getCredentials()
+    {
+        return credentials;
+    }
+
+    public String toString()
+    {
+        return "RouterSource[" + ( getCredentials() == null ? "" : getCredentials().getUserName() + "@" ) + getUrl()
+            + "]";
+    }
+
+}

Propchange: maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/conf/RouterSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/loader/ArtifactRouterLoader.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/loader/ArtifactRouterLoader.java?rev=1130392&r1=1130391&r2=1130392&view=diff
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/loader/ArtifactRouterLoader.java (original)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/loader/ArtifactRouterLoader.java Thu Jun  2 03:13:03 2011
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 package org.apache.maven.artifact.router.loader;
 
 /*
@@ -21,15 +40,15 @@ package org.apache.maven.artifact.router
 
 import org.apache.maven.artifact.router.ArtifactRouter;
 import org.apache.maven.artifact.router.ArtifactRouterException;
-import org.apache.maven.artifact.router.conf.ArtifactRouterConfiguration;
+import org.apache.maven.artifact.router.session.ArtifactRouterSession;
 
 public interface ArtifactRouterLoader
 {
 
-    ArtifactRouter load( ArtifactRouterConfiguration config )
+    ArtifactRouter load( ArtifactRouterSession session )
         throws ArtifactRouterException;
     
-    void save( ArtifactRouter router, ArtifactRouterConfiguration config )
+    void save( ArtifactRouter router, ArtifactRouterSession session )
         throws ArtifactRouterException;
 
 }

Added: maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/loader/ArtifactRouterReader.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/loader/ArtifactRouterReader.java?rev=1130392&view=auto
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/loader/ArtifactRouterReader.java (added)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/loader/ArtifactRouterReader.java Thu Jun  2 03:13:03 2011
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+package org.apache.maven.artifact.router.loader;
+
+import org.apache.maven.artifact.router.ArtifactRouter;
+import org.apache.maven.artifact.router.ArtifactRouterException;
+import org.apache.maven.artifact.router.conf.RouterSource;
+import org.apache.maven.artifact.router.session.ArtifactRouterSession;
+
+public interface ArtifactRouterReader
+{
+
+    ArtifactRouter loadRouter( RouterSource source, ArtifactRouterSession session )
+        throws ArtifactRouterException;
+
+}

Propchange: maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/loader/ArtifactRouterReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/loader/DefaultArtifactRouterReader.java
URL: http://svn.apache.org/viewvc/maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/loader/DefaultArtifactRouterReader.java?rev=1130392&view=auto
==============================================================================
--- maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/loader/DefaultArtifactRouterReader.java (added)
+++ maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/loader/DefaultArtifactRouterReader.java Thu Jun  2 03:13:03 2011
@@ -0,0 +1,269 @@
+/*
+ * 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.
+ */
+
+package org.apache.maven.artifact.router.loader;
+
+import static org.codehaus.plexus.util.IOUtil.close;
+import static org.codehaus.plexus.util.StringUtils.isNotBlank;
+
+import org.apache.maven.artifact.router.ArtifactRouter;
+import org.apache.maven.artifact.router.ArtifactRouterException;
+import org.apache.maven.artifact.router.conf.RouterSource;
+import org.apache.maven.artifact.router.io.ArtifactRouteSerializer;
+import org.apache.maven.artifact.router.session.ArtifactRouterSession;
+import org.apache.maven.settings.Proxy;
+import org.codehaus.plexus.component.annotations.Component;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.Authenticator;
+import java.net.InetSocketAddress;
+import java.net.MalformedURLException;
+import java.net.PasswordAuthentication;
+import java.net.Proxy.Type;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.StringTokenizer;
+import java.util.zip.GZIPInputStream;
+
+@Component( role = ArtifactRouterReader.class )
+public class DefaultArtifactRouterReader
+    implements ArtifactRouterReader
+{
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.artifact.router.loader.ArtifactRouterReader#loadRouter(java.lang.String,
+     *      org.apache.maven.artifact.router.conf.ArtifactRouterConfiguration)
+     */
+    public ArtifactRouter loadRouter( RouterSource source, ArtifactRouterSession session )
+        throws ArtifactRouterException
+    {
+        RouterAuthenticator authenticator = new RouterAuthenticator( source, session );
+        Authenticator.setDefault( authenticator );
+
+        final URL url;
+        try
+        {
+            url = new URL( source.getUrl() );
+        }
+        catch ( MalformedURLException e )
+        {
+            throw new ArtifactRouterException( "Invalid router source: '" + source + "'", e );
+        }
+
+        Proxy proxy = authenticator.getProxy( url.getProtocol(), url.getHost() );
+
+        ArtifactRouter router = null;
+        InputStream in = null;
+        try
+        {
+            URLConnection conn;
+            if ( proxy == null )
+            {
+                conn = url.openConnection();
+            }
+            else
+            {
+                Type type = proxy.getProtocol().toLowerCase().startsWith( "socks" ) ? Type.SOCKS : Type.HTTP;
+                
+                java.net.Proxy connProxy =
+                    new java.net.Proxy( type, new InetSocketAddress( proxy.getHost(), proxy.getPort() ) );
+
+                conn = url.openConnection( connProxy );
+            }
+
+            conn.setRequestProperty( "Accept", "application/json;q=0.9,*/*;q=0.8" );
+            conn.setRequestProperty( "Accept-Encoding", "gzip" );
+
+            in = conn.getInputStream();
+            String contentEncoding = conn.getHeaderField( "Content-Encoding" );
+            boolean isGZipped = contentEncoding == null ? false : "gzip".equalsIgnoreCase( contentEncoding );
+            if ( isGZipped )
+            {
+                in = new GZIPInputStream( in );
+            }
+
+            router = ArtifactRouteSerializer.deserialize( new InputStreamReader( in ) );
+        }
+        catch ( IOException e )
+        {
+            throw new ArtifactRouterException( "Cannot load artifact routes from: " + source, e );
+        }
+        finally
+        {
+            close( in );
+        }
+
+        return router;
+    }
+
+    // private Proxy setProxy( Proxy proxy )
+    // {
+    // Proxy prev = new Proxy();
+    // prev.setHost( System.getProperty( "http.proxyHost" ) );
+    // prev.setNonProxyHosts( System.getProperty( "http.nonProxyHosts" ) );
+    //
+    // String port = System.getProperty( "http.proxyPort" );
+    // if ( port != null )
+    // {
+    // prev.setPort( Integer.parseInt( port ) );
+    // }
+    //
+    // if ( proxy != null )
+    // {
+    // setSystemProperty( "http.proxyHost", proxy.getHost() );
+    // setSystemProperty( "http.proxyPort", String.valueOf( proxy.getPort() ) );
+    // setSystemProperty( "http.nonProxyHosts", proxy.getNonProxyHosts() );
+    // }
+    // else
+    // {
+    // setSystemProperty( "http.proxyHost", null );
+    // setSystemProperty( "http.proxyPort", null );
+    // }
+    //
+    // return prev;
+    // }
+
+    void setSystemProperty( String key, String value )
+    {
+        if ( value != null )
+        {
+            System.setProperty( key, value );
+        }
+        else
+        {
+            System.getProperties().remove( key );
+        }
+    }
+
+    private static final class RouterAuthenticator
+        extends Authenticator
+    {
+
+        private final ArtifactRouterSession session;
+
+        private final RouterSource source;
+
+        public RouterAuthenticator( RouterSource source, ArtifactRouterSession session )
+        {
+            this.source = source;
+            this.session = session;
+        }
+
+        @Override
+        protected PasswordAuthentication getPasswordAuthentication()
+        {
+            if ( getRequestorType() == RequestorType.PROXY )
+            {
+                Proxy proxy = getProxy();
+                if ( proxy != null )
+                {
+                    String user = proxy.getUsername();
+                    String password = proxy.getPassword();
+                    if ( isNotBlank( user ) && isNotBlank( password ) )
+                    {
+                        return new PasswordAuthentication( user, password.toCharArray() );
+                    }
+                }
+            }
+            else
+            {
+                return source.getCredentials();
+            }
+
+            return null;
+        }
+
+        private Proxy getProxy()
+        {
+            return getProxy( getRequestingProtocol(), getRequestingHost() );
+        }
+
+        Proxy getProxy( String protocol, String host )
+        {
+            Proxy proxy = session.getProxy( getRequestingProtocol() );
+            if ( proxy != null && !checkNonProxyHosts( proxy, getRequestingHost() ) )
+            {
+                return proxy;
+            }
+
+            return null;
+        }
+
+        @Override
+        protected URL getRequestingURL()
+        {
+            try
+            {
+                if ( getRequestorType() == RequestorType.PROXY )
+                {
+                    Proxy proxy = getProxy();
+                    if ( proxy != null )
+                    {
+                        return new URL( proxy.getProtocol() + "://" + proxy.getHost()
+                            + ( proxy.getPort() > 0 ? ":" + proxy.getPort() : "" ) );
+                    }
+                }
+                else
+                {
+                    return new URL( source.getUrl() );
+                }
+            }
+            catch ( MalformedURLException e )
+            {
+            }
+
+            return null;
+        }
+
+        private static boolean checkNonProxyHosts( Proxy proxy, String targetHost )
+        {
+            if ( targetHost == null )
+            {
+                targetHost = new String();
+            }
+            if ( proxy == null )
+            {
+                return false;
+            }
+            String nonProxyHosts = proxy.getNonProxyHosts();
+            if ( nonProxyHosts == null )
+            {
+                return false;
+            }
+
+            StringTokenizer tokenizer = new StringTokenizer( nonProxyHosts, "|" );
+
+            while ( tokenizer.hasMoreTokens() )
+            {
+                String pattern = tokenizer.nextToken();
+                pattern = pattern.replaceAll( "\\.", "\\\\." ).replaceAll( "\\*", ".*" );
+                if ( targetHost.matches( pattern ) )
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+
+}

Propchange: maven/maven-3/branches/mirror-group-routing/maven-routem-impl/src/main/java/org/apache/maven/artifact/router/loader/DefaultArtifactRouterReader.java
------------------------------------------------------------------------------
    svn:eol-style = native