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 / AbstractRequest.java @ 3375
History | View | Annotate | Download (2.54 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.util.Map; |
26 |
import org.gvsig.vcsgis.lib.repository.VCSGisRepository; |
27 |
import org.gvsig.vcsgis.lib.repository.requests.VCSGisRequest; |
28 |
import org.slf4j.Logger; |
29 |
import org.slf4j.LoggerFactory; |
30 |
|
31 |
/**
|
32 |
*
|
33 |
* @author gvSIG Team
|
34 |
*/
|
35 |
public abstract class AbstractRequest implements VCSGisRequest { |
36 |
|
37 |
protected static final Logger LOGGER = LoggerFactory.getLogger(AbstractRequest.class); |
38 |
|
39 |
private final RequestHelper helper; |
40 |
|
41 |
public AbstractRequest(RequestHelper helper) {
|
42 |
this.helper = helper;
|
43 |
} |
44 |
|
45 |
public RequestHelper helper() {
|
46 |
return helper;
|
47 |
} |
48 |
|
49 |
@Override
|
50 |
public String getCode() { |
51 |
return helper.getCode();
|
52 |
} |
53 |
|
54 |
@Override
|
55 |
public String getRequestName() { |
56 |
return helper.getRequestName();
|
57 |
} |
58 |
|
59 |
@Override
|
60 |
public int getLastErrorCode() { |
61 |
return helper.getLastErrorCode();
|
62 |
} |
63 |
|
64 |
@Override
|
65 |
public String getLastErrorMessage() { |
66 |
return helper.getLastErrorMessage();
|
67 |
} |
68 |
|
69 |
protected VCSGisRepository getRepository() {
|
70 |
return helper.getRepository();
|
71 |
} |
72 |
|
73 |
protected int error(int code) { |
74 |
return helper.error(code, null); |
75 |
} |
76 |
|
77 |
public int error(int code, String message) { |
78 |
return helper.error(code, message);
|
79 |
} |
80 |
|
81 |
@Override
|
82 |
public void dispose() { |
83 |
helper.dispose(); |
84 |
} |
85 |
|
86 |
@Override
|
87 |
public void setEnabledStatus(boolean enable) { |
88 |
this.helper().setEnabledStatus(enable);
|
89 |
} |
90 |
|
91 |
@Override
|
92 |
public void setAuthenticationTokenAndUser(Map<String, String> params) { |
93 |
this.setAuthenticationToken(params.get("auth")); |
94 |
this.setUserCode(params.get("user")); |
95 |
} |
96 |
|
97 |
|
98 |
|
99 |
} |