Revision 47841 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.downloader/org.gvsig.downloader.lib/org.gvsig.downloader.lib.impl/src/main/java/org/gvsig/downloader/lib/impl/DownloaderManagerImpl.java
DownloaderManagerImpl.java | ||
---|---|---|
39 | 39 |
import org.gvsig.downloader.DownloaderCredentials; |
40 | 40 |
import org.gvsig.downloader.DownloaderManager; |
41 | 41 |
import static org.gvsig.downloader.DownloaderManager.urlStartsWith; |
42 |
import org.gvsig.json.Json; |
|
42 | 43 |
import org.slf4j.Logger; |
43 | 44 |
import org.slf4j.LoggerFactory; |
44 | 45 |
|
... | ... | |
146 | 147 |
} |
147 | 148 |
} |
148 | 149 |
DownloaderAuthenticationConfig config = this.getAuthenticationConfigurationService(url); |
150 |
if(config == null){ |
|
151 |
return null; |
|
152 |
} |
|
149 | 153 |
for (DownloaderCredentials theCredentials : this.credentials) { |
150 | 154 |
DownloaderCredentials x = config.getCredentials(theCredentials); |
151 | 155 |
if(x != null) { |
... | ... | |
202 | 206 |
} |
203 | 207 |
return null; |
204 | 208 |
} |
205 |
|
|
209 |
|
|
206 | 210 |
@Override |
207 | 211 |
public Collection<DownloaderAuthenticationFactory> getAuthenticationTypes() { |
208 | 212 |
return this.authenticationTypes.values(); |
... | ... | |
224 | 228 |
|
225 | 229 |
@Override |
226 | 230 |
public DownloaderAuthenticationFactory getDownloaderAuthenticationFactory(String providerName) { |
227 |
return this.authenticationTypes.get(providerName); |
|
231 |
return this.authenticationTypes.get(providerName.toLowerCase());
|
|
228 | 232 |
} |
233 |
|
|
234 |
public void registerAuthenticationConfigurationService(String config) { |
|
235 |
if(StringUtils.isNotBlank(config)) { |
|
236 |
DownloaderAuthenticationConfig downloaderConfig = (DownloaderAuthenticationConfig) Json.toObject(config); |
|
237 |
if(downloaderConfig != null){ |
|
238 |
this.registerAuthenticationConfigurationService(downloaderConfig); |
|
239 |
} |
|
240 |
} |
|
241 |
} |
|
229 | 242 |
|
243 |
public String getAuthenticationConfigurationServiceAsString(String baseUrl) { |
|
244 |
DownloaderAuthenticationConfig downloaderConfig = this.getAuthenticationConfigurationService(baseUrl); |
|
245 |
if(downloaderConfig != null){ |
|
246 |
return downloaderConfig.toJson().toString(); |
|
247 |
} |
|
248 |
return null; |
|
249 |
} |
|
230 | 250 |
} |
Also available in: Unified diff