From: Mathieu Baudier Date: Fri, 20 Feb 2015 16:26:38 +0000 (+0000) Subject: Adapt to changes in Aether X-Git-Tag: argeo-slc-2.1.7~84 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=81813da6b19af2157d1b27559c4cc34d9824144e;p=gpl%2Fargeo-slc.git Adapt to changes in Aether git-svn-id: https://svn.argeo.org/slc/trunk@7931 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/org.argeo.slc.support/src/org/argeo/slc/aether/spring/RemoteRepositoryFactory.java b/org.argeo.slc.support/src/org/argeo/slc/aether/spring/RemoteRepositoryFactory.java index eddcea720..7223c78cb 100644 --- a/org.argeo.slc.support/src/org/argeo/slc/aether/spring/RemoteRepositoryFactory.java +++ b/org.argeo.slc.support/src/org/argeo/slc/aether/spring/RemoteRepositoryFactory.java @@ -16,11 +16,13 @@ package org.argeo.slc.aether.spring; import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.util.repository.AuthenticationBuilder; import org.springframework.beans.factory.BeanNameAware; import org.springframework.beans.factory.FactoryBean; /** Simplifies the definition of a remote factory using Spring */ -public class RemoteRepositoryFactory implements BeanNameAware, FactoryBean { +public class RemoteRepositoryFactory implements BeanNameAware, + FactoryBean { private String beanName; private String id; private String url; @@ -28,16 +30,17 @@ public class RemoteRepositoryFactory implements BeanNameAware, FactoryBean { private String username; private String password; - public Object getObject() throws Exception { - RemoteRepository remoteRepository = new RemoteRepository.Builder( - id != null ? id : beanName, type, url).build(); - // FIXME Adapt to changes in Aether - // if (username != null) { - // Authentication authentication = new Authentication(username, - // password); - // remoteRepository.setAuthentication(authentication); - // } - return null; + public RemoteRepository getObject() throws Exception { + RemoteRepository.Builder builder = new RemoteRepository.Builder( + id != null ? id : beanName, type, url); + if (username != null) { + AuthenticationBuilder authBuilder = new AuthenticationBuilder(); + authBuilder.addUsername(username); + authBuilder.addPassword(password); + builder.setAuthentication(authBuilder.build()); + } + RemoteRepository remoteRepository = builder.build(); + return remoteRepository; } public Class getObjectType() {