1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8
|
|
9
|
|
10
|
|
11
|
|
12
|
|
13
|
|
14
|
|
15
|
|
16
|
|
17
|
|
18
|
|
19
|
package fr.ias.sitools.resources.vo;
|
20
|
|
21
|
import fr.ias.sitools.vo.ssa.SimpleSpectralAccessProtocolLibrary;
|
22
|
import fr.cnes.sitools.common.validator.ConstraintViolation;
|
23
|
import fr.cnes.sitools.common.validator.ConstraintViolationLevel;
|
24
|
import fr.cnes.sitools.common.validator.Validator;
|
25
|
import fr.cnes.sitools.dataset.DataSetApplication;
|
26
|
import fr.cnes.sitools.plugins.resources.model.DataSetSelectionType;
|
27
|
import fr.cnes.sitools.plugins.resources.model.ResourceModel;
|
28
|
import fr.cnes.sitools.plugins.resources.model.ResourceParameter;
|
29
|
import fr.cnes.sitools.plugins.resources.model.ResourceParameterType;
|
30
|
import fr.cnes.sitools.util.Util;
|
31
|
import java.util.HashSet;
|
32
|
import java.util.Map;
|
33
|
import java.util.Set;
|
34
|
import java.util.logging.Logger;
|
35
|
|
36
|
|
37
|
|
38
|
|
39
|
|
40
|
|
41
|
|
42
|
|
43
|
|
44
|
|
45
|
|
46
|
|
47
|
|
48
|
|
49
|
|
50
|
|
51
|
|
52
|
|
53
|
|
54
|
|
55
|
|
56
|
|
57
|
|
58
|
|
59
|
|
60
|
|
61
|
|
62
|
|
63
|
|
64
|
public class SimpleSpectralAccessResourceModel extends ResourceModel {
|
65
|
|
66
|
|
67
|
|
68
|
|
69
|
private static final Logger LOG = Logger.getLogger(SimpleSpectralAccessResourceModel.class.getName());
|
70
|
|
71
|
|
72
|
|
73
|
|
74
|
public SimpleSpectralAccessResourceModel() {
|
75
|
super();
|
76
|
setClassAuthor("Mnicoals");
|
77
|
setClassOwner("IAS");
|
78
|
setClassVersion("0.1");
|
79
|
setName("Simple Spectral Access Protocol");
|
80
|
setDescription("This plugin provides an access to your data through the Simple Image Access Protocol");
|
81
|
setResourceClassName(fr.ias.sitools.resources.vo.SimpleSpectralAccessResource.class.getName());
|
82
|
|
83
|
this.setApplicationClassName(DataSetApplication.class.getName());
|
84
|
this.setDataSetSelection(DataSetSelectionType.SINGLE);
|
85
|
this.getParameterByName("methods").setValue("GET");
|
86
|
this.completeAttachUrlWith("/services/vo/ssa");
|
87
|
setConfiguration();
|
88
|
|
89
|
|
90
|
|
91
|
|
92
|
|
93
|
|
94
|
|
95
|
}
|
96
|
|
97
|
|
98
|
|
99
|
|
100
|
private void setConfiguration() {
|
101
|
final ResourceParameter dico = new ResourceParameter(fr.ias.sitools.vo.ssa.SimpleSpectralAccessProtocolLibrary.DICTIONARY, "Dictionary name that sets up the service.",
|
102
|
ResourceParameterType.PARAMETER_INTERN);
|
103
|
dico.setValueType("xs:dictionary");
|
104
|
this.addParam(dico);
|
105
|
|
106
|
final ResourceParameter intersect = new ResourceParameter(fr.ias.sitools.vo.ssa.SimpleSpectralAccessProtocolLibrary.INTERSECT,
|
107
|
"how matched images should intersect the region of interest",
|
108
|
ResourceParameterType.PARAMETER_INTERN);
|
109
|
|
110
|
intersect.setValueType("xs:enum[CENTER, OVERLAPS]");
|
111
|
intersect.setValue("OVERLAPS");
|
112
|
addParam(intersect);
|
113
|
|
114
|
final ResourceParameter verb = new ResourceParameter(fr.ias.sitools.vo.ssa.SimpleSpectralAccessProtocolLibrary.VERB,
|
115
|
"Verbosity determines how many columns are to be returned in the resulting table",
|
116
|
ResourceParameterType.PARAMETER_INTERN);
|
117
|
verb.setValueType("xs:enum[0, 1, 2, 3]");
|
118
|
verb.setValue("1");
|
119
|
addParam(verb);
|
120
|
|
121
|
final ResourceParameter responsibleParty = new ResourceParameter(fr.ias.sitools.vo.ssa.SimpleSpectralAccessProtocolLibrary.RESPONSIBLE_PARTY,
|
122
|
"The data provider's name and email", ResourceParameterType.PARAMETER_INTERN);
|
123
|
addParam(responsibleParty);
|
124
|
|
125
|
final ResourceParameter serviceName = new ResourceParameter(fr.ias.sitools.vo.ssa.SimpleSpectralAccessProtocolLibrary.SERVICE_NAME,
|
126
|
"The name of the service",
|
127
|
ResourceParameterType.PARAMETER_INTERN);
|
128
|
serviceName.setValueType("xs:enum[Spectral Archive Service, Spectral Cutout Service, Spectral Mosaicing Service, Spectral Extraction Service]");
|
129
|
serviceName.setValue("Spectral Archive Service");
|
130
|
addParam(serviceName);
|
131
|
|
132
|
final ResourceParameter description = new ResourceParameter(fr.ias.sitools.vo.ssa.SimpleSpectralAccessProtocolLibrary.DESCRIPTION,
|
133
|
"A couple of paragraphs of text that describe the nature of the service and its wider context",
|
134
|
ResourceParameterType.PARAMETER_INTERN);
|
135
|
addParam(description);
|
136
|
|
137
|
final ResourceParameter instrument = new ResourceParameter(fr.ias.sitools.vo.ssa.SimpleSpectralAccessProtocolLibrary.INSTRUMENT,
|
138
|
"The instrument that made the observations, for example STScI.HST.WFPC2",
|
139
|
ResourceParameterType.PARAMETER_INTERN);
|
140
|
addParam(instrument);
|
141
|
|
142
|
final ResourceParameter maxQuerySize = new ResourceParameter(
|
143
|
fr.ias.sitools.vo.ssa.SimpleSpectralAccessProtocolLibrary.MAX_QUERY_SIZE,
|
144
|
"The largest search area, given in decimal degrees, that will be accepted by the service without returning an error condition."
|
145
|
+ " A value of 64800 indicates that there is no restriction",
|
146
|
ResourceParameterType.PARAMETER_INTERN);
|
147
|
maxQuerySize.setValue("64800");
|
148
|
addParam(maxQuerySize);
|
149
|
|
150
|
final ResourceParameter maxImageSize = new ResourceParameter(
|
151
|
fr.ias.sitools.vo.ssa.SimpleSpectralAccessProtocolLibrary.MAX_IMAGE_SIZE,
|
152
|
"The largest image area, given in decimal degrees, that will be returned by the service",
|
153
|
ResourceParameterType.PARAMETER_INTERN);
|
154
|
addParam(maxImageSize);
|
155
|
|
156
|
final ResourceParameter maxFileSize = new ResourceParameter(
|
157
|
fr.ias.sitools.vo.ssa.SimpleSpectralAccessProtocolLibrary.MAX_FILE_SIZE,
|
158
|
"The largest file size, given in Bytes, that will be returned by the service",
|
159
|
ResourceParameterType.PARAMETER_INTERN);
|
160
|
addParam(maxFileSize);
|
161
|
|
162
|
final ResourceParameter maxRecords = new ResourceParameter(fr.ias.sitools.vo.ssa.SimpleSpectralAccessProtocolLibrary.MAX_RECORDS,
|
163
|
"The largest number of records that the service will return", ResourceParameterType.PARAMETER_INTERN);
|
164
|
maxRecords.setValue("-1");
|
165
|
addParam(maxRecords);
|
166
|
|
167
|
final ResourceParameter geoAttribut = new ResourceParameter(fr.ias.sitools.vo.ssa.SimpleSpectralAccessProtocolLibrary.GEO_ATTRIBUT,
|
168
|
"Geographical attribut for OVERLAPS mode. The geographical attribut must be spoly datatype from pgsphere",
|
169
|
ResourceParameterType.PARAMETER_INTERN);
|
170
|
geoAttribut.setValueType("xs:dataset.columnAlias");
|
171
|
addParam(geoAttribut);
|
172
|
|
173
|
}
|
174
|
|
175
|
|
176
|
|
177
|
|
178
|
|
179
|
|
180
|
@Override
|
181
|
public final Validator<ResourceModel> getValidator() {
|
182
|
return new Validator<ResourceModel>() {
|
183
|
@Override
|
184
|
public final Set<ConstraintViolation> validate(final ResourceModel item) {
|
185
|
final Set<ConstraintViolation> constraintList = new HashSet<ConstraintViolation>();
|
186
|
final Map<String, ResourceParameter> params = item.getParametersMap();
|
187
|
final ResourceParameter dico = params.get(fr.ias.sitools.vo.ssa.SimpleSpectralAccessProtocolLibrary.DICTIONARY);
|
188
|
|
189
|
if (!Util.isNotEmpty(dico.getValue())) {
|
190
|
final ConstraintViolation constraint = new ConstraintViolation();
|
191
|
constraint.setLevel(ConstraintViolationLevel.WARNING);
|
192
|
constraint.setMessage("A dictionary must be set");
|
193
|
constraint.setValueName(fr.ias.sitools.vo.ssa.SimpleSpectralAccessProtocolLibrary.DICTIONARY);
|
194
|
constraintList.add(constraint);
|
195
|
}
|
196
|
return constraintList;
|
197
|
}
|
198
|
};
|
199
|
}
|
200
|
}
|