1 |
779bac69
|
Marc NICOLAS
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
package fr.ias.sitools.resources.spectrofits;
|
20 |
|
|
|
21 |
|
|
import java.util.HashSet;
|
22 |
|
|
import java.util.Map;
|
23 |
|
|
import java.util.Set;
|
24 |
|
|
|
25 |
|
|
import fr.cnes.sitools.common.validator.ConstraintViolation;
|
26 |
|
|
import fr.cnes.sitools.common.validator.Validator;
|
27 |
|
|
import fr.cnes.sitools.dataset.DataSetApplication;
|
28 |
|
|
import fr.cnes.sitools.plugins.resources.model.DataSetSelectionType;
|
29 |
|
|
import fr.cnes.sitools.plugins.resources.model.ResourceModel;
|
30 |
|
|
import fr.cnes.sitools.plugins.resources.model.ResourceParameter;
|
31 |
|
|
import fr.cnes.sitools.plugins.resources.model.ResourceParameterType;
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
public class GetFitsDataSpectroModel extends ResourceModel {
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
public GetFitsDataSpectroModel() {
|
45 |
|
|
|
46 |
|
|
super();
|
47 |
|
|
setClassAuthor("Boualem HASNOUN");
|
48 |
|
|
setClassOwner("IAS2");
|
49 |
|
|
setClassVersion("1.0");
|
50 |
|
|
setName("GetFitsDataSpectroModel");
|
51 |
|
|
setDescription("Getting data and metadata from a fits file");
|
52 |
|
|
setClassName("fr.ias.sitools.resources.spectrofits.GetFitsDataSpectroModel");
|
53 |
|
|
setResourceClassName(fr.ias.sitools.resources.spectrofits.GetFitsDataSpectro.class.getName());
|
54 |
|
|
|
55 |
|
|
ResourceParameter paramColUrl = new ResourceParameter("colUrl", "Colum containing the url of the fits file.",
|
56 |
|
|
ResourceParameterType.PARAMETER_INTERN);
|
57 |
|
|
paramColUrl.setValueType("xs:dataset.columnAlias");
|
58 |
|
|
this.addParam(paramColUrl);
|
59 |
|
|
|
60 |
|
|
ResourceParameter paramHDU = new ResourceParameter("hduCube", "HDU number where to find the spectral cube.",
|
61 |
|
|
ResourceParameterType.PARAMETER_INTERN);
|
62 |
|
|
paramHDU.setValueType("xs:integer");
|
63 |
|
|
this.addParam(paramHDU);
|
64 |
|
|
|
65 |
|
|
ResourceParameter paramWaveFromWCS = new ResourceParameter("wave", "HDU Table and column number where to find the wave data if you can't build the wave array from the WCS metadata of the spectral cube. Ex: 4-0",
|
66 |
|
|
ResourceParameterType.PARAMETER_INTERN);
|
67 |
|
|
paramWaveFromWCS.setValueType("xs:string");
|
68 |
|
|
this.addParam(paramWaveFromWCS);
|
69 |
|
|
|
70 |
|
|
this.setApplicationClassName(DataSetApplication.class.getName());
|
71 |
|
|
this.setDataSetSelection(DataSetSelectionType.SINGLE);
|
72 |
|
|
this.getParameterByName("methods").setValue("GET");
|
73 |
|
|
this.completeAttachUrlWith("/getFitsDataSpectro");
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
@Override
|
77 |
|
|
public Validator<ResourceModel> getValidator() {
|
78 |
|
|
return new Validator<ResourceModel>() {
|
79 |
|
|
|
80 |
|
|
@Override
|
81 |
|
|
public Set<ConstraintViolation> validate(ResourceModel item) {
|
82 |
|
|
Set<ConstraintViolation> constraints = new HashSet<ConstraintViolation>();
|
83 |
|
|
Map<String, ResourceParameter> params = item.getParametersMap();
|
84 |
|
|
|
85 |
|
|
return constraints;
|
86 |
|
|
}
|
87 |
|
|
};
|
88 |
|
|
}
|
89 |
|
|
} |