maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject [10/50] git commit: o Accounted for refactoring of aether-api
Date Mon, 18 Mar 2013 21:47:28 GMT
o Accounted for refactoring of aether-api


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/28387451
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/28387451
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/28387451

Branch: refs/heads/master
Commit: 28387451563d45dbc166df3d4b029b63a858c6ac
Parents: 03b0269
Author: Benjamin Bentmann <bentmann@apache.org>
Authored: Mon Sep 17 00:05:23 2012 +0200
Committer: Benjamin Bentmann <bentmann@apache.org>
Committed: Mon Sep 17 00:05:23 2012 +0200

----------------------------------------------------------------------
 .../repository/legacy/LegacyRepositorySystem.java  |   26 ++++++++++----
 .../main/java/org/apache/maven/DefaultMaven.java   |   18 ++++++----
 .../java/org/apache/maven/RepositoryUtils.java     |   12 ++++--
 3 files changed, 36 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/28387451/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java
----------------------------------------------------------------------
diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java
b/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java
index 366f8ce..591debc 100644
--- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java
+++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java
@@ -74,6 +74,7 @@ import org.codehaus.plexus.component.repository.exception.ComponentLookupExcepti
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.util.StringUtils;
 import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.repository.AuthenticationContext;
 import org.eclipse.aether.repository.AuthenticationSelector;
 import org.eclipse.aether.repository.ProxySelector;
 import org.eclipse.aether.repository.RemoteRepository;
@@ -583,13 +584,17 @@ public class LegacyRepositorySystem
             AuthenticationSelector selector = session.getAuthenticationSelector();
             if ( selector != null )
             {
-                org.eclipse.aether.repository.Authentication auth =
-                    selector.getAuthentication( RepositoryUtils.toRepo( repository ) );
+                RemoteRepository repo = RepositoryUtils.toRepo( repository );
+                org.eclipse.aether.repository.Authentication auth = selector.getAuthentication(
repo );
                 if ( auth != null )
                 {
-                    Authentication result = new Authentication( auth.getUsername(), auth.getPassword()
);
-                    result.setPrivateKey( auth.getPrivateKeyFile() );
-                    result.setPassphrase( auth.getPassphrase() );
+                    AuthenticationContext authCtx = AuthenticationContext.forRepository(
session, repo );
+                    Authentication result =
+                        new Authentication( authCtx.get( AuthenticationContext.USERNAME ),
+                                            authCtx.get( AuthenticationContext.PASSWORD )
);
+                    result.setPrivateKey( authCtx.get( AuthenticationContext.PRIVATE_KEY_PATH
) );
+                    result.setPassphrase( authCtx.get( AuthenticationContext.PRIVATE_KEY_PASSPHRASE
) );
+                    authCtx.close();
                     return result;
                 }
             }
@@ -688,7 +693,8 @@ public class LegacyRepositorySystem
             ProxySelector selector = session.getProxySelector();
             if ( selector != null )
             {
-                org.eclipse.aether.repository.Proxy proxy = selector.getProxy( RepositoryUtils.toRepo(
repository ) );
+                RemoteRepository repo = RepositoryUtils.toRepo( repository );
+                org.eclipse.aether.repository.Proxy proxy = selector.getProxy( repo );
                 if ( proxy != null )
                 {
                     Proxy p = new Proxy();
@@ -697,8 +703,12 @@ public class LegacyRepositorySystem
                     p.setPort( proxy.getPort() );
                     if ( proxy.getAuthentication() != null )
                     {
-                        p.setUserName( proxy.getAuthentication().getUsername() );
-                        p.setPassword( proxy.getAuthentication().getPassword() );
+                        AuthenticationContext authCtx = AuthenticationContext.forProxy( session,
repo );
+                        p.setUserName( authCtx.get( AuthenticationContext.USERNAME ) );
+                        p.setPassword( authCtx.get( AuthenticationContext.PASSWORD ) );
+                        p.setNtlmDomain( authCtx.get( AuthenticationContext.NTLM_DOMAIN )
);
+                        p.setNtlmHost( authCtx.get( AuthenticationContext.NTLM_WORKSTATION
) );
+                        authCtx.close();
                     }
                     return p;
                 }

http://git-wip-us.apache.org/repos/asf/maven/blob/28387451/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
index 28769e7..b6f3f49 100644
--- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
+++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
@@ -83,7 +83,6 @@ import org.eclipse.aether.collection.DependencyGraphTransformer;
 import org.eclipse.aether.collection.DependencyManager;
 import org.eclipse.aether.collection.DependencySelector;
 import org.eclipse.aether.collection.DependencyTraverser;
-import org.eclipse.aether.repository.Authentication;
 import org.eclipse.aether.repository.LocalRepository;
 import org.eclipse.aether.repository.RepositoryPolicy;
 import org.eclipse.aether.repository.WorkspaceReader;
@@ -99,6 +98,7 @@ import org.eclipse.aether.util.graph.transformer.ConflictMarker;
 import org.eclipse.aether.util.graph.transformer.JavaDependencyContextRefiner;
 import org.eclipse.aether.util.graph.transformer.JavaEffectiveScopeCalculator;
 import org.eclipse.aether.util.graph.traverser.FatArtifactTraverser;
+import org.eclipse.aether.util.repository.AuthenticationBuilder;
 import org.eclipse.aether.util.repository.ChainedWorkspaceReader;
 import org.eclipse.aether.util.repository.DefaultAuthenticationSelector;
 import org.eclipse.aether.util.repository.DefaultMirrorSelector;
@@ -407,19 +407,21 @@ public class DefaultMaven
         DefaultProxySelector proxySelector = new DefaultProxySelector();
         for ( Proxy proxy : decrypted.getProxies() )
         {
-            Authentication proxyAuth = new Authentication( proxy.getUsername(), proxy.getPassword()
);
-            proxySelector.add( new org.eclipse.aether.repository.Proxy( proxy.getProtocol(),
proxy.getHost(), proxy.getPort(),
-                                                                proxyAuth ), proxy.getNonProxyHosts()
);
+            AuthenticationBuilder authBuilder = new AuthenticationBuilder();
+            authBuilder.username( proxy.getUsername() ).password( proxy.getPassword() );
+            proxySelector.add( new org.eclipse.aether.repository.Proxy( proxy.getProtocol(),
proxy.getHost(),
+                                                                        proxy.getPort(),
authBuilder.build() ),
+                               proxy.getNonProxyHosts() );
         }
         session.setProxySelector( proxySelector );
 
         DefaultAuthenticationSelector authSelector = new DefaultAuthenticationSelector();
         for ( Server server : decrypted.getServers() )
         {
-            Authentication auth =
-                new Authentication( server.getUsername(), server.getPassword(), server.getPrivateKey(),
-                                    server.getPassphrase() );
-            authSelector.add( server.getId(), auth );
+            AuthenticationBuilder authBuilder = new AuthenticationBuilder();
+            authBuilder.username( server.getUsername() ).password( server.getPassword() );
+            authBuilder.privateKey( server.getPrivateKey(), server.getPassphrase() );
+            authSelector.add( server.getId(), authBuilder.build() );
 
             if ( server.getConfiguration() != null )
             {

http://git-wip-us.apache.org/repos/asf/maven/blob/28387451/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java b/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java
index 4ad30ea..f07a377 100644
--- a/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java
+++ b/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java
@@ -44,6 +44,7 @@ import org.eclipse.aether.repository.Authentication;
 import org.eclipse.aether.repository.Proxy;
 import org.eclipse.aether.repository.RemoteRepository;
 import org.eclipse.aether.repository.RepositoryPolicy;
+import org.eclipse.aether.util.repository.AuthenticationBuilder;
 
 /**
  * <strong>Warning:</strong> This is an internal utility class that is only public
for technical reasons, it is not part
@@ -247,8 +248,10 @@ public class RepositoryUtils
         Authentication result = null;
         if ( auth != null )
         {
-            result =
-                new Authentication( auth.getUsername(), auth.getPassword(), auth.getPrivateKey(),
auth.getPassphrase() );
+            AuthenticationBuilder authBuilder = new AuthenticationBuilder();
+            authBuilder.username( auth.getUsername() ).password( auth.getPassword() );
+            authBuilder.privateKey( auth.getPrivateKey(), auth.getPassphrase() );
+            result = authBuilder.build();
         }
         return result;
     }
@@ -258,8 +261,9 @@ public class RepositoryUtils
         Proxy result = null;
         if ( proxy != null )
         {
-            Authentication auth = new Authentication( proxy.getUserName(), proxy.getPassword()
);
-            result = new Proxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(), auth
);
+            AuthenticationBuilder authBuilder = new AuthenticationBuilder();
+            authBuilder.username( proxy.getUserName() ).password( proxy.getPassword() );
+            result = new Proxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(), authBuilder.build()
);
         }
         return result;
     }


Mime
View raw message