Revision 94284c9a
Added by Marc Nicolas about 9 years ago
hesiod/javaExt/src/fr/ias/sitools/vo/representation/DatabaseRequestIasModel.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
|
|
7 |
package fr.ias.sitools.vo.representation; |
|
8 |
|
|
9 |
import fr.cnes.sitools.astro.representation.DatabaseRequestModel; |
|
10 |
import fr.cnes.sitools.common.exception.SitoolsException; |
|
11 |
import fr.cnes.sitools.dataset.converter.business.ConverterChained; |
|
12 |
import fr.cnes.sitools.dataset.database.DatabaseRequest; |
|
13 |
import java.util.logging.Level; |
|
14 |
import java.util.logging.Logger; |
|
15 |
|
|
16 |
/** |
|
17 |
* |
|
18 |
* @author marc |
|
19 |
*/ |
|
20 |
public class DatabaseRequestIasModel extends DatabaseRequestModel { |
|
21 |
|
|
22 |
/** |
|
23 |
* Logger. |
|
24 |
*/ |
|
25 |
private static final Logger LOG = Logger.getLogger(DatabaseRequestIasModel.class.getName()); |
|
26 |
/** |
|
27 |
* DB Result set. |
|
28 |
*/ |
|
29 |
private DatabaseRequest request; |
|
30 |
/** |
|
31 |
* SITools2 converters. |
|
32 |
*/ |
|
33 |
private ConverterChained converterChained; |
|
34 |
/** |
|
35 |
* Number of rows. |
|
36 |
*/ |
|
37 |
private transient int sizeValue; |
|
38 |
|
|
39 |
/** |
|
40 |
* Empty constructor. |
|
41 |
*/ |
|
42 |
protected DatabaseRequestIasModel() { |
|
43 |
setSize(0); |
|
44 |
} |
|
45 |
|
|
46 |
public DatabaseRequestIasModel(DatabaseRequest rsVal, ConverterChained converterChainedVal) { |
|
47 |
super(rsVal, converterChainedVal); |
|
48 |
int countRowRequest = rsVal.getCount(); |
|
49 |
setSize(countRowRequest); |
|
50 |
|
|
51 |
// we need to close the connection here |
|
52 |
// otherwise the connection will not be free. |
|
53 |
if (this.size() == 0) { |
|
54 |
try { |
|
55 |
this.request.close(); |
|
56 |
} catch (SitoolsException ex) { |
|
57 |
LOG.log(Level.SEVERE, null, ex); |
|
58 |
} |
|
59 |
} |
|
60 |
} |
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
} |
hesiod/javaExt/src/fr/ias/sitools/vo/representation/VOTableRepresentation.java | ||
---|---|---|
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.vo.representation; |
|
20 |
|
|
21 |
import java.io.IOException; |
|
22 |
import java.io.OutputStream; |
|
23 |
import java.util.Map; |
|
24 |
import java.util.logging.Level; |
|
25 |
import java.util.logging.Logger; |
|
26 |
import org.restlet.data.LocalReference; |
|
27 |
import org.restlet.data.MediaType; |
|
28 |
import org.restlet.ext.freemarker.TemplateRepresentation; |
|
29 |
import org.restlet.representation.OutputRepresentation; |
|
30 |
import org.restlet.representation.Representation; |
|
31 |
import org.restlet.resource.ClientResource; |
|
32 |
|
|
33 |
/** |
|
34 |
* Creates a VOTable representation with a template and a data model. The data model is the following : |
|
35 |
* <pre> |
|
36 |
* root |
|
37 |
* |__ description |
|
38 |
* |__ infos |
|
39 |
* | |__ id |
|
40 |
* | |__ name (required) |
|
41 |
* | |__ valueAttribute (required) |
|
42 |
* | |__ xtype |
|
43 |
* | |__ ref |
|
44 |
* | |__ unit |
|
45 |
* | |__ ucd |
|
46 |
* | |__ utype |
|
47 |
* | |__ value |
|
48 |
* |__ params (List) |
|
49 |
* | |__ param |
|
50 |
* | |__ id |
|
51 |
* | |__ unit |
|
52 |
* | |__ datatype (required) |
|
53 |
* | |__ precision |
|
54 |
* | |__ width |
|
55 |
* | |__ xtype |
|
56 |
* | |__ ref |
|
57 |
* | |__ name (required) |
|
58 |
* | |__ ucd |
|
59 |
* | |__ utype |
|
60 |
* | |__ arraysize |
|
61 |
* | |__ value (required) |
|
62 |
* | |__ DESCRIPTION |
|
63 |
* | |__ VALUES |
|
64 |
* | |__ id |
|
65 |
* | |__ type |
|
66 |
* | |__ null |
|
67 |
* | |__ ref |
|
68 |
* | |__ OPTION (List) |
|
69 |
* | |__ option |
|
70 |
* | |__ name |
|
71 |
* | |__ value (required) |
|
72 |
* |__ fields (List) |
|
73 |
* | |__ field |
|
74 |
* | |__ DESCRIPTION |
|
75 |
* | |__ id |
|
76 |
* | |__ name (required) |
|
77 |
* | |__ ucd |
|
78 |
* | |__ utype |
|
79 |
* | |__ ref |
|
80 |
* | |__ datatype (required) |
|
81 |
* | |__ width |
|
82 |
* | |__ precision |
|
83 |
* | |__ unit |
|
84 |
* | |__ type |
|
85 |
* | |__ xtype |
|
86 |
* | |__ arraysize |
|
87 |
* |__ rows (List) (required) |
|
88 |
* | |__ row (required) |
|
89 |
* | |
|
90 |
* |__ sqlColAlias (List) (required) |
|
91 |
* | |__ sqlcol (required) |
|
92 |
* |__ mappingColAliasConceptSql (Hash) (optional) |
|
93 |
* |__ siaCut (boolean, optional) |
|
94 |
* |__ nrows (optional) |
|
95 |
* |__ mapPartFileCutUrl (Hash) (optional) |
|
96 |
* |__ primaryKey (optional) |
|
97 |
* |__ queryParams (POS,SIZE,...) |
|
98 |
* |__ queryInfos (Query status) |
|
99 |
* |
|
100 |
* </pre> Provide a VOTable representation by streaming based on Freemarker To have a dataModel by streaming, dataModel for rows element |
|
101 |
* must use the DatabaseRequestModel adapter |
|
102 |
* |
|
103 |
* @author Jean-Christophe Malapert <jean-christophe.malapert@cnes.fr> |
|
104 |
*/ |
|
105 |
public class VOTableRepresentation extends OutputRepresentation { |
|
106 |
|
|
107 |
/** |
|
108 |
* Logger. |
|
109 |
*/ |
|
110 |
private static final Logger LOG = Logger.getLogger(VOTableRepresentation.class.getName()); |
|
111 |
/** |
|
112 |
* Default template file = votable.ftl. |
|
113 |
*/ |
|
114 |
public static final String DEFAULT_TEMPLATE = "votable.ftl"; |
|
115 |
/** |
|
116 |
* Data model that contains the information to represent. |
|
117 |
*/ |
|
118 |
private Map dataModel; |
|
119 |
/** |
|
120 |
* Template file. |
|
121 |
*/ |
|
122 |
private String ftl; |
|
123 |
|
|
124 |
/** |
|
125 |
* Creates a VOTableRepresentation based on a dataModel and a templateFile. |
|
126 |
* |
|
127 |
* @param dataModelVal DataModel |
|
128 |
* @param ftlVal template File |
|
129 |
*/ |
|
130 |
public VOTableRepresentation(final Map dataModelVal, final String ftlVal) { |
|
131 |
super(MediaType.TEXT_XML); |
|
132 |
setDataModel(dataModelVal); |
|
133 |
setFtl(ftlVal); |
|
134 |
} |
|
135 |
/** |
|
136 |
* Creates a GeoJson representation with the default template (<code>DEFAULT_TEMPLATE</code>). |
|
137 |
* |
|
138 |
* @param dataModelVal the data model |
|
139 |
*/ |
|
140 |
public VOTableRepresentation(final Map dataModelVal) { |
|
141 |
this(dataModelVal, DEFAULT_TEMPLATE); |
|
142 |
} |
|
143 |
/** |
|
144 |
* Writes the representation. |
|
145 |
* |
|
146 |
* @param outputStream output stream |
|
147 |
* @throws IOException Exception |
|
148 |
*/ |
|
149 |
@Override |
|
150 |
public final void write(final OutputStream outputStream) throws IOException { |
|
151 |
final Representation metadataFtl = new ClientResource(LocalReference.createClapReference(getClass().getPackage()) + "/" |
|
152 |
+ getFtl()).get(); |
|
153 |
final TemplateRepresentation tpl = new TemplateRepresentation(metadataFtl, getDataModel(), getMediaType()); |
|
154 |
LOG.log(Level.FINEST, getFtl(), tpl); |
|
155 |
outputStream.write(tpl.getText().getBytes()); |
|
156 |
outputStream.flush(); |
|
157 |
} |
|
158 |
|
|
159 |
|
|
160 |
/** |
|
161 |
* Returns the data model. |
|
162 |
* @return the dataModel |
|
163 |
*/ |
|
164 |
protected final Map getDataModel() { |
|
165 |
return dataModel; |
|
166 |
} |
|
167 |
|
|
168 |
/** |
|
169 |
* Sets the data model. |
|
170 |
* @param dataModelVal the dataModel to set |
|
171 |
*/ |
|
172 |
protected final void setDataModel(final Map dataModelVal) { |
|
173 |
this.dataModel = dataModelVal; |
|
174 |
} |
|
175 |
|
|
176 |
/** |
|
177 |
* Returns the template filename. |
|
178 |
* @return the ftl |
|
179 |
*/ |
|
180 |
protected final String getFtl() { |
|
181 |
return ftl; |
|
182 |
} |
|
183 |
|
|
184 |
/** |
|
185 |
* Sets the template filename. |
|
186 |
* @param ftlVal the ftl to set |
|
187 |
*/ |
|
188 |
protected final void setFtl(final String ftlVal) { |
|
189 |
this.ftl = ftlVal; |
|
190 |
} |
|
191 |
} |
hesiod/javaExt/src/fr/ias/sitools/vo/representation/votable.ftl | ||
---|---|---|
1 |
<?xml version="1.0" ?> |
|
2 |
<VOTABLE version="1.2" xmlns="http://www.ivoa.net/xml/VOTable/v1.2"> |
|
3 |
<RESOURCE type="results"> |
|
4 |
<#if description?exists><DESCRIPTION>${description}</DESCRIPTION></#if> |
|
5 |
<#if queryInfos?exists> |
|
6 |
<#list queryInfos as queryInfo> |
|
7 |
<INFO<#if queryInfo.id?exists> ID="${queryInfo.id}"</#if> name="${queryInfo.name}" value="${queryInfo.valueAttribute}"<#if queryInfo.xtype?exists> xtype="${queryInfo.xtype}"</#if><#if queryInfo.unit?exists> unit="${queryInfo.unit}"</#if><#if queryInfo.ucd?exists> ucd="${queryInfo.ucd}"</#if><#if queryInfo.utype?exists> utype="${queryInfo.utype}"</#if> /> |
|
8 |
</#list> |
|
9 |
</#if> |
|
10 |
<#if queryParams?exists> |
|
11 |
<#list queryParams as queryParam> |
|
12 |
<PARAM<#if queryParam.id?exists> ID="${queryParam.id}"</#if> name="${queryParam.name}" datatype="${queryParam.datatype.value()}" <#if queryParam.xtype?exists> xtype="${queryParam.xtype}"</#if><#if queryParam.unit?exists> unit="${queryParam.unit}"</#if><#if queryParam.ucd?exists> ucd="${queryParam.ucd}"</#if><#if queryParam.utype?exists> utype="${queryParam.utype}"</#if> value="${queryParam.value}"/> |
|
13 |
</#list> |
|
14 |
</#if> |
|
15 |
<#if infos?exists> |
|
16 |
<#list infos as info> |
|
17 |
<INFO<#if info.id?exists> ID="${info.id}"</#if> name="${info.name}" value="${info.valueAttribute}"<#if info.xtype?exists> xtype="${info.xtype}"</#if><#if info.ref?exists> ref="${info.ref}"</#if><#if info.unit?exists> unit="${info.unit}"</#if><#if info.ucd?exists> ucd="${info.ucd}"</#if><#if info.utype?exists> utype="${info.utype}"</#if> /> |
|
18 |
</#list> |
|
19 |
</#if> |
|
20 |
<#if params?exists> |
|
21 |
<#list params as param> |
|
22 |
<#if param.DESCRIPTION?exists> |
|
23 |
<PARAM<#if param.id?exists> ID="${param.id}"</#if> name="${param.name}" <#if param.unit?exists> unit="${param.unit}"</#if> datatype="${param.datatype.value()}"<#if param.precision?exists> precision="${param.precision}"</#if><#if param.width?exists> ID="${param.width}"</#if><#if param.xtype?exists> xtype="${param.xtype}"</#if><#if param.ref?exists> ref="${param.ref}"</#if><#if param.ucd?exists> ucd="${param.ucd}"</#if><#if param.utype?exists> utype="${param.utype}"</#if><#if param.arraysize?exists> arraysize="${param.arraysize}"</#if> value="${param.value}"> |
|
24 |
<DESCRIPTION> |
|
25 |
<#list param.DESCRIPTION.content as description> |
|
26 |
${description} |
|
27 |
</#list> |
|
28 |
</DESCRIPTION> |
|
29 |
<#if param.VALUES?exists> |
|
30 |
<VALUES<#if param.VALUES.id?exists> ID="${param.VALUES.id}"</#if><#if param.VALUES.type?exists> type="${param.VALUES.type}"</#if><#if param.VALUES.null?exists> null="${param.VALUES.null}"</#if><#if param.VALUES.ref?exists> ref="${param.VALUES.ref}"</#if>> |
|
31 |
<#if param.VALUES.OPTION?exists> |
|
32 |
<#list param.VALUES.OPTION as option> |
|
33 |
<OPTION<#if option.name?exists> name="${option.name}"</#if> value="${option.value}"/> |
|
34 |
</#list> |
|
35 |
</#if> |
|
36 |
</VALUES> |
|
37 |
</#if> |
|
38 |
</PARAM> |
|
39 |
<#else> |
|
40 |
<PARAM<#if param.id?exists> ID="${param.id}"</#if> name="${param.name}" <#if param.unit?exists> unit="${param.unit}"</#if> datatype="${param.datatype.value()}"<#if param.precision?exists> precision="${param.precision}"</#if><#if param.width?exists> ID="${param.width}"</#if><#if param.xtype?exists> xtype="${param.xtype}"</#if><#if param.ref?exists> ref="${param.ref}"</#if><#if param.ucd?exists> ucd="${param.ucd}"</#if><#if param.utype?exists> utype="${param.utype}"</#if><#if param.arraysize?exists> arraysize="${param.arraysize}"</#if> value="${param.value}"/> |
|
41 |
</#if> |
|
42 |
</#list> |
|
43 |
</#if> |
|
44 |
<#if fields?exists> |
|
45 |
<#list fields as field> |
|
46 |
<#if field.DESCRIPTION?exists> |
|
47 |
<FIELD<#if field.id?exists> ID="${field.id}</#if> name="${field.name}"<#if field.ucd?exists> ucd="${field.ucd}"</#if><#if field.utype?exists> utype="${field.utype}"</#if><#if field.ref?exists> ref="${field.ref}"</#if><#if field.datatype?exists> datatype="${field.datatype.value()}"</#if><#if field.width?exists> width="${field.width}"</#if><#if field.precision?exists> precision="${field.precision}"</#if><#if field.unit?exists> unit="${field.unit}"</#if><#if field.type?exists> type="${field.type}"</#if><#if field.xtype?exists> xtype="${field.xtype}"</#if><#if field.arraysize?exists> arraysize="${field.arraysize}"</#if>> |
|
48 |
<DESCRIPTION> |
|
49 |
<#list field.DESCRIPTION.content as description> |
|
50 |
${description} |
|
51 |
</#list> |
|
52 |
</DESCRIPTION> |
|
53 |
</FIELD> |
|
54 |
<#else> |
|
55 |
<FIELD<#if field.id?exists> ID="${field.id}</#if> name="${field.name}"<#if field.ucd?exists> ucd="${field.ucd}"</#if><#if field.utype?exists> utype="${field.utype}"</#if><#if field.ref?exists> ref="${field.ref}"</#if><#if field.datatype?exists> datatype="${field.datatype.value()}"</#if><#if field.width?exists> width="${field.width}"</#if><#if field.precision?exists> precision="${field.precision}"</#if><#if field.unit?exists> unit="${field.unit}"</#if><#if field.type?exists> type="${field.type}"</#if><#if field.xtype?exists> xtype="${field.xtype}"</#if><#if field.arraysize?exists> arraysize="${field.arraysize}"</#if> /> |
|
56 |
</#if> |
|
57 |
</#list> |
|
58 |
</#if> |
|
59 |
<#if rows?exists> |
|
60 |
<#if nrows != 0> |
|
61 |
<TABLE<#if nrows?exists> nrows="${nrows}"</#if>> |
|
62 |
<DATA> |
|
63 |
<TABLEDATA> |
|
64 |
<#list rows as row> |
|
65 |
<TR> |
|
66 |
<#list sqlColAlias as sqlcol> |
|
67 |
<#if row["${sqlcol}"] == "null"><TD> <#if sqlcol?exists> header : ${sqlcol}</#if></TD><#else><TD>${row["${sqlcol}"]}</TD></#if> |
|
68 |
</#list> |
|
69 |
</TR> |
|
70 |
</#list> |
|
71 |
</TABLEDATA> |
|
72 |
</DATA> |
|
73 |
</TABLE> |
|
74 |
</#if> |
|
75 |
</#if> |
|
76 |
|
|
77 |
</RESOURCE> |
|
78 |
</VOTABLE> |
hesiod/javaExt/src/fr/ias/sitools/vo/tap/DataModelInterface.java | ||
---|---|---|
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.vo.tap; |
|
20 |
|
|
21 |
import java.util.Map; |
|
22 |
|
|
23 |
/** |
|
24 |
* Provides an interface to get the data model. |
|
25 |
* |
|
26 |
* @author Jean-Christophe Malapert |
|
27 |
*/ |
|
28 |
public interface DataModelInterface { |
|
29 |
|
|
30 |
/** |
|
31 |
* Returns the data model. |
|
32 |
* |
|
33 |
* @return data model |
|
34 |
*/ |
|
35 |
Map getDataModel(); |
|
36 |
} |
hesiod/javaExt/src/fr/ias/sitools/vo/tap/TableAccessProtocolAsynchronousResponse.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
|
|
7 |
package fr.ias.sitools.vo.tap; |
|
8 |
|
|
9 |
import fr.cnes.sitools.extensions.astro.application.uws.common.Util; |
|
10 |
import fr.cnes.sitools.extensions.astro.application.uws.jobmanager.AbstractJobTask; |
|
11 |
import fr.cnes.sitools.xml.uws.v1.Job; |
|
12 |
import java.util.ArrayList; |
|
13 |
import java.util.Date; |
|
14 |
import java.util.List; |
|
15 |
import java.util.logging.Level; |
|
16 |
import javax.xml.datatype.DatatypeConfigurationException; |
|
17 |
import net.ivoa.xml.uws.v1.ErrorSummary; |
|
18 |
import net.ivoa.xml.uws.v1.ErrorType; |
|
19 |
import net.ivoa.xml.uws.v1.ExecutionPhase; |
|
20 |
import org.restlet.engine.Engine; |
|
21 |
|
|
22 |
/** |
|
23 |
* |
|
24 |
* @author marc |
|
25 |
*/ |
|
26 |
public class TableAccessProtocolAsynchronousResponse extends AbstractJobTask { |
|
27 |
|
|
28 |
final TableAccessProtocolInputParameters inputParams; |
|
29 |
|
|
30 |
public TableAccessProtocolAsynchronousResponse(final TableAccessProtocolInputParameters inputParameters) { |
|
31 |
this.inputParams = inputParameters; |
|
32 |
} |
|
33 |
|
|
34 |
@Override |
|
35 |
public void run() { |
|
36 |
Engine.getLogger(TableAccessProtocolAsynchronousResponse.class.getName()).log(Level.SEVERE, "***************** JE SUIS DANS LE RUN !!!"); |
|
37 |
try { |
|
38 |
setBlinker(Thread.currentThread()); |
|
39 |
setStartTime(Util.convertIntoXMLGregorian(new Date())); |
|
40 |
setPhase(ExecutionPhase.EXECUTING); |
|
41 |
final List<String> filenameList = createJob(); |
|
42 |
//createResults(filenameList); |
|
43 |
setEndTime(Util.convertIntoXMLGregorian(new Date())); |
|
44 |
setPhase(ExecutionPhase.COMPLETED); |
|
45 |
} catch (DatatypeConfigurationException ex) { |
|
46 |
Engine.getLogger(TableAccessProtocolAsynchronousResponse.class.getName()).log(Level.SEVERE, null, ex); |
|
47 |
final ErrorSummary errorSumm = new ErrorSummary(); |
|
48 |
errorSumm.setMessage(ex.getMessage()); |
|
49 |
errorSumm.setType(ErrorType.FATAL); |
|
50 |
errorSumm.setHasDetail(true); |
|
51 |
setError(errorSumm); |
|
52 |
setPhase(ExecutionPhase.ERROR); |
|
53 |
} catch (Error error) { |
|
54 |
Engine.getLogger(TableAccessProtocolAsynchronousResponse.class.getName()).log(Level.SEVERE, null, error); |
|
55 |
final ErrorSummary errorSumm = new ErrorSummary(); |
|
56 |
errorSumm.setMessage(error.getMessage()); |
|
57 |
errorSumm.setType(ErrorType.FATAL); |
|
58 |
errorSumm.setHasDetail(true); |
|
59 |
setError(errorSumm); |
|
60 |
setPhase(ExecutionPhase.ERROR); |
|
61 |
} |
|
62 |
} |
|
63 |
|
|
64 |
private List<String> createJob(){ |
|
65 |
List<String> a = new ArrayList<String>(); |
|
66 |
Engine.getLogger(TableAccessProtocolAsynchronousResponse.class.getName()).log(Level.SEVERE,"+++++++++++++++++++++++"); |
|
67 |
|
|
68 |
final String query = this.inputParams.getQuery(); |
|
69 |
Engine.getLogger(TableAccessProtocolAsynchronousResponse.class.getName()).log(Level.SEVERE,"+++++++++++++++++++++++ QUERY : "+query); |
|
70 |
//final String format = String.valueOf(getParameterValue(TableAccessProtocolLibrary.FORMAT)); |
|
71 |
//final String lang = String.valueOf(getParameterValue(TableAccessProtocolLibrary.LANG)); |
|
72 |
Engine.getLogger(TableAccessProtocolAsynchronousResponse.class.getName()).log(Level.SEVERE,"+++++++++++++++++++++++ getJobInfo "+getJobInfo().toString()); |
|
73 |
return a; |
|
74 |
} |
|
75 |
|
|
76 |
@Override |
|
77 |
public Job getCapabilities() { |
|
78 |
throw new UnsupportedOperationException("Not supported yet."); |
|
79 |
} |
|
80 |
|
|
81 |
} |
hesiod/javaExt/src/fr/ias/sitools/vo/tap/TableAccessProtocolDataModelInterface.java | ||
---|---|---|
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.vo.tap; |
|
20 |
import java.util.Map; |
|
21 |
|
|
22 |
/* |
|
23 |
* To change this license header, choose License Headers in Project Properties. |
|
24 |
* To change this template file, choose Tools | Templates |
|
25 |
* and open the template in the editor. |
|
26 |
*/ |
|
27 |
|
|
28 |
/** |
|
29 |
* |
|
30 |
* @author marc |
|
31 |
*/ |
|
32 |
interface TableAccessProtocolDataModelInterface { |
|
33 |
Map getDataModel(); |
|
34 |
} |
hesiod/javaExt/src/fr/ias/sitools/vo/tap/TableAccessProtocolException.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
|
|
7 |
package fr.ias.sitools.vo.tap; |
|
8 |
|
|
9 |
import fr.cnes.sitools.common.exception.SitoolsException; |
|
10 |
|
|
11 |
/** |
|
12 |
* @author marc |
|
13 |
*/ |
|
14 |
public class TableAccessProtocolException extends SitoolsException { |
|
15 |
|
|
16 |
public TableAccessProtocolException(String message) { |
|
17 |
super(message); |
|
18 |
} |
|
19 |
} |
hesiod/javaExt/src/fr/ias/sitools/vo/tap/TableAccessProtocolInputParameters.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
|
|
7 |
package fr.ias.sitools.vo.tap; |
|
8 |
|
|
9 |
import fr.cnes.sitools.dataset.DataSetApplication; |
|
10 |
import fr.cnes.sitools.plugins.resources.model.ResourceModel; |
|
11 |
import java.util.ArrayList; |
|
12 |
import java.util.Collections; |
|
13 |
import java.util.HashMap; |
|
14 |
import java.util.List; |
|
15 |
import java.util.Map; |
|
16 |
import java.util.logging.Level; |
|
17 |
import net.ivoa.xml.votable.v1.Info; |
|
18 |
import org.restlet.Context; |
|
19 |
import org.restlet.Request; |
|
20 |
|
|
21 |
/** |
|
22 |
* |
|
23 |
* @author marc |
|
24 |
*/ |
|
25 |
public class TableAccessProtocolInputParameters implements DataModelInterface { |
|
26 |
|
|
27 |
/** |
|
28 |
* Data model that stores the metadata response of the service. |
|
29 |
*/ |
|
30 |
private final transient Map dataModel = new HashMap(); |
|
31 |
/** |
|
32 |
* Request. |
|
33 |
*/ |
|
34 |
private final transient Request request; |
|
35 |
/** |
|
36 |
* Context. |
|
37 |
*/ |
|
38 |
private final transient Context context; |
|
39 |
/** |
|
40 |
* Application where this resources is linked. |
|
41 |
*/ |
|
42 |
private final transient DataSetApplication datasetApp; |
|
43 |
/** |
|
44 |
* Configuration parameters of this resource. |
|
45 |
*/ |
|
46 |
private final transient ResourceModel resourceModel; |
|
47 |
|
|
48 |
private final String query; |
|
49 |
private final String format; |
|
50 |
|
|
51 |
|
|
52 |
/** |
|
53 |
* Constructs the objet that returns the metadata of the service. |
|
54 |
* @param datasetAppVal application |
|
55 |
* @param requestVal request |
|
56 |
* @param contextVal context |
|
57 |
* @param resourceModelVal configuration parameters |
|
58 |
*/ |
|
59 |
public TableAccessProtocolInputParameters(final DataSetApplication datasetAppVal, final Request requestVal, final Context contextVal, final ResourceModel resourceModelVal) { |
|
60 |
this.request = requestVal; |
|
61 |
this.context = contextVal; |
|
62 |
this.datasetApp = datasetAppVal; |
|
63 |
this.resourceModel = resourceModelVal; |
|
64 |
final String requestType = this.request.getResourceRef().getQueryAsForm().getFirstValue(TableAccessProtocolLibrary.REQUEST); |
|
65 |
final String langRequest = this.request.getResourceRef().getQueryAsForm().getFirstValue(TableAccessProtocolLibrary.LANG); |
|
66 |
final String phase = this.request.getResourceRef().getQueryAsForm().getFirstValue(TableAccessProtocolLibrary.PHASE); |
|
67 |
this.query = this.request.getResourceRef().getQueryAsForm().getFirstValue(TableAccessProtocolLibrary.QUERY); |
|
68 |
this.format = this.request.getResourceRef().getQueryAsForm().getFirstValue(TableAccessProtocolLibrary.FORMAT); |
|
69 |
//if(langRequestTableAccessProtocolLibrary.langSupported.) |
|
70 |
//fillMetadataFormat(); |
|
71 |
} |
|
72 |
|
|
73 |
/** |
|
74 |
* Fills metadata response. |
|
75 |
*/ |
|
76 |
private void fillMetadataFormat() { |
|
77 |
|
|
78 |
this.dataModel.put("description", this.resourceModel.getParameterByName(TableAccessProtocolLibrary.DESCRIPTION).getValue()); |
|
79 |
|
|
80 |
final Info info = new Info(); |
|
81 |
info.setName("QUERY_STATUS"); |
|
82 |
info.setValueAttribute("OK"); |
|
83 |
final List<Info> listInfos = new ArrayList<Info>(); |
|
84 |
listInfos.add(info); |
|
85 |
this.dataModel.put("infos", listInfos); |
|
86 |
|
|
87 |
/* ON EN N'A PAS BESOIN |
|
88 |
final List<Param> listParam = new ArrayList<Param>(); |
|
89 |
Param param = new Param(); |
|
90 |
param.setName("INPUT:POS"); |
|
91 |
param.setValue("0,0"); |
|
92 |
param.setDatatype(DataType.DOUBLE); |
|
93 |
AnyTEXT anyText = new AnyTEXT(); |
|
94 |
anyText.getContent().add("Search Position in the form ra,dec where ra and dec are given in decimal degrees in the ICRS coordinate system."); |
|
95 |
param.setDESCRIPTION(anyText); |
|
96 |
listParam.add(param); |
|
97 |
|
|
98 |
param = new Param(); |
|
99 |
param.setName("INPUT:SIZE"); |
|
100 |
param.setValue("0.05"); |
|
101 |
param.setDatatype(DataType.DOUBLE); |
|
102 |
anyText = new AnyTEXT(); |
|
103 |
anyText.getContent().add("Size of search region in the RA and Dec directions."); |
|
104 |
param.setDESCRIPTION(anyText); |
|
105 |
listParam.add(param); |
|
106 |
|
|
107 |
param = new Param(); |
|
108 |
param.setName("INPUT:FORMAT"); |
|
109 |
param.setValue(TableAccessProtocolLibrary.ParamStandardFormat.ALL.name()); |
|
110 |
param.setDatatype(DataType.CHAR); |
|
111 |
param.setArraysize("*"); |
|
112 |
AnyTEXT anyText = new AnyTEXT(); |
|
113 |
anyText.getContent().add("Requested format of result."); |
|
114 |
param.setDESCRIPTION(anyText); |
|
115 |
|
|
116 |
|
|
117 |
//TODO : le faire pour chaque format |
|
118 |
listParam.add(param); |
|
119 |
ON EN N'A PAS BESOIN |
|
120 |
param = new Param(); |
|
121 |
param.setName("INPUT:INTERSECT"); |
|
122 |
param.setValue(this.resourceModel.getParameterByName(TableAccessProtocolLibrary.INTERSECT).getValue()); |
|
123 |
param.setDatatype(DataType.CHAR); |
|
124 |
anyText = new AnyTEXT(); |
|
125 |
anyText.getContent().add("Choice of overlap with requested region."); |
|
126 |
param.setDESCRIPTION(anyText); |
|
127 |
listParam.add(param); |
|
128 |
|
|
129 |
param = new Param(); |
|
130 |
param.setName("INPUT:VERB"); |
|
131 |
param.setValue(this.resourceModel.getParameterByName(TableAccessProtocolLibrary.VERB).getValue()); |
|
132 |
param.setDatatype(DataType.INT); |
|
133 |
anyText = new AnyTEXT(); |
|
134 |
anyText.getContent().add("Verbosity level, controlling the number of columns returned."); |
|
135 |
param.setDESCRIPTION(anyText); |
|
136 |
listParam.add(param); |
|
137 |
|
|
138 |
dataModel.put("params", listParam); |
|
139 |
|
|
140 |
String dictionaryName = resourceModel.getParameterByName(TableAccessProtocolLibrary.DICTIONARY).getValue(); |
|
141 |
final List<String> columnList = new ArrayList<String>(); |
|
142 |
List<Field> fieldList = new ArrayList<Field>(); |
|
143 |
try { |
|
144 |
List<ColumnConceptMappingDTO> mappingList = getDicoFromConfiguration(datasetApp, dictionaryName); |
|
145 |
setFields(fieldList, columnList, mappingList); |
|
146 |
}catch (SitoolsException ex) { |
|
147 |
|
|
148 |
} |
|
149 |
*/ |
|
150 |
} |
|
151 |
|
|
152 |
@Override |
|
153 |
public final Map getDataModel() { |
|
154 |
return Collections.unmodifiableMap(this.dataModel); |
|
155 |
} |
|
156 |
|
|
157 |
/* GETTER DE LA CLASSE */ |
|
158 |
public String getQuery() { |
|
159 |
return query; |
|
160 |
} |
|
161 |
public String getFormat() { |
|
162 |
return format; |
|
163 |
} |
|
164 |
public Context getContext() { |
|
165 |
return context; |
|
166 |
} |
|
167 |
|
|
168 |
public Request getRequest() { |
|
169 |
return request; |
|
170 |
} |
|
171 |
public DataSetApplication getDatasetApp() { |
|
172 |
return datasetApp; |
|
173 |
} |
|
174 |
|
|
175 |
public ResourceModel getResourceModel() { |
|
176 |
return resourceModel; |
|
177 |
} |
|
178 |
|
|
179 |
} |
hesiod/javaExt/src/fr/ias/sitools/vo/tap/TableAccessProtocolLibrary.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
package fr.ias.sitools.vo.tap; |
|
7 |
|
|
8 |
import fr.ias.sitools.vo.representation.VOTableRepresentation; |
|
9 |
import fr.cnes.sitools.dataset.DataSetApplication; |
|
10 |
import fr.cnes.sitools.plugins.resources.model.ResourceModel; |
|
11 |
import java.util.Map; |
|
12 |
import java.util.logging.Level; |
|
13 |
import org.restlet.Context; |
|
14 |
import org.restlet.Request; |
|
15 |
|
|
16 |
/** |
|
17 |
* |
|
18 |
* @author marc |
|
19 |
*/ |
|
20 |
public class TableAccessProtocolLibrary { |
|
21 |
|
|
22 |
public enum langSupported { |
|
23 |
|
|
24 |
ADQL |
|
25 |
}; |
|
26 |
|
|
27 |
public enum formatResultsSupported { |
|
28 |
|
|
29 |
VOTABLE |
|
30 |
}; |
|
31 |
|
|
32 |
// Pour la requete |
|
33 |
public static final String FORMAT = "FORMAT"; |
|
34 |
public static final String QUERY = "QUERY"; |
|
35 |
public static final String LANG = "LANG"; |
|
36 |
public static final String PHASE = "PHASE"; |
|
37 |
public static final String REQUEST = "REQUEST"; |
|
38 |
// String pour décomposer la requete ADQL |
|
39 |
public static final String SELECT = "SELECT"; |
|
40 |
public static final String FROM = "FROM"; |
|
41 |
public static final String WHERE = "WHERE"; |
|
42 |
public static final String SELECT_ALL = "*"; |
|
43 |
public static final String BLANCK = " "; |
|
44 |
|
|
45 |
private transient DataSetApplication datasetApp; |
|
46 |
private transient ResourceModel resourceModel; |
|
47 |
private transient Request request; |
|
48 |
private transient Context context; |
|
49 |
|
|
50 |
/** |
|
51 |
* |
|
52 |
*/ |
|
53 |
public static final String DICTIONARY = "PARAM_Dictionary"; |
|
54 |
//Pour les Metadata |
|
55 |
/** |
|
56 |
* |
|
57 |
*/ |
|
58 |
public static final String DESCRIPTION = "Description"; |
|
59 |
/** |
|
60 |
* |
|
61 |
*/ |
|
62 |
public static final String INSTRUMENT = "Instrument"; |
|
63 |
/** |
|
64 |
* |
|
65 |
*/ |
|
66 |
public static final String SERVICE_NAME = "Service Name"; |
|
67 |
/** |
|
68 |
* |
|
69 |
*/ |
|
70 |
public static final String MAX_RECORDS = "Max records"; |
|
71 |
|
|
72 |
public TableAccessProtocolLibrary(final DataSetApplication datasetApp, final ResourceModel resourceModel, final Request request, final Context context) { |
|
73 |
this.datasetApp = datasetApp; |
|
74 |
this.resourceModel = resourceModel; |
|
75 |
this.request = request; |
|
76 |
this.context = context; |
|
77 |
} |
|
78 |
|
|
79 |
/** |
|
80 |
* Fill data Model that will be used in the template. |
|
81 |
* |
|
82 |
* @return data model for the template |
|
83 |
*/ |
|
84 |
private Map fillDataModel() { |
|
85 |
// init |
|
86 |
Map dataModel = null; |
|
87 |
Map<String, Object> map = this.request.getAttributes(); |
|
88 |
/* |
|
89 |
String entityAsText = this.request.getEntityAsText(); |
|
90 |
String query1 = this.request.getResourceRef().getQuery(); |
|
91 |
String queryDecoded = this.request.getResourceRef().getQuery(true); |
|
92 |
String queryNotDecoded = this.request.getResourceRef().getQuery(false); |
|
93 |
*/ |
|
94 |
String tapRequestType = this.request.getAttributes().get("tapRequestType").toString(); |
|
95 |
// Handling input parameters |
|
96 |
final DataModelInterface inputParameters = new TableAccessProtocolInputParameters(datasetApp, request, this.context, this.resourceModel); |
|
97 |
if (tapRequestType.equalsIgnoreCase("sync")) { |
|
98 |
this.context.getLogger().log(Level.INFO, "JE SUIS DANS LE SYNC !!!"); |
|
99 |
// data model response |
|
100 |
if (inputParameters.getDataModel().containsKey("infos")) { |
|
101 |
dataModel = inputParameters.getDataModel(); |
|
102 |
} else { |
|
103 |
final TableAccessProtocolDataModelInterface response = new TableAccessProtocolResponse((TableAccessProtocolInputParameters) inputParameters, resourceModel); |
|
104 |
dataModel = response.getDataModel(); |
|
105 |
} |
|
106 |
} else if (tapRequestType.equalsIgnoreCase("async")) { |
|
107 |
this.context.getLogger().log(Level.INFO, "JE SUIS DANS LE ASYNC !!!"); |
|
108 |
TableAccessProtocolAsynchronousResponse asyncTask = new TableAccessProtocolAsynchronousResponse((TableAccessProtocolInputParameters) inputParameters); |
|
109 |
asyncTask.run(); |
|
110 |
|
|
111 |
|
|
112 |
} else { |
|
113 |
this.context.getLogger().log(Level.INFO, "JE SUIS DANS NI SYNC NI ASYNC !!!"); |
|
114 |
} |
|
115 |
|
|
116 |
return dataModel; |
|
117 |
} |
|
118 |
|
|
119 |
/** |
|
120 |
* VOTable response. |
|
121 |
* |
|
122 |
* @return VOTable response |
|
123 |
*/ |
|
124 |
public final VOTableRepresentation getResponse() { |
|
125 |
final Map dataModel = fillDataModel(); |
|
126 |
return new VOTableRepresentation(dataModel, "votable.ftl"); |
|
127 |
} |
|
128 |
|
|
129 |
} |
hesiod/javaExt/src/fr/ias/sitools/vo/tap/TableAccessProtocolResponse.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
|
|
7 |
package fr.ias.sitools.vo.tap; |
|
8 |
|
|
9 |
import adql.parser.ADQLParser; |
|
10 |
import adql.parser.ParseException; |
|
11 |
import adql.query.ADQLQuery; |
|
12 |
import adql.translator.ADQLTranslator; |
|
13 |
import adql.translator.PostgreSQLTranslator; |
|
14 |
import adql.translator.TranslationException; |
|
15 |
//import fr.cnes.sitools.astro.representation.DatabaseRequestModel; |
|
16 |
import fr.cnes.sitools.common.exception.SitoolsException; |
|
17 |
import fr.cnes.sitools.dataset.DataSetApplication; |
|
18 |
import fr.cnes.sitools.dataset.converter.business.ConverterChained; |
|
19 |
import fr.cnes.sitools.dataset.database.DatabaseRequest; |
|
20 |
import fr.cnes.sitools.dataset.database.DatabaseRequestFactory; |
|
21 |
import fr.cnes.sitools.dataset.database.DatabaseRequestParameters; |
|
22 |
import fr.cnes.sitools.dataset.database.common.DataSetExplorerUtil; |
|
23 |
import fr.cnes.sitools.dataset.dto.ColumnConceptMappingDTO; |
|
24 |
import fr.cnes.sitools.dataset.dto.DictionaryMappingDTO; |
|
25 |
import fr.cnes.sitools.dataset.model.Column; |
|
26 |
import fr.cnes.sitools.dataset.model.Predicat; |
|
27 |
import fr.cnes.sitools.dictionary.model.Concept; |
|
28 |
import fr.cnes.sitools.plugins.resources.model.ResourceModel; |
|
29 |
import fr.cnes.sitools.util.Util; |
|
30 |
import fr.ias.sitools.vo.representation.DatabaseRequestIasModel; |
|
31 |
import freemarker.template.TemplateSequenceModel; |
|
32 |
import java.math.BigInteger; |
|
33 |
|
|
34 |
import java.util.ArrayList; |
|
35 |
import java.util.Collections; |
|
36 |
import java.util.HashMap; |
|
37 |
import java.util.List; |
|
38 |
import java.util.Map; |
|
39 |
import java.util.logging.Level; |
|
40 |
import java.util.logging.Logger; |
|
41 |
import net.ivoa.xml.votable.v1.AnyTEXT; |
|
42 |
import net.ivoa.xml.votable.v1.DataType; |
|
43 |
import net.ivoa.xml.votable.v1.Field; |
|
44 |
import net.ivoa.xml.votable.v1.Info; |
|
45 |
import net.ivoa.xml.votable.v1.Param; |
|
46 |
import org.restlet.Context; |
|
47 |
|
|
48 |
/** |
|
49 |
* |
|
50 |
* @author marc |
|
51 |
*/ |
|
52 |
class TableAccessProtocolResponse implements TableAccessProtocolDataModelInterface { |
|
53 |
|
|
54 |
/** |
|
55 |
* Data model. |
|
56 |
*/ |
|
57 |
private final transient Map dataModel = new HashMap(); |
|
58 |
|
|
59 |
/** |
|
60 |
* Context |
|
61 |
**/ |
|
62 |
private final transient Context ctx; |
|
63 |
|
|
64 |
/** |
|
65 |
* The ADQL Query |
|
66 |
*/ |
|
67 |
private final String adqlQuery; |
|
68 |
|
|
69 |
/** |
|
70 |
* The Psql Query from the ADQL query |
|
71 |
*/ |
|
72 |
private transient String psqlQuery; |
|
73 |
/** |
|
74 |
* The col to query |
|
75 |
*/ |
|
76 |
private ArrayList<String> colsToQuery = new ArrayList<String>(); |
|
77 |
|
|
78 |
private String clauseWhereToQuery; |
|
79 |
|
|
80 |
private String clauseLimit; |
|
81 |
private int clauseLimitInt; |
|
82 |
private String format; |
|
83 |
|
|
84 |
boolean isPrimaryKey; |
|
85 |
|
|
86 |
public TableAccessProtocolResponse(final TableAccessProtocolInputParameters inputParameters, final ResourceModel model) { |
|
87 |
this.format = inputParameters.getFormat(); |
|
88 |
this.adqlQuery = inputParameters.getQuery(); |
|
89 |
this.ctx = inputParameters.getContext(); |
|
90 |
|
|
91 |
if(this.adqlQuery == null || this.adqlQuery .equalsIgnoreCase("")){ |
|
92 |
// TO DO |
|
93 |
}else{ |
|
94 |
processQuery(); |
|
95 |
createResponse(inputParameters, model); |
|
96 |
} |
|
97 |
} |
|
98 |
|
|
99 |
private void createResponse(final TableAccessProtocolInputParameters inputParameters, final ResourceModel model){ |
|
100 |
|
|
101 |
|
|
102 |
// On récupère le nom du dico |
|
103 |
final String dictionaryName = model.getParameterByName(TableAccessProtocolLibrary.DICTIONARY).getValue(); |
|
104 |
|
|
105 |
//On set les params |
|
106 |
setVotableParametersFromConfiguration(this.dataModel, model); |
|
107 |
//On requete la base et on remplit le template |
|
108 |
setVotableResource(inputParameters.getDatasetApp(), inputParameters, model, dictionaryName); |
|
109 |
|
|
110 |
// On set le query_status à OK |
|
111 |
setQueryInfos(model); |
|
112 |
|
|
113 |
} |
|
114 |
// FONCTIONS PRIVATE |
|
115 |
/** |
|
116 |
* Creates the response based on Table. |
|
117 |
* |
|
118 |
* @param datasetApp Dataset application |
|
119 |
* @param inputParameters Input Parameters |
|
120 |
* @param model data model |
|
121 |
* @param dictionaryName TAP dictionary |
|
122 |
*/ |
|
123 |
private void setVotableResource(final DataSetApplication datasetApp, final TableAccessProtocolInputParameters inputParameters, |
|
124 |
final ResourceModel model, final String dictionaryName) { |
|
125 |
|
|
126 |
final List<Field> fieldList = new ArrayList<Field>(); |
|
127 |
final List<String> columnStringList = new ArrayList<String>(); |
|
128 |
final List<Column> columnList = datasetApp.getDataSet().getColumnModel(); |
|
129 |
|
|
130 |
DatabaseRequest databaseRequest = null; |
|
131 |
try { |
|
132 |
// On récupère les columns |
|
133 |
|
|
134 |
// On récupere le mapping |
|
135 |
List<ColumnConceptMappingDTO> mappingList = getDicoFromConfiguration(datasetApp, dictionaryName); |
|
136 |
|
|
137 |
final DatabaseRequestParameters dbParams = setQueryParameters(datasetApp, model, inputParameters, mappingList); |
|
138 |
|
|
139 |
// On récupère les colonnes à requeter |
|
140 |
List<Column> listCol = getColumnToQuery(columnList); |
|
141 |
listCol = checkPrimaryKeyAndAddItColTQuery(columnList, listCol); |
|
142 |
// On envoie les colonnes à requeter |
|
143 |
dbParams.setSqlVisibleColumns(listCol); |
|
144 |
|
|
145 |
// S'il y a un parametre Limit on le rajoute au parametre de requete |
|
146 |
if(this.clauseLimitInt > 0) |
|
147 |
{ |
|
148 |
dbParams.setMaxrows(this.clauseLimitInt); |
|
149 |
} |
|
150 |
databaseRequest = DatabaseRequestFactory.getDatabaseRequest(dbParams); |
|
151 |
databaseRequest.checkRequest(); |
|
152 |
// Execute query |
|
153 |
databaseRequest.createRequest(); |
|
154 |
|
|
155 |
getCtx().getLogger().log(Level.FINEST, "-------- DB REQUEST : {0}", databaseRequest.getRequestAsString()); |
|
156 |
|
|
157 |
setFields(fieldList, columnStringList, mappingList, listCol); |
|
158 |
|
|
159 |
final int count = (databaseRequest.getCount() > dbParams.getPaginationExtend()) ? dbParams.getPaginationExtend() : databaseRequest.getCount(); |
|
160 |
dataModel.put("nrows", count); |
|
161 |
dataModel.put("fields", fieldList); |
|
162 |
dataModel.put("sqlColAlias", columnStringList); |
|
163 |
|
|
164 |
final ConverterChained converterChained = datasetApp.getConverterChained(); |
|
165 |
|
|
166 |
//final TemplateSequenceModel rows = new DatabaseRequestModel(databaseRequest, converterChained); |
|
167 |
final TemplateSequenceModel rows = new DatabaseRequestIasModel(databaseRequest, converterChained); |
|
168 |
|
|
169 |
dataModel.put("rows", rows); |
|
170 |
} catch (SitoolsException ex) { |
|
171 |
Logger.getLogger(TableAccessProtocolResponse.class.getName()).log(Level.SEVERE, null, ex); |
|
172 |
} |
|
173 |
} |
|
174 |
|
|
175 |
/** |
|
176 |
* Set Query parameters to the database. |
|
177 |
* |
|
178 |
* @param datasetApp Dataset Application |
|
179 |
* @param model Data model |
|
180 |
* @param inputParameters Input Parameters |
|
181 |
* @return DatabaseRequestParamerters object |
|
182 |
*/ |
|
183 |
@SuppressWarnings("empty-statement") |
|
184 |
private DatabaseRequestParameters setQueryParameters(final DataSetApplication datasetApp, final ResourceModel model, |
|
185 |
final TableAccessProtocolInputParameters inputParameters, List<ColumnConceptMappingDTO> mappingList) { |
|
186 |
|
|
187 |
// Get the dataset |
|
188 |
final DataSetExplorerUtil dsExplorerUtil = new DataSetExplorerUtil(datasetApp, inputParameters.getRequest(), |
|
189 |
inputParameters.getContext()); |
|
190 |
|
|
191 |
// Get query parameters |
|
192 |
final DatabaseRequestParameters dbParams = dsExplorerUtil.getDatabaseParams(); |
|
193 |
// Get dataset records |
|
194 |
final int nbRecordsInDataSet = datasetApp.getDataSet().getNbRecords(); |
|
195 |
|
|
196 |
// Get max records that is defined by admin |
|
197 |
int nbMaxRecords = Integer.valueOf(model.getParameterByName(TableAccessProtocolLibrary.MAX_RECORDS).getValue()); |
|
198 |
nbMaxRecords = (nbMaxRecords > nbRecordsInDataSet || nbMaxRecords == -1) ? nbRecordsInDataSet : nbMaxRecords; |
|
199 |
// if a limit clause is defined, used it. |
|
200 |
if(this.clauseLimit != null){ |
|
201 |
nbMaxRecords = Integer.parseInt(this.clauseLimit); |
|
202 |
} |
|
203 |
// Set max records |
|
204 |
dbParams.setPaginationExtend(nbMaxRecords); |
|
205 |
|
|
206 |
|
|
207 |
|
|
208 |
final List<Predicat> predicatList = dbParams.getPredicats(); |
|
209 |
//String customQuery = "AND ra > 25 and dec < 180 and flux > 0.256"; |
|
210 |
Predicat predicat = new Predicat(); |
|
211 |
|
|
212 |
predicat.setStringDefinition(this.clauseWhereToQuery); |
|
213 |
predicatList.add(predicat); |
|
214 |
dbParams.setPredicats(predicatList); |
|
215 |
|
|
216 |
return dbParams; |
|
217 |
} |
|
218 |
|
|
219 |
|
|
220 |
private void setQueryInfos(final ResourceModel model){ |
|
221 |
final List<Info> queryInfos = new ArrayList<Info>(); |
|
222 |
|
|
223 |
Info info = new Info(); |
|
224 |
info.setName("QUERY_STATUS"); |
|
225 |
info.setValueAttribute("OK"); |
|
226 |
queryInfos.add(info); |
|
227 |
info = new Info(); |
|
228 |
info.setName("ADQL query"); |
|
229 |
String query = this.adqlQuery.replaceAll("\"", "").replaceAll(">",">").replaceAll("<","<"); |
|
230 |
info.setValueAttribute(query); |
|
231 |
|
|
232 |
queryInfos.add(info); |
|
233 |
|
|
234 |
this.dataModel.put("queryInfos", queryInfos); |
|
235 |
} |
|
236 |
/** |
|
237 |
* Sets VOTable parameters coming from administration configuration. |
|
238 |
* |
|
239 |
* @param dataModel data model to set |
|
240 |
* @param model parameters from administration |
|
241 |
*/ |
|
242 |
private void setVotableParametersFromConfiguration(final Map dataModel, final ResourceModel model) { |
|
243 |
final List<Param> params = new ArrayList<Param>(); |
|
244 |
setVotableParam(params, model, TableAccessProtocolLibrary.INSTRUMENT, DataType.CHAR); |
|
245 |
setVotableParam(params, model, TableAccessProtocolLibrary.SERVICE_NAME, DataType.CHAR); |
|
246 |
if (Util.isSet(params)) { |
|
247 |
this.dataModel.put("params", params); |
|
248 |
} |
|
249 |
} |
|
250 |
|
|
251 |
/** |
|
252 |
* Sets Votable Param. |
|
253 |
* |
|
254 |
* @param params List of params |
|
255 |
* @param model data model |
|
256 |
* @param parameterName parameter name |
|
257 |
* @param datatype datatype |
|
258 |
*/ |
|
259 |
private void setVotableParam(final List<Param> params, final ResourceModel model, final String parameterName, |
|
260 |
final DataType datatype) { |
|
261 |
final String parameterValue = model.getParameterByName(parameterName).getValue(); |
|
262 |
if (Util.isNotEmpty(parameterValue)) { |
|
263 |
final Param param = new Param(); |
|
264 |
param.setName(parameterName); |
|
265 |
param.setValue(parameterValue); |
|
266 |
param.setDatatype(datatype); |
|
267 |
params.add(param); |
|
268 |
} |
|
269 |
} |
|
270 |
/** |
|
271 |
* Provide the mapping between SQL column/concept for a given dictionary. |
|
272 |
* |
|
273 |
* @param datasetApp Application where this service is attached |
|
274 |
* @param dicoToFind Dictionary name to find |
|
275 |
* @return Returns a mapping SQL column/Concept |
|
276 |
* @throws SitoolsException No mapping has been done or cannot find the dico |
|
277 |
*/ |
|
278 |
private List<ColumnConceptMappingDTO> getDicoFromConfiguration(final DataSetApplication datasetApp, |
|
279 |
final String dicoToFind) throws SitoolsException { |
|
280 |
List<ColumnConceptMappingDTO> colConceptMappingDTOList = null; |
|
281 |
|
|
282 |
// Get the list of dictionnaries related to the datasetApplication |
|
283 |
final List<DictionaryMappingDTO> dicoMappingList = datasetApp.getDictionaryMappings(); |
|
284 |
if (!Util.isSet(dicoMappingList) || dicoMappingList.isEmpty()) { |
|
285 |
throw new SitoolsException("No mapping with VO concepts has been done. please contact the administrator"); |
|
286 |
} |
|
287 |
|
|
288 |
// For each dictionary, find the interesting one and return the mapping SQLcolumn/concept |
|
289 |
for (DictionaryMappingDTO dicoMappingIter : dicoMappingList) { |
|
290 |
final String dicoName = dicoMappingIter.getDictionaryName(); |
|
291 |
if (dicoToFind.equals(dicoName)) { |
|
292 |
colConceptMappingDTOList = dicoMappingIter.getMapping(); |
|
293 |
break; |
|
294 |
} |
|
295 |
} |
|
296 |
return colConceptMappingDTOList; |
|
297 |
} |
|
298 |
|
|
299 |
|
|
300 |
private List<Column> getColumnToQuery(List<Column> columnList){ |
|
301 |
List<Column> colsToQueryList = new ArrayList<Column>(); |
|
302 |
String all = this.adqlQuery.split(TableAccessProtocolLibrary.SELECT)[1].split(TableAccessProtocolLibrary.FROM)[0]; |
|
303 |
if(this.colsToQuery.size() == 1 && all.contains("*")){ |
|
304 |
for(Column colCol : columnList){ |
|
305 |
colsToQueryList.add(colCol); |
|
306 |
} |
|
307 |
return colsToQueryList; |
|
308 |
} |
|
309 |
for(String col : this.colsToQuery){ |
|
310 |
for(Column colCol : columnList){ |
|
311 |
if(col.equalsIgnoreCase(colCol.getColumnAlias())){ |
|
312 |
colsToQueryList.add(colCol); |
|
313 |
} |
|
314 |
} |
|
315 |
} |
|
316 |
|
|
317 |
return colsToQueryList; |
|
318 |
} |
|
319 |
|
|
320 |
/** |
|
321 |
* Set Fields and columnSqlAliasList. |
|
322 |
* |
|
323 |
* @param fieldList List of fields to display on the VOTable |
|
324 |
* @param colToQuery List of column to query and so to display in VOTable |
|
325 |
* @param columnList List of SQL column |
|
326 |
* @param mappingList List of SQL column/concept |
|
327 |
*/ |
|
328 |
private void setFields(final List<Field> fieldList, final List<String> columnList, final List<ColumnConceptMappingDTO> mappingList, final List<Column> colToQuery) { |
|
329 |
|
|
330 |
List<Column> colToQuery2 = colToQuery; |
|
331 |
if(!isPrimaryKey){ |
|
332 |
colToQuery2.remove(colToQuery2.size()-1); |
|
333 |
} |
|
334 |
for(Column col : colToQuery2){ |
|
335 |
|
|
336 |
for (ColumnConceptMappingDTO mappingIter : mappingList) { |
|
337 |
if(col.getColumnAlias().equalsIgnoreCase(mappingIter.getColumnAlias())){ |
|
338 |
|
|
339 |
String id = null; |
|
340 |
String name = null; |
|
341 |
String ucd = null; |
|
342 |
String utype = null; |
|
343 |
String ref = null; |
|
344 |
String datatype = null; |
|
345 |
String width = null; |
|
346 |
String precision = null; |
|
347 |
String unit = null; |
|
348 |
String type = null; |
|
349 |
String xtype = null; |
|
350 |
String arraysize = null; |
|
351 |
String descriptionValue = null; |
|
352 |
columnList.add(mappingIter.getColumnAlias()); |
|
353 |
final Concept concept = mappingIter.getConcept(); |
|
354 |
if (concept.getName() != null) { |
|
355 |
name = concept.getName(); |
|
356 |
} |
|
357 |
if (concept.getPropertyFromName("ID").getValue() != null) { |
|
358 |
id = concept.getPropertyFromName("ID").getValue(); |
|
359 |
} |
|
360 |
if (concept.getPropertyFromName("ucd").getValue() != null) { |
|
361 |
ucd = concept.getPropertyFromName("ucd").getValue(); |
|
362 |
} |
|
363 |
if (concept.getPropertyFromName("utype").getValue() != null) { |
|
364 |
utype = concept.getPropertyFromName("utype").getValue(); |
|
365 |
} |
|
366 |
if (concept.getPropertyFromName("ref").getValue() != null) { |
|
367 |
ref = concept.getPropertyFromName("ref").getValue(); |
|
368 |
} |
|
369 |
if (concept.getPropertyFromName("datatype").getValue() != null) { |
|
370 |
datatype = concept.getPropertyFromName("datatype").getValue(); |
|
371 |
} |
|
372 |
if (concept.getPropertyFromName("width").getValue() != null) { |
|
373 |
width = concept.getPropertyFromName("width").getValue(); |
|
374 |
} |
|
375 |
if (concept.getPropertyFromName("precision").getValue() != null) { |
|
376 |
precision = concept.getPropertyFromName("precision").getValue(); |
|
377 |
} |
|
378 |
if (concept.getPropertyFromName("unit").getValue() != null) { |
|
379 |
unit = concept.getPropertyFromName("unit").getValue(); |
|
380 |
} |
|
381 |
if (concept.getPropertyFromName("type").getValue() != null) { |
|
382 |
type = concept.getPropertyFromName("type").getValue(); |
|
383 |
} |
|
384 |
if (concept.getPropertyFromName("xtype").getValue() != null) { |
|
385 |
xtype = concept.getPropertyFromName("xtype").getValue(); |
|
386 |
} |
|
387 |
if (concept.getPropertyFromName("arraysize").getValue() != null) { |
|
388 |
arraysize = concept.getPropertyFromName("arraysize").getValue(); |
|
389 |
} |
|
390 |
if (concept.getDescription() != null) { |
|
391 |
descriptionValue = concept.getDescription(); |
|
392 |
} |
|
393 |
final Field field = new Field(); |
|
394 |
field.setID(id); |
|
395 |
field.setName(name); |
|
396 |
field.setUcd(ucd); |
|
397 |
field.setUtype(utype); |
|
398 |
field.setRef(ref); |
|
399 |
field.setDatatype(DataType.fromValue(datatype)); |
|
400 |
if (width != null) { |
|
401 |
field.setWidth(BigInteger.valueOf(Long.valueOf(width))); |
|
402 |
} |
|
403 |
field.setPrecision(precision); |
|
404 |
field.setUnit(unit); |
|
405 |
field.setType(type); |
|
406 |
field.setXtype(xtype); |
|
407 |
field.setArraysize(arraysize); |
|
408 |
final AnyTEXT anyText = new AnyTEXT(); |
|
409 |
anyText.getContent().add(descriptionValue); |
|
410 |
field.setDESCRIPTION(anyText); |
|
411 |
fieldList.add(field); |
|
412 |
} |
|
413 |
} |
|
414 |
} |
|
415 |
} |
|
416 |
//List<Column> columnList = datasetApp.getDataSet().getColumnModel(); |
|
417 |
private List<Column> checkPrimaryKeyAndAddItColTQuery(List<Column> columnList, List<Column> colToQuery){ |
|
418 |
Column colPrimKey = null; |
|
419 |
for(Column co : columnList){ |
|
420 |
if(co.isPrimaryKey()){ |
|
421 |
colPrimKey = co; |
|
422 |
} |
|
423 |
} |
|
424 |
for(Column col : colToQuery){ |
|
425 |
if(col.isPrimaryKey()){ |
|
426 |
isPrimaryKey = true; |
|
427 |
} |
|
428 |
} |
|
429 |
if(!isPrimaryKey && "" != colPrimKey.getColumnAlias()){ |
|
430 |
colToQuery.add(colPrimKey); |
|
431 |
} |
|
432 |
|
|
433 |
return colToQuery; |
|
434 |
} |
|
435 |
|
|
436 |
private void processQuery(){ |
|
437 |
try { |
|
438 |
// On crée un parser pour transformer notre string query en adql query |
|
439 |
ADQLParser parser = new ADQLParser(); |
|
440 |
ADQLQuery adqlQueryValue = parser.parseQuery(this.adqlQuery); |
|
441 |
// On traduit l'adql query en psql query |
|
442 |
ADQLTranslator translator = new PostgreSQLTranslator(); |
|
443 |
|
|
444 |
this.psqlQuery = translator.translate(adqlQueryValue); |
|
445 |
|
|
446 |
|
|
447 |
if(this.psqlQuery.contains("Limit ")){ |
|
448 |
this.clauseLimit = this.psqlQuery.split("Limit ")[1]; |
|
449 |
this.clauseLimitInt = Integer.parseInt(this.clauseLimit.replaceAll(" ", "")); |
|
450 |
this.psqlQuery = this.psqlQuery.split("Limit ")[0]; |
|
451 |
}else{ |
|
452 |
this.clauseLimit = null; |
|
453 |
this.clauseLimitInt = -1; |
|
454 |
} |
|
455 |
|
|
456 |
this.clauseWhereToQuery = "AND"+ this.psqlQuery.split(TableAccessProtocolLibrary.FROM)[1].split(TableAccessProtocolLibrary.WHERE)[1]; |
|
457 |
|
|
458 |
String[] colsToQueryTmp = this.psqlQuery.split(TableAccessProtocolLibrary.FROM)[0].split(TableAccessProtocolLibrary.SELECT)[1].split(","); |
|
459 |
for(String col : colsToQueryTmp){ |
|
460 |
if(col.equalsIgnoreCase(TableAccessProtocolLibrary.SELECT_ALL)){ |
|
461 |
colsToQuery.add(col.replaceAll(TableAccessProtocolLibrary.BLANCK, "")); |
|
462 |
break; |
|
463 |
}else{ |
|
464 |
colsToQuery.add(col.split("AS")[0].replaceAll(TableAccessProtocolLibrary.BLANCK, "")); |
|
465 |
} |
|
466 |
} |
|
467 |
if(format == null || format.equalsIgnoreCase("")){ |
|
468 |
// TO DO |
|
469 |
}else{ |
|
470 |
ctx.getLogger().log(Level.INFO, "format = "+format); |
|
471 |
} |
|
472 |
} catch (TranslationException ex) { |
|
473 |
Logger.getLogger(TableAccessProtocolResponse.class.getName()).log(Level.SEVERE, null, ex); |
|
474 |
} catch (ParseException ex) { |
|
475 |
Logger.getLogger(TableAccessProtocolResponse.class.getName()).log(Level.SEVERE, null, ex); |
|
476 |
} |
|
477 |
} |
|
478 |
@Override |
|
479 |
public final Map getDataModel() { |
|
480 |
return Collections.unmodifiableMap(this.dataModel); |
|
481 |
} |
|
482 |
|
|
483 |
// GETTER DE LA CLASSE |
|
484 |
public Context getCtx() { |
|
485 |
return ctx; |
|
486 |
} |
|
487 |
} |
webstatDev/idoc_Maison/idoc/settings.py | ||
---|---|---|
59 | 59 |
# Database |
60 | 60 |
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases |
61 | 61 |
|
62 |
#DATABASES = { |
|
63 |
# 'default': { |
|
64 |
# 'ENGINE': 'django.db.backends.sqlite3', |
|
65 |
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), |
|
66 |
# } |
|
67 |
#} |
|
62 |
DATABASES = { |
|
63 |
'default': { |
|
64 |
'ENGINE': 'django.db.backends.sqlite3', |
|
65 |
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), |
|
66 |
} |
|
67 |
} |
|
68 |
''' |
|
68 | 69 |
DATABASES = { |
69 | 70 |
'default': { |
70 | 71 |
'ENGINE': 'django.db.backends.postgresql_psycopg2', |
71 |
'NAME': 'webstat_DB', |
|
72 |
'NAME': 'webstat_DB_TEST',
|
|
72 | 73 |
'USER': 'postgres', |
73 | 74 |
'PASSWORD': '', |
74 | 75 |
'HOST': 'localhost', |
75 | 76 |
'PORT': 5432 |
76 | 77 |
} |
77 | 78 |
} |
78 |
|
|
79 |
|
|
79 |
''' |
|
80 | 80 |
|
81 | 81 |
# Internationalization |
82 | 82 |
# https://docs.djangoproject.com/en/1.7/topics/i18n/ |
webstatDev/idoc_Maison/static/chart/Volume de telechargement par IP entre le 2011-02-01 et le 2012-02-0120150610093724793157.svg | ||
---|---|---|
1 |
<?xml version='1.0' encoding='utf-8'?> |
|
2 |
<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" id="chart-2370f94c-da85-49db-92d5-7f3a46c574f6" class="pygal-chart" viewBox="0 0 800 600"><!--Generated with pygal 1.7.0 (lxml) ©Kozea 2011-2014 on 2015-06-10--><!--http://pygal.org--><!--http://github.com/Kozea/pygal--><defs><style type="text/css">#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .title{font-family:"monospace";font-size:16px}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .legends .legend text{font-family:"monospace";font-size:14px}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .axis text{font-family:"monospace";font-size:10px}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .axis text.major{font-family:"monospace";font-size:10px}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .series text{font-family:"monospace";font-size:8px}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .tooltip text{font-family:"monospace";font-size:16px}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 text.no_data{font-size:64px} |
|
3 |
#chart-2370f94c-da85-49db-92d5-7f3a46c574f6{background-color:black}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 path,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 line,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 rect,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 circle{-webkit-transition:250ms;-moz-transition:250ms;transition:250ms}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .graph > .background{fill:black}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .plot > .background{fill:#111}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .graph{fill:#999}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 text.no_data{fill:#eee}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .title{fill:#eee}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .legends .legend text{fill:#999}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .legends .legend:hover text{fill:#eee}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .axis .line{stroke:#eee}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .axis .guide.line{stroke:#555}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .axis .major.line{stroke:#999}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .axis text.major{stroke:#eee;fill:#eee}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .axis.y .guides:hover .guide.line,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .line-graph .axis.x .guides:hover .guide.line,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .stackedline-graph .axis.x .guides:hover .guide.line,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .xy-graph .axis.x .guides:hover .guide.line{stroke:#eee}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .axis .guides:hover text{fill:#eee}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .reactive{fill-opacity:.8}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .reactive.active,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .active .reactive{fill-opacity:.4}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .series{stroke-width:1.0;stroke-linejoin:round;stroke-linecap:round;stroke-dasharray:0,0}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .series text{fill:#eee}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .tooltip rect{fill:#111;stroke:#eee}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .tooltip text{fill:#eee}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .map-element{fill:#999;stroke:#555 !important;opacity:.9;stroke-width:3;-webkit-transition:250ms;-moz-transition:250ms;-o-transition:250ms;transition:250ms}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .map-element:hover{opacity:1;stroke-width:10}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-0,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-0 a:visited{stroke:#ff5995;fill:#ff5995}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-1,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-1 a:visited{stroke:#b6e354;fill:#b6e354}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-2,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-2 a:visited{stroke:#feed6c;fill:#feed6c}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-3,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-3 a:visited{stroke:#8cedff;fill:#8cedff}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-4,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-4 a:visited{stroke:#9e6ffe;fill:#9e6ffe}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-5,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-5 a:visited{stroke:#899ca1;fill:#899ca1}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-6,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-6 a:visited{stroke:#f8f8f2;fill:#f8f8f2}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-7,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-7 a:visited{stroke:#bf4646;fill:#bf4646}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-8,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-8 a:visited{stroke:#516083;fill:#516083}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-9,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-9 a:visited{stroke:#f92672;fill:#f92672}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-10,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-10 a:visited{stroke:#82b414;fill:#82b414}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-11,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-11 a:visited{stroke:#fd971f;fill:#fd971f}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-12,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-12 a:visited{stroke:#56c2d6;fill:#56c2d6}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-13,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-13 a:visited{stroke:#808384;fill:#808384}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-14,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-14 a:visited{stroke:#8c54fe;fill:#8c54fe}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-15,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .color-15 a:visited{stroke:#465457;fill:#465457} |
|
4 |
#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 text.no_data{text-anchor:middle}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .guide.line{fill-opacity:0}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .centered{text-anchor:middle}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .title{text-anchor:middle}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .legends .legend text{fill-opacity:1}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .axis.x text{text-anchor:middle}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .axis.x:not(.web) text[transform]{text-anchor:start}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .axis.y text{text-anchor:end}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .axis.y2 text{text-anchor:start}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .axis.y .logarithmic text:not(.major),#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .axis.y2 .logarithmic text:not(.major){font-size:50%}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .axis .guide.line{stroke-dasharray:4,4}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .axis .major.guide.line{stroke-dasharray:6,6}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .axis text.major{stroke-width:0.5px}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .horizontal .axis.y .guide.line,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .horizontal .axis.y2 .guide.line,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .vertical .axis.x .guide.line{opacity:0}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .horizontal .axis.always_show .guide.line,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .vertical .axis.always_show .guide.line{opacity:1 !important}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .axis.y .guides:hover .guide.line,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .axis.y2 .guides:hover .guide.line,#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .axis.x .guides:hover .guide.line{opacity:1}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .axis .guides:hover text{opacity:1}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .nofill{fill:none}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .subtle-fill{fill-opacity:.2}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .dot{stroke-width:1px;fill-opacity:1}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .dot.active{stroke-width:5px}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .series text{stroke:none}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .series text.active{opacity:1}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .tooltip rect{fill-opacity:0.8}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .tooltip text{fill-opacity:1}#chart-2370f94c-da85-49db-92d5-7f3a46c574f6 .tooltip text tspan.label{fill-opacity:.8}</style><script type="text/javascript">window.config = {"inner_radius": 0, "print_values": false, "tooltip_font_size": 16, "xrange": null, "legend_at_bottom_columns": null, "height": 600, "legend_at_bottom": false, "show_legend": true, "show_dots": true, "explicit_size": false, "legend_font_size": 14, "y_labels_major": null, "show_minor_x_labels": true, "major_label_font_size": 10, "fill": false, "half_pie": false, "x_value_formatter": null, "style": {"opacity": ".8", "foreground": "#999", "plot_background": "#111", "stroke_style": "round", "foreground_light": "#eee", "transition": "250ms", "foreground_dark": "#555", "stroke_dasharray": "0,0", "opacity_hover": ".4", "stroke_width": 1.0, "colors": ["#ff5995", "#b6e354", "#feed6c", "#8cedff", "#9e6ffe", "#899ca1", "#f8f8f2", "#bf4646", "#516083", "#f92672", "#82b414", "#fd971f", "#56c2d6", "#808384", "#8c54fe", "#465457"], "background": "black", "font_family": "monospace"}, "x_label_rotation": 0, "missing_value_fill_truncation": "x", "zero": 0, "margin_right": null, "interpolation_parameters": {}, "x_labels_major": null, "rounded_bars": null, "label_font_size": 10, "show_y_labels": true, "dots_size": 2.5, "show_y_guides": true, "show_minor_y_labels": true, "x_labels": null, "y_title": null, "value_font_size": 8, "order_min": null, "disable_xml_declaration": false, "strict": false, "css": ["style.css", "graph.css"], "mode": null, "show_only_major_dots": false, "y_label_rotation": 0, "human_readable": false, "show_x_guides": false, "spacing": 10, "x_labels_major_count": null, "pretty_print": false, "tooltip_border_radius": 0, "interpolate": null, "js": ["http://kozea.github.io/pygal.js/javascripts/svg.jquery.js", "http://kozea.github.io/pygal.js/javascripts/pygal-tooltips.js"], "y_labels": null, "y_labels_major_every": null, "x_label_format": "%Y-%m-%d %H:%M:%S.%f", "interpolation_precision": 250, "x_title": null, "value_formatter": null, "no_data_font_size": 64, "logarithmic": false, "width": 800, "print_zeroes": false, "no_data_text": "No data", "truncate_legend": null, "x_labels_major_every": null, "title": "Volume de telechargement par IP entre le 2011-02-01 et le 2012-02-01", "legend_box_size": 12, "no_prefix": false, "stroke": true, "title_font_size": 16, "include_x_axis": false, "range": null, "truncate_label": null, "margin_top": null, "margin_left": null, "y_labels_major_count": null, "margin_bottom": null, "margin": 20, "stack_from_top": false, "show_x_labels": true}</script><script type="text/javascript" xlink:href="http://kozea.github.io/pygal.js/javascripts/svg.jquery.js"/><script type="text/javascript" xlink:href="http://kozea.github.io/pygal.js/javascripts/pygal-tooltips.js"/></defs><title>Volume de telechargement par IP entre le 2011-02-01 et le 2012-02-01</title><g class="graph pie-graph vertical"><rect class="background" height="600" width="800" x="0" y="0"/><g class="plot" transform="translate(20, 46)"><rect class="background" height="534" width="760" x="0" y="0"/></g><g class="titles"><text class="title plot_title" x="400.0" y="26">Volume de telechargement par IP entre le 2011-02-01 et le 2012-02-01</text></g><g class="plot overlay" transform="translate(20, 46)"/><g class="plot text-overlay" transform="translate(20, 46)"><text class="no_data" x="380.0" y="267.0">No data</text></g><g class="plot tooltip-overlay" transform="translate(20, 46)"><g class="tooltip" style="opacity: 0" transform="translate(0 0)"><a><rect class="tooltip-box" height="0" rx="0" ry="0" width="0"/><text class="text"><tspan class="label"/><tspan class="value"/></text></a></g></g><g class="legends" transform="translate(10, 56)"/><g class="legends" transform="translate(790, 56)"/></g></svg> |
Also available in: Unified diff
ajout du dev sur le protocol TAP