From 6c7b1fdb9ddca8dee09416a58c55d68735966ee8 Mon Sep 17 00:00:00 2001 From: ebocher Date: Wed, 13 Nov 2019 11:10:29 +0100 Subject: [PATCH] Fix comments https://github.com/orbisgis/orbisdata/pull/159 --- .../datamanagerapi/dataset/ITable.java | 1 + .../datasource/IJdbcDataSource.java | 50 +++++++++---------- .../org/orbisgis/datamanager/JdbcTable.java | 2 +- .../org/orbisgis/datamanager/h2gis/H2GIS.java | 2 + .../orbisgis/datamanager/postgis/POSTGIS.java | 2 + .../datamanager/GroovyH2GISTest.groovy | 3 +- 6 files changed, 32 insertions(+), 28 deletions(-) diff --git a/data-manager-api/src/main/java/org/orbisgis/datamanagerapi/dataset/ITable.java b/data-manager-api/src/main/java/org/orbisgis/datamanagerapi/dataset/ITable.java index da1939f8..c6201130 100644 --- a/data-manager-api/src/main/java/org/orbisgis/datamanagerapi/dataset/ITable.java +++ b/data-manager-api/src/main/java/org/orbisgis/datamanagerapi/dataset/ITable.java @@ -75,6 +75,7 @@ public interface ITable extends IDataSet { /** * Get the type of the column from the underlying table. * + * @param columnName set the name of the column * @return The type of the column. */ String getColumnsType(String columnName); diff --git a/data-manager-api/src/main/java/org/orbisgis/datamanagerapi/datasource/IJdbcDataSource.java b/data-manager-api/src/main/java/org/orbisgis/datamanagerapi/datasource/IJdbcDataSource.java index ab302888..c26901d4 100644 --- a/data-manager-api/src/main/java/org/orbisgis/datamanagerapi/datasource/IJdbcDataSource.java +++ b/data-manager-api/src/main/java/org/orbisgis/datamanagerapi/datasource/IJdbcDataSource.java @@ -95,7 +95,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * * @param tableName Name of the table to check. * - * @return True if the table is found, false otherwise. + * @return True if {@link ITable} is found, false otherwise. */ boolean hasTable(String tableName); @@ -108,7 +108,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * Load a file into the database. * * @param filePath Path of the file. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(String filePath); @@ -117,7 +117,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * * @param filePath Path of the file. * @param delete True to delete the table if exists, false otherwise. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(String filePath, boolean delete); @@ -126,7 +126,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * * @param filePath Path of the file. * @param tableName Name of the table. - * @return + * @return The {@link ITable} containing the loaded data. */ ITable load(String filePath, String tableName); @@ -136,7 +136,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * @param filePath Path of the file. * @param tableName Name of the table. * @param delete True to delete the table if exists, false otherwise. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(String filePath, String tableName, boolean delete); @@ -147,7 +147,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * @param tableName Name of the table * @param encoding Encoding of the loaded file. * @param delete True to delete the table if exists, false otherwise. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(String filePath, String tableName, String encoding, boolean delete); @@ -155,7 +155,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * Load a file into the database. * * @param url {@link URL} of the file. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(URL url); @@ -164,7 +164,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * * @param url {@link URL} of the file. * @param delete True to delete the table if exists, false otherwise. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(URL url, boolean delete); @@ -173,7 +173,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * * @param url {@link URL} of the file. * @param tableName Name of the table. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(URL url, String tableName); @@ -183,7 +183,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * @param url {@link URL} of the file. * @param tableName Name of the table. * @param delete True to delete the table if exists, false otherwise. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(URL url, String tableName, boolean delete); @@ -194,7 +194,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * @param tableName Name of the table * @param encoding Encoding of the loaded file. * @param delete True to delete the table if exists, false otherwise. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(URL url, String tableName, String encoding, boolean delete); @@ -202,7 +202,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * Load a file into the database. * * @param uri {@link URI} of the file. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(URI uri); @@ -211,7 +211,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * * @param uri {@link URI} of the file. * @param delete True to delete the table if exists, false otherwise. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(URI uri, boolean delete); @@ -220,7 +220,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * * @param uri {@link URI} of the file. * @param tableName Name of the table. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(URI uri, String tableName); @@ -230,7 +230,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * @param uri {@link URI} of the file. * @param tableName Name of the table. * @param delete True to delete the table if exists, false otherwise. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(URI uri, String tableName, boolean delete); @@ -241,7 +241,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * @param tableName Name of the table * @param encoding Encoding of the loaded file. * @param delete True to delete the table if exists, false otherwise. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(URI uri, String tableName, String encoding, boolean delete); @@ -249,7 +249,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * Load a file into the database. * * @param file {@link File}. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(File file); @@ -258,7 +258,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * * @param file {@link File}. * @param delete True to delete the table if exists, false otherwise. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(File file, boolean delete); @@ -267,7 +267,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * * @param file {@link File}. * @param tableName Name of the table. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(File file, String tableName); @@ -277,7 +277,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * @param file {@link File}. * @param tableName Name of the table. * @param delete True to delete the table if exists, false otherwise. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(File file, String tableName, boolean delete); @@ -288,7 +288,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * @param tableName Name of the table * @param encoding Encoding of the loaded file. * @param delete True to delete the table if exists, false otherwise. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(File file, String tableName, String encoding, boolean delete); @@ -297,7 +297,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * * @param properties Properties used to connect to the database. * @param inputTableName Name of the table to import. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(Map properties, String inputTableName); @@ -308,7 +308,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * @param properties Properties used to connect to the database. * @param inputTableName Name of the table to import. * @param outputTableName Name of the imported table in the database. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(Map properties, String inputTableName, String outputTableName); @@ -318,7 +318,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * @param properties Properties used to connect to the database. * @param inputTableName Name of the table to import. * @param delete True to delete the outputTableName if exists, false otherwise. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(Map properties, String inputTableName, boolean delete); @@ -329,7 +329,7 @@ public interface IJdbcDataSource extends IDataSource, GroovyObject { * @param inputTableName Name of the table to import. * @param outputTableName Name of the imported table in the database. * @param delete True to delete the outputTableName if exists, false otherwise. - * @return a ITable + * @return The {@link ITable} containing the loaded data. */ ITable load(Map properties, String inputTableName, String outputTableName, boolean delete); diff --git a/data-manager/src/main/java/org/orbisgis/datamanager/JdbcTable.java b/data-manager/src/main/java/org/orbisgis/datamanager/JdbcTable.java index 93e1d370..4d75928b 100644 --- a/data-manager/src/main/java/org/orbisgis/datamanager/JdbcTable.java +++ b/data-manager/src/main/java/org/orbisgis/datamanager/JdbcTable.java @@ -179,7 +179,7 @@ public ResultSetMetaData getMetaData(){ * * @return The parent DataSource. */ - public JdbcDataSource getJdbcDataSource(){ + protected JdbcDataSource getJdbcDataSource(){ return jdbcDataSource; } diff --git a/data-manager/src/main/java/org/orbisgis/datamanager/h2gis/H2GIS.java b/data-manager/src/main/java/org/orbisgis/datamanager/h2gis/H2GIS.java index f608fed5..5fa8d16f 100644 --- a/data-manager/src/main/java/org/orbisgis/datamanager/h2gis/H2GIS.java +++ b/data-manager/src/main/java/org/orbisgis/datamanager/h2gis/H2GIS.java @@ -243,6 +243,8 @@ public boolean hasTable(String tableName) { try { return JDBCUtilities.tableExists(connectionWrapper,TableLocation.parse(tableName, true).toString()); } catch (SQLException ex) { + LOGGER.error("Cannot find the table '" + tableName + ".\n" + + ex.getLocalizedMessage()); return false; } } diff --git a/data-manager/src/main/java/org/orbisgis/datamanager/postgis/POSTGIS.java b/data-manager/src/main/java/org/orbisgis/datamanager/postgis/POSTGIS.java index 9a958103..36b15e72 100644 --- a/data-manager/src/main/java/org/orbisgis/datamanager/postgis/POSTGIS.java +++ b/data-manager/src/main/java/org/orbisgis/datamanager/postgis/POSTGIS.java @@ -199,6 +199,8 @@ public boolean hasTable(String tableName) { try { return JDBCUtilities.tableExists(connectionWrapper,TableLocation.parse(tableName, false).toString()); } catch (SQLException ex) { + LOGGER.error("Cannot find the table '" + tableName + ".\n" + + ex.getLocalizedMessage()); return false; } } diff --git a/data-manager/src/test/groovy/org/orbisgis/datamanager/GroovyH2GISTest.groovy b/data-manager/src/test/groovy/org/orbisgis/datamanager/GroovyH2GISTest.groovy index ea2f2763..84316919 100644 --- a/data-manager/src/test/groovy/org/orbisgis/datamanager/GroovyH2GISTest.groovy +++ b/data-manager/src/test/groovy/org/orbisgis/datamanager/GroovyH2GISTest.groovy @@ -564,7 +564,6 @@ class GroovyH2GISTest { h2GIS.getSpatialTable("orbisgis").the_geom.createSpatialIndex() assertTrue h2GIS.getSpatialTable("orbisgis").the_geom.indexed assertTrue h2GIS.getSpatialTable("orbisgis").the_geom.spatialIndexed - h2GIS.getSpatialTable("orbisgis").the_geom.createSpatialIndex() } @Test @@ -629,5 +628,5 @@ class GroovyH2GISTest { """) def concat = "" println h2GIS.firstRow("select count(*) as nb from h2gis").nb - } + } }