git_sitools_idoc / sitools-idoc / hesiod / javaExt / src / fr / ias / sitools / resources / spectrofits / GetFitsDataSpectroModel.java @ 779bac69
1 |
/*******************************************************************************
|
---|---|
2 |
* Copyright 2010-2013 CNES - CENTRE NATIONAL d'ETUDES SPATIALES
|
3 |
*
|
4 |
* This file is part of SITools2.
|
5 |
*
|
6 |
* SITools2 is free software: you can redistribute it and/or modify
|
7 |
* it under the terms of the GNU General Public License as published by
|
8 |
* the Free Software Foundation, either version 3 of the License, or
|
9 |
* (at your option) any later version.
|
10 |
*
|
11 |
* SITools2 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 SITools2. If not, see <http://www.gnu.org/licenses/>.
|
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 |
* The Model for show fits header resource
|
35 |
*
|
36 |
*
|
37 |
* @author b.hasnoun
|
38 |
*/
|
39 |
public class GetFitsDataSpectroModel extends ResourceModel { |
40 |
|
41 |
/**
|
42 |
* Constructor
|
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 |
} |