Statistics
| Revision:

svn-gvsig-desktop / 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 / types / httpbasic / DownloaderHTTPBasicAuthenticationConfig.java @ 47845

History | View | Annotate | Download (1.94 KB)

1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
package org.gvsig.downloader.lib.impl.types.httpbasic;
7

    
8
import org.apache.commons.lang3.StringUtils;
9
import org.gvsig.downloader.DownloaderAuthenticationConfig;
10
import org.gvsig.downloader.DownloaderAuthenticationRequester;
11
import static org.gvsig.downloader.lib.impl.types.httpbasic.DownloaderHTTPBasicAuthenticationFactory.HTTPBASIC_AUTHENTICATION_NAME;
12
import org.gvsig.downloader.spi.AbstractDownloaderAuthenticationConfig;
13
import org.gvsig.json.JsonObjectBuilder;
14

    
15

    
16
/**
17
 *
18
 * @author jjdelcerro
19
 */
20
public class DownloaderHTTPBasicAuthenticationConfig
21
        extends AbstractDownloaderAuthenticationConfig
22
        implements DownloaderAuthenticationConfig 
23
    {
24
    
25
    /**
26
     * Constructor necesario para la persistencia
27
     */
28
    public DownloaderHTTPBasicAuthenticationConfig() {
29
        this(null, null);
30
    }
31

    
32
    public DownloaderHTTPBasicAuthenticationConfig(DownloaderHTTPBasicAuthenticationFactory factory, String baseUrl) {
33
        super(HTTPBASIC_AUTHENTICATION_NAME, factory, baseUrl);
34
    }
35
    
36
    @Override
37
    public DownloaderAuthenticationRequester create() {
38
        return new DownloaderHTTPBasicAuthenticationRequester(this);
39
    }
40

    
41
    @Override
42
    public Object clone() throws CloneNotSupportedException {
43
        return super.clone();
44
    }
45

    
46
    @Override
47
    public JsonObjectBuilder toJsonBuilder() {
48
        JsonObjectBuilder builder = super.toJsonBuilder();
49
        builder.add_class(this);
50
        return builder;
51
    }
52

    
53
    @Override
54
    public DownloaderAuthenticationConfig createAuthenticationConfig(String serviceUrl) {
55
        if (StringUtils.isBlank(serviceUrl)) {
56
            return null;
57
        }
58
        
59
        DownloaderAuthenticationConfig other = new DownloaderHTTPBasicAuthenticationConfig(null, serviceUrl);
60
        return other;
61
    }
62

    
63
}