diff --git a/src/tap/data/ResultSetTableIterator.java b/src/tap/data/ResultSetTableIterator.java index 5d23c20204e87c5ae97762b3bbf085ffe9e27a63..61867cbfa159943817eadd9df905533a07b93b90 100644 --- a/src/tap/data/ResultSetTableIterator.java +++ b/src/tap/data/ResultSetTableIterator.java @@ -2,20 +2,20 @@ package tap.data; /* * This file is part of TAPLibrary. - * + * * TAPLibrary is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * TAPLibrary is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public License * along with TAPLibrary. If not, see <http://www.gnu.org/licenses/>. - * + * * Copyright 2014-2017 - Astronomisches Rechen Institut (ARI) */ @@ -42,11 +42,11 @@ import uws.ISO8601Format; /** * <p>{@link TableIterator} which lets iterate over a SQL {@link ResultSet}.</p> - * + * * <p><i>Note: * {@link #getColType()} will return a TAP type based on the one declared in the {@link ResultSetMetaData} object. * </i></p> - * + * * @author Grégory Mantelet (ARI) * @version 2.1 (07/2017) * @since 2.0 @@ -85,25 +85,25 @@ public class ResultSetTableIterator implements TableIterator { /** * <p>Build a TableIterator able to read rows and columns of the given ResultSet.</p> - * + * * <p> * In order to provide the metadata through {@link #getMetadata()}, this constructor is trying to guess the datatype * from the DBMS column datatype (using {@link #convertType(int, String, String)}). * </p> - * + * * <h3>Type guessing</h3> - * + * * <p> * In order to guess a TAP type from a DBMS type, this constructor will call {@link #defaultTypeConversion(String, String[], String)} * which proceeds a default conversion using the most common standard datatypes known in Postgres, SQLite, MySQL, Oracle and JavaDB/Derby. * This conversion is therefore not as precise as the one expected by the translator. * </p> - * + * * @param dataSet Dataset over which this iterator must iterate. - * + * * @throws NullPointerException If NULL is given in parameter. * @throws DataReadException If the given ResultSet is closed or if the metadata (columns count and types) can not be fetched. - * + * * @see #ResultSetTableIterator(DBConnection, ResultSet, DBColumn[], JDBCTranslator, String) */ public ResultSetTableIterator(final ResultSet dataSet) throws NullPointerException, DataReadException{ @@ -112,42 +112,42 @@ public class ResultSetTableIterator implements TableIterator { /** * <p>Build a TableIterator able to read rows and columns of the given ResultSet.</p> - * + * * <p> * In order to provide the metadata through {@link #getMetadata()}, this constructor is reading first the given metadata (if any), * and then, try to guess the datatype from the DBMS column datatype (using {@link #convertType(int, String, String)}). * </p> - * + * * <h3>Provided metadata</h3> - * + * * <p>The second parameter of this constructor aims to provide the metadata expected for each column of the ResultSet.</p> - * + * * <p> * For that, it is expected that all these metadata are {@link TAPColumn} objects. Indeed, simple {@link DBColumn} * instances do not have the type information. If just {@link DBColumn}s are provided, the ADQL name it provides will be kept * but the type will be guessed from the type provided by the ResultSetMetadata. * </p> - * + * * <p><i>Note: * If this parameter is incomplete (array length less than the column count returned by the ResultSet or some array items are NULL), * column metadata will be associated in the same order as the ResultSet columns. Missing metadata will be built from the * {@link ResultSetMetaData} and so the types will be guessed. * </i></p> - * + * * <h3>Type guessing</h3> - * + * * <p> * In order to guess a TAP type from a DBMS type, this constructor will call {@link #defaultTypeConversion(String, String[], String)} * which proceeds a default conversion using the most common standard datatypes known in Postgres, SQLite, MySQL, Oracle and JavaDB/Derby. * This conversion is therefore not as precise as the one expected by the translator. * </p> - * + * * @param dataSet Dataset over which this iterator must iterate. * @param resultMeta List of expected columns. <i>note: these metadata are expected to be really {@link TAPColumn} objects ; MAY be NULL.</i> - * + * * @throws NullPointerException If NULL is given in parameter. * @throws DataReadException If the metadata (columns count and types) can not be fetched. - * + * * @see #ResultSetTableIterator(DBConnection, ResultSet, DBColumn[], JDBCTranslator, String) */ public ResultSetTableIterator(final ResultSet dataSet, final DBColumn[] resultMeta) throws NullPointerException, DataReadException{ @@ -156,36 +156,36 @@ public class ResultSetTableIterator implements TableIterator { /** * <p>Build a TableIterator able to read rows and columns of the given ResultSet.</p> - * + * * <p> * In order to provide the metadata through {@link #getMetadata()}, this constructor is trying to guess the datatype * from the DBMS column datatype (using {@link #convertType(int, String, String)}). * </p> - * + * * <h3>Type guessing</h3> - * + * * <p> * In order to guess a TAP type from a DBMS type, this constructor will call {@link #convertType(int, String, String)} * which deals with the most common standard datatypes known in Postgres, SQLite, MySQL, Oracle and JavaDB/Derby. * This conversion is therefore not as precise as the one expected by a translator. That's why it is recommended * to use one of the constructor having a {@link JDBCTranslator} in parameter. * </p> - * + * * <p><i><b>Important</b>: * The second parameter of this constructor is given as second parameter of {@link #convertType(int, String, String)}. * <b>This parameter is really used ONLY when the DBMS is SQLite ("sqlite").</b> * Indeed, SQLite has so many datatype restrictions that it is absolutely needed to know it is the DBMS from which the * ResultSet is coming. Without this information, type guessing will be unpredictable! * </i></p> - * + * * @param dataSet Dataset over which this iterator must iterate. * @param dbms Lower-case string which indicates from which DBMS the given ResultSet is coming. <i>note: MAY be NULL.</i> - * + * * @throws NullPointerException If NULL is given in parameter. * @throws DataReadException If the given ResultSet is closed or if the metadata (columns count and types) can not be fetched. - * + * * @see #ResultSetTableIterator(DBConnection, ResultSet, DBColumn[], JDBCTranslator, String) - * + * * @deprecated Use {@link #ResultSetTableIterator(ResultSet, JDBCTranslator, String)} instead ; using the translator without the DBMS name is generally not enough. * It is then preferable to give also the DBMS name. */ @@ -196,14 +196,14 @@ public class ResultSetTableIterator implements TableIterator { /** * <p>Build a TableIterator able to read rows and columns of the given ResultSet.</p> - * + * * <p> * In order to provide the metadata through {@link #getMetadata()}, this constructor is trying to guess the datatype * from the DBMS column datatype (using {@link #convertType(int, String, String)}). * </p> - * + * * <h3>Type guessing</h3> - * + * * <p> * In order to guess a TAP type from a DBMS type, this constructor will call {@link #convertType(int, String, String)} * which will ask to the given translator ({@link JDBCTranslator#convertTypeFromDB(int, String, String, String[])}) @@ -211,16 +211,16 @@ public class ResultSetTableIterator implements TableIterator { * using the most common standard datatypes known in Postgres, SQLite, MySQL, Oracle and JavaDB/Derby. * This conversion is therefore not as precise as the one expected by the translator. * </p> - * + * * @param dataSet Dataset over which this iterator must iterate. * @param translator The {@link JDBCTranslator} used to transform the ADQL query into SQL query. This translator is also able to convert * JDBC types and to parse geometrical values. <i>note: MAY be NULL</i> - * + * * @throws NullPointerException If NULL is given in parameter. * @throws DataReadException If the given ResultSet is closed or if the metadata (columns count and types) can not be fetched. - * + * * @see #ResultSetTableIterator(DBConnection, ResultSet, DBColumn[], JDBCTranslator, String) - * + * * @deprecated Use {@link #ResultSetTableIterator(ResultSet, JDBCTranslator, String)} instead ; using the translator without the DBMS name is generally not enough. * It is then preferable to give also the DBMS name. */ @@ -231,14 +231,14 @@ public class ResultSetTableIterator implements TableIterator { /** * <p>Build a TableIterator able to read rows and columns of the given ResultSet.</p> - * + * * <p> * In order to provide the metadata through {@link #getMetadata()}, this constructor is trying to guess the datatype * from the DBMS column datatype (using {@link #convertType(int, String, String)}). * </p> - * + * * <h3>Type guessing</h3> - * + * * <p> * In order to guess a TAP type from a DBMS type, this constructor will call {@link #convertType(int, String, String)} * which will ask to the given translator ({@link JDBCTranslator#convertTypeFromDB(int, String, String, String[])}) @@ -246,22 +246,22 @@ public class ResultSetTableIterator implements TableIterator { * using the most common standard datatypes known in Postgres, SQLite, MySQL, Oracle and JavaDB/Derby. * This conversion is therefore not as precise as the one expected by the translator. * </p> - * + * * <p><i><b>Important</b>: * The third parameter of this constructor is given as second parameter of {@link #convertType(int, String, String)}. * <b>This parameter is really used ONLY when the translator conversion failed and when the DBMS is SQLite ("sqlite").</b> * Indeed, SQLite has so many datatype restrictions that it is absolutely needed to know it is the DBMS from which the * ResultSet is coming. Without this information, type guessing will be unpredictable! * </i></p> - * + * * @param dataSet Dataset over which this iterator must iterate. * @param translator The {@link JDBCTranslator} used to transform the ADQL query into SQL query. This translator is also able to convert * JDBC types and to parse geometrical values. <i>note: MAY be NULL</i> * @param dbms Lower-case string which indicates from which DBMS the given ResultSet is coming. <i>note: MAY be NULL.</i> - * + * * @throws NullPointerException If NULL is given in parameter. * @throws DataReadException If the given ResultSet is closed or if the metadata (columns count and types) can not be fetched. - * + * * @see #ResultSetTableIterator(DBConnection, ResultSet, DBColumn[], JDBCTranslator, String) */ public ResultSetTableIterator(final ResultSet dataSet, final JDBCTranslator translator, final String dbms) throws NullPointerException, DataReadException{ @@ -270,30 +270,30 @@ public class ResultSetTableIterator implements TableIterator { /** * <p>Build a TableIterator able to read rows and columns of the given ResultSet.</p> - * + * * <p> * In order to provide the metadata through {@link #getMetadata()}, this constructor is reading first the given metadata (if any), * and then, try to guess the datatype from the DBMS column datatype (using {@link #convertType(int, String, String)}). * </p> - * + * * <h3>Provided metadata</h3> - * + * * <p>The third parameter of this constructor aims to provide the metadata expected for each column of the ResultSet.</p> - * + * * <p> * For that, it is expected that all these metadata are {@link TAPColumn} objects. Indeed, simple {@link DBColumn} * instances do not have the type information. If just {@link DBColumn}s are provided, the ADQL name it provides will be kept * but the type will be guessed from the type provide by the ResultSetMetadata. * </p> - * + * * <p><i>Note: * If this parameter is incomplete (array length less than the column count returned by the ResultSet or some array items are NULL), * column metadata will be associated in the same order as the ResultSet columns. Missing metadata will be built from the * {@link ResultSetMetaData} and so the types will be guessed. * </i></p> - * + * * <h3>Type guessing</h3> - * + * * <p> * In order to guess a TAP type from a DBMS type, this constructor will call {@link #convertType(int, String, String)} * which will ask to the given translator ({@link JDBCTranslator#convertTypeFromDB(int, String, String, String[])}) @@ -301,25 +301,25 @@ public class ResultSetTableIterator implements TableIterator { * using the most common standard datatypes known in Postgres, SQLite, MySQL, Oracle and JavaDB/Derby. * This conversion is therefore not as precise as the one expected by the translator. * </p> - * + * * <p><i><b>Important</b>: * The third parameter of this constructor is given as second parameter of {@link #convertType(int, String, String)}. * <b>This parameter is really used ONLY when the translator conversion failed and when the DBMS is SQLite ("sqlite").</b> * Indeed, SQLite has so many datatype restrictions that it is absolutely needed to know it is the DBMS from which the * ResultSet is coming. Without this information, type guessing will be unpredictable! * </i></p> - * + * * @param dataSet Dataset over which this iterator must iterate. * @param translator The {@link JDBCTranslator} used to transform the ADQL query into SQL query. This translator is also able to convert * JDBC types and to parse geometrical values. <i>note: MAY be NULL</i> * @param dbms Lower-case string which indicates from which DBMS the given ResultSet is coming. <i>note: MAY be NULL.</i> * @param resultMeta List of expected columns. <i>note: these metadata are expected to be really {@link TAPColumn} objects ; MAY be NULL.</i> - * + * * @throws NullPointerException If NULL is given in parameter. * @throws DataReadException If the metadata (columns count and types) can not be fetched. - * + * * @see #ResultSetTableIterator(DBConnection, ResultSet, DBColumn[], JDBCTranslator, String) - * + * * @deprecated Use {@link #ResultSetTableIterator(ResultSet, DBColumn[], JDBCTranslator, String)} instead ; only the position of the parameters has changed. */ @Deprecated @@ -329,30 +329,30 @@ public class ResultSetTableIterator implements TableIterator { /** * <p>Build a TableIterator able to read rows and columns of the given ResultSet.</p> - * + * * <p> * In order to provide the metadata through {@link #getMetadata()}, this constructor is reading first the given metadata (if any), * and then, try to guess the datatype from the DBMS column datatype (using {@link #convertType(int, String, String)}). * </p> - * + * * <h3>Provided metadata</h3> - * + * * <p>The second parameter of this constructor aims to provide the metadata expected for each column of the ResultSet.</p> - * + * * <p> * For that, it is expected that all these metadata are {@link TAPColumn} objects. Indeed, simple {@link DBColumn} * instances do not have the type information. If just {@link DBColumn}s are provided, the ADQL name it provides will be kept * but the type will be guessed from the type provided by the ResultSetMetadata. * </p> - * + * * <p><i>Note: * If this parameter is incomplete (array length less than the column count returned by the ResultSet or some array items are NULL), * column metadata will be associated in the same order as the ResultSet columns. Missing metadata will be built from the * {@link ResultSetMetaData} and so the types will be guessed. * </i></p> - * + * * <h3>Type guessing</h3> - * + * * <p> * In order to guess a TAP type from a DBMS type, this constructor will call {@link #convertType(int, String, String)} * which will ask to the given translator ({@link JDBCTranslator#convertTypeFromDB(int, String, String, String[])}) @@ -360,23 +360,23 @@ public class ResultSetTableIterator implements TableIterator { * using the most common standard datatypes known in Postgres, SQLite, MySQL, Oracle and JavaDB/Derby. * This conversion is therefore not as precise as the one expected by the translator. * </p> - * + * * <p><i><b>Important</b>: * The fourth parameter of this constructor is given as second parameter of {@link #convertType(int, String, String)}. * <b>This parameter is really used ONLY when the translator conversion failed and when the DBMS is SQLite ("sqlite").</b> * Indeed, SQLite has so many datatype restrictions that it is absolutely needed to know it is the DBMS from which the * ResultSet is coming. Without this information, type guessing will be unpredictable! * </i></p> - * + * * @param dataSet Dataset over which this iterator must iterate. * @param resultMeta List of expected columns. <i>note: these metadata are expected to be really {@link TAPColumn} objects ; MAY be NULL.</i> * @param translator The {@link JDBCTranslator} used to transform the ADQL query into SQL query. This translator is also able to convert * JDBC types and to parse geometrical values. <i>note: MAY be NULL</i> * @param dbms Lower-case string which indicates from which DBMS the given ResultSet is coming. <i>note: MAY be NULL.</i> - * + * * @throws NullPointerException If NULL is given in parameter. * @throws DataReadException If the metadata (columns count and types) can not be fetched. - * + * * @see #ResultSetTableIterator(DBConnection, ResultSet, DBColumn[], JDBCTranslator, String) */ public ResultSetTableIterator(final ResultSet dataSet, final DBColumn[] resultMeta, final JDBCTranslator translator, final String dbms) throws NullPointerException, DataReadException{ @@ -385,28 +385,28 @@ public class ResultSetTableIterator implements TableIterator { /** * <p>Build a TableIterator able to read rows and columns of the given ResultSet.</p> - * + * * <p> * In order to provide the metadata through {@link #getMetadata()}, this constructor is trying to guess the datatype * from the DBMS column datatype (using {@link #convertType(int, String, String)}). * </p> - * + * * <h3>Type guessing</h3> - * + * * <p> * In order to guess a TAP type from a DBMS type, this constructor will call {@link #defaultTypeConversion(String, String[], String)} * which proceeds a default conversion using the most common standard datatypes known in Postgres, SQLite, MySQL, Oracle and JavaDB/Derby. * This conversion is therefore not as precise as the one expected by the translator. * </p> - * + * * @param dbConn {@link DBConnection} instance which has provided the given result. * @param dataSet Dataset over which this iterator must iterate. - * + * * @throws NullPointerException If NULL is given in parameter. * @throws DataReadException If the given ResultSet is closed or if the metadata (columns count and types) can not be fetched. - * + * * @see #ResultSetTableIterator(DBConnection, ResultSet, DBColumn[], JDBCTranslator, String) - * + * * @since 2.1 */ public ResultSetTableIterator(final DBConnection dbConn, final ResultSet dataSet) throws NullPointerException, DataReadException{ @@ -415,45 +415,45 @@ public class ResultSetTableIterator implements TableIterator { /** * <p>Build a TableIterator able to read rows and columns of the given ResultSet.</p> - * + * * <p> * In order to provide the metadata through {@link #getMetadata()}, this constructor is trying to guess the datatype * from the DBMS column datatype (using {@link #convertType(int, String, String)}). * </p> - * + * * <h3>Provided metadata</h3> - * + * * <p>The third parameter of this constructor aims to provide the metadata expected for each column of the ResultSet.</p> - * + * * <p> * For that, it is expected that all these metadata are {@link TAPColumn} objects. Indeed, simple {@link DBColumn} * instances do not have the type information. If just {@link DBColumn}s are provided, the ADQL name it provides will be kept * but the type will be guessed from the type provided by the ResultSetMetadata. * </p> - * + * * <p><i>Note: * If this parameter is incomplete (array length less than the column count returned by the ResultSet or some array items are NULL), * column metadata will be associated in the same order as the ResultSet columns. Missing metadata will be built from the * {@link ResultSetMetaData} and so the types will be guessed. * </i></p> - * + * * <h3>Type guessing</h3> - * + * * <p> * In order to guess a TAP type from a DBMS type, this constructor will call {@link #defaultTypeConversion(String, String[], String)} * which proceeds a default conversion using the most common standard datatypes known in Postgres, SQLite, MySQL, Oracle and JavaDB/Derby. * This conversion is therefore not as precise as the one expected by the translator. * </p> - * + * * @param dbConn {@link DBConnection} instance which has provided the given result. * @param dataSet Dataset over which this iterator must iterate. - * @param resultMeta List of expected columns. <i>note: these metadata are expected to be really {@link TAPColumn} objects ; MAY be NULL.</i> - * + * @param metadata List of expected columns. <i>note: these metadata are expected to be really {@link TAPColumn} objects ; MAY be NULL.</i> + * * @throws NullPointerException If NULL is given in parameter. * @throws DataReadException If the given ResultSet is closed or if the metadata (columns count and types) can not be fetched. - * + * * @see #ResultSetTableIterator(DBConnection, ResultSet, DBColumn[], JDBCTranslator, String) - * + * * @since 2.1 */ public ResultSetTableIterator(final DBConnection dbConn, final ResultSet dataSet, final DBColumn[] metadata) throws NullPointerException, DataReadException{ @@ -462,14 +462,14 @@ public class ResultSetTableIterator implements TableIterator { /** * <p>Build a TableIterator able to read rows and columns of the given ResultSet.</p> - * + * * <p> * In order to provide the metadata through {@link #getMetadata()}, this constructor is trying to guess the datatype * from the DBMS column datatype (using {@link #convertType(int, String, String)}). * </p> - * + * * <h3>Type guessing</h3> - * + * * <p> * In order to guess a TAP type from a DBMS type, this constructor will call {@link #convertType(int, String, String)} * which will ask to the given translator ({@link JDBCTranslator#convertTypeFromDB(int, String, String, String[])}) @@ -477,25 +477,25 @@ public class ResultSetTableIterator implements TableIterator { * using the most common standard datatypes known in Postgres, SQLite, MySQL, Oracle and JavaDB/Derby. * This conversion is therefore not as precise as the one expected by the translator. * </p> - * + * * <p><i><b>Important</b>: * The fourth parameter of this constructor is given as second parameter of {@link #convertType(int, String, String)}. * <b>This parameter is really used ONLY when the translator conversion failed and when the DBMS is SQLite ("sqlite").</b> * Indeed, SQLite has so many datatype restrictions that it is absolutely needed to know it is the DBMS from which the * ResultSet is coming. Without this information, type guessing will be unpredictable! * </i></p> - * + * * @param dbConn {@link DBConnection} instance which has provided the given result. * @param dataSet Dataset over which this iterator must iterate. * @param translator The {@link JDBCTranslator} used to transform the ADQL query into SQL query. This translator is also able to convert * JDBC types and to parse geometrical values. <i>note: MAY be NULL</i> * @param dbms Lower-case string which indicates from which DBMS the given ResultSet is coming. <i>note: MAY be NULL.</i> - * + * * @throws NullPointerException If NULL is given in parameter. * @throws DataReadException If the given ResultSet is closed or if the metadata (columns count and types) can not be fetched. - * + * * @see #ResultSetTableIterator(DBConnection, ResultSet, DBColumn[], JDBCTranslator, String) - * + * * @since 2.1 */ public ResultSetTableIterator(final DBConnection dbConn, final ResultSet dataSet, final JDBCTranslator translator, final String dbms) throws NullPointerException, DataReadException{ @@ -504,30 +504,30 @@ public class ResultSetTableIterator implements TableIterator { /** * <p>Build a TableIterator able to read rows and columns of the given ResultSet.</p> - * + * * <p> * In order to provide the metadata through {@link #getMetadata()}, this constructor is reading first the given metadata (if any), * and then, try to guess the datatype from the DBMS column datatype (using {@link #convertType(int, String, String)}). * </p> - * + * * <h3>Provided metadata</h3> - * + * * <p>The third parameter of this constructor aims to provide the metadata expected for each column of the ResultSet.</p> - * + * * <p> * For that, it is expected that all these metadata are {@link TAPColumn} objects. Indeed, simple {@link DBColumn} * instances do not have the type information. If just {@link DBColumn}s are provided, the ADQL name it provides will be kept * but the type will be guessed from the type provided by the ResultSetMetadata. * </p> - * + * * <p><i>Note: * If this parameter is incomplete (array length less than the column count returned by the ResultSet or some array items are NULL), * column metadata will be associated in the same order as the ResultSet columns. Missing metadata will be built from the * {@link ResultSetMetaData} and so the types will be guessed. * </i></p> - * + * * <h3>Type guessing</h3> - * + * * <p> * In order to guess a TAP type from a DBMS type, this constructor will call {@link #convertType(int, String, String)} * which will ask to the given translator ({@link JDBCTranslator#convertTypeFromDB(int, String, String, String[])}) @@ -535,26 +535,26 @@ public class ResultSetTableIterator implements TableIterator { * using the most common standard datatypes known in Postgres, SQLite, MySQL, Oracle and JavaDB/Derby. * This conversion is therefore not as precise as the one expected by the translator. * </p> - * + * * <p><i><b>Important</b>: * The fifth parameter of this constructor is given as second parameter of {@link #convertType(int, String, String)}. * <b>This parameter is really used ONLY when the translator conversion failed and when the DBMS is SQLite ("sqlite").</b> * Indeed, SQLite has so many datatype restrictions that it is absolutely needed to know it is the DBMS from which the * ResultSet is coming. Without this information, type guessing will be unpredictable! * </i></p> - * + * * @param dbConn {@link DBConnection} instance which has provided the given result. * @param dataSet Dataset over which this iterator must iterate. * @param resultMeta List of expected columns. <i>note: these metadata are expected to be really {@link TAPColumn} objects ; MAY be NULL.</i> * @param translator The {@link JDBCTranslator} used to transform the ADQL query into SQL query. This translator is also able to convert * JDBC types and to parse geometrical values. <i>note: MAY be NULL</i> * @param dbms Lower-case string which indicates from which DBMS the given ResultSet is coming. <i>note: MAY be NULL.</i> - * + * * @throws NullPointerException If NULL is given in parameter. * @throws DataReadException If the metadata (columns count and types) can not be fetched. - * + * * @see #convertType(int, String, String) - * + * * @since 2.1 */ public ResultSetTableIterator(final DBConnection dbConn, final ResultSet dataSet, final DBColumn[] resultMeta, final JDBCTranslator translator, final String dbms) throws NullPointerException, DataReadException{ @@ -642,7 +642,7 @@ public class ResultSetTableIterator implements TableIterator { * <li>the row iteration has started = the first row has been read = a first call of {@link #nextRow()} has been done</li> * <li>AND the row iteration is not finished = the last row has been read.</li> * </ul> - * + * * @throws IllegalStateException */ private void checkReadState() throws IllegalStateException{ @@ -663,15 +663,15 @@ public class ResultSetTableIterator implements TableIterator { /** * <p>Return the value of the next column and format it (see {@link #formatColValue(Object)}).</p> - * + * * <p><i>Note: The column type can be fetched using {@link #getColType()} <b>after</b> a call to {@link #nextCol()}.</i></p> - * + * * @return Get the value of the next column. - * + * * @throws NoSuchElementException If no more column value is available. * @throws IllegalStateException If {@link #nextRow()} has not yet been called. * @throws DataReadException If an error occurs while reading the table dataset. - * + * * @see tap.data.TableIterator#nextCol() * @see #formatColValue(Object) */ @@ -692,25 +692,25 @@ public class ResultSetTableIterator implements TableIterator { /** * <p>Format the given column value.</p> - * + * * <p> * This function should be overwritten if a different or additional formatting * should be performed before, after or instead of the one implemented here by default. * </p> - * + * * <p>By default, the following function performs the following formatting:</p> * <ul> * <li><b>If {@link Timestamp}, {@link Date} or {@link Time}:</b> the date-time is converted into a string with the ISO8601 format (see {@link ISO8601Format}).</li> * <li><b>If a single CHAR is declared and a String is given:</b> only the first character is returned as a {@link Character} object.</li> * <li><b>If the value is declared as a Geometry:</b> the geometry is formatted as a STC-S expression.</li> * </ul> - * + * * @param colValue A column value as provided by a {@link ResultSet}. - * + * * @return The formatted column value. - * + * * @throws DataReadException In case a formatting can not be performed. - * + * * @since 2.1 */ protected Object formatColValue(Object colValue) throws DataReadException{ @@ -727,10 +727,10 @@ public class ResultSetTableIterator implements TableIterator { else if (colValue instanceof java.util.Date) colValue = ISO8601Format.format((java.util.Date)colValue); // if the type is a BigDecimal object (this is possible for instance with PostgreSQL "numeric" datatype, - // but this type can not be supported in FITS and VOTable): + // but this type can not be supported in FITS and VOTable): else if (colValue instanceof BigDecimal) colValue = ((BigDecimal)colValue).doubleValue(); - // if the type is a BigInteger object (as BigDecimal, this type can not be supported in FITS and VOTable): + // if the type is a BigInteger object (as BigDecimal, this type can not be supported in FITS and VOTable): else if (colValue instanceof BigInteger) colValue = ((BigInteger)colValue).longValue(); // if the type is Integer but it is declared as a SMALLINT cast the value (absolutely required for the FITS format): @@ -743,7 +743,7 @@ public class ResultSetTableIterator implements TableIterator { else if (colType != null && colValue != null && colType.type == DBDatatype.CHAR && (colType.length == 1 || colType.length <= 0) && colValue instanceof String) colValue = ((String)colValue).charAt(0); // if the column value is a geometrical object, it must be serialized in STC-S: - else if (translator != null && colType != null && colType.isGeometry()) { + else if (translator != null && colType != null && colType.isGeometry()){ try{ Region region = translator.translateGeometryFromDB(colValue); if (region != null) @@ -773,24 +773,24 @@ public class ResultSetTableIterator implements TableIterator { /** * <p>Convert the given DBMS type into the corresponding {@link DBType} instance.</p> - * + * * <p> * This function first tries the conversion using the translator ({@link JDBCTranslator#convertTypeFromDB(int, String, String, String[])}). * If the translator fails, a default conversion is done. * </p> - * + * * <p><b>Warning: * It is not recommended to rely on the default conversion. * This conversion is just a matter of guessing the better matching {@link DBType} * considering the types of the following DBMS: PostgreSQL, SQLite, MySQL, Oracle and Java/DB/Derby. * </b></p> - * + * * @param dbmsType DBMS column data-type name. * @param dbms Lower-case string which indicates which DBMS the ResultSet is coming from. <i>note: MAY be NULL.</i> - * + * * @return The best suited {@link DBType} object, * or an {@link DBDatatype#UNKNOWN UNKNOWN} type if none can be found. - * + * * @see JDBCTranslator#convertTypeFromDB(int, String, String, String[]) * @see #defaultTypeConversion(String, String[], String) */ @@ -822,33 +822,33 @@ public class ResultSetTableIterator implements TableIterator { * <p>Convert the given DBMS type into the better matching {@link DBType} instance. * This function is used to <b>guess</b> the TAP type of a column when it is not provided in the constructor. * It aims not to be exhaustive, but just to provide a type when the given TAP metadata are incomplete.</p> - * + * * <p><i>Note: * Any unknown DBMS data-type will be considered and translated as a VARCHAR. * This latter will be also returned if the given parameter is an empty string or NULL. * </i></p> - * + * * <p><i>Note: * This type conversion function has been designed to work with all standard data-types of the following DBMS: * PostgreSQL, SQLite, MySQL, Oracle and JavaDB/Derby. * </i></p> - * + * * <p><i><b>Important</b>: * <b>The third parameter is REALLY NEEDED when the DBMS is SQLite ("sqlite")!</b> * Indeed, SQLite has a so restrictive list of data-types that this function can reliably convert * only if it knows the DBMS is SQLite. Otherwise, the conversion result would be unpredictable. * </i>In this default implementation of this function, all other DBMS values are ignored.<i> * </i></p> - * + * * <p><b>Warning</b>: * This function is not translating the geometrical data-types. If a such data-type is encountered, * it will considered as unknown and so, a VARCHAR TAP type will be returned. * </p> - * + * * @param dbmsTypeName Name of type, without the eventual parameters. * @param params The eventual type parameters (e.g. char string length). * @param dbms The targeted DBMS. - * + * * @return The corresponding ADQL/TAP type. <i>NEVER NULL ; * an {@link DBDatatype#UNKNOWN UNKNOWN} type is returned in case no match can be found.</i> */ diff --git a/src/tap/metadata/TAPMetadata.java b/src/tap/metadata/TAPMetadata.java index 644fb7a97247c3727ae9eb0017eb596d77e2dee4..0c98e66559969f7608c705de81bb648c4d7fd102 100644 --- a/src/tap/metadata/TAPMetadata.java +++ b/src/tap/metadata/TAPMetadata.java @@ -96,7 +96,7 @@ public class TAPMetadata implements Iterable<TAPSchema>, VOSIResource, TAPResour protected String accessURL = getName(); /** The path of the XSLT style-sheet to apply. - * @version 2.1 */ + * @since 2.1 */ protected String xsltPath = null; /** @@ -131,7 +131,7 @@ public class TAPMetadata implements Iterable<TAPSchema>, VOSIResource, TAPResour * * @return XSLT path/url. * - * @version 2.1 + * @since 2.1 */ public final String getXSLTPath(){ return xsltPath; @@ -142,7 +142,7 @@ public class TAPMetadata implements Iterable<TAPSchema>, VOSIResource, TAPResour * * @param path The new XSLT path/URL. * - * @version 2.1 + * @since 2.1 */ public final void setXSLTPath(final String path){ if (path == null) diff --git a/src/tap/resource/Capabilities.java b/src/tap/resource/Capabilities.java index bb207e7305f8ce33a69bcf7bb699e8bd269f7eda..b3ca2f6787563291e696e35fc2fd16a889f4de27 100644 --- a/src/tap/resource/Capabilities.java +++ b/src/tap/resource/Capabilities.java @@ -2,20 +2,20 @@ package tap.resource; /* * This file is part of TAPLibrary. - * + * * TAPLibrary is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * TAPLibrary is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public License * along with TAPLibrary. If not, see <http://www.gnu.org/licenses/>. - * + * * Copyright 2012-2016 - UDS/Centre de DonnĂ©es astronomiques de Strasbourg (CDS), * Astronomisches Rechen Institut (ARI) */ @@ -35,9 +35,9 @@ import uws.UWSToolBox; /** * <p>TAP resource describing the capabilities of a TAP service.</p> - * + * * <p>This resource just return an XML document giving a description of the TAP service and list all its VOSI resources.</p> - * + * * @author Grégory Mantelet (CDS;ARI) * @version 2.1 (07/2016) */ @@ -52,18 +52,18 @@ public class Capabilities implements TAPResource, VOSIResource { /** <p>URL toward this TAP resource. * This URL is particularly important for its declaration in the capabilities of the TAP service.</p> - * + * * <p><i>Note: By default, it is just the name of this resource. It is updated after initialization of the service * when the TAP service base URL is communicated to its resources. Then, it is: baseTAPURL + "/" + RESOURCE_NAME.</i></p> */ protected String accessURL = getName(); /** The path of the XSLT style-sheet to apply. - * @version 2.1 */ + * @since 2.1 */ protected String xsltPath = null; /** * Build a "/capabilities" resource. - * + * * @param tap Object representation of the whole TAP service. */ public Capabilities(final TAP tap){ @@ -72,10 +72,10 @@ public class Capabilities implements TAPResource, VOSIResource { /** * Gets the path/URL of the XSLT style-sheet to use. - * + * * @return XSLT path/url. - * - * @version 2.1 + * + * @since 2.1 */ public final String getXSLTPath(){ return xsltPath; @@ -83,10 +83,10 @@ public class Capabilities implements TAPResource, VOSIResource { /** * Sets the path/URL of the XSLT style-sheet to use. - * + * * @param path The new XSLT path/URL. - * - * @version 2.1 + * + * @since 2.1 */ public final void setXSLTPath(final String path){ if (path == null) @@ -191,9 +191,9 @@ public class Capabilities implements TAPResource, VOSIResource { /** * Write the XML description of the given VOSI resource. - * + * * @param res Resource to describe in XML. - * + * * @return XML description of the given VOSI resource. */ public static final String getDefaultCapability(final VOSIResource res){ diff --git a/src/tap/resource/TAP.java b/src/tap/resource/TAP.java index 700b46e328b8dee45d4ca3a830b6cc24f1d1558a..cb8379eeed029ff3546dd86340a0f63c0bcf2f06 100644 --- a/src/tap/resource/TAP.java +++ b/src/tap/resource/TAP.java @@ -745,7 +745,7 @@ public class TAP implements VOSIResource { * @param linePrefix Tabulations/Spaces that should prefix all lines * (for human readability). * - * @see TAPMetadata#getRegTAPTable() + * @see TAPMetadata#getRegTAPSchema() * * @since 2.1 */ diff --git a/src/uws/job/parameters/DurationParamController.java b/src/uws/job/parameters/DurationParamController.java index ae33a2d5fd981b59f9be3d8cb449488f0848c6e1..de91fd5d9e2b48c76545a61b0282585879ce5a55 100644 --- a/src/uws/job/parameters/DurationParamController.java +++ b/src/uws/job/parameters/DurationParamController.java @@ -2,20 +2,20 @@ package uws.job.parameters; /* * This file is part of UWSLibrary. - * + * * UWSLibrary is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * UWSLibrary is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public License * along with UWSLibrary. If not, see <http://www.gnu.org/licenses/>. - * + * * Copyright 2016 - Astronomisches Rechen Institut (ARI) */ @@ -30,7 +30,7 @@ import uws.UWSException; * Let controlling a duration parameter. Thus it is possible to set a default but also a minimum and a maximum value. * Moreover you can indicate whether the value of the parameter can be modified by the user or not after initialization. * </p> - * + * * <p>This controller behaves like a {@link NumericParamController} EXCEPT on two points:</p> * <ul> * <li>Every given value is casted into a long value. @@ -39,7 +39,7 @@ import uws.UWSException; * This string must be prefixed by a unit. See {@link #parseDuration(String)} (and its reverse operation {@link #toString(Long)}) * for more details.</li> * </ul> - * + * * @author Grégory Mantelet (ARI) * @version 4.2 (06/2016) * @since 4.2 @@ -49,7 +49,7 @@ public class DurationParamController extends NumericParamController { /** * Create a parameter controller for duration value with no restriction. - * + * * <p> * A default, minimum and/or maximum value can be set after creation using {@link #setDefault(Number)}, * {@link #setMinimum(Number)} and {@link #setMaximum(Number)}. By default this parameter can always be modified, @@ -65,17 +65,17 @@ public class DurationParamController extends NumericParamController { * The default and the maximum value are initialized with the given parameters (expressed in milliseconds). * The third parameter allows also to forbid the modification of the parameter value by the user, * if set to <i>false</i>.</p> - * + * * <p> * A default and/or maximum value can be modified after creation using {@link #setDefault(Number)} * and {@link #setMaximum(Number)}. The flag telling whether this parameter can be modified by the user * can be changed using {@link #allowModification(boolean)}. * </p> - * + * * <p><b>Important note:</b> * Values given in this constructor MUST be expressed in milliseconds. * </p> - * + * * @param defaultValue Value (in ms) set by default to the parameter, when none is specified. * @param minValue Minimum value (in ms) that can be set. If a smaller value is provided by the user, an exception will be thrown by {@link #check(Object)}. * @param maxValue Maximum value (in ms) that can be set. If a bigger value is provided by the user, an exception will be thrown by {@link #check(Object)}. @@ -87,7 +87,7 @@ public class DurationParamController extends NumericParamController { /** * Cast the given value as a long value and call {@link NumericParamController#setDefault(Number)}. - * + * * @see uws.job.parameters.NumericParamController#setMinimum(java.lang.Number) */ @Override @@ -97,7 +97,7 @@ public class DurationParamController extends NumericParamController { /** * Cast the given value as a long value and call {@link NumericParamController#setMinimum(Number)}. - * + * * @see uws.job.parameters.NumericParamController#setMinimum(java.lang.Number) */ @Override @@ -107,7 +107,7 @@ public class DurationParamController extends NumericParamController { /** * Cast the given value as a long value and call {@link NumericParamController#setMaximum(Number)}. - * + * * @see uws.job.parameters.NumericParamController#setMinimum(java.lang.Number) */ @Override @@ -158,7 +158,7 @@ public class DurationParamController extends NumericParamController { protected final static long MULT_MIN = 60000; /** Multiplication factor between milliseconds and hours. - * <p>An hour is here defined as 60 minutes. So the value is computed as follows: {@link #MULT_MINUTES}*60.</p> */ + * <p>An hour is here defined as 60 minutes. So the value is computed as follows: {@link #MULT_MIN}*60.</p> */ protected final static long MULT_HOURS = 3600000; /** Multiplication factor between milliseconds and days. @@ -232,11 +232,11 @@ public class DurationParamController extends NumericParamController { * <li>months, M</li> * <li>years, Y</li> * </ul> - * + * * <p><b>Important:</b> * Units are case <b>sensitive</b>! * </p> - * + * * <p><i>Note: * Space characters are ignored only if leading or trailing the whole string, * or if between the duration and its unit. @@ -245,7 +245,7 @@ public class DurationParamController extends NumericParamController { /** * Parse the given duration string. - * + * * <p> * Such string MUST be a positive integer/long value eventually suffixed by a unit. * Allowed unit strings are the following: @@ -260,24 +260,24 @@ public class DurationParamController extends NumericParamController { * <li>months, M</li> * <li>years, Y</li> * </ul> - * + * * <p><b>Important:</b> * Units are case <b>sensitive</b>! * </p> - * + * * <p><i>Note: * Space characters are ignored only if leading or trailing the whole string, * or if between the duration and its unit. * </i></p> - * + * * @param duration The duration string. - * + * * @return The parsed duration converted into milliseconds, * or <code>-1</code> if the given string is <code>null</code> or negative. - * + * * @throws ParseException If the given string is using an unknown unit string, * or if the string does not start digits. - * + * * @see #toString(Long) */ public long parseDuration(final String duration) throws ParseException{ @@ -319,12 +319,12 @@ public class DurationParamController extends NumericParamController { /** * Convert a duration value (expressed in milliseconds) into the best human readable unit value. - * + * * @param duration A duration in milliseconds. - * + * * @return An empty string if the given duration is <code>null</code>, * or a string expressing the given duration in the best integer value with a unit suffix. - * + * * @see #parseDuration(String) */ public String toString(Long duration){ diff --git a/src/uws/service/request/XMLRequestParser.java b/src/uws/service/request/XMLRequestParser.java index 448ebbcbbfa295bb07b55e03448d87217c544d74..f3cbeba0b5acf2d26d78bc05c9e4621aa15ba864 100644 --- a/src/uws/service/request/XMLRequestParser.java +++ b/src/uws/service/request/XMLRequestParser.java @@ -2,20 +2,20 @@ package uws.service.request; /* * This file is part of UWSLibrary. - * + * * UWSLibrary is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * UWSLibrary is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public License * along with UWSLibrary. If not, see <http://www.gnu.org/licenses/>. - * + * * Copyright 2017 - Astronomisches Rechen Institut (ARI) */ @@ -47,23 +47,23 @@ import uws.service.file.UWSFileManager; /** * This parser aims to copy the full content of an HTTP request if it is * identified as an XML document. - * + * * <p><b>UWS's Job Description</b></p> - * + * * <p> * Actually, this parser implements the possibility defined in the UWS 1.0 * standard to provide an XML document describing the parameters of a UWS job. * This XML document is then called "Job Description". * </p> - * + * * <p><b>Validation</b></p> - * + * * <p> * In the UWS 1.0 standard, it is said that this Job Description has to follow * a Job Description Language (JDL ; that's to say a known pattern describing * the expected job parameters) dependent of the UWS service implementation. * </p> - * + * * <p> * By default, this parser copies the request content and checks it is an XML * document. Nothing else is done, and particularly not the validation of @@ -71,24 +71,24 @@ import uws.service.file.UWSFileManager; * class and overwrite its function {@link #validate(InputStream)}. By default * this function just ensures the request content is a valid XML document. * </p> - * + * * <p><b>Document access</b></p> - * + * * <p> * Once parsed, the request content will be made accessible through an * {@link HttpServletRequest} attribute under the name * <b>{@value uws.service.UWS#REQ_ATTRIBUTE_JOB_DESCRIPTION}</b>. * The associated object <b>is typed as an {@link XMLJobInfo}</b>. * </p> - * + * * <p><i>Note: * Afterwards, it is intended to be attached to a {@link uws.job.UWSJob} and * then made accessible through its function * {@link uws.job.UWSJob#getJobInfo()}. * </i></p> - * + * * <p><b>Document storage</b></p> - * + * * <p>{@link XMLJobInfo} gives two storage possibility:</p> * <ol> * <li><i>in memory</i> with the constructor @@ -96,7 +96,7 @@ import uws.service.file.UWSFileManager; * <li><i>in a file</i> with the constructor * {@link XMLJobInfo#XMLJobInfo(UploadFile) XMLJobInfo(UploadFile)}</li> * </ol> - * + * * <p> * The storage chosen by this parser depends on the size of the input document. * If it exceeds {@link #SMALL_XML_THRESHOLD} (expressed in bytes), then @@ -105,7 +105,7 @@ import uws.service.file.UWSFileManager; * field {@link #SMALL_XML_THRESHOLD} to the desired value (in bytes). * By default, it is set to {@value #DEFAULT_SMALL_XML_THRESHOLD} bytes. * </p> - * + * * <p><b>Important:</b> * It is possible to prevent the unwanted storage of a very large document * by setting the limit {@link #SIZE_LIMIT} to a different value (in bytes). @@ -113,7 +113,7 @@ import uws.service.file.UWSFileManager; * an 413 (REQUEST ENTITY TOO LARGE) error. * By default this limit is set to {@value #DEFAULT_SIZE_LIMIT} bytes. * </p> - * + * * @author Grégory Mantelet (ARI) * @version 4.2 (06/2017) * @since 4.2 @@ -150,7 +150,7 @@ public class XMLRequestParser implements RequestParser { /** * Build the request parser. - * + * * @param fileManager A file manager. <i>Must NOT be NULL.</i> */ public XMLRequestParser(final UWSFileManager fileManager){ @@ -273,16 +273,16 @@ public class XMLRequestParser implements RequestParser { /** * Validate the given XML document. - * + * * <p> * By default, it is only ensured this document is an XML one. * </p> - * + * * @param smallXML The document to check. - * + * * @throws UWSException If the given document is not valid. - * - * @see {@link #validate(InputStream)} + * + * @see #validate(InputStream) */ protected void validate(final String smallXML) throws UWSException{ validate(new ByteArrayInputStream(smallXML.getBytes())); @@ -290,16 +290,16 @@ public class XMLRequestParser implements RequestParser { /** * Validate the specified XML document. - * + * * <p> * By default, it is only ensured this document is an XML one. * </p> - * + * * @param xmlFile The file containing the document to check. - * + * * @throws UWSException If the specified document is not valid. - * - * @see {@link #validate(InputStream)} + * + * @see #validate(InputStream) */ protected void validate(final File xmlFile) throws UWSException{ InputStream input = null; @@ -319,13 +319,13 @@ public class XMLRequestParser implements RequestParser { /** * Validate the given XML document. - * + * * <p> * By default, it is only ensured this document is an XML one. * </p> - * + * * @param input Stream toward the document to check. - * + * * @throws UWSException If the given document is not valid. */ protected void validate(final InputStream input) throws UWSException{ @@ -346,7 +346,7 @@ public class XMLRequestParser implements RequestParser { /** * Utility method that determines whether the content of the given * request is an XML (or XML-derived) document. - * + * * <p><b>Important:</b> * This function just tests the content-type of the request. * Neither the HTTP method (e.g. GET, POST, ...) nor the content is tested.