Statistics
| Revision:

gvsig-projects-pool / org.gvsig.vcsgis / trunk / org.gvsig.vcsgis / org.gvsig.vcsgis.lib / org.gvsig.vcsgis.lib.impl / src / main / java / org / gvsig / vcsgis / lib / requests / AbstractVCSGisRequest.java @ 2697

History | View | Annotate | Download (2.39 KB)

1
/*
2
 * gvSIG. Desktop Geographic Information System.
3
 * 
4
 * Copyright (C) 2007-2020 gvSIG Association.
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License 
17
 * along with this program. If not, see <https://www.gnu.org/licenses/>. 
18
 * 
19
 * For any additional information, do not hesitate to contact us
20
 * at info AT gvsig.com, or visit our website www.gvsig.com.
21
 */
22

    
23
package org.gvsig.vcsgis.lib.requests;
24

    
25
import java.io.IOException;
26
import java.io.InputStream;
27
import javax.json.JsonValue;
28
import org.gvsig.vcsgis.lib.VCSGisUtils;
29
import org.gvsig.vcsgis.lib.repository.VCSGisRepository;
30
import org.gvsig.vcsgis.lib.repository.requests.VCSGisRequest;
31
import org.slf4j.Logger;
32
import org.slf4j.LoggerFactory;
33

    
34
/**
35
 *
36
 * @author gvSIG Team
37
 */
38
public abstract class AbstractVCSGisRequest implements VCSGisRequest {
39

    
40
    protected static final Logger LOGGER = LoggerFactory.getLogger(AbstractVCSGisRequest.class);
41

    
42
    String code;
43
    int lastErrorCode;
44
    String lastErrorMessage;
45
    final VCSGisRepository repository;
46

    
47
    public AbstractVCSGisRequest(VCSGisRepository repository) {
48
        this.repository = repository;
49
    }
50
    
51
    @Override
52
    public String getCode() {
53
        return this.code;
54
    }
55

    
56
    @Override
57
    public int getLastErrorCode() {
58
        return this.lastErrorCode;
59
    }
60

    
61
    @Override
62
    public String getLastErrorMessage() {
63
        return this.lastErrorMessage;
64
    }
65

    
66
    protected VCSGisRepository getRepository() {
67
        return repository;
68
    }
69

    
70
    protected int error(int code) {
71
        return error(code, null);
72
    }
73
    
74
    protected int error(int code, String message) {
75
        this.lastErrorCode = code;
76
        if( message==null ) {
77
            this.lastErrorMessage = VCSGisUtils.getErrorMessage(code);        
78
        } else {
79
            this.lastErrorMessage = message;
80
        }
81
        return code;
82
    }
83
  
84
    @Override
85
    public void dispose() {
86
    }
87

    
88
}