You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2021/09/30 13:51:34 UTC
[sis] 01/04: Remove sis-shapefile and sis-webapp modules (they are
not ready for releases).
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch 1.1-RC
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 93b8dac62c5a685d3df256572d8373b114fb7998
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Wed Sep 29 18:24:40 2021 +0200
Remove sis-shapefile and sis-webapp modules (they are not ready for releases).
---
application/pom.xml | 1 -
application/sis-webapp/pom.xml | 47 -
.../main/java/org/apache/sis/services/Servlet.java | 26 -
.../java/org/apache/sis/services/package-info.java | 21 -
.../src/main/webapp/META-INF/context.xml | 26 -
.../sis-webapp/src/main/webapp/WEB-INF/web.xml | 24 -
ide-project/NetBeans/build.xml | 11 -
ide-project/NetBeans/nbproject/build-impl.xml | 56 +-
ide-project/NetBeans/nbproject/genfiles.properties | 4 +-
ide-project/NetBeans/nbproject/project.properties | 3 -
ide-project/NetBeans/nbproject/project.xml | 3 -
storage/pom.xml | 1 -
storage/sis-shapefile/pom.xml | 132 --
.../apache/sis/internal/shapefile/AutoChecker.java | 186 ---
...nvalidRecordNumberForDirectAccessException.java | 65 -
.../SQLNoDirectAccessAvailableException.java | 50 -
.../shapefile/SQLShapefileNotFoundException.java | 50 -
.../internal/shapefile/ShapefileByteReader.java | 465 -------
.../internal/shapefile/ShapefileDescriptor.java | 201 ---
.../shapefile/jdbc/AbstractDbase3ByteReader.java | 283 -----
.../sis/internal/shapefile/jdbc/AbstractJDBC.java | 162 ---
.../internal/shapefile/jdbc/CommonByteReader.java | 132 --
.../sis/internal/shapefile/jdbc/DBFDriver.java | 145 ---
.../shapefile/jdbc/DBase3FieldDescriptor.java | 150 ---
.../sis/internal/shapefile/jdbc/DBaseDataType.java | 103 --
.../internal/shapefile/jdbc/Dbase3ByteReader.java | 130 --
.../internal/shapefile/jdbc/MappedByteReader.java | 309 -----
.../jdbc/SQLConnectionClosedException.java | 63 -
.../jdbc/SQLDbaseFileNotFoundException.java | 50 -
.../jdbc/SQLInvalidDbaseFileFormatException.java | 50 -
.../jdbc/connection/AbstractConnection.java | 418 -------
.../shapefile/jdbc/connection/DBFConnection.java | 336 -----
.../connection/SQLClosingIOFailureException.java | 63 -
.../shapefile/jdbc/connection/package-info.java | 19 -
.../jdbc/metadata/AbstractDatabaseMetaData.java | 202 ---
.../jdbc/metadata/DBFDatabaseMetaData.java | 1300 --------------------
.../jdbc/metadata/DBFResultSetMataData.java | 473 -------
.../shapefile/jdbc/metadata/package-info.java | 21 -
.../sis/internal/shapefile/jdbc/package-info.java | 26 -
.../jdbc/resultset/AbstractResultSet.java | 707 -----------
.../jdbc/resultset/BuiltInMemoryResultSet.java | 196 ---
...iltInMemoryResultSetForCatalogNamesListing.java | 51 -
...DBFBuiltInMemoryResultSetForColumnsListing.java | 460 -------
.../DBFBuiltInMemoryResultSetForSchemaListing.java | 51 -
.../DBFBuiltInMemoryResultSetForTablesListing.java | 88 --
...uiltInMemoryResultSetForTablesTypesListing.java | 74 --
.../jdbc/resultset/DBFRecordBasedResultSet.java | 609 ---------
.../shapefile/jdbc/resultset/DBFResultSet.java | 965 ---------------
.../resultset/SQLIllegalColumnIndexException.java | 76 --
.../jdbc/resultset/SQLNoResultException.java | 63 -
.../jdbc/resultset/SQLNoSuchFieldException.java | 76 --
.../jdbc/resultset/SQLNotDateException.java | 89 --
.../jdbc/resultset/SQLNotNumericException.java | 89 --
.../shapefile/jdbc/resultset/package-info.java | 21 -
.../shapefile/jdbc/sql/ClauseResolver.java | 391 ------
.../jdbc/sql/ConditionalClauseResolver.java | 38 -
.../shapefile/jdbc/sql/CrudeSQLParser.java | 137 ---
.../jdbc/sql/SQLIllegalParameterException.java | 89 --
.../jdbc/sql/SQLInvalidStatementException.java | 63 -
.../sql/SQLUnsupportedParsingFeatureException.java | 63 -
.../internal/shapefile/jdbc/sql/package-info.java | 20 -
.../jdbc/statement/AbstractStatement.java | 308 -----
.../shapefile/jdbc/statement/DBFStatement.java | 244 ----
.../shapefile/jdbc/statement/package-info.java | 19 -
.../sis/internal/shapefile/package-info.java | 25 -
.../storage/shapefile/DataStoreQueryException.java | 53 -
.../shapefile/DataStoreQueryResultException.java | 53 -
.../shapefile/DbaseFileNotFoundException.java | 53 -
.../sis/storage/shapefile/InputFeatureStream.java | 377 ------
.../shapefile/InvalidDbaseFileFormatException.java | 36 -
.../shapefile/InvalidShapefileFormatException.java | 52 -
.../apache/sis/storage/shapefile/ShapeFile.java | 210 ----
.../sis/storage/shapefile/ShapeTypeEnum.java | 77 --
.../shapefile/ShapefileNotFoundException.java | 53 -
.../apache/sis/storage/shapefile/cpg/CpgFiles.java | 79 --
.../apache/sis/storage/shapefile/package-info.java | 30 -
.../shapefile/ShapefileByteReader.properties | 36 -
.../shapefile/ShapefileByteReader_fr.properties | 36 -
.../jdbc/AbstractDbase3ByteReader.properties | 14 -
.../jdbc/AbstractDbase3ByteReader_fr.properties | 14 -
.../shapefile/jdbc/AbstractJDBC.properties | 23 -
.../shapefile/jdbc/AbstractJDBC_fr.properties | 1 -
.../shapefile/jdbc/CommonByteReader.properties | 3 -
.../jdbc/DBase3FieldDescriptor.properties | 7 -
.../jdbc/DBase3FieldDescriptor_fr.properties | 1 -
.../shapefile/jdbc/MappedByteReader.properties | 30 -
.../shapefile/jdbc/MappedByteReader_fr.properties | 30 -
.../jdbc/connection/AbstractConnection.properties | 6 -
.../connection/AbstractConnection_fr.properties | 6 -
.../jdbc/connection/DBFConnection.properties | 49 -
.../jdbc/connection/DBFConnection_fr.properties | 39 -
.../jdbc/metadata/DBFResultSetMataData.properties | 14 -
.../metadata/DBFResultSetMataData_fr.properties | 4 -
.../jdbc/resultset/AbstractResultSet.properties | 1 -
.../jdbc/resultset/AbstractResultSet_fr.properties | 1 -
...ltInMemoryResultSetForColumnsListing.properties | 8 -
...nMemoryResultSetForColumnsListing_fr.properties | 8 -
...iltInMemoryResultSetForTablesListing.properties | 2 -
...MemoryResultSetForTablesTypesListing.properties | 2 -
.../resultset/DBFRecordBasedResultSet.properties | 28 -
.../DBFRecordBasedResultSet_fr.properties | 28 -
.../jdbc/resultset/DBFResultSet.properties | 10 -
.../jdbc/resultset/DBFResultSet_fr.properties | 4 -
.../shapefile/jdbc/sql/ClauseResolver.properties | 25 -
.../jdbc/sql/ClauseResolver_fr.properties | 16 -
.../shapefile/jdbc/sql/CrudeSQLParser.properties | 12 -
.../jdbc/statement/DBFStatement.properties | 22 -
.../jdbc/statement/DBFStatement_fr.properties | 12 -
.../shapefile/InputFeatureStream.properties | 9 -
.../shapefile/InputFeatureStream_fr.properties | 9 -
.../jdbc/AbstractTestBaseForInternalJDBC.java | 68 -
.../internal/shapefile/jdbc/DBFConnectionTest.java | 92 --
.../internal/shapefile/jdbc/DBFResultSetTest.java | 205 ---
.../internal/shapefile/jdbc/DBFStatementTest.java | 97 --
.../apache/sis/internal/shapefile/jdbc/readme.txt | 58 -
.../shapefile/jdbc/sql/WhereClauseTest.java | 140 ---
.../sis/storage/shapefile/ShapeFileTest.java | 206 ----
.../apache/sis/test/suite/ShapefileTestSuite.java | 44 -
.../org/apache/sis/test/suite/package-info.txt | 3 -
.../shapefile/ABRALicenseePt_4326_clipped.dbf | Bin 5861 -> 0 bytes
.../shapefile/ABRALicenseePt_4326_clipped.prj | 1 -
.../shapefile/ABRALicenseePt_4326_clipped.shp | Bin 184 -> 0 bytes
.../shapefile/ABRALicenseePt_4326_clipped.shx | Bin 124 -> 0 bytes
.../org/apache/sis/storage/shapefile/NOTES.md | 12 -
.../shapefile/SignedBikeRoute_4326_clipped.dbf | Bin 7363 -> 0 bytes
.../shapefile/SignedBikeRoute_4326_clipped.prj | 1 -
.../shapefile/SignedBikeRoute_4326_clipped.shp | Bin 1148 -> 0 bytes
.../shapefile/SignedBikeRoute_4326_clipped.shx | Bin 148 -> 0 bytes
128 files changed, 16 insertions(+), 13313 deletions(-)
diff --git a/application/pom.xml b/application/pom.xml
index bec294f..21ec518 100644
--- a/application/pom.xml
+++ b/application/pom.xml
@@ -118,7 +118,6 @@
=========================================================== -->
<modules>
<module>sis-console</module>
- <module>sis-webapp</module>
<module>sis-openoffice</module>
</modules>
<profiles>
diff --git a/application/sis-webapp/pom.xml b/application/sis-webapp/pom.xml
deleted file mode 100644
index 0df17d0..0000000
--- a/application/sis-webapp/pom.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-
-<project xmlns = "http://maven.apache.org/POM/4.0.0"
- xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation = "http://maven.apache.org/POM/4.0.0
- http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.sis</groupId>
- <artifactId>application</artifactId>
- <version>1.1-SNAPSHOT</version>
- </parent>
-
- <groupId>org.apache.sis.application</groupId>
- <artifactId>sis-webapp</artifactId>
- <packaging>war</packaging>
- <name>Apache SIS web services layer</name>
- <url>http://sis.apache.org</url>
-
- <dependencies>
- <dependency>
- <groupId>javax</groupId>
- <artifactId>javaee-api</artifactId>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/application/sis-webapp/src/main/java/org/apache/sis/services/Servlet.java b/application/sis-webapp/src/main/java/org/apache/sis/services/Servlet.java
deleted file mode 100644
index c3d4b5e..0000000
--- a/application/sis-webapp/src/main/java/org/apache/sis/services/Servlet.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.services;
-
-
-/**
- * Place-holder for future web services.
- */
-public final class Servlet {
- private Servlet() {
- }
-}
diff --git a/application/sis-webapp/src/main/java/org/apache/sis/services/package-info.java b/application/sis-webapp/src/main/java/org/apache/sis/services/package-info.java
deleted file mode 100644
index 25ac794..0000000
--- a/application/sis-webapp/src/main/java/org/apache/sis/services/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Place-holder for future web services.
- */
-package org.apache.sis.services;
diff --git a/application/sis-webapp/src/main/webapp/META-INF/context.xml b/application/sis-webapp/src/main/webapp/META-INF/context.xml
deleted file mode 100644
index 011866c..0000000
--- a/application/sis-webapp/src/main/webapp/META-INF/context.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE file distributed with this work for
-additional information regarding copyright ownership. The ASF licenses this
-file to you under the Apache License, Version 2.0 (the "License"); you may not
-use this file except in compliance with the License. You may obtain a copy of
-the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-License for the specific language governing permissions and limitations under
-the License.
--->
-
-<Context path="/sis" docBase="/path/to/sis-webapp-x.y.war">
-
- <!-- TODO: this file is only a template. Need to be edited. -->
-
- <Parameter name="org.apache.sis.services.config.filePath"
- value="/path/to/sis-location-config.xml" override="false"/>
-
-</Context>
diff --git a/application/sis-webapp/src/main/webapp/WEB-INF/web.xml b/application/sis-webapp/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 74993a4..0000000
--- a/application/sis-webapp/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE file distributed with this work for
-additional information regarding copyright ownership. The ASF licenses this
-file to you under the Apache License, Version 2.0 (the "License"); you may not
-use this file except in compliance with the License. You may obtain a copy of
-the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-License for the specific language governing permissions and limitations under
-the License.
--->
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- id="WebApp_ID" version="2.5">
- <display-name>Apache SIS</display-name>
-</web-app>
diff --git a/ide-project/NetBeans/build.xml b/ide-project/NetBeans/build.xml
index f081cc0..f56d50a 100644
--- a/ide-project/NetBeans/build.xml
+++ b/ide-project/NetBeans/build.xml
@@ -87,11 +87,6 @@
<fileset dir="${project.root}/storage/sis-sqlstore/target/generated-resources">
<include name="**/*.utf"/>
</fileset>
- <!-- Pending discussion about how to handle resources in the Shapefile module.
- <fileset dir="${project.root}/storage/sis-shapefile/target/generated-resources">
- <include name="**/*.utf"/>
- </fileset>
- -->
<fileset dir="${project.root}/application/sis-javafx/target/generated-resources">
<include name="**/*.utf"/>
</fileset>
@@ -300,12 +295,6 @@
<fileset dir="${project.root}/storage/sis-earth-observation/src/test/resources">
<include name="**/*.txt"/>
</fileset>
- <fileset dir="${project.root}/storage/sis-shapefile/src/test/resources">
- <include name="**/*.dbf"/>
- <include name="**/*.prj"/>
- <include name="**/*.shp"/>
- <include name="**/*.shx"/>
- </fileset>
<fileset dir="${project.root}/profiles/sis-french-profile/src/test/resources">
<include name="**/*.xml"/>
</fileset>
diff --git a/ide-project/NetBeans/nbproject/build-impl.xml b/ide-project/NetBeans/nbproject/build-impl.xml
index 451e1a7..269ab1a 100644
--- a/ide-project/NetBeans/nbproject/build-impl.xml
+++ b/ide-project/NetBeans/nbproject/build-impl.xml
@@ -90,7 +90,7 @@ is divided into following sections:
</not>
</condition>
</fail>
- <j2seproject3:modulename property="module.name" sourcepath="${src.local-src.dir}:${src.javafx.dir}:${src.webapp.dir}:${src.console.dir}:${src.portrayal.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.sql.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${src.jpn-profile.dir}"/>
+ <j2seproject3:modulename property="module.name" sourcepath="${src.local-src.dir}:${src.javafx.dir}:${src.console.dir}:${src.portrayal.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.sql.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${src.jpn-profile.dir}"/>
<condition property="named.module.internal">
<and>
<isset property="module.name"/>
@@ -185,7 +185,6 @@ is divided into following sections:
<available file="${test.earth-obs.dir}"/>
<available file="${test.geotiff.dir}"/>
<available file="${test.netcdf.dir}"/>
- <available file="${test.shapefile.dir}"/>
<available file="${test.sql.dir}"/>
<available file="${test.xmlstore.dir}"/>
<available file="${test.storage.dir}"/>
@@ -202,13 +201,11 @@ is divided into following sections:
<or>
<available file="${src.local-src.dir}"/>
<available file="${src.javafx.dir}"/>
- <available file="${src.webapp.dir}"/>
<available file="${src.console.dir}"/>
<available file="${src.portrayal.dir}"/>
<available file="${src.earth-obs.dir}"/>
<available file="${src.geotiff.dir}"/>
<available file="${src.netcdf.dir}"/>
- <available file="${src.shapefile.dir}"/>
<available file="${src.sql.dir}"/>
<available file="${src.xmlstore.dir}"/>
<available file="${src.storage.dir}"/>
@@ -323,13 +320,11 @@ is divided into following sections:
<target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
<fail unless="src.local-src.dir">Must set src.local-src.dir</fail>
<fail unless="src.javafx.dir">Must set src.javafx.dir</fail>
- <fail unless="src.webapp.dir">Must set src.webapp.dir</fail>
<fail unless="src.console.dir">Must set src.console.dir</fail>
<fail unless="src.portrayal.dir">Must set src.portrayal.dir</fail>
<fail unless="src.earth-obs.dir">Must set src.earth-obs.dir</fail>
<fail unless="src.geotiff.dir">Must set src.geotiff.dir</fail>
<fail unless="src.netcdf.dir">Must set src.netcdf.dir</fail>
- <fail unless="src.shapefile.dir">Must set src.shapefile.dir</fail>
<fail unless="src.sql.dir">Must set src.sql.dir</fail>
<fail unless="src.xmlstore.dir">Must set src.xmlstore.dir</fail>
<fail unless="src.storage.dir">Must set src.storage.dir</fail>
@@ -345,7 +340,6 @@ is divided into following sections:
<fail unless="test.earth-obs.dir">Must set test.earth-obs.dir</fail>
<fail unless="test.geotiff.dir">Must set test.geotiff.dir</fail>
<fail unless="test.netcdf.dir">Must set test.netcdf.dir</fail>
- <fail unless="test.shapefile.dir">Must set test.shapefile.dir</fail>
<fail unless="test.sql.dir">Must set test.sql.dir</fail>
<fail unless="test.xmlstore.dir">Must set test.xmlstore.dir</fail>
<fail unless="test.storage.dir">Must set test.storage.dir</fail>
@@ -376,7 +370,7 @@ is divided into following sections:
</target>
<target depends="-init-ap-cmdline-properties,-init-source-module-properties" if="modules.supported.internal" name="-init-macrodef-javac-with-module">
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
- <attribute default="${src.local-src.dir}:${src.javafx.dir}:${src.webapp.dir}:${src.console.dir}:${src.portrayal.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.sql.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${src.jpn-profile.dir}" name="srcdir"/>
+ <attribute default="${src.local-src.dir}:${src.javafx.dir}:${src.console.dir}:${src.portrayal.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.sql.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${src.jpn-profile.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/>
<attribute default="${javac.modulepath}" name="modulepath"/>
@@ -388,7 +382,7 @@ is divided into following sections:
<attribute default="${excludes}" name="excludes"/>
<attribute default="${javac.debug}" name="debug"/>
<attribute default="${empty.dir}" name="sourcepath" unless:set="named.module.internal"/>
- <attribute default="${src.local-src.dir}:${src.javafx.dir}:${src.webapp.dir}:${src.console.dir}:${src.portrayal.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.sql.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${src.jpn-profile.dir}" if:set="named.module.internal" name="sourcepath"/>
+ <attribute default="${src.local-src.dir}:${src.javafx.dir}:${src.console.dir}:${src.portrayal.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.sql.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${src.jpn-profile.dir}" if:set="named.module.internal" name="sourcepath"/>
<attribute default="${empty.dir}" name="gensrcdir"/>
<element name="customize" optional="true"/>
<sequential>
@@ -443,7 +437,7 @@ is divided into following sections:
</target>
<target depends="-init-ap-cmdline-properties,-init-source-module-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors" unless="modules.supported.internal">
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
- <attribute default="${src.local-src.dir}:${src.javafx.dir}:${src.webapp.dir}:${src.console.dir}:${src.portrayal.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.sql.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${src.jpn-profile.dir}" name="srcdir"/>
+ <attribute default="${src.local-src.dir}:${src.javafx.dir}:${src.console.dir}:${src.portrayal.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.sql.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${src.jpn-profile.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/>
<attribute default="${javac.modulepath}" name="modulepath"/>
@@ -486,7 +480,7 @@ is divided into following sections:
</target>
<target depends="-init-ap-cmdline-properties,-init-source-module-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
- <attribute default="${src.local-src.dir}:${src.javafx.dir}:${src.webapp.dir}:${src.console.dir}:${src.portrayal.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.sql.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${src.jpn-profile.dir}" name="srcdir"/>
+ <attribute default="${src.local-src.dir}:${src.javafx.dir}:${src.console.dir}:${src.portrayal.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.sql.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${src.jpn-profile.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/>
<attribute default="${javac.modulepath}" name="modulepath"/>
@@ -521,7 +515,7 @@ is divided into following sections:
</target>
<target depends="-init-macrodef-javac-with-module,-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
<macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
- <attribute default="${src.local-src.dir}:${src.javafx.dir}:${src.webapp.dir}:${src.console.dir}:${src.portrayal.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.sql.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${src.jpn-profile.dir}" name="srcdir"/>
+ <attribute default="${src.local-src.dir}:${src.javafx.dir}:${src.console.dir}:${src.portrayal.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.sql.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${src.jpn-profile.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/>
<sequential>
@@ -669,9 +663,6 @@ is divided into following sections:
<fileset dir="${test.netcdf.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
- <fileset dir="${test.shapefile.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
- <filename name="@{testincludes}"/>
- </fileset>
<fileset dir="${test.sql.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
@@ -740,9 +731,6 @@ is divided into following sections:
<fileset dir="${test.netcdf.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
- <fileset dir="${test.shapefile.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
- <filename name="@{testincludes}"/>
- </fileset>
<fileset dir="${test.sql.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
@@ -1246,20 +1234,18 @@ is divided into following sections:
<include name="*"/>
</dirset>
</pathconvert>
- <j2seproject3:depend srcdir="${src.local-src.dir}:${src.javafx.dir}:${src.webapp.dir}:${src.console.dir}:${src.portrayal.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.sql.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${src.jpn-profile.dir}:${build.generated.subdirs}"/>
+ <j2seproject3:depend srcdir="${src.local-src.dir}:${src.javafx.dir}:${src.console.dir}:${src.portrayal.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.sql.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${src.jpn-profile.dir}:${build.generated.subdirs}"/>
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
<j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
<copy todir="${build.classes.dir}">
<fileset dir="${src.local-src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.javafx.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
- <fileset dir="${src.webapp.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.console.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.portrayal.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.earth-obs.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.geotiff.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.netcdf.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
- <fileset dir="${src.shapefile.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.sql.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.xmlstore.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.storage.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
@@ -1290,7 +1276,7 @@ is divided into following sections:
<target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<j2seproject3:force-recompile/>
- <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}, module-info.java" sourcepath="${src.local-src.dir}:${src.javafx.dir}:${src.webapp.dir}:${src.console.dir}:${src.portrayal.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.sql.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile. [...]
+ <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}, module-info.java" sourcepath="${src.local-src.dir}:${src.javafx.dir}:${src.console.dir}:${src.portrayal.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.sql.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${src.jpn-profile.dir}"/>
</target>
<target name="-post-compile-single">
<!-- Empty placeholder for easier customization. -->
@@ -1688,9 +1674,6 @@ is divided into following sections:
<fileset dir="${src.javafx.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
<filename name="**/*.java"/>
</fileset>
- <fileset dir="${src.webapp.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
- <filename name="**/*.java"/>
- </fileset>
<fileset dir="${src.console.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
<filename name="**/*.java"/>
</fileset>
@@ -1706,9 +1689,6 @@ is divided into following sections:
<fileset dir="${src.netcdf.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
<filename name="**/*.java"/>
</fileset>
- <fileset dir="${src.shapefile.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
- <filename name="**/*.java"/>
- </fileset>
<fileset dir="${src.sql.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
<filename name="**/*.java"/>
</fileset>
@@ -1753,9 +1733,6 @@ is divided into following sections:
<fileset dir="${src.javafx.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/doc-files/**"/>
</fileset>
- <fileset dir="${src.webapp.dir}" excludes="${excludes}" includes="${includes}">
- <filename name="**/doc-files/**"/>
- </fileset>
<fileset dir="${src.console.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/doc-files/**"/>
</fileset>
@@ -1771,9 +1748,6 @@ is divided into following sections:
<fileset dir="${src.netcdf.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/doc-files/**"/>
</fileset>
- <fileset dir="${src.shapefile.dir}" excludes="${excludes}" includes="${includes}">
- <filename name="**/doc-files/**"/>
- </fileset>
<fileset dir="${src.sql.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/doc-files/**"/>
</fileset>
@@ -1826,14 +1800,14 @@ is divided into following sections:
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="-init-source-module-properties" if="named.module.internal" name="-init-test-javac-module-properties-with-module">
- <j2seproject3:modulename property="test.module.name" sourcepath="${test.javafx.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.sql.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.ref-by-id.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}:${test.jpn-profile.dir}"/>
- <condition else="${empty.dir}" property="javac.test.sourcepath" value="${test.javafx.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.sql.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.ref-by-id.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}:${test.jpn-profile.dir}">
+ <j2seproject3:modulename property="test.module.name" sourcepath="${test.javafx.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.sql.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.ref-by-id.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}:${test.jpn-profile.dir}"/>
+ <condition else="${empty.dir}" property="javac.test.sourcepath" value="${test.javafx.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.sql.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.ref-by-id.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}:${test.jpn-profile.dir}">
<and>
<isset property="test.module.name"/>
<length length="0" string="${test.module.name}" when="greater"/>
</and>
</condition>
- <condition else="--patch-module ${module.name}=${test.javafx.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.sql.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.ref-by-id.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}:${test.jpn-profile.dir} --add-reads ${module.name}=ALL-UNNAMED" property="javac.test.compilerargs" value="--add-reads ${test.mo [...]
+ <condition else="--patch-module ${module.name}=${test.javafx.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.sql.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.ref-by-id.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}:${test.jpn-profile.dir} --add-reads ${module.name}=ALL-UNNAMED" property="javac.test.compilerargs" value="--add-reads ${test.module.name}=ALL-UNNAMED">
<and>
<isset property="test.module.name"/>
<length length="0" string="${test.module.name}" when="greater"/>
@@ -1874,10 +1848,10 @@ is divided into following sections:
</target>
<target depends="-init-test-javac-module-properties-with-module,-init-test-module-properties-without-module" name="-init-test-module-properties"/>
<target if="do.depend.true" name="-compile-test-depend">
- <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.javafx.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.sql.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.ref-by-id.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}:${test.jpn-profile.dir}"/>
+ <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.javafx.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.sql.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.ref-by-id.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}:${test.jpn-profile.dir}"/>
</target>
<target depends="init,deps-jar,compile,-init-test-module-properties,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
- <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" modulepath="${javac.test.modulepath}" processorpath="${javac.test.processorpath}" sourcepath="${javac.test.sourcepath}" srcdir="${test.javafx.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.sql.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test [...]
+ <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" modulepath="${javac.test.modulepath}" processorpath="${javac.test.processorpath}" sourcepath="${javac.test.sourcepath}" srcdir="${test.javafx.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.sql.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${te [...]
<customize>
<compilerarg line="${javac.test.compilerargs}"/>
</customize>
@@ -1888,7 +1862,6 @@ is divided into following sections:
<fileset dir="${test.earth-obs.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.geotiff.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.netcdf.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
- <fileset dir="${test.shapefile.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.sql.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.xmlstore.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.storage.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
@@ -1913,7 +1886,7 @@ is divided into following sections:
<target depends="init,deps-jar,compile,-init-test-module-properties,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
- <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}, module-info.java" modulepath="${javac.test.modulepath}" processorpath="${javac.test.processorpath}" sourcepath="${test.javafx.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.sql.dir}:${test.xmlstore.dir}:${test.storage.dir}:$ [...]
+ <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}, module-info.java" modulepath="${javac.test.modulepath}" processorpath="${javac.test.processorpath}" sourcepath="${test.javafx.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.sql.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${t [...]
<customize>
<compilerarg line="${javac.test.compilerargs}"/>
</customize>
@@ -1924,7 +1897,6 @@ is divided into following sections:
<fileset dir="${test.earth-obs.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.geotiff.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.netcdf.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
- <fileset dir="${test.shapefile.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.sql.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.xmlstore.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.storage.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
diff --git a/ide-project/NetBeans/nbproject/genfiles.properties b/ide-project/NetBeans/nbproject/genfiles.properties
index c9bfff4..fea5fb7 100644
--- a/ide-project/NetBeans/nbproject/genfiles.properties
+++ b/ide-project/NetBeans/nbproject/genfiles.properties
@@ -3,6 +3,6 @@
build.xml.data.CRC32=58e6b21c
build.xml.script.CRC32=462eaba0
build.xml.stylesheet.CRC32=28e38971@1.53.1.46
-nbproject/build-impl.xml.data.CRC32=bff50692
-nbproject/build-impl.xml.script.CRC32=933f5834
+nbproject/build-impl.xml.data.CRC32=090601b4
+nbproject/build-impl.xml.script.CRC32=60cdcd10
nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.100.0.48
diff --git a/ide-project/NetBeans/nbproject/project.properties b/ide-project/NetBeans/nbproject/project.properties
index c1f8f72..bcb1bc5 100644
--- a/ide-project/NetBeans/nbproject/project.properties
+++ b/ide-project/NetBeans/nbproject/project.properties
@@ -55,7 +55,6 @@ project.root = ../..
src.local-src.dir = ../local-src
src.javafx.dir = ${project.root}/application/sis-javafx/doc
test.javafx.dir = ${project.root}/application/sis-javafx/doc
-src.webapp.dir = ${project.root}/application/sis-webapp/src/main/java
src.console.dir = ${project.root}/application/sis-console/src/main/java
test.console.dir = ${project.root}/application/sis-console/src/test/java
src.earth-obs.dir = ${project.root}/storage/sis-earth-observation/src/main/java
@@ -64,8 +63,6 @@ src.geotiff.dir = ${project.root}/storage/sis-geotiff/src/main/java
test.geotiff.dir = ${project.root}/storage/sis-geotiff/src/test/java
src.netcdf.dir = ${project.root}/storage/sis-netcdf/src/main/java
test.netcdf.dir = ${project.root}/storage/sis-netcdf/src/test/java
-src.shapefile.dir = ${project.root}/storage/sis-shapefile/src/main/java
-test.shapefile.dir = ${project.root}/storage/sis-shapefile/src/test/java
src.sql.dir = ${project.root}/storage/sis-sqlstore/src/main/java
test.sql.dir = ${project.root}/storage/sis-sqlstore/src/test/java
src.xmlstore.dir = ${project.root}/storage/sis-xmlstore/src/main/java
diff --git a/ide-project/NetBeans/nbproject/project.xml b/ide-project/NetBeans/nbproject/project.xml
index 85206a2..3bb24c5 100644
--- a/ide-project/NetBeans/nbproject/project.xml
+++ b/ide-project/NetBeans/nbproject/project.xml
@@ -25,13 +25,11 @@
<source-roots>
<root id="src.local-src.dir" name="Local sources (unversioned)"/>
<root id="src.javafx.dir" name="JavaFX application"/>
- <root id="src.webapp.dir" name="Web application"/>
<root id="src.console.dir" name="Console"/>
<root id="src.portrayal.dir" name="Portrayal"/>
<root id="src.earth-obs.dir" name="Earth observation"/>
<root id="src.geotiff.dir" name="GeoTIFF"/>
<root id="src.netcdf.dir" name="NetCDF"/>
- <root id="src.shapefile.dir" name="Shapefile"/>
<root id="src.sql.dir" name="SQLStore"/>
<root id="src.xmlstore.dir" name="XMLStore"/>
<root id="src.storage.dir" name="Storage"/>
@@ -49,7 +47,6 @@
<root id="test.earth-obs.dir" name="Test Earth observation"/>
<root id="test.geotiff.dir" name="Test GeoTIFF"/>
<root id="test.netcdf.dir" name="Test NetCDF"/>
- <root id="test.shapefile.dir" name="Test Shapefile"/>
<root id="test.sql.dir" name="Test SQLStore"/>
<root id="test.xmlstore.dir" name="Test XMLStore"/>
<root id="test.storage.dir" name="Test Storage"/>
diff --git a/storage/pom.xml b/storage/pom.xml
index 0e7f4e6..4d292dd 100644
--- a/storage/pom.xml
+++ b/storage/pom.xml
@@ -164,7 +164,6 @@
=========================================================== -->
<modules>
<module>sis-storage</module>
- <module>sis-shapefile</module>
<module>sis-xmlstore</module>
<module>sis-sqlstore</module>
<module>sis-netcdf</module>
diff --git a/storage/sis-shapefile/pom.xml b/storage/sis-shapefile/pom.xml
deleted file mode 100644
index 216f872..0000000
--- a/storage/sis-shapefile/pom.xml
+++ /dev/null
@@ -1,132 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-
-<project xmlns = "http://maven.apache.org/POM/4.0.0"
- xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation = "http://maven.apache.org/POM/4.0.0
- http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.sis</groupId>
- <artifactId>storage</artifactId>
- <version>1.1-SNAPSHOT</version>
- </parent>
-
-
- <!-- ===========================================================
- Module Description
- =========================================================== -->
- <groupId>org.apache.sis.storage</groupId>
- <artifactId>sis-shapefile</artifactId>
- <name>Apache SIS Shapefile storage</name>
- <description>
- Read and write files in the Shapefile format.
- </description>
-
-
- <!-- ===========================================================
- Developers and Contributors
- =========================================================== -->
- <developers>
- <developer>
- <name>Travis L. Pinney</name>
- <id>tlpinney</id>
- <email>travis.pinney@gmail.com</email>
- <roles>
- <role>developer</role>
- </roles>
- </developer>
- </developers>
-
-
- <!-- ===========================================================
- Build configuration
- =========================================================== -->
- <build>
- <plugins>
-
- <!-- Compile properties files into resources UTF files. -->
- <plugin>
- <groupId>org.apache.sis.core</groupId>
- <artifactId>sis-build-helper</artifactId>
- <version>${sis.plugin.version}</version>
- <executions>
- <execution>
- <goals>
- <goal>compile-resources</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <!-- Anticipation for Java 9 -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifestEntries>
- <Automatic-Module-Name>
- org.apache.sis.storage.shapefile
- </Automatic-Module-Name>
- </manifestEntries>
- </archive>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <executions>
- <execution>
- <configuration>
- <skip>true</skip> <!-- Java code formatting in this module is different than other modules. -->
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-
- <!-- ===========================================================
- Dependencies
- =========================================================== -->
- <dependencies>
- <dependency>
- <groupId>org.apache.sis.core</groupId>
- <artifactId>sis-feature</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.sis.storage</groupId>
- <artifactId>sis-storage</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>com.esri.geometry</groupId>
- <artifactId>esri-geometry-api</artifactId>
- <optional>false</optional>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/AutoChecker.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/AutoChecker.java
deleted file mode 100644
index b656511..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/AutoChecker.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile;
-
-import java.lang.reflect.Constructor;
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.Objects;
-import java.util.ResourceBundle;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.apache.sis.internal.system.Modules;
-
-import org.apache.sis.util.logging.Logging;
-
-
-/**
- * Base class for objets having auto-checking abilities
- * and easy access to Bundle and logging function.
- * @author Marc LE BIHAN
- */
-public abstract class AutoChecker {
- /** Logger. */
- static Logger LOGGER = Logging.getLogger(Modules.SHAPEFILE);
-
- /**
- * Format a resource bundle message.
- *
- * @param classForResourceBundleName class from which ResourceBundle name will be extracted.
- * @param key Message key.
- * @param args Message arguments.
- * @return Message.
- */
- final protected String format(Class<?> classForResourceBundleName, String key, Object... args) {
- Objects.requireNonNull(classForResourceBundleName, "Class from with the ResourceBundle name is extracted cannot be null.");
- Objects.requireNonNull(key, "Message key cannot be bull.");
-
- Class<?> candidateClass = classForResourceBundleName;
- MessageFormat format = null;
-
- // Find the key in the bundle having for name this class, or in one of its superclasses.
- do {
- try {
- ResourceBundle rsc = ResourceBundle.getBundle(candidateClass.getName());
- format = new MessageFormat(rsc.getString(key));
- }
- catch(MissingResourceException e) {
- candidateClass = candidateClass.getSuperclass();
- }
- }
- while(candidateClass != null && format == null);
-
- if (format == null) {
- String fmt = "Cannot find property key {0} in {1} properties file or any of its superclasses.";
- String message = MessageFormat.format(fmt, key, classForResourceBundleName.getName());
- throw new MissingResourceException(message, classForResourceBundleName.getName(), key);
- }
- else
- return format.format(args);
- }
-
- /**
- * Format a resource bundle message.
- *
- * @param key Message key.
- * @param args Message arguments.
- * @return Message.
- */
- final protected String format(String key, Object... args) {
- return format(getClass(), key, args);
- }
-
- /**
- * Format a resource bundle message and before returning it, log it.
- *
- * @param logLevel Log Level.
- * @param key Message key.
- * @param args Message arguments.
- * @return Message.
- */
- final protected String format(Level logLevel, String key, Object... args) {
- Objects.requireNonNull(logLevel, "The log level cannot be null.");
-
- String message = format(key, args);
- LOGGER.log(logLevel, message);
- return(message);
- }
-
- /**
- * Format a resource bundle message and before returning it, log it.
- *
- * @param classForResourceBundleName class from which ResourceBundle name will be extracted.
- * @param logLevel Log Level.
- * @param key Message key.
- * @param args Message arguments.
- * @return Message.
- */
- final protected String format(Level logLevel, Class<?> classForResourceBundleName, String key, Object... args) {
- Objects.requireNonNull(logLevel, "The log level cannot be null.");
-
- String message = format(classForResourceBundleName, key, args);
- LOGGER.log(logLevel, message);
- return(message);
- }
-
- /**
- * Tells if the logger of the base class will log this level of log.
- * @param level Wished level of logging.
- * @return true if it will log it.
- */
- protected boolean isLoggable(Level level) {
- return LOGGER.isLoggable(level);
- }
-
- /**
- * Logs (and take the time to format an entry log) only if the logger accepts the message.
- * @param logLevel Log level.
- * @param key Message key.
- * @param args Message arguments.
- */
- final protected void log(Level logLevel, String key, Object... args) {
- Objects.requireNonNull(logLevel, "The log level cannot be null.");
-
- if (LOGGER.isLoggable(logLevel))
- format(logLevel, key, args);
- }
-
- /**
- * Throw an exception by reflection.
- * @param <E> Class of the exception to build.
- * @param classException Class of the exception to build.
- * @param message Exception message.
- * @param cause Exception root cause.
- * @throws E wished exception.
- */
- public static <E extends Throwable> void throwException(Class<E> classException, String message, Throwable cause) throws E {
- throw(exception(classException, message, cause));
- }
-
- /**
- * Build an exception by reflection.
- * @param <E> Class of the exception to build.
- * @param classException Class of the exception to build.
- * @param message Exception message.
- * @param cause Exception root cause.
- * @return E wished exception.
- */
- private static <E extends Throwable> E exception(Class<E> classException, String message, Throwable cause) {
- Objects.requireNonNull(classException, "The class of the exception to throw cannot be null."); //$NON-NLS-1$
-
- try
- {
- Constructor<E> cstr = classException.getConstructor(String.class, Throwable.class);
- E exception = cstr.newInstance(message, cause);
- return(exception);
- }
- catch(Exception e) {
- // Create the error message manually to avoid re-entrance in function of this class, that if it has a trouble here could have also a problem everywhere.
- String format = "The exception of class {0} (message ''{1}'') can''t be created by reflection. An exception of class {2} happened with the message {3}.";
- String msg = MessageFormat.format(format, classException.getName(), message, e.getClass().getName(), e.getMessage());
- throw new RuntimeException(msg, e);
- }
- }
-
- /**
- * Return the class logger.
- * @return logger.
- */
- public Logger getLogger() {
- return LOGGER;
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/SQLInvalidRecordNumberForDirectAccessException.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/SQLInvalidRecordNumberForDirectAccessException.java
deleted file mode 100644
index ec5642c..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/SQLInvalidRecordNumberForDirectAccessException.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile;
-
-import java.sql.SQLNonTransientException;
-
-
-/**
- * Thrown when a record number is invalid to do a direct access in a Shapefile or a DBase III file.
- *
- * @author Marc Le Bihan
- * @version 0.7
- * @since 0.7
- * @module
- */
-public class SQLInvalidRecordNumberForDirectAccessException extends SQLNonTransientException {
- /** Serial UID. */
- private static final long serialVersionUID = 6828362742568015813L;
-
- /** Wrong record number. */
- private int wrongRecordNumber;
-
- /**
- * Construct an exception.
- * @param number Wrong record number value.
- * @param message Message of the exception.
- */
- public SQLInvalidRecordNumberForDirectAccessException(int number, String message) {
- super(message);
- this.wrongRecordNumber = number;
- }
-
- /**
- * Construct an exception.
- * @param number Wrong record number value.
- * @param message Message of the exception.
- * @param cause Root cause of the exception.
- */
- public SQLInvalidRecordNumberForDirectAccessException(int number, String message, Throwable cause) {
- super(message, cause);
- this.wrongRecordNumber = number;
- }
-
- /**
- * Returns the wrong record number value.
- * @return Record number.
- */
- public int getWrongRecordNumber() {
- return this.wrongRecordNumber;
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/SQLNoDirectAccessAvailableException.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/SQLNoDirectAccessAvailableException.java
deleted file mode 100644
index a0b4d60..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/SQLNoDirectAccessAvailableException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile;
-
-import java.sql.SQLNonTransientException;
-
-
-/**
- * Thrown when a shapefile or a DBase III file cannot allow a direct acces (because it has no index).
- *
- * @author Marc Le Bihan
- * @version 0.7
- * @since 0.7
- * @module
- */
-public class SQLNoDirectAccessAvailableException extends SQLNonTransientException {
- /** Serial UID. */
- private static final long serialVersionUID = 16719558033196219L;
-
- /**
- * Construct an exception.
- * @param message Message of the exception.
- */
- public SQLNoDirectAccessAvailableException(String message) {
- super(message);
- }
-
- /**
- * Construct an exception.
- * @param message Message of the exception.
- * @param cause Root cause of the exception.
- */
- public SQLNoDirectAccessAvailableException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/SQLShapefileNotFoundException.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/SQLShapefileNotFoundException.java
deleted file mode 100644
index 22aa585..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/SQLShapefileNotFoundException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile;
-
-import java.sql.SQLNonTransientException;
-
-
-/**
- * Thrown when a shapefile has not been found.
- *
- * @author Marc Le Bihan
- * @version 0.5
- * @since 0.5
- * @module
- */
-public class SQLShapefileNotFoundException extends SQLNonTransientException {
- /** Serial UID. */
- private static final long serialVersionUID = -3235671561698931817L;
-
- /**
- * Construct an exception.
- * @param message Message of the exception.
- */
- public SQLShapefileNotFoundException(String message) {
- super(message);
- }
-
- /**
- * Construct an exception.
- * @param message Message of the exception.
- * @param cause Root cause of the exception.
- */
- public SQLShapefileNotFoundException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileByteReader.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileByteReader.java
deleted file mode 100644
index 2aa1bb1..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileByteReader.java
+++ /dev/null
@@ -1,465 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile;
-
-import java.io.*;
-import java.nio.ByteOrder;
-import java.nio.MappedByteBuffer;
-import java.nio.channels.FileChannel;
-import java.text.MessageFormat;
-import java.util.*;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.sis.feature.DefaultAttributeType;
-import org.apache.sis.feature.DefaultFeatureType;
-import org.apache.sis.internal.shapefile.jdbc.*;
-import org.apache.sis.storage.shapefile.InvalidShapefileFormatException;
-import org.apache.sis.storage.shapefile.ShapeTypeEnum;
-import org.apache.sis.feature.AbstractFeature;
-
-import com.esri.core.geometry.*;
-
-/**
- * Reader of a Shapefile Binary content by the way of a {@link java.nio.MappedByteBuffer}
- *
- * @author Marc Le Bihan
- * @version 0.5
- * @since 0.5
- * @module
- */
-public class ShapefileByteReader extends CommonByteReader<InvalidShapefileFormatException, SQLShapefileNotFoundException> {
- /** Name of the Geometry field. */
- private static final String GEOMETRY_NAME = "geometry";
-
- /** Shapefile descriptor. */
- private ShapefileDescriptor shapefileDescriptor;
-
- /** Database Field descriptors. */
- private List<DBase3FieldDescriptor> databaseFieldsDescriptors;
-
- /** Type of the features contained in this shapefile. */
- private DefaultFeatureType featuresType;
-
- /** Shapefile index. */
- private File shapeFileIndex;
-
- /** Shapefile indexes (loaded from .SHX file, if any found). */
- private ArrayList<Integer> indexes;
-
- /** Shapefile records lengths (loaded from .SHX file, if any found). */
- private ArrayList<Integer> recordsLengths;
-
- /**
- * Construct a shapefile byte reader.
- * @param shapefile Shapefile.
- * @param dbaseFile underlying database file name.
- * @param shapefileIndex Shapefile index, if any. Null else.
- * @throws InvalidShapefileFormatException if the shapefile format is invalid.
- * @throws SQLInvalidDbaseFileFormatException if the database file format is invalid.
- * @throws SQLShapefileNotFoundException if the shapefile has not been found.
- * @throws SQLDbaseFileNotFoundException if the database file has not been found.
- */
- public ShapefileByteReader(File shapefile, File dbaseFile, File shapefileIndex) throws InvalidShapefileFormatException, SQLInvalidDbaseFileFormatException, SQLShapefileNotFoundException, SQLDbaseFileNotFoundException {
- super(shapefile, InvalidShapefileFormatException.class, SQLShapefileNotFoundException.class);
- this.shapeFileIndex = shapefileIndex;
-
- loadDatabaseFieldDescriptors(dbaseFile);
- loadDescriptor();
-
- if (this.shapeFileIndex != null) {
- loadShapefileIndexes();
- }
-
- this.featuresType = getFeatureType(shapefile.getName());
- }
-
- /**
- * Returns the DBase 3 fields descriptors.
- * @return Fields descriptors.
- */
- public List<DBase3FieldDescriptor> getFieldsDescriptors() {
- return this.databaseFieldsDescriptors;
- }
-
- /**
- * Returns the shapefile descriptor.
- * @return Shapefile descriptor.
- */
- public ShapefileDescriptor getShapefileDescriptor() {
- return this.shapefileDescriptor;
- }
-
- /**
- * Returns the type of the features contained in this shapefile.
- * @return Features type.
- */
- public DefaultFeatureType getFeaturesType() {
- return this.featuresType;
- }
-
- /**
- * Create a feature descriptor.
- * @param name Name of the field.
- * @return The feature type.
- */
- private DefaultFeatureType getFeatureType(final String name) {
- Objects.requireNonNull(name, "The feature name cannot be null.");
-
- final int n = this.databaseFieldsDescriptors.size();
- final DefaultAttributeType<?>[] attributes = new DefaultAttributeType<?>[n + 1];
- final Map<String, Object> properties = new HashMap<>(4);
-
- // Load data field.
- for (int i = 0; i < n; i++) {
- properties.put(DefaultAttributeType.NAME_KEY, this.databaseFieldsDescriptors.get(i).getName());
- attributes[i] = new DefaultAttributeType<>(properties, String.class, 1, 1, null);
- }
-
- // Add geometry field.
- properties.put(DefaultAttributeType.NAME_KEY, GEOMETRY_NAME);
- attributes[n] = new DefaultAttributeType<>(properties, Geometry.class, 1, 1, null);
-
- // Add name.
- properties.put(DefaultAttributeType.NAME_KEY, name);
- return new DefaultFeatureType(properties, false, null, attributes);
- }
-
- /**
- * Load shapefile descriptor.
- */
- private void loadDescriptor() {
- this.shapefileDescriptor = new ShapefileDescriptor(getByteBuffer());
- }
-
- /**
- * Load shapefile indexes.
- * @return true if shapefile indexes has been read,
- * false if none where available or a problem occured.
- */
- private boolean loadShapefileIndexes() {
- if (this.shapeFileIndex == null) {
- return false;
- }
-
- try(FileInputStream fis = new FileInputStream(this.shapeFileIndex); FileChannel fc = fis.getChannel()) {
- try {
- int fsize = (int)fc.size();
- MappedByteBuffer indexesByteBuffer = fc.map(FileChannel.MapMode.READ_ONLY, 0, fsize);
-
- // Indexes entries follow.
- this.indexes = new ArrayList<>();
- this.recordsLengths = new ArrayList<>();
- indexesByteBuffer.position(100);
- indexesByteBuffer.order(ByteOrder.BIG_ENDIAN);
-
- while(indexesByteBuffer.hasRemaining()) {
- this.indexes.add(indexesByteBuffer.getInt()); // Data offset : the position of the record in the main shapefile, expressed in words (16 bits).
- this.recordsLengths.add(indexesByteBuffer.getInt()); // Length of this shapefile record.
- }
-
- log(Level.INFO, "log.index_has_been_read", this.shapeFileIndex.getAbsolutePath(), this.indexes.size(), this.getFile().getAbsolutePath());
- return true;
- }
- catch(IOException e) {
- log(Level.WARNING, "log.invalid_file_content_for_shapefile_index", this.shapeFileIndex.getAbsolutePath(), e.getMessage());
- this.shapeFileIndex = null;
- return false;
- }
- }
- catch(FileNotFoundException e) {
- log(Level.WARNING, "log.no_shapefile_index_found_at_location", this.shapeFileIndex.getAbsolutePath(), this.getFile().getAbsolutePath());
- this.shapeFileIndex = null;
- return false;
- }
- catch(IOException e) {
- log(Level.WARNING, "log.invalid_file_content_for_shapefile_index", this.shapeFileIndex.getAbsolutePath(), e.getMessage());
- this.shapeFileIndex = null;
- return false;
- }
- }
-
- /**
- * Load database field descriptors.
- * @param dbaseFile Database file.
- * @throws SQLInvalidDbaseFileFormatException if the database format is incorrect.
- * @throws SQLDbaseFileNotFoundException if the database file cannot be found.
- */
- private void loadDatabaseFieldDescriptors(File dbaseFile) throws SQLInvalidDbaseFileFormatException, SQLDbaseFileNotFoundException {
- MappedByteReader databaseReader = null;
-
- try {
- databaseReader = new MappedByteReader(dbaseFile, null);
- this.databaseFieldsDescriptors = databaseReader.getFieldsDescriptors();
- }
- finally {
- if (databaseReader != null) {
- try {
- databaseReader.close();
- }
- catch(IOException e) {
- }
- }
- }
- }
-
- /**
- * Direct access to a feature by its record number.
- * @param recordNumber Record number.
- * @throws SQLNoDirectAccessAvailableException if this shape file doesn't allow direct acces, because it has no index.
- * @throws SQLInvalidRecordNumberForDirectAccessException if the record number asked for is invalid (below the start, after the end).
- */
- public void setRowNum(int recordNumber) throws SQLNoDirectAccessAvailableException, SQLInvalidRecordNumberForDirectAccessException {
- // Check that the asked record number is not before the first.
- if (recordNumber < 1) {
- String message = format(Level.SEVERE, "excp.wrong_direct_access_before_start", recordNumber, getFile().getAbsolutePath());
- throw new SQLInvalidRecordNumberForDirectAccessException(recordNumber, message);
- }
-
- // Check that the shapefile allows direct access : it won't if it has no index.
- if (this.shapeFileIndex == null) {
- String message = format(Level.SEVERE, "excp.no_direct_access", getFile().getAbsolutePath());
- throw new SQLNoDirectAccessAvailableException(message);
- }
-
- int position = this.indexes.get(recordNumber - 1) * 2; // Indexes unit are words (16 bits).
-
- // Check that the asked record number is not after the last.
- if (position >= this.getByteBuffer().capacity()) {
- String message = format(Level.SEVERE, "excp.wrong_direct_access_after_last", recordNumber, getFile().getAbsolutePath());
- throw new SQLInvalidRecordNumberForDirectAccessException(recordNumber, message);
- }
-
- try {
- getByteBuffer().position(position);
- }
- catch(IllegalArgumentException e) {
- String message = format(Level.SEVERE, "assert.wrong_position", recordNumber, position, getFile().getAbsolutePath(), e.getMessage());
- throw new RuntimeException(message, e);
- }
- }
-
- /**
- * Complete a feature with shapefile content.
- * @param feature Feature to complete.
- * @throws InvalidShapefileFormatException if a validation problem occurs.
- */
- public void completeFeature(AbstractFeature feature) throws InvalidShapefileFormatException {
- // insert points into some type of list
- int RecordNumber = getByteBuffer().getInt();
- @SuppressWarnings("unused")
- int ContentLength = getByteBuffer().getInt();
-
- getByteBuffer().order(ByteOrder.LITTLE_ENDIAN);
- int iShapeType = getByteBuffer().getInt();
-
- ShapeTypeEnum type = ShapeTypeEnum.get(iShapeType);
-
- if (type == null)
- throw new InvalidShapefileFormatException(MessageFormat.format("The shapefile feature type {0} doesn''t match to any known feature type.", this.featuresType));
-
- switch (type) {
- case Point:
- loadPointFeature(feature);
- break;
-
- case Polygon:
- loadPolygonFeature(feature);
- break;
-
- case PolyLine:
- loadPolylineFeature(feature);
- break;
-
- default:
- throw new InvalidShapefileFormatException("Unsupported shapefile type: " + iShapeType);
- }
-
- getByteBuffer().order(ByteOrder.BIG_ENDIAN);
- }
-
- /**
- * Load point feature.
- * @param feature Feature to fill.
- */
- private void loadPointFeature(AbstractFeature feature) {
- double x = getByteBuffer().getDouble();
- double y = getByteBuffer().getDouble();
- Point pnt = new Point(x, y);
- feature.setPropertyValue(GEOMETRY_NAME, pnt);
- }
-
- /**
- * Load polygon feature.
- * @param feature Feature to fill.
- */
- private void loadPolygonFeature(AbstractFeature feature) {
- /* double xmin = */getByteBuffer().getDouble();
- /* double ymin = */getByteBuffer().getDouble();
- /* double xmax = */getByteBuffer().getDouble();
- /* double ymax = */getByteBuffer().getDouble();
- int numParts = getByteBuffer().getInt();
- int numPoints = getByteBuffer().getInt();
-
- Polygon poly;
-
- // Handle multiple polygon parts.
- if (numParts > 1) {
- Logger log = AutoChecker.LOGGER;
-
- if (log.isLoggable(Level.FINER)) {
- String format = "Polygon with multiple linear rings encountered at position {0,number} with {1,number} parts.";
- String message = MessageFormat.format(format, getByteBuffer().position(), numParts);
- log.finer(message);
- }
-
- poly = readMultiplePolygonParts(numParts, numPoints);
- }
- else {
- // Polygon with an unique part.
- poly = readUniquePolygonPart(numPoints);
- }
-
- feature.setPropertyValue(GEOMETRY_NAME, poly);
- }
-
- /**
- * Read a polygon that has a unique part.
- * @param numPoints Number of the points of the polygon.
- * @return Polygon.
- */
- @Deprecated // As soon as the readMultiplePolygonParts method proofs working well, this readUniquePolygonPart method can be removed and all calls be deferred to readMultiplePolygonParts.
- private Polygon readUniquePolygonPart(int numPoints) {
- /*int part = */ getByteBuffer().getInt();
- Polygon poly = new Polygon();
-
- // create a line from the points
- double xpnt = getByteBuffer().getDouble();
- double ypnt = getByteBuffer().getDouble();
-
- poly.startPath(xpnt, ypnt);
-
- for (int j = 0; j < numPoints - 1; j++) {
- xpnt = getByteBuffer().getDouble();
- ypnt = getByteBuffer().getDouble();
- poly.lineTo(xpnt, ypnt);
- }
-
- return poly;
- }
-
- /**
- * Read a polygon that has multiple parts.
- * @param numParts Number of parts of this polygon.
- * @param numPoints Total number of points of this polygon, all parts considered.
- * @return a multiple part polygon.
- */
- private Polygon readMultiplePolygonParts(int numParts, int numPoints) {
- /**
- * From ESRI Specification :
- * Parts : 0 5 (meaning : 0 designs the first v1, 5 designs the first v5 on the points list below).
- * Points : v1 v2 v3 v4 v1 v5 v8 v7 v6 v5
- *
- * POSITION FIELD VALUE TYPE NUMBER ORDER
- * Byte 0 Shape Type 5 Integer 1 Little
- * Byte 4 Box Box Double 4 Little
- * Byte 36 NumParts NumParts Integer 1 Little
- * Byte 40 NumPoints NumPoints Integer 1 Little
- * Byte 44 Parts Parts Integer NumParts Little
- * Byte X Points Points Point NumPoints Little
- */
- int[] partsIndexes = new int[numParts];
-
- // Read all the parts indexes (starting at byte 44).
- for(int index=0; index < numParts; index ++) {
- partsIndexes[index] = getByteBuffer().getInt();
- }
-
- // Read all the points.
- double[] xPoints = new double[numPoints];
- double[] yPoints = new double[numPoints];
-
- for(int index=0; index < numPoints; index ++) {
- xPoints[index] = getByteBuffer().getDouble();
- yPoints[index] = getByteBuffer().getDouble();
- }
-
- // Create the polygon from the points.
- Polygon poly = new Polygon();
-
- // create a line from the points
- for(int index=0; index < numPoints; index ++) {
- // Check if this index is one that begins a new part.
- boolean newPolygon = false;
-
- for(int j=0; j < partsIndexes.length; j ++) {
- if (partsIndexes[j] == index) {
- newPolygon = true;
- break;
- }
- }
-
- if (newPolygon) {
- poly.startPath(xPoints[index], yPoints[index]);
- }
- else {
- poly.lineTo(xPoints[index], yPoints[index]);
- }
- }
-
- return poly;
- }
-
- /**
- * Load polyline feature.
- * @param feature Feature to fill.
- */
- private void loadPolylineFeature(AbstractFeature feature) {
- /* double xmin = */getByteBuffer().getDouble();
- /* double ymin = */getByteBuffer().getDouble();
- /* double xmax = */getByteBuffer().getDouble();
- /* double ymax = */getByteBuffer().getDouble();
-
- int NumParts = getByteBuffer().getInt();
- int NumPoints = getByteBuffer().getInt();
-
- int[] NumPartArr = new int[NumParts + 1];
-
- for (int n = 0; n < NumParts; n++) {
- int idx = getByteBuffer().getInt();
- NumPartArr[n] = idx;
- }
- NumPartArr[NumParts] = NumPoints;
-
- double xpnt, ypnt;
- Polyline ply = new Polyline();
-
- for (int m = 0; m < NumParts; m++) {
- xpnt = getByteBuffer().getDouble();
- ypnt = getByteBuffer().getDouble();
- ply.startPath(xpnt, ypnt);
-
- for (int j = NumPartArr[m]; j < NumPartArr[m + 1] - 1; j++) {
- xpnt = getByteBuffer().getDouble();
- ypnt = getByteBuffer().getDouble();
- ply.lineTo(xpnt, ypnt);
- }
- }
-
- feature.setPropertyValue(GEOMETRY_NAME, ply);
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileDescriptor.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileDescriptor.java
deleted file mode 100644
index c3ab8bb..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileDescriptor.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile;
-
-import java.nio.ByteOrder;
-import java.nio.MappedByteBuffer;
-
-import org.apache.sis.storage.shapefile.ShapeTypeEnum;
-
-/**
- * Shapefile Descriptor.
- * @author Marc Le Bihan
- * @version 0.5
- * @since 0.5
- * @module
- */
-public class ShapefileDescriptor {
- /** File code. */
- private int fileCode; // big
-
- /** File length. */
- private int fileLength; // big // The value for file length is the total length of the file in 16-bit words
-
- /** File version. */
- private int version; // little
-
- /** Shapefile type. */
- private ShapeTypeEnum shapeType; // little
-
- /** X Min. */
- private double xmin; // little
-
- /** Y Min. */
- private double ymin; // little
-
- /** X Max. */
- private double xmax; // little
-
- /** Y Max. */
- private double ymax; // little
-
- /** Z Min. */
- private double zmin; // little
-
- /** Z Max. */
- private double zmax; // little
-
- /** M Min. */
- private double mmin; // little
-
- /** M Max. */
- private double mmax; // little
-
- /**
- * Create a shapefile descriptor.
- * @param byteBuffer Source Bytebuffer.
- */
- public ShapefileDescriptor(MappedByteBuffer byteBuffer) {
- this.fileCode = byteBuffer.getInt();
- byteBuffer.getInt();
- byteBuffer.getInt();
- byteBuffer.getInt();
- byteBuffer.getInt();
- byteBuffer.getInt();
- this.fileLength = byteBuffer.getInt() * 2;
-
- byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
- this.version = byteBuffer.getInt();
- this.shapeType = ShapeTypeEnum.get(byteBuffer.getInt());
- this.xmin = byteBuffer.getDouble();
- this.ymin = byteBuffer.getDouble();
- this.xmax = byteBuffer.getDouble();
- this.ymax = byteBuffer.getDouble();
- this.zmin = byteBuffer.getDouble();
- this.zmax = byteBuffer.getDouble();
- this.mmin = byteBuffer.getDouble();
- this.mmax = byteBuffer.getDouble();
- byteBuffer.order(ByteOrder.BIG_ENDIAN);
-
- //dbf.byteBuffer.get(); // should be 0d for field terminator
- }
-
- /**
- * Returns the version of the shapefile.
- * @return Version.
- */
- public int getVersion() {
- return this.version;
- }
-
- /**
- * Returns the ESRI shape type in the shapefile.
- * @return Shape type.
- */
- public ShapeTypeEnum getShapeType() {
- return this.shapeType;
- }
-
- /**
- * Returns the X Min property.
- * @return XMin.
- */
- public double getXmin() {
- return this.xmin;
- }
-
- /**
- * Returns the Y Min property.
- * @return YMin.
- */
- public double getYmin() {
- return this.ymin;
- }
-
- /**
- * Returns the X Max property.
- * @return XMax.
- */
- public double getXmax() {
- return this.xmax;
- }
-
- /**
- * Returns the Y Max property.
- * @return YMax.
- */
- public double getYmax() {
- return this.ymax;
- }
-
- /**
- * Returns the Z Min property.
- * @return ZMin.
- */
- public double getZmin() {
- return this.zmin;
- }
-
- /**
- * Returns the Z Max property.
- * @return ZMax.
- */
- public double getZmax() {
- return this.zmax;
- }
-
- /**
- * Returns the M Min property.
- * @return M min.
- */
- public double getMmin() {
- return this.mmin;
- }
-
- /**
- * Returns the M Max property.
- * @return M Max.
- */
- public double getMmax(){
- return this.mmax;
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- StringBuilder s = new StringBuilder();
- String lineSeparator = System.lineSeparator();
-
- s.append("FileCode: ").append(this.fileCode).append(lineSeparator);
- s.append("FileLength: ").append(this.fileLength).append(lineSeparator);
- s.append("Version: ").append(this.version).append(lineSeparator);
- s.append("ShapeType: ").append(this.shapeType).append(lineSeparator);
- s.append("xmin: ").append(this.xmin).append(lineSeparator);
- s.append("ymin: ").append(this.ymin).append(lineSeparator);
- s.append("xmax: ").append(this.xmax).append(lineSeparator);
- s.append("ymax: ").append(this.ymax).append(lineSeparator);
- s.append("zmin: ").append(this.zmin).append(lineSeparator);
- s.append("zmax: ").append(this.zmax).append(lineSeparator);
- s.append("mmin: ").append(this.mmin).append(lineSeparator);
- s.append("mmax: ").append(this.mmax).append(lineSeparator);
- s.append("------------------------").append(lineSeparator);
-
- return s.toString();
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java
deleted file mode 100644
index d05aec9..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc;
-
-import java.io.File;
-import java.nio.charset.Charset;
-import java.nio.charset.UnsupportedCharsetException;
-import java.text.MessageFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Objects;
-import java.util.logging.Level;
-
-/**
- * The Abstract Byte Reader.
- * @author Marc Le Bihan
- * @version 0.5
- * @since 0.5
- * @module
- */
-abstract class AbstractDbase3ByteReader extends CommonByteReader<SQLInvalidDbaseFileFormatException, SQLDbaseFileNotFoundException> implements Dbase3ByteReader {
- /** First data record position, in bytes. */
- protected short firstRecordPosition;
-
- /** Size of one record, in bytes. */
- protected short recordLength;
-
- /** Reserved (dBASE IV) Filled with 00h. */
- protected byte[] reservedFiller1 = new byte[2];
-
- /**
- * Reserved : Incomplete transaction (dBASE IV).
- * 00h : Transaction ended (or rolled back).
- * 01h : Transaction started.
- */
- protected byte reservedIncompleteTransaction;
-
- /**
- * Reserved : Encryption flag (dBASE IV).
- * 00h : Not encrypted.
- * 01h : Data encrypted.
- */
- protected byte reservedEncryptionFlag;
-
- /** Reserved : Free record thread (for LAN only). */
- protected byte[] reservedFreeRecordThread = new byte[4];
-
- /** Reserved : For multi-user (DBase 3+). */
- protected byte[] reservedMultiUser = new byte[8];
-
- /** Reserved : MDX flag (dBASE IV). */
- protected byte reservedMDXFlag;
-
- /** Binary code page value. */
- protected byte codePage;
-
- /** Reserved (dBASE IV) Filled with 00h. */
- protected byte[] reservedFiller2 = new byte[2];
-
- /** Marks the end of the descriptor : must be 0x0D. */
- protected byte descriptorTerminator;
-
- /** Valid dBASE III PLUS table file (03h without a memo .DBT file; 83h with a memo). */
- protected byte dbaseVersion;
-
- /** Number of records in the table. */
- protected int rowCount;
-
- /** Database charset. */
- protected Charset charset;
-
- /** Date of last update; in YYMMDD format. */
- protected byte[] dbaseLastUpdate = new byte[3];
-
- /**
- * Map a dbf file.
- * @param file Database file.
- * @throws SQLDbaseFileNotFoundException if the DBF file has not been found.
- * @throws SQLInvalidDbaseFileFormatException if the database has an invalid format.
- */
- public AbstractDbase3ByteReader(File file) throws SQLDbaseFileNotFoundException, SQLInvalidDbaseFileFormatException {
- super(file, SQLInvalidDbaseFileFormatException.class, SQLDbaseFileNotFoundException.class);
- }
-
- /**
- * Returns the charset.
- * @return Charset.
- */
- @Override public Charset getCharset() {
- return this.charset;
- }
-
- /**
- * Returns the database last update date.
- * @return Date of the last update.
- */
- @Override public Date getDateOfLastUpdate() {
- return toDate(this.dbaseLastUpdate);
- }
-
- /**
- * Returns the first record position, in bytes, in the DBase file.
- * @return First record position.
- */
- @Override public short getFirstRecordPosition() {
- return this.firstRecordPosition;
- }
-
- /**
- * Returns the length (in bytes) of one record in this DBase file, including the delete flag.
- * @return Record length.
- */
- @Override public short getRecordLength() {
- return this.recordLength;
- }
-
- /**
- * Returns the record count.
- * @return Record count.
- */
- @Override public int getRowCount() {
- return this.rowCount;
- }
-
- /**
- * Convert the binary code page value of the Dbase 3 file to a recent Charset.
- * @param codePageBinaryValue page code binary value.
- * @return Charset.
- * @throws UnsupportedCharsetException if the code page as no representation in recents Charset (legacy DOS or macintosh charsets).
- */
- protected Charset toCharset(byte codePageBinaryValue) throws UnsupportedCharsetException {
- // Attempt to find a known conversion.
- String dbfCodePage = toCodePage(codePageBinaryValue);
-
- // If no conversion has been found, decide if the cause is an unsupported value or an illegal value to choose the good exception to return.
- if (dbfCodePage == null) {
- switch(Byte.toUnsignedInt(codePageBinaryValue)) {
- case 0x04: dbfCodePage = "unsupported"; break;
- case 0x68: dbfCodePage = "unsupported"; break; // Kamenicky (Czech) MS-DOS
- case 0x69: dbfCodePage = "unsupported"; break; // Mazovia (Polish) MS-DOS
- case 0x96: dbfCodePage = "unsupported"; break; // russian mac
- case 0x97: dbfCodePage = "unsupported"; break; // eastern european macintosh
- case 0x98: dbfCodePage = "unsupported"; break; // greek macintosh
- case 0xC8: dbfCodePage = "unsupported"; break; // windows ee
- default: dbfCodePage = "unsupported"; break;
- }
- }
-
- assert dbfCodePage != null;
-
- // If the code page cannot find a match for a more recent Charset, we wont be able to handle this DBF.
- if (dbfCodePage.equals("unsupported")) {
- String message = format(Level.WARNING, "excp.unsupported_codepage", codePageBinaryValue, getFile().getAbsolutePath());
- throw new UnsupportedCharsetException(message);
- }
-
- try {
- return Charset.forName(dbfCodePage);
- }
- catch(IllegalArgumentException e) {
- // If this happens here, it means that we have selected a wrong charset. We have a bug.
- String message = format(Level.WARNING, "assert.wrong_charset_selection", dbfCodePage, getFile().getAbsolutePath());
- throw new RuntimeException(message);
- }
- }
-
- /**
- * Return a Charset code page from a binary code page value.
- * @param pageCodeBinaryValue binary code page value.
- * @return Page code.
- */
- private String toCodePage(byte pageCodeBinaryValue) {
- // From http://trac.osgeo.org/gdal/ticket/2864
- HashMap<Integer, String> knownConversions = new HashMap<>();
- knownConversions.put(0x01, "cp437"); // U.S. MS–DOS
- knownConversions.put(0x02, "cp850"); // International MS–DOS
- knownConversions.put(0x03, "cp1252"); // Windows ANSI
- knownConversions.put(0x08, "cp865"); // Danish OEM
- knownConversions.put(0x09, "cp437"); // Dutch OEM
- knownConversions.put(0x0a, "cp850"); // Dutch OEM*
- knownConversions.put(0x0b, "cp437"); // Finnish OEM
- knownConversions.put(0x0d, "cp437"); // French OEM
- knownConversions.put(0x0e, "cp850"); // French OEM*
- knownConversions.put(0x0f, "cp437"); // German OEM
- knownConversions.put(0x10, "cp850"); // German OEM*
- knownConversions.put(0x11, "cp437"); // Italian OEM
- knownConversions.put(0x12, "cp850"); // Italian OEM*
- knownConversions.put(0x13, "cp932"); // Japanese Shift-JIS
- knownConversions.put(0x14, "cp850"); // Spanish OEM*
- knownConversions.put(0x15, "cp437"); // Swedish OEM
- knownConversions.put(0x16, "cp850"); // Swedish OEM*
- knownConversions.put(0x17, "cp865"); // Norwegian OEM
- knownConversions.put(0x18, "cp437"); // Spanish OEM
- knownConversions.put(0x19, "cp437"); // English OEM (Britain)
- knownConversions.put(0x1a, "cp850"); // English OEM (Britain)*
- knownConversions.put(0x1b, "cp437"); // English OEM (U.S.)
- knownConversions.put(0x1c, "cp863"); // French OEM (Canada)
- knownConversions.put(0x1d, "cp850"); // French OEM*
- knownConversions.put(0x1f, "cp852"); // Czech OEM
- knownConversions.put(0x22, "cp852"); // Hungarian OEM
- knownConversions.put(0x23, "cp852"); // Polish OEM
- knownConversions.put(0x24, "cp860"); // Portuguese OEM
- knownConversions.put(0x25, "cp850"); // Portuguese OEM*
- knownConversions.put(0x26, "cp866"); // Russian OEM
- knownConversions.put(0x37, "cp850"); // English OEM (U.S.)*
- knownConversions.put(0x40, "cp852"); // Romanian OEM
- knownConversions.put(0x4d, "cp936"); // Chinese GBK (PRC)
- knownConversions.put(0x4e, "cp949"); // Korean (ANSI/OEM)
- knownConversions.put(0x4f, "cp950"); // Chinese Big5 (Taiwan)
- knownConversions.put(0x50, "cp874"); // Thai (ANSI/OEM)
- knownConversions.put(0x57, "cp1252"); // ANSI
- knownConversions.put(0x58, "cp1252"); // Western European ANSI
- knownConversions.put(0x59, "cp1252"); // Spanish ANSI
- knownConversions.put(0x64, "cp852"); // Eastern European MS–DOS
- knownConversions.put(0x65, "cp866"); // Russian MS–DOS
- knownConversions.put(0x66, "cp865"); // Nordic MS–DOS
- knownConversions.put(0x67, "cp861"); // Icelandic MS–DOS
- knownConversions.put(0x6a, "cp737"); // Greek MS–DOS (437G)
- knownConversions.put(0x6b, "cp857"); // Turkish MS–DOS
- knownConversions.put(0x6c, "cp863"); // French–Canadian MS–DOS
- knownConversions.put(0x78, "cp950"); // Taiwan Big 5
- knownConversions.put(0x79, "cp949"); // Hangul (Wansung)
- knownConversions.put(0x7a, "cp936"); // PRC GBK
- knownConversions.put(0x7b, "cp932"); // Japanese Shift-JIS
- knownConversions.put(0x7c, "cp874"); // Thai Windows/MS–DOS
- knownConversions.put(0x86, "cp737"); // Greek OEM
- knownConversions.put(0x87, "cp852"); // Slovenian OEM
- knownConversions.put(0x88, "cp857"); // Turkish OEM
- knownConversions.put(0xc8, "cp1250"); // Eastern European Windows
- knownConversions.put(0xc9, "cp1251"); // Russian Windows
- knownConversions.put(0xca, "cp1254"); // Turkish Windows
- knownConversions.put(0xcb, "cp1253"); // Greek Windows
- knownConversions.put(0xcc, "cp1257"); // Baltic Windows
-
- return(knownConversions.get(Byte.toUnsignedInt(pageCodeBinaryValue)));
- }
-
- /**
- * Set a charset.
- * @param cs Charset.
- */
- public void setCharset(Charset cs) {
- this.charset = cs;
- }
-
- /**
- * Return a date from a byte array.
- * @param yymmdd byte[3] with byte[0] = year (2 digits), [1] = month, [2] = day.
- * @return Date.
- */
- private Date toDate(byte[] yymmdd) {
- Objects.requireNonNull(yymmdd, "the yymmdd bytes cannot be null");
-
- if (yymmdd.length != 3)
- throw new IllegalArgumentException(MessageFormat.format("Database:toDate() works only on a 3 bytes YY MM DD date. this array has {0} length", yymmdd.length));
-
- Objects.requireNonNull(yymmdd[0], "the year byte cannot be null");
- Objects.requireNonNull(yymmdd[1], "the month byte cannot be null");
- Objects.requireNonNull(yymmdd[2], "the day byte cannot be null");
-
- int year = yymmdd[0] < 70 ? 100 + yymmdd[0] : yymmdd[0];
- int month = yymmdd[1];
- int day = yymmdd[2];
-
- @SuppressWarnings("deprecation") // But everything is deprecated in DBF files...
- Date date = new Date(year, month, day);
- return date;
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC.java
deleted file mode 100644
index 5c12b48..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc;
-
-import java.io.File;
-import java.sql.*;
-import java.util.logging.Level;
-
-import org.apache.sis.internal.shapefile.AutoChecker;
-
-
-/**
- * Base class for each JDBC class.
- * @author Marc Le Bihan
- * @version 0.5
- * @since 0.5
- * @module
- */
-public abstract class AbstractJDBC extends AutoChecker implements Wrapper {
- /**
- * Constructs a new instance of a JDBC interface.
- */
- public AbstractJDBC() {
- }
-
- /**
- * Returns the JDBC interface implemented by this class.
- * This is used for formatting error messages.
- * @return The JDBC interface implemented by this class.
- */
- abstract protected Class<?> getInterface();
-
- /**
- * Unsupported by default.
- * @param iface the type of the wrapped object.
- * @return The wrapped object.
- */
- @Override
- public <T> T unwrap(Class<T> iface) throws SQLException {
- throw unsupportedOperation("unwrap", iface);
- }
-
- /**
- * Defaults to {@code null}.
- * @return SQL Warning.
- */
- public SQLWarning getWarnings() {
- return null;
- }
-
- /**
- * Defaults to nothing, since there is no SQL warning.
- */
- public void clearWarnings() {
- }
-
- /**
- * Returns an unsupported operation exception to be thrown.
- * @param methodOrWishedFeatureName The feature / call the caller attempted.
- * @return the not supported feature exception.
- * @throws SQLFeatureNotSupportedException the not supported feature.
- */
- public final SQLFeatureNotSupportedException unsupportedOperation(final String methodOrWishedFeatureName) throws SQLFeatureNotSupportedException {
- String message = format(Level.WARNING, "excp.unsupportedDriverFeature", getInterface(), methodOrWishedFeatureName, getClass().getSimpleName());
- throw new SQLFeatureNotSupportedException(message);
- }
-
- /**
- * Returns an unsupported operation exception to be thrown : this exception add parameters sent to the method that isn't implemented.
- * @param methodOrWishedFeatureName The feature / call the caller attempted.
- * @param args Arguments that where sent to the unimplemented function.
- * @return the not supported feature exception.
- * @throws SQLFeatureNotSupportedException the not supported feature.
- */
- public final SQLFeatureNotSupportedException unsupportedOperation(final String methodOrWishedFeatureName, Object... args) throws SQLFeatureNotSupportedException {
- StringBuffer arguments = new StringBuffer();
-
- for(Object arg : args) {
- arguments.append(arguments.length() == 0 ? "" : ", "); // Separator if needed.
- arguments.append(arg instanceof String ? "\"" : ""); // Enclosing " for String, if needed.
- arguments.append(arg == null ? "null" : arg.toString()); // String value of the argument.
- arguments.append(arg instanceof String ? "\"" : ""); // Enclosing " for String, if needed.
- }
-
- String message = format(Level.WARNING, "excp.unsupportedDriverFeature_with_arguments", getInterface(), methodOrWishedFeatureName, getClass().getSimpleName(), arguments.toString());
- throw new SQLFeatureNotSupportedException(message);
- }
-
- /**
- * log a function call in the driver : very verbose.
- * @param methodName The call the caller attempted.
- */
- public void logStep(final String methodName) {
- log(Level.FINER, "log.step", methodName, getClass().getSimpleName());
- }
-
- /**
- * log a function call in the driver : very verbose.
- * @param methodName The call the caller attempted.
- * @param args Arguments that where sent to the unimplemented function.
- */
- public void logStep(final String methodName, Object... args) {
- if (isLoggable(Level.FINER)) { // Avoid resolution of arguments(...) if not needed.
- log(Level.FINER, "log.step_with_arguments", methodName, getClass().getSimpleName(), arguments(args));
- }
- }
-
- /**
- * log an unsupported feature as a warning.
- * @param methodName The call the caller attempted.
- */
- public void logUnsupportedOperation(final String methodName) {
- log(Level.WARNING, "excp.unsupportedDriverFeature", getInterface(), methodName, getClass().getSimpleName());
- }
-
- /**
- * log an unsupported feature as a warning.
- * @param methodName The call the caller attempted.
- * @param args Arguments that where sent to the unimplemented function.
- */
- public void logUnsupportedOperation(final String methodName, Object... args) {
- log(Level.WARNING, "excp.unsupportedDriverFeature_with_arguments", getInterface(), methodName, getClass().getSimpleName(), arguments(args));
- }
-
- /**
- * Returns the Database File.
- * @return Database File.
- */
- abstract protected File getFile();
-
- /**
- * Concat arguments in a StringBuffer.
- * @param args arguments.
- * @return Arguments.
- */
- private StringBuffer arguments(Object... args) {
- StringBuffer arguments = new StringBuffer();
-
- for(Object arg : args) {
- arguments.append(arguments.length() == 0 ? "" : ", "); // Separator if needed.
- arguments.append(arg instanceof String ? "\"" : ""); // Enclosing " for String, if needed.
- arguments.append(arg == null ? "null" : arg.toString()); // String value of the argument.
- arguments.append(arg instanceof String ? "\"" : ""); // Enclosing " for String, if needed.
- }
-
- return arguments;
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/CommonByteReader.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/CommonByteReader.java
deleted file mode 100644
index e1fadd7..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/CommonByteReader.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc;
-
-import java.io.*;
-import java.nio.MappedByteBuffer;
-import java.nio.channels.FileChannel;
-import java.util.Objects;
-import java.util.logging.Level;
-
-import org.apache.sis.internal.shapefile.AutoChecker;
-
-/**
- * Common byte reader.
- * @author Marc Le Bihan
- * @version 0.5
- * @param <InvalidFormatException> Invalid format Exception to throw in case of trouble.
- * @param <FNFException> File not found Exception to throw in case of missing file.
- * @since 0.5
- * @module
- */
-public abstract class CommonByteReader<InvalidFormatException extends Exception, FNFException extends Exception> extends AutoChecker implements AutoCloseable {
- /** The File. */
- private File file;
-
- /** Input Stream on the DBF. */
- private FileInputStream fis;
-
- /** File channel on the file. */
- private FileChannel fc;
-
- /** Buffer reader. */
- private MappedByteBuffer byteBuffer;
-
- /** Indicates if the byte buffer is closed. */
- private boolean isClosed = false;
-
- /** Invalid Exception to throw in case of invalid file format. */
- private Class<InvalidFormatException> classInvalidFormatException;
-
- /** Invalid Exception to throw in case of file not found exception. */
- private Class<FNFException> classFNFException;
-
- /**
- * Create and open a byte reader based on a file.
- * @param f File.
- * @param invalidFormatException Invalid Exception to throw in case of invalid file format.
- * @param fileNotFoundException Invalid Exception to throw in case of file not found exception.
- * @throws FNFException if the file cannot be opened.
- * @throws InvalidFormatException if the file format is invalid.
- */
- public CommonByteReader(File f, Class<InvalidFormatException> invalidFormatException, Class<FNFException> fileNotFoundException) throws FNFException, InvalidFormatException {
- Objects.requireNonNull(f, "The file cannot be null.");
- this.classInvalidFormatException = invalidFormatException;
- this.classFNFException = fileNotFoundException;
-
- this.file = f;
-
- try {
- this.fis = new FileInputStream(this.file);
- }
- catch(FileNotFoundException e) {
- throwException(this.classInvalidFormatException, e.getMessage(), e);
- throw new RuntimeException("this place should not be reached.");
- }
-
- this.fc = this.fis.getChannel();
-
- try {
- int fsize = (int)this.fc.size();
- this.byteBuffer = this.fc.map(FileChannel.MapMode.READ_ONLY, 0, fsize);
- }
- catch(IOException e) {
- String message = format(Level.WARNING, "excp.reader_cannot_be_created", this.file.getAbsolutePath(), e.getMessage());
- throwException(this.classFNFException, message, e);
- throw new RuntimeException("this place should not be reached.");
- }
- }
-
- /**
- * Close the MappedByteReader.
- * @throws IOException if the close operation fails.
- */
- @Override
- public void close() throws IOException {
- if (this.fc != null)
- this.fc.close();
-
- if (this.fis != null)
- this.fis.close();
-
- this.isClosed = true;
- }
-
- /**
- * Returns the closed state of this binary reader.
- * @return true if it is closed.
- */
- public boolean isClosed() {
- return this.isClosed;
- }
-
- /**
- * Returns the byte buffer.
- * @return Byte Buffer.
- */
- public MappedByteBuffer getByteBuffer() {
- return this.byteBuffer;
- }
-
- /**
- * Return the file mapped.
- * @return File.
- */
- public File getFile() {
- return this.file;
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFDriver.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFDriver.java
deleted file mode 100644
index 198ffa7..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFDriver.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc;
-
-import java.io.File;
-import java.sql.Connection;
-import java.sql.Driver;
-import java.sql.DriverPropertyInfo;
-import java.util.Objects;
-import java.util.Properties;
-import java.util.logging.Logger;
-
-import org.apache.sis.internal.shapefile.jdbc.connection.DBFConnection;
-import org.apache.sis.internal.system.Modules;
-
-
-/**
- * Database driver for DBF 3.
- *
- * @author Marc Le Bihan
- * @version 0.5
- * @since 0.5
- * @module
- */
-public class DBFDriver extends AbstractJDBC implements Driver {
- /**
- * Creates a new driver.
- */
- public DBFDriver() {
- }
-
- /**
- * @see java.sql.Wrapper#isWrapperFor(java.lang.Class)
- */
- @Override
- public boolean isWrapperFor(Class<?> iface) {
- return iface.isAssignableFrom(getInterface());
- }
-
- /**
- * Returns the JDBC interface implemented by this class.
- * This is used for formatting error messages.
- */
- @Override
- final protected Class<?> getInterface() {
- return Driver.class;
- }
-
- /**
- * Attempts to make a database connection to the given filename.
- *
- * @param url The path to a {@code .dbf} file.
- * @param info Properties to ask for special features, behavior, or compatibility.
- * @return A connection to the given DBF file.
- * @throws SQLInvalidDbaseFileFormatException if the database file format is invalid.
- * @throws SQLDbaseFileNotFoundException if the database file doesn't exist.
- * @throws SQLInvalidDbaseFileFormatException if the database file has a wrong format.
- */
- @Override
- @SuppressWarnings("resource") // the function opens a connection.
- public Connection connect(final String url, Properties info) throws SQLInvalidDbaseFileFormatException, SQLDbaseFileNotFoundException {
- Objects.requireNonNull(url, "the DBase3 url cannot be null");
- File file = new File(url);
- return new DBFConnection(file, new MappedByteReader(file, info));
- }
-
- /**
- * Returns {@code true} if this driver thinks that it can open the given URL.
- */
- @Override
- public boolean acceptsURL(final String url) {
- if (!url.endsWith(".dbf")) {
- return false;
- }
-
- final File datafile = new File(url);
- return datafile.isFile(); // Future version should check for magic number.
- }
-
- /**
- * @see org.apache.sis.internal.shapefile.jdbc.AbstractJDBC#getFile()
- */
- @Override protected File getFile() {
- return null;
- }
-
- /**
- * Gets information about the possible properties for this driver.
- * The current version has none.
- */
- @Override
- public DriverPropertyInfo[] getPropertyInfo(@SuppressWarnings("unused") String url, @SuppressWarnings("unused") Properties info) {
- return new DriverPropertyInfo[0];
- }
-
- /**
- * The major version number of this driver.
- * This is set to the Apache SIS version.
- */
- @Override
- public int getMajorVersion() {
- return Modules.MAJOR_VERSION;
- }
-
- /**
- * The minor version number of this driver.
- * This is set to the Apache SIS version.
- */
- @Override
- public int getMinorVersion() {
- return Modules.MINOR_VERSION;
- }
-
- /**
- * This driver is currently not compliant.
- * It has to succeed these tests first:
- * <a href="http://www.oracle.com/technetwork/java/jdbctestsuite-1-3-1-140675.html">Compliance tests</a>.
- */
- @Override
- public boolean jdbcCompliant() {
- return false; // No, and for some time...
- }
-
- /**
- * The logger used by this driver.
- */
- @Override
- public Logger getParentLogger() {
- return super.getLogger();
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBase3FieldDescriptor.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBase3FieldDescriptor.java
deleted file mode 100644
index 3f10500..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBase3FieldDescriptor.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc;
-
-import java.nio.MappedByteBuffer;
-
-import org.apache.sis.internal.shapefile.AutoChecker;
-
-
-/**
- * Field descriptor.
- *
- * @author Travis L. Pinney
- * @version 0.5
- * @since 0.5
- * @module
- */
-public class DBase3FieldDescriptor extends AutoChecker {
- /** Field name. */
- private byte[] fieldName = new byte[11];
-
- /** Field name as String, for performance issues. */
- private String stringFieldName;
-
- /** Field type. */
- private DBaseDataType fieldType;
-
- /** Field address (Field data address (address is set in memory; not useful on disk). */
- private byte[] fieldAddress = new byte[4];
-
- /** Field length. */
- private byte fieldLength;
-
- /** Decimal count. */
- private byte fieldDecimalCount;
-
- /** Reserved 2. */
- private byte[] dbasePlusLanReserved2 = new byte[2];
-
- /** Work area id. */
- @SuppressWarnings("unused") // Kept in case of later ALTER TABLE sql calls.
- private byte workAreaID;
-
- /** Reserved 3. */
- private byte[] dbasePlusLanReserved3 = new byte[2];
-
- /** Undocumented use. */
- @SuppressWarnings("unused") // Kept in case of later ALTER TABLE sql calls.
- private byte setFields;
-
- /**
- * Create a field descriptor from the current position of the binary stream.
- * @param byteBuffer ByteBuffer.
- */
- public DBase3FieldDescriptor(MappedByteBuffer byteBuffer) {
- // Field name.
- byteBuffer.get(this.fieldName);
-
- // Field type.
- char dt = (char)byteBuffer.get();
- this.fieldType = DBaseDataType.valueOfDataType(dt);
-
- // Field address.
- byteBuffer.get(this.fieldAddress);
-
- // Length and scale.
- this.fieldLength = byteBuffer.get();
- this.fieldDecimalCount = byteBuffer.get();
-
- byteBuffer.getShort(); // reserved
-
- byteBuffer.get(this.dbasePlusLanReserved2);
-
- // Work area id.
- this.workAreaID = byteBuffer.get();
-
- byteBuffer.get(this.dbasePlusLanReserved3);
-
- // Fields.
- this.setFields = byteBuffer.get();
-
- byte[] data = new byte[6];
- byteBuffer.get(data); // reserved
- }
-
- /**
- * Returns the decimal count of that field.
- * @return Decimal count.
- */
- public int getDecimalCount() {
- return Byte.toUnsignedInt(this.fieldDecimalCount);
- }
-
- /**
- * Returns the field length.
- * @return field length.
- */
- public int getLength() {
- return Byte.toUnsignedInt(this.fieldLength);
- }
-
- /**
- * Return the field name.
- * @return Field name.
- */
- public String getName() {
- // Converting bytes to String takes time. Only do that once.
- if (this.stringFieldName == null) {
- int length = this.fieldName.length;
- while (length != 0 && Byte.toUnsignedInt(this.fieldName[length - 1]) <= ' ') {
- length--;
- }
-
- this.stringFieldName = new String(this.fieldName, 0, length);
- }
-
- return this.stringFieldName;
- }
-
- /**
- * Return the field data type.
- * @return Data type.
- */
- public DBaseDataType getType() {
- return(this.fieldType);
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- String text = format("toString", getName(), this.fieldType, Byte.toUnsignedInt(this.fieldLength), Byte.toUnsignedInt(this.fieldDecimalCount));
- return text;
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBaseDataType.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBaseDataType.java
deleted file mode 100644
index 6078a9a..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBaseDataType.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc;
-
-
-/**
- * Provides a simple DataType class.
- *
- * @author Travis L. Pinney
- * @version 0.5
- *
- * @see <a href="http://www.clicketyclick.dk/databases/xbase/format/data_types.html">Xbase Data Types</a>
- *
- * @since 0.5
- * @module
- */
-public enum DBaseDataType {
- /** Character (less than 254 characters). */
- Character('C'),
-
- /** Number (less than 18 characters, can include sign and decimal). */
- Number('N'),
-
- /** Logical (3 way, ? Y,y,T,t N,n,F,f). */
- Logical('L'),
-
- /** Date (YYYYMMDD format). */
- Date('D'),
-
- /** Memo (Pointer to ASCII text field). */
- Memo('M'),
-
- /** Floating point (20 digits). */
- FloatingPoint('F'),
-
- // CharacterNameVariable("?"), //1-254 Characters
-
- /** Picture (memo). */
- Picture('P'),
-
- /** Currency (Foxpro). */
- Currency('Y'),
-
- /** Date time (32 bit little-endian Julian date, 32 byte little endian milliseconds since midnight). */
- DateTime('T'),
-
- /** Integer (4 byte little endian). */
- Integer('I'),
-
- /** Varifield (???). */
- VariField('V'),
-
- /** Variant (???). */
- Variant('X'),
-
- /** Time stamp (see url). */
- TimeStamp('@'),
-
- /** Double. */
- Double('O'),
-
- /** Auto increment. */
- AutoIncrement('+');
-
- /** Data type. */
- public final char datatype;
-
- /**
- * Construct a datatype.
- * @param type Data type.
- */
- DBaseDataType(char type) {
- this.datatype = type;
- }
-
- /**
- * Return the Datatype enum of a code.
- * @param code Character code describing the dbf datatype.
- * @return Datatype.
- */
- public static DBaseDataType valueOfDataType(char code) {
- for (DBaseDataType v : values()) {
- if (v.datatype == code) {
- return v;
- }
- }
- throw new IllegalArgumentException("Enum datatype is incorrect");
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/Dbase3ByteReader.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/Dbase3ByteReader.java
deleted file mode 100644
index d9fecf9..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/Dbase3ByteReader.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc;
-
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.sis.internal.shapefile.jdbc.resultset.SQLIllegalColumnIndexException;
-import org.apache.sis.internal.shapefile.jdbc.resultset.SQLNoSuchFieldException;
-import org.apache.sis.feature.AbstractFeature;
-
-/**
- * Database byte reader contract. Used to allow refactoring of core byte management of a DBase file.
- * @author Marc LE BIHAN
- */
-public interface Dbase3ByteReader {
- /**
- * Close the MappedByteReader.
- * @throws IOException if the close operation fails.
- */
- public void close() throws IOException;
-
- /**
- * Checks if the ByteReader is closed.
- * @return true if it is closed.
- */
- public boolean isClosed();
-
- /**
- * Returns the fields descriptors in their binary format.
- * @return Fields descriptors.
- */
- public List<DBase3FieldDescriptor> getFieldsDescriptors();
-
- /**
- * Returns the column index for the given column name.
- * The default implementation of all methods expecting a column label will invoke this method.
- * @param columnLabel The name of the column.
- * @param sql For information, the SQL statement that is attempted.
- * @return The index of the given column name : first column is 1.
- * @throws SQLNoSuchFieldException if there is no field with this name in the query.
- */
- public int findColumn(String columnLabel, String sql) throws SQLNoSuchFieldException;
-
- /**
- * Returns the charset.
- * @return Charset.
- */
- public Charset getCharset();
-
- /**
- * Returns the column count of the unique table of the DBase 3.
- * @return Column count.
- */
- public int getColumnCount();
-
- /**
- * Return a field name.
- * @param columnIndex Column index.
- * @param sql For information, the SQL statement that is attempted.
- * @return Field Name.
- * @throws SQLIllegalColumnIndexException if the index is out of bounds.
- */
- public String getFieldName(int columnIndex, String sql) throws SQLIllegalColumnIndexException;
-
- /**
- * Returns the database last update date.
- * @return Date of the last update.
- */
- public Date getDateOfLastUpdate();
-
- /**
- * Returns the first record position, in bytes, in the DBase file.
- * @return First record position.
- */
- public short getFirstRecordPosition();
-
- /**
- * Returns the length (in bytes) of one record in this DBase file, including the delete flag.
- * @return Record length.
- */
- public short getRecordLength();
-
- /**
- * Returns the record count.
- * @return Record count.
- */
- public int getRowCount();
-
- /**
- * Returns the current record number.
- * @return Current record number.
- */
- public int getRowNum();
-
- /**
- * Load a row into a feature.
- * @param feature Feature to fill.
- */
- public void loadRowIntoFeature(AbstractFeature feature);
-
- /**
- * Checks if a next row is available. Warning : it may be a deleted one.
- * @return true if a next row is available.
- */
- public boolean nextRowAvailable();
-
- /**
- * Read the next row as a set of objects.
- * @return Map of field name / object value.
- */
- public Map<String, byte[]> readNextRowAsObjects();
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/MappedByteReader.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/MappedByteReader.java
deleted file mode 100644
index 294be4a..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/MappedByteReader.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc;
-
-import java.io.File;
-import java.nio.BufferUnderflowException;
-import java.nio.ByteOrder;
-import java.nio.charset.Charset;
-import java.nio.charset.UnsupportedCharsetException;
-import java.util.*;
-import java.util.logging.Level;
-
-import org.apache.sis.internal.shapefile.jdbc.resultset.SQLIllegalColumnIndexException;
-import org.apache.sis.internal.shapefile.jdbc.resultset.SQLNoSuchFieldException;
-import org.apache.sis.feature.AbstractFeature;
-
-
-/**
- * Reader of a Database Binary content by the way of a {@link java.nio.MappedByteBuffer}
- *
- * @author Marc Le Bihan
- * @version 0.5
- * @since 0.5
- * @module
- */
-public class MappedByteReader extends AbstractDbase3ByteReader implements AutoCloseable {
- /** List of field descriptors. */
- private List<DBase3FieldDescriptor> fieldsDescriptors = new ArrayList<>();
-
- /** Connection properties. */
- private Properties info;
-
- /**
- * Construct a mapped byte reader on a file.
- * @param dbase3File File.
- * @param connectionInfos Connection properties, maybe null.
- * @throws SQLInvalidDbaseFileFormatException if the database seems to be invalid.
- * @throws SQLDbaseFileNotFoundException if the Dbase file has not been found.
- */
- public MappedByteReader(File dbase3File, Properties connectionInfos) throws SQLInvalidDbaseFileFormatException, SQLDbaseFileNotFoundException {
- super(dbase3File);
- this.info = connectionInfos;
-
- // React to special features asked.
- if (this.info != null) {
- // Sometimes, DBF files have a wrong charset, or more often : none, and you have to specify it.
- String recordCharset = (String)this.info.get("record_charset");
-
- if (recordCharset != null) {
- Charset cs = Charset.forName(recordCharset);
- setCharset(cs);
- }
- }
-
- loadDescriptor();
- }
-
- /**
- * Load a row into a feature.
- * @param feature Feature to fill.
- */
- @Override public void loadRowIntoFeature(AbstractFeature feature) {
- // TODO: ignore deleted records
- getByteBuffer().get(); // denotes whether deleted or current
- // read first part of record
-
- for (DBase3FieldDescriptor fd : this.fieldsDescriptors) {
- byte[] data = new byte[fd.getLength()];
- getByteBuffer().get(data);
-
- int length = data.length;
- while (length != 0 && Byte.toUnsignedInt(data[length - 1]) <= ' ') {
- length--;
- }
-
- String value = new String(data, 0, length);
- feature.setPropertyValue(fd.getName(), value);
- }
- }
-
- /**
- * Checks if a next row is available. Warning : it may be a deleted one.
- * @return true if a next row is available.
- */
- @Override
- public boolean nextRowAvailable() {
- // 1) Check for remaining bytes.
- if (getByteBuffer().hasRemaining() == false) {
- return false;
- }
-
- // 2) Check that the immediate next byte read isn't the EOF signal.
- byte eofCheck = getByteBuffer().get();
-
- boolean isEOF = (eofCheck == 0x1A);
- this.log(Level.FINER, "log.delete_status", getRowNum(), eofCheck, isEOF ? "EOF" : "Active");
-
- if (eofCheck == 0x1A) {
- return false;
- }
- else {
- // Return one byte back.
- int position = getByteBuffer().position();
- getByteBuffer().position(position-1);
- return true;
- }
- }
-
- /**
- * Returns the record number of the last record red.
- * @return The record number.
- */
- @Override public int getRowNum() {
- int position = getByteBuffer().position();
- int recordNumber = (position - Short.toUnsignedInt(this.firstRecordPosition)) / Short.toUnsignedInt(this.recordLength);
- return recordNumber;
- }
-
- /**
- * Read the next row as a set of objects.
- * @return Map of field name / object value.
- */
- @Override
- public Map<String, byte[]> readNextRowAsObjects() {
- // TODO: ignore deleted records
- /* byte isDeleted = */ getByteBuffer().get(); // denotes whether deleted or current
-
- // read first part of record
- HashMap<String, byte[]> fieldsValues = new HashMap<>();
-
- for (DBase3FieldDescriptor fd : this.fieldsDescriptors) {
- byte[] data = new byte[fd.getLength()];
- getByteBuffer().get(data);
-
- // Trim the bytes right.
- int length = data.length;
-
- while (length != 0 && Byte.toUnsignedInt(data[length - 1]) <= ' ') {
- length--;
- }
-
- if (length != data.length) {
- byte[] dataTrimmed = new byte[length];
-
- for(int index=0; index < length; index ++) {
- dataTrimmed[index] = data[index];
- }
-
- fieldsValues.put(fd.getName(), dataTrimmed);
- }
- else {
- fieldsValues.put(fd.getName(), data);
- }
- }
-
- return fieldsValues;
- }
-
- /**
- * Loading the database file content from binary .dbf file.
- * @throws SQLInvalidDbaseFileFormatException if descriptor is not readable.
- */
- private void loadDescriptor() throws SQLInvalidDbaseFileFormatException {
- try {
- this.dbaseVersion = getByteBuffer().get();
- getByteBuffer().get(this.dbaseLastUpdate);
-
- getByteBuffer().order(ByteOrder.LITTLE_ENDIAN);
- this.rowCount = getByteBuffer().getInt();
- this.firstRecordPosition = getByteBuffer().getShort();
- this.recordLength = getByteBuffer().getShort();
- getByteBuffer().order(ByteOrder.BIG_ENDIAN);
-
- getByteBuffer().get(this.reservedFiller1);
- this.reservedIncompleteTransaction = getByteBuffer().get();
- this.reservedEncryptionFlag = getByteBuffer().get();
- getByteBuffer().get(this.reservedFreeRecordThread);
- getByteBuffer().get(this.reservedMultiUser);
- this.reservedMDXFlag = getByteBuffer().get();
-
- // Translate code page value to a known charset.
- this.codePage = getByteBuffer().get();
-
- if (this.charset == null) {
- try {
- this.charset = toCharset(this.codePage);
- }
- catch(UnsupportedCharsetException e) {
- // Warn the caller that he will have to perform is own conversions.
- log(Level.WARNING, "log.no_valid_charset", getFile().getAbsolutePath(), e.getMessage());
- }
- }
- else {
- log(Level.INFO, "log.record_charset", this.charset.name());
- }
-
- getByteBuffer().get(this.reservedFiller2);
-
- while(getByteBuffer().position() < this.firstRecordPosition - 1) {
- DBase3FieldDescriptor fd = new DBase3FieldDescriptor(getByteBuffer());
- this.fieldsDescriptors.add(fd);
- // loop until you hit the 0Dh field terminator
- }
-
- this.descriptorTerminator = getByteBuffer().get();
-
- // If the last character read after the field descriptor isn't 0x0D, the expected mark has not been found and the DBF is corrupted.
- if (this.descriptorTerminator != 0x0D) {
- String message = format(Level.WARNING, "excp.filedescriptor_problem", getFile().getAbsolutePath(), "Character marking the end of the fields descriptors (0x0D) has not been found.");
- throw new SQLInvalidDbaseFileFormatException(message);
- }
- }
- catch(BufferUnderflowException e) {
- // This exception doesn't denote a trouble of file opening because the file has been checked before
- // the calling of this private function.
- // Therefore, an internal structure problem cause maybe a premature End of file or anything else, but the only thing
- // we can conclude is : we are not before a device trouble, but a file format trouble.
- String message = format(Level.WARNING, "excp.filedescriptor_problem", getFile().getAbsolutePath(), e.getMessage());
- throw new SQLInvalidDbaseFileFormatException(message);
- }
- }
-
- /**
- * Returns the fields descriptors in their binary format.
- * @return Fields descriptors.
- */
- @Override
- public List<DBase3FieldDescriptor> getFieldsDescriptors() {
- return this.fieldsDescriptors;
- }
-
- /**
- * Return a field name.
- * @param columnIndex Column index.
- * @param sql For information, the SQL statement that is attempted.
- * @return Field Name.
- * @throws SQLIllegalColumnIndexException if the index is out of bounds.
- */
- @Override
- public String getFieldName(int columnIndex, String sql) throws SQLIllegalColumnIndexException {
- return getField(columnIndex, sql).getName();
- }
-
- /**
- * @see org.apache.sis.internal.shapefile.jdbc.Dbase3ByteReader#getColumnCount()
- */
- @Override
- public int getColumnCount() {
- return this.fieldsDescriptors.size();
- }
-
- /**
- * Returns the column index for the given column name.
- * The default implementation of all methods expecting a column label will invoke this method.
- * @param columnLabel The name of the column.
- * @param sql For information, the SQL statement that is attempted.
- * @return The index of the given column name : first column is 1.
- * @throws SQLNoSuchFieldException if there is no field with this name in the query.
- */
- @Override
- public int findColumn(String columnLabel, String sql) throws SQLNoSuchFieldException {
- // If the column name is null, no search is needed.
- if (columnLabel == null) {
- String message = format(Level.WARNING, "excp.no_such_column_in_resultset", columnLabel, sql, getFile().getName());
- throw new SQLNoSuchFieldException(message, sql, getFile(), columnLabel);
- }
-
- // Search the field among the fields descriptors.
- for(int index=0; index < this.fieldsDescriptors.size(); index ++) {
- if (this.fieldsDescriptors.get(index).getName().equals(columnLabel)) {
- return index + 1;
- }
- }
-
- // If we are here, we haven't found our field. Throw an exception.
- String message = format(Level.WARNING, "excp.no_such_column_in_resultset", columnLabel, sql, getFile().getName());
- throw new SQLNoSuchFieldException(message, sql, getFile(), columnLabel);
- }
-
- /**
- * Returns the field descriptor of a given ResultSet column index.
- * @param columnIndex Column index, first column is 1, second is 2, etc.
- * @param sql For information, the SQL statement that is attempted.
- * @return Field Descriptor.
- * @throws SQLIllegalColumnIndexException if the index is out of bounds.
- */
- private DBase3FieldDescriptor getField(int columnIndex, String sql) throws SQLIllegalColumnIndexException {
- if (columnIndex < 1 || columnIndex > getColumnCount()) {
- String message = format(Level.WARNING, "excp.illegal_column_index", columnIndex, getColumnCount());
- throw new SQLIllegalColumnIndexException(message, sql, getFile(), columnIndex);
- }
-
- return this.fieldsDescriptors.get(columnIndex-1);
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/SQLConnectionClosedException.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/SQLConnectionClosedException.java
deleted file mode 100644
index 118f6d9..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/SQLConnectionClosedException.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc;
-
-import java.io.File;
-import java.sql.SQLException;
-
-/**
- * Exception thrown when a connection is closed.
- * @author Marc LE BIHAN
- */
-public class SQLConnectionClosedException extends SQLException {
- /** Serial ID. */
- private static final long serialVersionUID = -7806101485624353416L;
-
- /** The SQL Statement that whas attempted (if known). */
- private String sql;
-
- /** The database file. */
- private File database;
-
- /**
- * Build the exception.
- * @param message Exception message.
- * @param sqlStatement SQL Statement who encountered the trouble, if known.
- * @param dbf The database that was queried.
- */
- public SQLConnectionClosedException(String message, String sqlStatement, File dbf) {
- super(message);
- this.sql = sqlStatement;
- this.database = dbf;
- }
-
- /**
- * Returns the SQL statement who encountered the "connection closed" alert, if known.
- * @return SQL statement or null.
- */
- public String getSQL() {
- return this.sql;
- }
-
- /**
- * Returns the database file that is not opened for connection.
- * @return Database file.
- */
- public File getDatabase() {
- return this.database;
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/SQLDbaseFileNotFoundException.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/SQLDbaseFileNotFoundException.java
deleted file mode 100644
index 73572f4..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/SQLDbaseFileNotFoundException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc;
-
-import java.sql.SQLNonTransientException;
-
-
-/**
- * Thrown when a DBF file has not been found.
- *
- * @author Marc Le Bihan
- * @version 0.5
- * @since 0.5
- * @module
- */
-public class SQLDbaseFileNotFoundException extends SQLNonTransientException {
- /** Serial UID. */
- private static final long serialVersionUID = 2572691456125734352L;
-
- /**
- * Construct an exception.
- * @param message Message of the exception.
- */
- public SQLDbaseFileNotFoundException(String message) {
- super(message);
- }
-
- /**
- * Construct an exception.
- * @param message Message of the exception.
- * @param cause Root cause of the exception.
- */
- public SQLDbaseFileNotFoundException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/SQLInvalidDbaseFileFormatException.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/SQLInvalidDbaseFileFormatException.java
deleted file mode 100644
index ba44980..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/SQLInvalidDbaseFileFormatException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc;
-
-import java.sql.SQLNonTransientException;
-
-
-/**
- * Thrown when the DBF file format seems to be invalid.
- *
- * @author Marc Le Bihan
- * @version 0.5
- * @since 0.5
- * @module
- */
-public class SQLInvalidDbaseFileFormatException extends SQLNonTransientException {
- /** Serial UID. */
- private static final long serialVersionUID = 3924612615300490837L;
-
- /**
- * Construct an exception.
- * @param message Message of the exception.
- */
- public SQLInvalidDbaseFileFormatException(String message) {
- super(message);
- }
-
- /**
- * Construct an exception.
- * @param message Message of the exception.
- * @param cause Root cause of the exception.
- */
- public SQLInvalidDbaseFileFormatException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/AbstractConnection.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/AbstractConnection.java
deleted file mode 100644
index 89d1845..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/AbstractConnection.java
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc.connection;
-
-import java.sql.*;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.Executor;
-import java.util.logging.Level;
-
-import org.apache.sis.internal.shapefile.jdbc.AbstractJDBC;
-
-
-/**
- * This base class holds most of the unimplemented feature of a {@code Connection}.
- * This is used in order to avoid having a Connection implementation of thousand lines and unreadable.
- *
- * <table class="sis">
- * <caption>Connection default values</caption>
- * <tr><th>Property</th> <th>Value</th></tr>
- * <tr><td>{@link #isReadOnly()}</td> <td>{@code false}</td></tr>
- * <tr><td>{@link #getAutoCommit()}</td> <td>{@code true}</td></tr>
- * <tr><td>{@link #getNetworkTimeout()}</td> <td>0</td></tr>
- * <tr><td>{@link #getTransactionIsolation()}</td> <td>{@link #TRANSACTION_NONE}</td></tr>
- * <tr><td>{@link #getTypeMap()}</td> <td>Empty map</td></tr>
- * <tr><td>{@link #nativeSQL(String)}</td> <td>No change</td></tr>
- * <tr><td>{@link #getWarnings()}</td> <td>{@code null}</td></tr>
- * <tr><td>{@link #clearWarnings()}</td> <td>Ignored</td></tr>
- * </table>
- *
- * @author Marc Le Bihan
- * @author Martin Desruisseaux (Geomatys)
- * @version 0.5
- * @since 0.5
- * @module
- */
-@SuppressWarnings("unused")
-abstract class AbstractConnection extends AbstractJDBC implements Connection {
- /**
- * Constructs a new {@code Connection} instance.
- */
- AbstractConnection() {
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void setCatalog(String catalog) {
- logUnsupportedOperation("setCatalog");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public String getSchema() throws SQLException {
- throw unsupportedOperation("getSchema");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void setSchema(String schema) throws SQLException {
- throw unsupportedOperation("setSchema");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Map<String, Class<?>> getTypeMap() {
- return Collections.emptyMap();
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void setTypeMap(Map<String, Class<?>> map) {
- if (!map.isEmpty()) {
- throw new UnsupportedOperationException("setTypeMap");
- }
- }
-
- /**
- * Returns {@code true} by default, assuming a driver without write capabilities.
- */
- @Override
- public boolean isReadOnly() {
- return true;
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void setReadOnly(boolean readOnly) {
- if (!readOnly) {
- throw new UnsupportedOperationException("setReadOnly");
- }
- }
-
- /**
- * Defaults to {@link #TRANSACTION_NONE}.
- */
- @Override
- public int getTransactionIsolation() {
- return TRANSACTION_NONE; // No guarantees of anything.
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void setTransactionIsolation(int level) {
- if (level != TRANSACTION_NONE) {
- throw new UnsupportedOperationException("setTransactionIsolation");
- }
- }
-
- /**
- * Defaults to {@code true}, assuming that auto-commit state is not handled.
- */
- @Override
- public boolean getAutoCommit() {
- return true;
- }
-
- /**
- * Defaults to ignoring the commit / rollback.
- * The auto-commit mode is assumed fixed to {@code true}.
- */
- @Override
- public void setAutoCommit(boolean autoCommit) {
- log(Level.FINE, "log.auto_commit_ignored", autoCommit);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void commit() {
- log(Level.FINE, "log.commit_rollback_ignored");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void rollback() {
- log(Level.FINE, "log.commit_rollback_ignored");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void rollback(Savepoint savepoint) throws SQLException {
- throw unsupportedOperation("rollback");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Savepoint setSavepoint() throws SQLException {
- throw unsupportedOperation("setSavepoint");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Savepoint setSavepoint(String name) throws SQLException {
- throw unsupportedOperation("setSavepoint");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void releaseSavepoint(Savepoint savepoint) throws SQLException {
- throw unsupportedOperation("releaseSavepoint");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public int getHoldability() throws SQLException {
- throw unsupportedOperation("getHoldability");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void setHoldability(int holdability) {
- logUnsupportedOperation("setHoldability");
- }
-
- /**
- * Returns the given string unchanged by default.
- */
- @Override
- public String nativeSQL(String sql) {
- return sql; // We do nothing at the moment.
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
- throw unsupportedOperation("createStatement");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
- throw unsupportedOperation("createStatement");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public PreparedStatement prepareStatement(String sql) throws SQLException {
- throw unsupportedOperation("prepareStatement");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
- throw unsupportedOperation("prepareStatement");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
- throw unsupportedOperation("prepareStatement");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
- throw unsupportedOperation("prepareCall");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
- throw unsupportedOperation("prepareStatement");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
- throw unsupportedOperation("prepareStatement");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
- throw unsupportedOperation("prepareStatement");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public CallableStatement prepareCall(String sql) throws SQLException {
- throw unsupportedOperation("prepareCall");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
- throw unsupportedOperation("prepareCall");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Clob createClob() throws SQLException {
- throw unsupportedOperation("createClob");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Blob createBlob() throws SQLException {
- throw unsupportedOperation("createBlob");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public NClob createNClob() throws SQLException {
- throw unsupportedOperation("createNClob");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public SQLXML createSQLXML() throws SQLException {
- throw unsupportedOperation("createSQLXML");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
- throw unsupportedOperation("createArrayOf");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
- throw unsupportedOperation("createStruct");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public String getClientInfo(String name) throws SQLException {
- throw unsupportedOperation("getClientInfo");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Properties getClientInfo() throws SQLException {
- throw unsupportedOperation("getClientInfo");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void setClientInfo(String name, String value) {
- logUnsupportedOperation("setClientInfo");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void setClientInfo(Properties properties) {
- logUnsupportedOperation("setClientInfo");
- }
-
- /**
- * Defaults to 0, which means there is no limit.
- */
- @Override
- public int getNetworkTimeout() {
- return 0; // Means there is no limt.
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void setNetworkTimeout(Executor executor, int milliseconds) {
- logUnsupportedOperation("setNetworkTimeout");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void abort(Executor executor) throws SQLException {
- throw unsupportedOperation("abort");
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/DBFConnection.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/DBFConnection.java
deleted file mode 100644
index cd60673..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/DBFConnection.java
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc.connection;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.sql.*;
-import java.util.*;
-import java.util.logging.Level;
-import java.util.stream.Collectors;
-
-import org.apache.sis.internal.shapefile.jdbc.*;
-import org.apache.sis.internal.shapefile.jdbc.metadata.DBFDatabaseMetaData;
-import org.apache.sis.internal.shapefile.jdbc.resultset.*;
-import org.apache.sis.internal.shapefile.jdbc.statement.DBFStatement;
-
-
-/**
- * Connection to a DBF database.
- * @author Marc Le Bihan
- * @version 0.5
- * @since 0.5
- * @module
- */
-public class DBFConnection extends AbstractConnection {
- /** The object to use for reading the database content. */
- final File databaseFile;
-
- /** Opened statement. */
- private HashSet<DBFStatement> openedStatements = new HashSet<>();
-
- /** ByteReader. */
- private Dbase3ByteReader byteReader;
-
- /**
- * Constructs a connection to the given database.
- * @param datafile Data file ({@code .dbf} extension).
- * @param br Byte reader to use for reading binary content.
- * @throws SQLDbaseFileNotFoundException if the Database file cannot be found or is not a file.
- */
- public DBFConnection(final File datafile, Dbase3ByteReader br) throws SQLDbaseFileNotFoundException {
- // Check that file exists.
- if (!datafile.exists()) {
- throw new SQLDbaseFileNotFoundException(format(Level.WARNING, "excp.file_not_found", datafile.getAbsolutePath()));
- }
-
- // Check that its not a directory.
- if (datafile.isDirectory()) {
- throw new SQLDbaseFileNotFoundException(format(Level.WARNING, "excp.directory_not_expected", datafile.getAbsolutePath()));
- }
-
- this.databaseFile = datafile;
- this.byteReader = br;
- log(Level.FINE, "log.database_connection_opened", this.databaseFile.getAbsolutePath(), "FIXME : column desc.");
- }
-
- /**
- * Closes the connection to the database.
- */
- @Override
- public void close() {
- if (isClosed())
- return;
-
- try {
- // Check if all the underlying connections that has been opened with this connection has been closed.
- // If not, we log a warning to help the developer.
- if (this.openedStatements.size() > 0) {
- log(Level.WARNING, "log.statements_left_opened", this.openedStatements.size(), this.openedStatements.stream().map(DBFStatement::toString).collect(Collectors.joining(", ")));
- }
-
- this.byteReader.close();
- } catch (IOException e) {
- log(Level.FINE, e.getMessage(), e);
- }
- }
-
- /**
- * Creates an object for sending SQL statements to the database.
- * @throws SQLConnectionClosedException if the connection is closed.
- */
- @Override
- public Statement createStatement() throws SQLConnectionClosedException {
- assertNotClosed();
-
- DBFStatement stmt = new DBFStatement(this);
- this.openedStatements.add(stmt);
- return stmt;
- }
-
- /**
- * @see java.sql.Connection#getCatalog()
- */
- @Override
- public String getCatalog() {
- return null; // DBase 3 offers no catalog.
- }
-
- /**
- * Returns the charset.
- * @return Charset.
- */
- public Charset getCharset() {
- return this.byteReader.getCharset();
- }
-
- /**
- * Returns the database File.
- * @return File.
- */
- @Override
- public File getFile() {
- return this.databaseFile;
- }
-
- /**
- * Returns the JDBC interface implemented by this class.
- * This is used for formatting error messages.
- */
- @Override
- final protected Class<?> getInterface() {
- return Connection.class;
- }
-
- /**
- * @see java.sql.Connection#getMetaData()
- */
- @Override
- public DatabaseMetaData getMetaData() {
- return new DBFDatabaseMetaData(this);
- }
-
- /**
- * Returns {@code true} if this connection has been closed.
- */
- @Override
- public boolean isClosed() {
- return this.byteReader.isClosed();
- }
-
- /**
- * Returns {@code true} if the connection has not been closed and is still valid.
- * The timeout parameter is ignored and this method bases itself only on {@link #isClosed()} state.
- */
- @Override
- public boolean isValid(@SuppressWarnings("unused") int timeout) {
- return !isClosed();
- }
-
- /**
- * @see java.sql.Wrapper#isWrapperFor(java.lang.Class)
- */
- @Override
- public boolean isWrapperFor(Class<?> iface) {
- return iface.isAssignableFrom(getInterface());
- }
-
- /**
- * Asserts that the connection is opened.
- * @throws SQLConnectionClosedException if the connection is closed.
- */
- public void assertNotClosed() throws SQLConnectionClosedException {
- // If closed throw an exception specifying the name if the DBF that is closed.
- if (isClosed()) {
- throw new SQLConnectionClosedException(format(Level.WARNING, "excp.closed_connection", getFile().getName()), null, getFile());
- }
- }
-
- /**
- * Method called by Statement class to notity this connection that a statement has been closed.
- * @param stmt Statement that has been closed.
- */
- public void notifyCloseStatement(DBFStatement stmt) {
- Objects.requireNonNull(stmt, "The statement notified being closed cannot be null.");
-
- if (this.openedStatements.remove(stmt) == false) {
- throw new RuntimeException(format(Level.SEVERE, "assert.statement_not_opened_by_me", stmt, toString()));
- }
- }
-
- /**
- * Returns the column index for the given column name.
- * The default implementation of all methods expecting a column label will invoke this method.
- * @param columnLabel The name of the column.
- * @param sql For information, the SQL statement that is attempted.
- * @return The index of the given column name : first column is 1.
- * @throws SQLNoSuchFieldException if there is no field with this name in the query.
- */
- public int findColumn(String columnLabel, String sql) throws SQLNoSuchFieldException {
- return this.byteReader.findColumn(columnLabel, sql);
- }
-
- /**
- * Returns the column count of the table of the database.
- * @return Column count.
- */
- public int getColumnCount() {
- return this.byteReader.getColumnCount();
- }
-
- /**
- * Get a field description.
- * @param columnLabel Column label.
- * @param sql SQL Statement.
- * @return ResultSet with current row set on the wished field.
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNoSuchFieldException if no column with that name exists.
- */
- public ResultSet getFieldDesc(String columnLabel, String sql) throws SQLConnectionClosedException, SQLNoSuchFieldException {
- Objects.requireNonNull(columnLabel, "The column name cannot be null.");
-
- DBFBuiltInMemoryResultSetForColumnsListing rs = (DBFBuiltInMemoryResultSetForColumnsListing)((DBFDatabaseMetaData)getMetaData()).getColumns(null, null, null, null);
-
- try {
- while(rs.next()) {
- try {
- if (rs.getString("COLUMN_NAME").equalsIgnoreCase(columnLabel)) {
- return rs;
- }
- }
- catch(SQLNoSuchFieldException e) {
- // if it is the COLUMN_NAME column that has not been found in the desc ResultSet, we have an internal error.
- rs.close();
- throw new RuntimeException(e.getMessage(), e);
- }
- }
- }
- catch(SQLNoResultException e) {
- // if we run out of bound of the ResultSet, the boolean returned by next() has not been checked well, and it's an internal error.
- rs.close();
- throw new RuntimeException(e.getMessage(), e);
- }
-
- // But if we are here, we have not found the column with this name, and we have to throw an SQLNoSuchFieldException exception ourselves.
- String message = format("excp.no_such_column_in_resultset", columnLabel, sql, getFile().getName());
- throw new SQLNoSuchFieldException(message, sql, getFile(), columnLabel);
- }
-
- /**
- * Get a field description.
- * @param column Column index.
- * @param sql SQL Statement.
- * @return ResultSet with current row set on the wished field.
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLIllegalColumnIndexException if the column index is out of bounds.
- */
- public ResultSet getFieldDesc(int column, String sql) throws SQLConnectionClosedException, SQLIllegalColumnIndexException {
- DBFBuiltInMemoryResultSetForColumnsListing rs = (DBFBuiltInMemoryResultSetForColumnsListing)((DBFDatabaseMetaData)getMetaData()).getColumns(null, null, null, null);
-
- if (column <= 0 || column > getColumnCount()) {
- rs.close();
- String message = format("excp.illegal_column_index_metadata", column, getColumnCount());
- throw new SQLIllegalColumnIndexException(message, sql, getFile(), column);
- }
-
- // TODO Implements ResultSet:absolute(int) instead.
- for(int index=1; index <= column; index ++) {
- try {
- rs.next();
- }
- catch(SQLNoResultException e) {
- // We encounter an internal API error in this case.
- rs.close();
- throw new RuntimeException(e.getMessage(), e);
- }
- }
-
- return rs;
- }
-
- /**
- * Returns the fields descriptors in their binary format.
- * @return Fields descriptors.
- */
- public List<DBase3FieldDescriptor> getFieldsDescriptors() {
- return this.byteReader.getFieldsDescriptors();
- }
-
- /**
- * Return a field name.
- * @param columnIndex Column index.
- * @param sql For information, the SQL statement that is attempted.
- * @return Field Name.
- * @throws SQLIllegalColumnIndexException if the index is out of bounds.
- */
- public String getFieldName(int columnIndex, String sql) throws SQLIllegalColumnIndexException {
- return this.byteReader.getFieldName(columnIndex, sql);
- }
-
- /**
- * Checks if a next row is available. Warning : it may be a deleted one.
- * @return true if a next row is available.
- */
- public boolean nextRowAvailable() {
- return this.byteReader.nextRowAvailable();
- }
-
- /**
- * Read the next row as a set of objects.
- * @return Map of field name / object value, or null if EoF has been encountered.
- */
- public Map<String, byte[]> readNextRowAsObjects() {
- return this.byteReader.readNextRowAsObjects();
- }
-
- /**
- * Returns the record number of the last record red.
- * @return The record number.
- */
- public int getRowNum() {
- return this.byteReader.getRowNum();
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return format("toString", this.databaseFile.getAbsolutePath(), isClosed() == false);
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/SQLClosingIOFailureException.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/SQLClosingIOFailureException.java
deleted file mode 100644
index e20e58c..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/SQLClosingIOFailureException.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc.connection;
-
-import java.io.File;
-import java.sql.SQLException;
-
-/**
- * Exception thrown when a connection cannot be closed due to an environement trouble.
- * @author Marc LE BIHAN
- */
-public class SQLClosingIOFailureException extends SQLException {
- /** Serial ID. */
- private static final long serialVersionUID = -3327372119927661463L;
-
- /** The SQL Statement that whas attempted (if known). */
- private String sql;
-
- /** The database file. */
- private File database;
-
- /**
- * Build the exception.
- * @param message Exception message.
- * @param sqlStatement SQL Statement who encountered the trouble, if known.
- * @param dbf The database that was queried.
- */
- public SQLClosingIOFailureException(String message, String sqlStatement, File dbf) {
- super(message);
- this.sql = sqlStatement;
- this.database = dbf;
- }
-
- /**
- * Returns the SQL statement who encountered the "connection closed" alert, if known.
- * @return SQL statement or null.
- */
- public String getSQL() {
- return this.sql;
- }
-
- /**
- * Returns the database file that is not opened for connection.
- * @return Database file.
- */
- public File getDatabase() {
- return this.database;
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/package-info.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/package-info.java
deleted file mode 100644
index e10322c..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/package-info.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/** Connections */
-package org.apache.sis.internal.shapefile.jdbc.connection;
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/AbstractDatabaseMetaData.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/AbstractDatabaseMetaData.java
deleted file mode 100644
index 91d0f0d..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/AbstractDatabaseMetaData.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc.metadata;
-
-import java.sql.*;
-
-import org.apache.sis.internal.shapefile.jdbc.AbstractJDBC;
-
-/**
- * Unimplemented methods of DatabaseMetaData.
- * @author Marc LE BIHAN
- */
-public abstract class AbstractDatabaseMetaData extends AbstractJDBC implements DatabaseMetaData {
- /**
- * @see java.sql.DatabaseMetaData#getAttributes(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
- */
- @Override public ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern, String attributeNamePattern) throws SQLException {
- throw unsupportedOperation("getAttributes", catalog, schemaPattern, typeNamePattern, attributeNamePattern);
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getBestRowIdentifier(java.lang.String, java.lang.String, java.lang.String, int, boolean)
- */
- @Override public ResultSet getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) throws SQLException {
- throw unsupportedOperation("getBestRowIdentifier", catalog, schema, table, scope, nullable);
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getClientInfoProperties()
- */
- @Override public ResultSet getClientInfoProperties() throws SQLException {
- throw unsupportedOperation("getClientInfoProperties");
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getColumnPrivileges(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
- */
- @Override public ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) throws SQLException {
- throw unsupportedOperation("getColumnPrivileges", catalog, schema, table, columnNamePattern);
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getCrossReference(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
- */
- @Override public ResultSet getCrossReference(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable) throws SQLException {
- throw unsupportedOperation("getCrossReference", parentCatalog, parentSchema, parentTable, foreignCatalog, foreignSchema, foreignTable);
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getExportedKeys(java.lang.String, java.lang.String, java.lang.String)
- */
- @Override public ResultSet getExportedKeys(String catalog, String schema, String table) throws SQLException {
- throw unsupportedOperation("getExportedKeys", catalog, schema, table);
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getFunctions(java.lang.String, java.lang.String, java.lang.String)
- */
- @Override public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException {
- throw unsupportedOperation("getFunctions", catalog, schemaPattern, functionNamePattern);
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getFunctionColumns(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
- */
- @Override public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) throws SQLException {
- throw unsupportedOperation("getFunctionColumns", catalog, schemaPattern, functionNamePattern, columnNamePattern);
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getIndexInfo(java.lang.String, java.lang.String, java.lang.String, boolean, boolean)
- */
- @Override public ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) throws SQLException {
- throw unsupportedOperation("getIndexInfo", catalog, schema, table, unique, approximate);
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getImportedKeys(java.lang.String, java.lang.String, java.lang.String)
- */
- @Override public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException {
- throw unsupportedOperation("getImportedKeys", catalog, schema, table);
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getPrimaryKeys(java.lang.String, java.lang.String, java.lang.String)
- */
- @Override public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException {
- throw unsupportedOperation("getPrimaryKeys", catalog, schema, table);
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getProcedures(java.lang.String, java.lang.String, java.lang.String)
- */
- @Override public ResultSet getProcedures(String catalog, String schemaPattern, String procedureNamePattern) throws SQLException {
- throw unsupportedOperation("getProcedures", catalog, schemaPattern, procedureNamePattern);
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getProcedureColumns(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
- */
- @Override public ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) throws SQLException{
- throw unsupportedOperation("getProcedureColumns", catalog, schemaPattern, procedureNamePattern, columnNamePattern);
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getPseudoColumns(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
- */
- @Override public ResultSet getPseudoColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException {
- throw unsupportedOperation("getPseudoColumns", catalog, schemaPattern, tableNamePattern, columnNamePattern);
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getRowIdLifetime()
- */
- @Override public RowIdLifetime getRowIdLifetime() throws SQLException {
- throw unsupportedOperation("getRowIdLifetime");
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getSchemas(java.lang.String, java.lang.String)
- */
- @Override public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException {
- throw unsupportedOperation("getSchemas", catalog, schemaPattern);
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getSearchStringEscape()
- */
- @Override public String getSearchStringEscape() throws SQLException {
- throw unsupportedOperation("getSearchStringEscape");
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getSQLStateType()
- */
- @Override public int getSQLStateType() throws SQLException {
- throw unsupportedOperation("getSQLStateType");
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getSuperTypes(java.lang.String, java.lang.String, java.lang.String)
- */
- @Override public ResultSet getSuperTypes(String catalog, String schemaPattern, String typeNamePattern) throws SQLException {
- throw unsupportedOperation("getSuperTypes", catalog, schemaPattern, typeNamePattern);
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getSuperTables(java.lang.String, java.lang.String, java.lang.String)
- */
- @Override public ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern) throws SQLException {
- throw unsupportedOperation("getSuperTables", catalog, schemaPattern, tableNamePattern);
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getTablePrivileges(java.lang.String, java.lang.String, java.lang.String)
- */
- @Override public ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws SQLException {
- throw unsupportedOperation("getTablePrivileges", catalog, schemaPattern, tableNamePattern);
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getTypeInfo()
- */
- @Override public ResultSet getTypeInfo() throws SQLException {
- throw unsupportedOperation("getTypeInfo");
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getUDTs(java.lang.String, java.lang.String, java.lang.String, int[])
- */
- @Override public ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) throws SQLException {
- throw unsupportedOperation("getUDTs", catalog, schemaPattern, typeNamePattern, types);
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getVersionColumns(java.lang.String, java.lang.String, java.lang.String)
- */
- @Override public ResultSet getVersionColumns(String catalog, String schema, String table) throws SQLException {
- throw unsupportedOperation("getVersionColumns", catalog, schema, table);
- }
-
- /**
- * @see org.apache.sis.internal.shapefile.jdbc.AbstractJDBC#unwrap(java.lang.Class)
- */
- @Override public <T> T unwrap(Class<T> iface) throws SQLFeatureNotSupportedException {
- throw unsupportedOperation("unwrap", iface);
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/DBFDatabaseMetaData.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/DBFDatabaseMetaData.java
deleted file mode 100644
index 931ed87..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/DBFDatabaseMetaData.java
+++ /dev/null
@@ -1,1300 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc.metadata;
-
-import java.io.File;
-import java.sql.*;
-import java.util.Arrays;
-import java.util.Objects;
-
-import org.apache.sis.internal.shapefile.jdbc.SQLConnectionClosedException;
-import org.apache.sis.internal.shapefile.jdbc.connection.DBFConnection;
-import org.apache.sis.internal.shapefile.jdbc.resultset.*;
-import org.apache.sis.internal.shapefile.jdbc.statement.DBFStatement;
-
-/**
- * Database Metadata.
- * @author Marc LE BIHAN
- */
-public class DBFDatabaseMetaData extends AbstractDatabaseMetaData {
- /** Connection. */
- private DBFConnection connection;
-
- /**
- * Construct a database Metadata.
- * @param cnt Connection.
- */
- public DBFDatabaseMetaData(DBFConnection cnt) {
- Objects.requireNonNull(cnt, "The database connection used to create Database metadata cannot be null.");
- this.connection = cnt;
- }
-
- /**
- * @see org.apache.sis.internal.shapefile.jdbc.AbstractJDBC#isWrapperFor(java.lang.Class)
- */
- @Override public boolean isWrapperFor(Class<?> iface) {
- logStep("isWrapperFor", iface);
- return getInterface().isAssignableFrom(iface);
- }
-
- /**
- * @see java.sql.DatabaseMetaData#allProceduresAreCallable()
- */
- @Override public boolean allProceduresAreCallable() {
- logStep("allProceduresAreCallable");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#allTablesAreSelectable()
- */
- @Override public boolean allTablesAreSelectable() {
- logStep("allTablesAreSelectable");
- return true;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getColumns(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
- * @throws SQLConnectionClosedException if the connection is closed.
- */
- @Override
- public ResultSet getColumns(@SuppressWarnings("unused") String catalog, @SuppressWarnings("unused") String schemaPattern, @SuppressWarnings("unused") String tableNamePattern, @SuppressWarnings("unused") String columnNamePattern) throws SQLConnectionClosedException {
- try(DBFStatement stmt = (DBFStatement)this.connection.createStatement()) {
- return new DBFBuiltInMemoryResultSetForColumnsListing(stmt, this.connection.getFieldsDescriptors());
- }
- }
-
- /**
- * Returns the Database File.
- * @return Database File.
- */
- @Override
- public File getFile() {
- return this.connection.getFile();
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getURL()
- */
- @Override public String getURL() {
- logStep("getURL");
- return getFile().getAbsolutePath();
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getUserName()
- */
- @Override public String getUserName() {
- logStep("getUserName");
- return null;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#isReadOnly()
- */
- @Override public boolean isReadOnly() {
- logStep("isReadOnly");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#nullsAreSortedHigh()
- */
- @Override public boolean nullsAreSortedHigh() {
- logStep("nullsAreSortedHigh");
- return false; // TODO : Check in documentation about this.
- }
-
- /**
- * @see java.sql.DatabaseMetaData#nullsAreSortedLow()
- */
- @Override public boolean nullsAreSortedLow() {
- logStep("nullsAreSortedLow");
- return false; // TODO : Check in documentation about this.
- }
-
- /**
- * @see java.sql.DatabaseMetaData#nullsAreSortedAtStart()
- */
- @Override public boolean nullsAreSortedAtStart() {
- logStep("nullsAreSortedAtStart");
- return false; // TODO : Check in documentation about this.
- }
-
- /**
- * @see java.sql.DatabaseMetaData#nullsAreSortedAtEnd()
- */
- @Override public boolean nullsAreSortedAtEnd() {
- logStep("nullsAreSortedAtEnd");
- return false; // TODO : Check in documentation about this.
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getDatabaseProductName()
- */
- @Override public String getDatabaseProductName() {
- logStep("getDatabaseProductName");
- return "DBase 3";
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getDatabaseProductVersion()
- */
- @Override public String getDatabaseProductVersion() {
- logStep("getDatabaseProductVersion");
- return "3";
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getDriverName()
- */
- @Override public String getDriverName() {
- logStep("getDriverName");
- return "Apache SIS DBase 3 JDBC driver";
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getDriverVersion()
- */
- @Override public String getDriverVersion() {
- logStep("getDriverVersion");
- return "1.0";
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getDriverMajorVersion()
- */
- @Override public int getDriverMajorVersion() {
- logStep("getDriverMajorVersion");
- return 1;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getDriverMinorVersion()
- */
- @Override public int getDriverMinorVersion() {
- logStep("getDriverMinorVersion");
- return 0;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#usesLocalFiles()
- */
- @Override public boolean usesLocalFiles() {
- logStep("usesLocalFiles");
- return true;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#usesLocalFilePerTable()
- */
- @Override public boolean usesLocalFilePerTable() {
- logStep("usesLocalFilePerTable");
- return true;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsMixedCaseIdentifiers()
- */
- @Override public boolean supportsMixedCaseIdentifiers() {
- logStep("supportsMixedCaseIdentifiers");
- return true;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#storesUpperCaseIdentifiers()
- */
- @Override public boolean storesUpperCaseIdentifiers() {
- logStep("storesUpperCaseIdentifiers");
- return true;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#storesLowerCaseIdentifiers()
- */
- @Override public boolean storesLowerCaseIdentifiers() {
- logStep("storesLowerCaseIdentifiers");
- return true;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#storesMixedCaseIdentifiers()
- */
- @Override public boolean storesMixedCaseIdentifiers() {
- logStep("storesMixedCaseIdentifiers");
- return true;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsMixedCaseQuotedIdentifiers()
- */
- @Override public boolean supportsMixedCaseQuotedIdentifiers() {
- logStep("supportsMixedCaseQuotedIdentifiers");
- return true;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#storesUpperCaseQuotedIdentifiers()
- */
- @Override public boolean storesUpperCaseQuotedIdentifiers() {
- logStep("storesUpperCaseQuotedIdentifiers");
- return true;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#storesLowerCaseQuotedIdentifiers()
- */
- @Override public boolean storesLowerCaseQuotedIdentifiers() {
- logStep("storesLowerCaseQuotedIdentifiers");
- return true;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#storesMixedCaseQuotedIdentifiers()
- */
- @Override public boolean storesMixedCaseQuotedIdentifiers() {
- logStep("storesMixedCaseQuotedIdentifiers");
- return true;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getIdentifierQuoteString()
- */
- @Override public String getIdentifierQuoteString() {
- logStep("getIdentifierQuoteString");
- return " ";
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getSQLKeywords()
- */
- @Override public String getSQLKeywords() {
- logStep("getSQLKeywords");
- return ""; // We don't have special Keywords yet.
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getNumericFunctions()
- */
- @Override public String getNumericFunctions() {
- logStep("getNumericFunctions");
- return "";
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getStringFunctions()
- */
- @Override public String getStringFunctions() {
- logStep("getStringFunctions");
- return "";
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getSystemFunctions()
- */
- @Override public String getSystemFunctions() {
- logStep("getSystemFunctions");
- return "";
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getTimeDateFunctions()
- */
- @Override public String getTimeDateFunctions() {
- logStep("getTimeDateFunctions");
- return "";
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getExtraNameCharacters()
- */
- @Override public String getExtraNameCharacters() {
- logStep("getExtraNameCharacters");
- return "";
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsAlterTableWithAddColumn()
- */
- @Override public boolean supportsAlterTableWithAddColumn() {
- logStep("supportsAlterTableWithAddColumn");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsAlterTableWithDropColumn()
- */
- @Override public boolean supportsAlterTableWithDropColumn() {
- logStep("supportsAlterTableWithDropColumn");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsColumnAliasing()
- */
- @Override public boolean supportsColumnAliasing() {
- logStep("supportsColumnAliasing");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#nullPlusNonNullIsNull()
- */
- @Override public boolean nullPlusNonNullIsNull() {
- logStep("nullPlusNonNullIsNull");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsConvert()
- */
- @Override public boolean supportsConvert() {
- logStep("supportsConvert");
- return false; // We can promote internally types, but not offer the keyword.
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsConvert(int, int)
- */
- @Override public boolean supportsConvert(int fromType, int toType) {
- logStep("supportsConvert", fromType, toType);
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsTableCorrelationNames()
- */
- @Override public boolean supportsTableCorrelationNames() {
- logStep("supportsTableCorrelationNames");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsDifferentTableCorrelationNames()
- */
- @Override public boolean supportsDifferentTableCorrelationNames() {
- logStep("supportsDifferentTableCorrelationNames");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsExpressionsInOrderBy()
- */
- @Override public boolean supportsExpressionsInOrderBy() {
- logStep("supportsExpressionsInOrderBy");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsOrderByUnrelated()
- */
- @Override public boolean supportsOrderByUnrelated() {
- logStep("supportsOrderByUnrelated");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsGroupBy()
- */
- @Override public boolean supportsGroupBy() {
- logStep("supportsGroupBy");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsGroupByUnrelated()
- */
- @Override public boolean supportsGroupByUnrelated() {
- logStep("supportsGroupByUnrelated");
- return false;
- }
- /**
- * @see java.sql.DatabaseMetaData#supportsGroupByBeyondSelect()
- */
- @Override public boolean supportsGroupByBeyondSelect() {
- logStep("supportsGroupByBeyondSelect");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsLikeEscapeClause()
- */
- @Override public boolean supportsLikeEscapeClause() {
- logStep("supportsLikeEscapeClause");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsMultipleResultSets()
- */
- @Override public boolean supportsMultipleResultSets() {
- logStep("supportsMultipleResultSets");
- return false; // Even if the code allow creating multiple ResultSet from a statement.
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsMultipleTransactions()
- */
- @Override public boolean supportsMultipleTransactions() {
- logStep("supportsMultipleTransactions");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsNonNullableColumns()
- */
- @Override public boolean supportsNonNullableColumns() {
- logStep("supportsNonNullableColumns");
- return false; // TODO Check in documentation.
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsMinimumSQLGrammar()
- */
- @Override public boolean supportsMinimumSQLGrammar() {
- logStep("supportsMinimumSQLGrammar");
- return false; // Check what is the ODBC SQL minimum grammar.
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsCoreSQLGrammar()
- */
- @Override public boolean supportsCoreSQLGrammar() {
- logStep("supportsCoreSQLGrammar");
- return false; // Check what is the core SQL grammar.
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsExtendedSQLGrammar()
- */
- @Override public boolean supportsExtendedSQLGrammar() {
- logStep("supportsExtendedSQLGrammar");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsANSI92EntryLevelSQL()
- */
- @Override public boolean supportsANSI92EntryLevelSQL() {
- logStep("supportsANSI92EntryLevelSQL");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsANSI92IntermediateSQL()
- */
- @Override public boolean supportsANSI92IntermediateSQL() {
- logStep("supportsANSI92IntermediateSQL");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsANSI92FullSQL()
- */
- @Override public boolean supportsANSI92FullSQL() {
- logStep("supportsANSI92FullSQL");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsIntegrityEnhancementFacility()
- */
- @Override public boolean supportsIntegrityEnhancementFacility() {
- logStep("supportsIntegrityEnhancementFacility");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsOuterJoins()
- */
- @Override public boolean supportsOuterJoins() {
- logStep("supportsOuterJoins");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsFullOuterJoins()
- */
- @Override public boolean supportsFullOuterJoins() {
- logStep("supportsFullOuterJoins");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsLimitedOuterJoins()
- */
- @Override public boolean supportsLimitedOuterJoins() {
- logStep("supportsLimitedOuterJoins");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getSchemaTerm()
- */
- @Override public String getSchemaTerm() {
- logStep("getSchemaTerm");
- return "";
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getProcedureTerm()
- */
- @Override public String getProcedureTerm() {
- logStep("getProcedureTerm");
- return "";
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getCatalogTerm()
- */
- @Override public String getCatalogTerm() {
- logStep("getCatalogTerm");
- return "";
- }
-
- /**
- * @see java.sql.DatabaseMetaData#isCatalogAtStart()
- */
- @Override public boolean isCatalogAtStart() {
- logStep("isCatalogAtStart");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getCatalogSeparator()
- */
- @Override public String getCatalogSeparator() {
- logStep("getCatalogSeparator");
- return "";
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsSchemasInDataManipulation()
- */
- @Override public boolean supportsSchemasInDataManipulation() {
- logStep("supportsSchemasInDataManipulation");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsSchemasInProcedureCalls()
- */
- @Override public boolean supportsSchemasInProcedureCalls() {
- logStep("supportsSchemasInProcedureCalls");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsSchemasInTableDefinitions()
- */
- @Override public boolean supportsSchemasInTableDefinitions() {
- logStep("supportsSchemasInTableDefinitions");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsSchemasInIndexDefinitions()
- */
- @Override public boolean supportsSchemasInIndexDefinitions() {
- logStep("supportsSchemasInIndexDefinitions");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsSchemasInPrivilegeDefinitions()
- */
- @Override public boolean supportsSchemasInPrivilegeDefinitions() {
- logStep("supportsSchemasInPrivilegeDefinitions");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsCatalogsInDataManipulation()
- */
- @Override public boolean supportsCatalogsInDataManipulation() {
- logStep("supportsCatalogsInDataManipulation");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsCatalogsInProcedureCalls()
- */
- @Override public boolean supportsCatalogsInProcedureCalls() {
- logStep("supportsCatalogsInProcedureCalls");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsCatalogsInTableDefinitions()
- */
- @Override public boolean supportsCatalogsInTableDefinitions() {
- logStep("supportsCatalogsInTableDefinitions");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsCatalogsInIndexDefinitions()
- */
- @Override public boolean supportsCatalogsInIndexDefinitions() {
- logStep("supportsCatalogsInIndexDefinitions");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsCatalogsInPrivilegeDefinitions()
- */
- @Override public boolean supportsCatalogsInPrivilegeDefinitions() {
- logStep("supportsCatalogsInPrivilegeDefinitions");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsPositionedDelete()
- */
- @Override public boolean supportsPositionedDelete() {
- logStep("supportsPositionedDelete");
- return false; // TODO not yet, but might later.
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsPositionedUpdate()
- */
- @Override public boolean supportsPositionedUpdate() {
- logStep("supportsPositionedUpdate");
- return false; // TODO not yet, but might later.
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsSelectForUpdate()
- */
- @Override public boolean supportsSelectForUpdate() {
- logStep("supportsSelectForUpdate");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsStoredProcedures()
- */
- @Override public boolean supportsStoredProcedures() {
- logStep("supportsStoredProcedures");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsSubqueriesInComparisons()
- */
- @Override public boolean supportsSubqueriesInComparisons() {
- logStep("supportsStoredProcedures");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsSubqueriesInExists()
- */
- @Override public boolean supportsSubqueriesInExists() {
- logStep("supportsSubqueriesInExists");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsSubqueriesInIns()
- */
- @Override public boolean supportsSubqueriesInIns() {
- logStep("supportsSubqueriesInIns");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsSubqueriesInQuantifieds()
- */
- @Override public boolean supportsSubqueriesInQuantifieds() {
- logStep("supportsSubqueriesInQuantifieds");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsCorrelatedSubqueries()
- */
- @Override public boolean supportsCorrelatedSubqueries() {
- logStep("supportsCorrelatedSubqueries");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsUnion()
- */
- @Override public boolean supportsUnion() {
- logStep("supportsUnion");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsUnionAll()
- */
- @Override public boolean supportsUnionAll() {
- logStep("supportsUnionAll");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsOpenCursorsAcrossCommit()
- */
- @Override public boolean supportsOpenCursorsAcrossCommit() {
- logStep("supportsOpenCursorsAcrossCommit");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsOpenCursorsAcrossRollback()
- */
- @Override public boolean supportsOpenCursorsAcrossRollback() {
- logStep("supportsOpenCursorsAcrossRollback");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsOpenStatementsAcrossCommit()
- */
- @Override public boolean supportsOpenStatementsAcrossCommit() {
- logStep("supportsOpenStatementsAcrossCommit");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsOpenStatementsAcrossRollback()
- */
- @Override public boolean supportsOpenStatementsAcrossRollback() {
- logStep("supportsOpenStatementsAcrossRollback");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getMaxBinaryLiteralLength()
- */
- @Override public int getMaxBinaryLiteralLength() {
- logStep("getMaxBinaryLiteralLength");
- return 0;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getMaxCharLiteralLength()
- */
- @Override public int getMaxCharLiteralLength() {
- logStep("getMaxCharLiteralLength");
- return 254;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getMaxColumnNameLength()
- */
- @Override public int getMaxColumnNameLength() {
- logStep("getMaxColumnNameLength");
- return 10;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getMaxColumnsInGroupBy()
- */
- @Override public int getMaxColumnsInGroupBy() {
- logStep("getMaxColumnsInGroupBy");
- return 0;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getMaxColumnsInIndex()
- */
- @Override public int getMaxColumnsInIndex() {
- logStep("getMaxColumnsInIndex");
- return 0;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getMaxColumnsInOrderBy()
- */
- @Override public int getMaxColumnsInOrderBy() {
- logStep("getMaxColumnsInOrderBy");
- return 0;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getMaxColumnsInSelect()
- */
- @Override public int getMaxColumnsInSelect() {
- logStep("getMaxColumnsInSelect");
- return 0;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getMaxColumnsInTable()
- */
- @Override public int getMaxColumnsInTable() {
- logStep("getMaxColumnsInTable");
- return 0;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getMaxConnections()
- */
- @Override public int getMaxConnections() {
- logStep("getMaxConnections");
- return 0;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getMaxCursorNameLength()
- */
- @Override public int getMaxCursorNameLength() {
- logStep("getMaxCursorNameLength");
- return 0;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getMaxIndexLength()
- */
- @Override public int getMaxIndexLength() {
- logStep("getMaxIndexLength");
- return 0;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getMaxSchemaNameLength()
- */
- @Override public int getMaxSchemaNameLength() {
- logStep("getMaxSchemaNameLength");
- return 0;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getMaxProcedureNameLength()
- */
- @Override public int getMaxProcedureNameLength() {
- logStep("getMaxProcedureNameLength");
- return 0;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getMaxCatalogNameLength()
- */
- @Override public int getMaxCatalogNameLength() {
- logStep("getMaxCatalogNameLength");
- return 0;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getMaxRowSize()
- */
- @Override public int getMaxRowSize() {
- logStep("getMaxRowSize");
- return 0;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#doesMaxRowSizeIncludeBlobs()
- */
- @Override public boolean doesMaxRowSizeIncludeBlobs() {
- logStep("doesMaxRowSizeIncludeBlobs");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getMaxStatementLength()
- */
- @Override public int getMaxStatementLength() {
- logStep("getMaxStatementLength");
- return 0;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getMaxStatements()
- */
- @Override public int getMaxStatements() {
- logStep("getMaxStatements");
- return 0;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getMaxTableNameLength()
- */
- @Override public int getMaxTableNameLength() {
- logStep("getMaxTableNameLength");
- return 0;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getMaxTablesInSelect()
- */
- @Override public int getMaxTablesInSelect() {
- logStep("getMaxTablesInSelect");
- return 1; // We only handle one table at this time.
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getMaxUserNameLength()
- */
- @Override public int getMaxUserNameLength() {
- logStep("getMaxUserNameLength");
- return 0;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getDefaultTransactionIsolation()
- */
- @Override public int getDefaultTransactionIsolation() {
- logStep("getDefaultTransactionIsolation");
- return 0; // No guaranties of anything.
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsTransactions()
- */
- @Override public boolean supportsTransactions() {
- logStep("supportsTransactions");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsTransactionIsolationLevel(int)
- */
- @Override public boolean supportsTransactionIsolationLevel(int level) {
- logStep("supportsTransactionIsolationLevel", level);
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsDataDefinitionAndDataManipulationTransactions()
- */
- @Override public boolean supportsDataDefinitionAndDataManipulationTransactions() {
- logStep("supportsDataDefinitionAndDataManipulationTransactions");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsDataManipulationTransactionsOnly()
- */
- @Override public boolean supportsDataManipulationTransactionsOnly() {
- logStep("supportsDataManipulationTransactionsOnly");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#dataDefinitionCausesTransactionCommit()
- */
- @Override public boolean dataDefinitionCausesTransactionCommit() {
- logStep("dataDefinitionCausesTransactionCommit");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#dataDefinitionIgnoredInTransactions()
- */
- @Override public boolean dataDefinitionIgnoredInTransactions() {
- logStep("dataDefinitionIgnoredInTransactions");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getTables(java.lang.String, java.lang.String, java.lang.String, java.lang.String[])
- */
- @SuppressWarnings("resource") // The statement will be closed by the caller.
- @Override public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) {
- logStep("getTables", catalog, schemaPattern, tableNamePattern, types != null ? Arrays.asList(types) : null);
-
- DBFStatement stmt = new DBFStatement(this.connection);
- DBFBuiltInMemoryResultSetForTablesListing tables = new DBFBuiltInMemoryResultSetForTablesListing(stmt);
- stmt.registerResultSet(tables);
- return tables;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getSchemas()
- */
- @SuppressWarnings("resource") // The statement will be closed by the caller.
- @Override public ResultSet getSchemas() {
- logStep("getSchemas");
-
- DBFStatement stmt = new DBFStatement(this.connection);
- DBFBuiltInMemoryResultSetForSchemaListing schemas = new DBFBuiltInMemoryResultSetForSchemaListing(stmt);
- stmt.registerResultSet(schemas);
- return schemas;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getCatalogs()
- */
- @SuppressWarnings("resource") // The statement will be closed by the caller.
- @Override public ResultSet getCatalogs() {
- logStep("getCatalogs");
-
- DBFStatement stmt = new DBFStatement(this.connection);
- DBFBuiltInMemoryResultSetForCatalogNamesListing catalogNames = new DBFBuiltInMemoryResultSetForCatalogNamesListing(stmt);
- stmt.registerResultSet(catalogNames);
- return catalogNames;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getTableTypes()
- */
- @SuppressWarnings("resource") // The statement will be closed by the caller.
- @Override public ResultSet getTableTypes() {
- logStep("getTableTypes");
-
- DBFStatement stmt = new DBFStatement(this.connection);
- DBFBuiltInMemoryResultSetForTablesTypesListing tablesTypes = new DBFBuiltInMemoryResultSetForTablesTypesListing(stmt);
- stmt.registerResultSet(tablesTypes);
- return tablesTypes;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsResultSetType(int)
- */
- @Override public boolean supportsResultSetType(int type) {
- logStep("supportsResultSetType", type);
-
- switch(type) {
- case ResultSet.FETCH_FORWARD:
- case ResultSet.FETCH_UNKNOWN:
- case ResultSet.TYPE_FORWARD_ONLY:
- return true;
-
- default :
- return false;
- }
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsResultSetConcurrency(int, int)
- */
- @Override public boolean supportsResultSetConcurrency(int type, int concurrency) {
- logStep("supportsResultSetConcurrency", type, concurrency);
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#ownUpdatesAreVisible(int)
- */
- @Override public boolean ownUpdatesAreVisible(int type) {
- logStep("ownUpdatesAreVisible", type);
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#ownDeletesAreVisible(int)
- */
- @Override public boolean ownDeletesAreVisible(int type) {
- logStep("ownDeletesAreVisible", type);
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#ownInsertsAreVisible(int)
- */
- @Override public boolean ownInsertsAreVisible(int type) {
- logStep("ownInsertsAreVisible", type);
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#othersUpdatesAreVisible(int)
- */
- @Override public boolean othersUpdatesAreVisible(int type) {
- logStep("othersUpdatesAreVisible", type);
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#othersDeletesAreVisible(int)
- */
- @Override public boolean othersDeletesAreVisible(int type) {
- logStep("othersDeletesAreVisible", type);
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#othersInsertsAreVisible(int)
- */
- @Override public boolean othersInsertsAreVisible(int type) {
- logStep("othersInsertsAreVisible", type);
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#updatesAreDetected(int)
- */
- @Override public boolean updatesAreDetected(int type) {
- logStep("updatesAreDetected", type);
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#deletesAreDetected(int)
- */
- @Override public boolean deletesAreDetected(int type) {
- logStep("deletesAreDetected", type);
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#insertsAreDetected(int)
- */
- @Override public boolean insertsAreDetected(int type) {
- logStep("insertsAreDetected", type);
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsBatchUpdates()
- */
- @Override public boolean supportsBatchUpdates() {
- logStep("supportsBatchUpdates");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getConnection()
- */
- @Override public Connection getConnection() {
- logStep("getConnection");
- return this.connection;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsSavepoints()
- */
- @Override public boolean supportsSavepoints() {
- logStep("supportsSavepoints");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsNamedParameters()
- */
- @Override public boolean supportsNamedParameters() {
- logStep("supportsNamedParameters");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsMultipleOpenResults()
- */
- @Override public boolean supportsMultipleOpenResults() {
- logStep("supportsMultipleOpenResults");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsGetGeneratedKeys()
- */
- @Override public boolean supportsGetGeneratedKeys() {
- logStep("supportsGetGeneratedKeys");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsResultSetHoldability(int)
- */
- @Override public boolean supportsResultSetHoldability(int holdability) {
- logStep("supportsResultSetHoldability", holdability);
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getResultSetHoldability()
- */
- @Override public int getResultSetHoldability() {
- logStep("getResultSetHoldability");
- return ResultSet.HOLD_CURSORS_OVER_COMMIT; // TODO : No matters, as we don't handle transactions.
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getDatabaseMajorVersion()
- */
- @Override public int getDatabaseMajorVersion() {
- logStep("getDatabaseMajorVersion");
- return 3;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getDatabaseMinorVersion()
- */
- @Override public int getDatabaseMinorVersion() {
- logStep("getDatabaseMinorVersion");
- return 0;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getJDBCMajorVersion()
- */
- @Override public int getJDBCMajorVersion() {
- logStep("getJDBCMajorVersion");
- return 1;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#getJDBCMinorVersion()
- */
- @Override public int getJDBCMinorVersion() {
- logStep("getJDBCMinorVersion");
- return 0;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#locatorsUpdateCopy()
- */
- @Override public boolean locatorsUpdateCopy() {
- logStep("locatorsUpdateCopy");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsStatementPooling()
- */
- @Override public boolean supportsStatementPooling() {
- logStep("supportsStatementPooling");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#supportsStoredFunctionsUsingCallSyntax()
- */
- @Override public boolean supportsStoredFunctionsUsingCallSyntax() {
- logStep("supportsStoredFunctionsUsingCallSyntax");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#autoCommitFailureClosesAllResultSets()
- */
- @Override public boolean autoCommitFailureClosesAllResultSets() {
- logStep("autoCommitFailureClosesAllResultSets");
- return false;
- }
-
- /**
- * @see java.sql.DatabaseMetaData#generatedKeyAlwaysReturned()
- */
- @Override public boolean generatedKeyAlwaysReturned() {
- logStep("generatedKeyAlwaysReturned");
- return false;
- }
-
- /**
- * @see org.apache.sis.internal.shapefile.jdbc.AbstractJDBC#getInterface()
- */
- @Override protected Class<?> getInterface() {
- return DatabaseMetaData.class;
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/DBFResultSetMataData.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/DBFResultSetMataData.java
deleted file mode 100644
index f3ae694..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/DBFResultSetMataData.java
+++ /dev/null
@@ -1,473 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc.metadata;
-
-import java.io.File;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
-import java.util.Objects;
-import java.util.logging.Level;
-
-import org.apache.sis.internal.shapefile.jdbc.AbstractJDBC;
-import org.apache.sis.internal.shapefile.jdbc.SQLConnectionClosedException;
-import org.apache.sis.internal.shapefile.jdbc.connection.DBFConnection;
-import org.apache.sis.internal.shapefile.jdbc.statement.DBFStatement;
-import org.apache.sis.internal.shapefile.jdbc.resultset.*;
-
-/**
- * ResultSet Metadata.
- * @author Marc LE BIHAN
- */
-public class DBFResultSetMataData extends AbstractJDBC implements ResultSetMetaData {
- /** ResultSet. */
- private DBFRecordBasedResultSet rs;
-
- /** Database metadata. */
- private DBFDatabaseMetaData metadata;
-
- /**
- * Construct a ResultSetMetaData.
- * @param resultset ResultSet.
- */
- public DBFResultSetMataData(DBFRecordBasedResultSet resultset) {
- Objects.requireNonNull(resultset, "A non null ResultSet is required.");
- this.rs = resultset;
-
- try {
- this.metadata = (DBFDatabaseMetaData)resultset.getStatement().getConnection().getMetaData();
- }
- catch(SQLException e) {
- throw new RuntimeException(e.getMessage(), e);
- }
- }
-
- /**
- * @see java.sql.Wrapper#unwrap(java.lang.Class)
- */
- @Override public <T> T unwrap(Class<T> iface) throws SQLFeatureNotSupportedException {
- throw unsupportedOperation("unwrap", iface);
- }
-
- /**
- * @see java.sql.Wrapper#isWrapperFor(java.lang.Class)
- */
- @Override
- public boolean isWrapperFor(Class<?> iface) {
- logStep("isWrapperFor", iface);
- return iface.isAssignableFrom(getInterface());
- }
-
- /**
- * @see java.sql.ResultSetMetaData#getColumnCount()
- * @throws SQLConnectionClosedException if the connection is closed.
- */
- @SuppressWarnings("resource") // The current connection is only used and has not to be closed.
- @Override public int getColumnCount() throws SQLConnectionClosedException {
- logStep("getColumnCount");
- DBFConnection cnt = (DBFConnection)(((DBFStatement)this.rs.getStatement()).getConnection());
-
- return cnt.getColumnCount();
- }
-
- /**
- * @see java.sql.ResultSetMetaData#isAutoIncrement(int)
- * @throws SQLIllegalColumnIndexException if the column index is illegal.
- * @throws SQLConnectionClosedException if the connection is closed.
- */
- @Override public boolean isAutoIncrement(int column) throws SQLIllegalColumnIndexException, SQLConnectionClosedException {
- logStep("isAutoIncrement", column);
-
- try(DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = desc(column)) {
- return rsDatabase.getString("TYPE_NAME").equals("AUTO_INCREMENT");
- }
- catch(SQLNoSuchFieldException e) {
- // We encounter an internal API error in this case.
- String message = format(Level.SEVERE, "assert.expected_databasemetadata_not_found", "TYPE_NAME", e.getMessage());
- throw new RuntimeException(message, e);
- }
- }
-
- /**
- * @see java.sql.ResultSetMetaData#isCaseSensitive(int)
- */
- @Override public boolean isCaseSensitive(int column) {
- logStep("isCaseSensitive", column);
- return true; // Yes, because behind, there's a HashMap.
- }
-
- /**
- * @see java.sql.ResultSetMetaData#isSearchable(int)
- */
- @Override public boolean isSearchable(int column) {
- logStep("isSearchable", column);
- return true; // All currently are searcheable.
- }
-
- /**
- * @see java.sql.ResultSetMetaData#isCurrency(int)
- * @throws SQLIllegalColumnIndexException if the column index is illegal.
- * @throws SQLConnectionClosedException if the connection is closed.
- */
- @Override public boolean isCurrency(int column) throws SQLIllegalColumnIndexException, SQLConnectionClosedException {
- logStep("isCurrency", column);
-
- try(DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = desc(column)) {
- return rsDatabase.getString("TYPE_NAME").equals("CURRENCY");
- }
- catch(SQLNoSuchFieldException e) {
- String message = format(Level.SEVERE, "assert.expected_databasemetadata_not_found", "TYPE_NAME", e.getMessage());
- throw new RuntimeException(message, e);
- }
- }
-
- /**
- * @see java.sql.ResultSetMetaData#isNullable(int)
- */
- @Override public int isNullable(int column) {
- logStep("isNullable", column);
- return ResultSetMetaData.columnNullableUnknown; // TODO Check if somes settings exists for that in field descriptor.
- }
-
- /**
- * @see java.sql.ResultSetMetaData#isSigned(int)
- */
- @Override public boolean isSigned(int column) {
- logStep("isSigned", column);
- return true; // TODO Check if somes settings exists for that in field descriptor.
- }
-
- /**
- * @see java.sql.ResultSetMetaData#getColumnDisplaySize(int)
- * @throws SQLIllegalColumnIndexException if the column index is illegal.
- * @throws SQLConnectionClosedException if the connection is closed.
- */
- @Override public int getColumnDisplaySize(int column) throws SQLIllegalColumnIndexException, SQLConnectionClosedException {
- logStep("getColumnDisplaySize", column);
-
- try(DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = desc(column)) {
- switch(rsDatabase.getString("TYPE_NAME")) {
- case "AUTO_INCREMENT":
- case "CHAR":
- case "INTEGER":
- return rsDatabase.getInt("COLUMN_SIZE");
-
- case "DATE":
- return 8;
-
- // Add decimal separator for decimal numbers.
- case "DOUBLE":
- case "FLOAT":
- case "DECIMAL":
- return rsDatabase.getInt("COLUMN_SIZE") + 1;
-
- case "BOOLEAN":
- return 5; // Translation for true, false, null.
-
- // Unhandled types default to field length.
- case "CURRENCY":
- case "DATETIME":
- case "TIMESTAMP":
- case "MEMO":
- case "PICTURE":
- case "VARIFIELD":
- case "VARIANT":
- case "UNKNOWN":
- return rsDatabase.getInt("COLUMN_SIZE");
-
- default:
- return rsDatabase.getInt("COLUMN_SIZE");
- }
- }
- catch(SQLNoSuchFieldException e) {
- String message = format(Level.SEVERE, "assert.expected_databasemetadata_not_found", "TYPE_NAME", e.getMessage());
- throw new RuntimeException(message, e);
- }
- }
-
- /**
- * @see java.sql.ResultSetMetaData#getColumnLabel(int)
- * @throws SQLIllegalColumnIndexException if the column index is illegal.
- * @throws SQLConnectionClosedException if the connection is closed.
- */
- @Override public String getColumnLabel(int column) throws SQLIllegalColumnIndexException, SQLConnectionClosedException {
- logStep("getColumnLabel", column);
-
- try(DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = desc(column)) {
- return rsDatabase.getString("COLUMN_NAME");
- }
- catch(SQLNoSuchFieldException e) {
- String message = format(Level.SEVERE, "assert.expected_databasemetadata_not_found", "COLUMN_NAME", e.getMessage());
- throw new RuntimeException(message, e);
- }
- }
-
- /**
- * @see java.sql.ResultSetMetaData#getColumnName(int)
- * @throws SQLIllegalColumnIndexException if the column index is illegal.
- * @throws SQLConnectionClosedException if the connection is closed.
- */
- @Override public String getColumnName(int column) throws SQLIllegalColumnIndexException, SQLConnectionClosedException {
- logStep("getColumnName", column);
-
- try(DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = desc(column)) {
- return rsDatabase.getString("COLUMN_NAME");
- }
- catch(SQLNoSuchFieldException e) {
- String message = format(Level.SEVERE, "assert.expected_databasemetadata_not_found", "COLUMN_NAME", e.getMessage());
- throw new RuntimeException(message, e);
- }
- }
-
- /**
- * @see java.sql.ResultSetMetaData#getSchemaName(int)
- */
- @Override public String getSchemaName(int column) {
- logStep("getSchemaName", column);
- return ""; // No schema name in DBase 3.
- }
-
- /**
- * @see java.sql.ResultSetMetaData#getPrecision(int)
- * @throws SQLIllegalColumnIndexException if the column index is illegal.
- * @throws SQLConnectionClosedException if the connection is closed.
- */
- @Override public int getPrecision(int column) throws SQLIllegalColumnIndexException, SQLConnectionClosedException {
- logStep("getPrecision", column);
-
- try(DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = desc(column)) {
- return rsDatabase.getInt("COLUMN_SIZE");
- }
- catch(SQLNoSuchFieldException e) {
- String message = format(Level.SEVERE, "assert.expected_databasemetadata_not_found", "COLUMN_SIZE", e.getMessage());
- throw new RuntimeException(message, e);
- }
- }
-
- /**
- * @see java.sql.ResultSetMetaData#getScale(int)
- * @throws SQLIllegalColumnIndexException if the column index is illegal.
- * @throws SQLConnectionClosedException if the connection is closed.
- */
- @Override public int getScale(int column) throws SQLIllegalColumnIndexException, SQLConnectionClosedException {
- logStep("getScale", column);
-
- try(DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = desc(column)) {
- return rsDatabase.getInt("DECIMAL_DIGITS");
- }
- catch(SQLNoSuchFieldException e) {
- String message = format(Level.SEVERE, "assert.expected_databasemetadata_not_found", "DECIMAL_DIGITS", e.getMessage());
- throw new RuntimeException(message, e);
- }
- }
-
- /**
- * @see java.sql.ResultSetMetaData#getTableName(int)
- */
- @Override public String getTableName(int column) {
- logStep("getTableName", column);
-
- // The table default to the file name (without its extension .dbf).
- String fileName = this.rs.getFile().getName();
- int indexDBF = fileName.lastIndexOf(".");
- String tableName = fileName.substring(0, indexDBF);
-
- return tableName;
- }
-
- /**
- * @see java.sql.ResultSetMetaData#getCatalogName(int)
- */
- @Override public String getCatalogName(int column) {
- logStep("getCatalogName", column);
- return "";
- }
-
- /**
- * @see java.sql.ResultSetMetaData#getColumnType(int)
- * @throws SQLIllegalColumnIndexException if the column index is illegal.
- */
- @Override public int getColumnType(int column) throws SQLIllegalColumnIndexException, SQLConnectionClosedException {
- logStep("getColumnType", column);
-
- try(DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = desc(column)) {
- return rsDatabase.getInt("DATA_TYPE");
- }
- catch(SQLNoSuchFieldException e) {
- String message = format(Level.SEVERE, "assert.expected_databasemetadata_not_found", "DATA_TYPE", e.getMessage());
- throw new RuntimeException(message, e);
- }
- }
-
- /**
- * @see java.sql.ResultSetMetaData#getColumnTypeName(int)
- * @throws SQLIllegalColumnIndexException if the column index is illegal.
- * @throws SQLConnectionClosedException if the connection is closed.
- */
- @Override public String getColumnTypeName(int column) throws SQLIllegalColumnIndexException, SQLConnectionClosedException {
- logStep("getColumnTypeName", column);
-
- try(DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = desc(column)) {
- return rsDatabase.getString("TYPE_NAME");
- }
- catch(SQLNoSuchFieldException e) {
- String message = format(Level.SEVERE, "assert.expected_databasemetadata_not_found", "TYPE_NAME", e.getMessage());
- throw new RuntimeException(message, e);
- }
- }
-
- /**
- * @see java.sql.ResultSetMetaData#isReadOnly(int)
- */
- @Override public boolean isReadOnly(int column) {
- logStep("isReadOnly", column);
- return false; // TODO Check if somes settings exists for that in field descriptor.
- }
-
- /**
- * @see java.sql.ResultSetMetaData#isWritable(int)
- */
- @Override public boolean isWritable(int column) {
- logStep("isWritable", column);
- return true; // TODO Check if somes settings exists for that in field descriptor.
- }
-
- /**
- * @see java.sql.ResultSetMetaData#isDefinitelyWritable(int)
- */
- @Override public boolean isDefinitelyWritable(int column) {
- logStep("isDefinitelyWritable", column);
- return true; // TODO Check if somes settings exists for that in field descriptor.
- }
-
- /**
- * @see java.sql.ResultSetMetaData#getColumnClassName(int)
- * @throws SQLFeatureNotSupportedException if underlying class implementing a type isn't currently set.
- * @throws SQLIllegalColumnIndexException if the column index is illegal.
- * @throws SQLConnectionClosedException if the connection is closed.
- */
- @Override public String getColumnClassName(int column) throws SQLFeatureNotSupportedException, SQLIllegalColumnIndexException, SQLConnectionClosedException {
- logStep("getColumnClassName", column);
-
- try(DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = desc(column)) {
- switch(rsDatabase.getString("TYPE_NAME")) {
- case "AUTO_INCREMENT":
- return Integer.class.getName();
-
- case "CHAR":
- return String.class.getName();
-
- case "INTEGER":
- return Integer.class.getName();
-
- case "DATE":
- return java.sql.Date.class.getName();
-
- case "DOUBLE":
- return Double.class.getName();
-
- case "FLOAT":
- return Float.class.getName();
-
- case "DECIMAL":
- return Double.class.getName();
-
- case "BOOLEAN":
- return Boolean.class.getName();
-
- case "CURRENCY":
- return Double.class.getName();
-
- case "DATETIME":
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on DateTime");
-
- case "TIMESTAMP":
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on TimeStamp");
-
- case "MEMO":
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on Memo");
-
- case "PICTURE":
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on Picture");
-
- case "VARIFIELD":
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on VariField");
-
- case "VARIANT":
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on Variant");
-
- case "UNKNOWN":
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on " + rsDatabase.getString("TYPE_NAME"));
-
- default:
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on " + rsDatabase.getString("TYPE_NAME"));
- }
- }
- catch(SQLNoSuchFieldException e) {
- // We encounter an internal API error in this case.
- String message = format(Level.SEVERE, "assert.expected_databasemetadata_not_found", "TYPE_NAME", e.getMessage());
- throw new RuntimeException(message, e);
- }
- }
-
- /**
- * @see org.apache.sis.internal.shapefile.jdbc.AbstractJDBC#getInterface()
- */
- @Override protected Class<?> getInterface() {
- return ResultSetMetaData.class;
- }
-
- /**
- * @see org.apache.sis.internal.shapefile.jdbc.AbstractJDBC#getFile()
- */
- @Override
- protected File getFile() {
- return this.rs.getFile();
- }
-
- /**
- * Returns a ResultSet set on the wished column.
- * @param column Column.
- * @return ResultSet describing to wished column?
- * @throws SQLIllegalColumnIndexException if the column index is out of bounds.
- * @throws SQLConnectionClosedException if the underlying connection is closed.
- */
- private DBFBuiltInMemoryResultSetForColumnsListing desc(int column) throws SQLIllegalColumnIndexException, SQLConnectionClosedException {
- DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = (DBFBuiltInMemoryResultSetForColumnsListing)this.metadata.getColumns(null, null, null, null);
-
- if (column > getColumnCount()) {
- rsDatabase.close();
- String message = format(Level.WARNING, "excp.illegal_column_index_metadata", column, getColumnCount());
- throw new SQLIllegalColumnIndexException(message, this.rs.getSQL(), getFile(), column);
- }
-
- // TODO Implements ResultSet:absolute(int) instead.
- for(int index=1; index <= column; index ++) {
- try {
- rsDatabase.next();
- }
- catch(SQLNoResultException e) {
- // We encounter an internal API error in this case.
- rsDatabase.close();
- String message = format(Level.SEVERE, "assert.less_column_in_metadata_than_expected", column, getColumnCount());
- throw new RuntimeException(message, e);
- }
- }
-
- return rsDatabase;
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/package-info.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/package-info.java
deleted file mode 100644
index 68e310d..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Metadata classes and dedicated forged ResultSets for JDBC DBase 3 driver.
- */
-package org.apache.sis.internal.shapefile.jdbc.metadata;
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/package-info.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/package-info.java
deleted file mode 100644
index fc8155d..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Allows access to the DBase3 part of a shapefile through JDBC driver.
- * Many exceptions are declared inside this package, to help trouble descriptions and permit precise unit tests.
- * @author Marc Le Bihan
- * @version 0.5
- * @since 0.5
- * @module
- */
-package org.apache.sis.internal.shapefile.jdbc;
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/AbstractResultSet.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/AbstractResultSet.java
deleted file mode 100644
index 5e39543..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/AbstractResultSet.java
+++ /dev/null
@@ -1,707 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc.resultset;
-
-import java.io.InputStream;
-import java.io.Reader;
-import java.math.BigDecimal;
-import java.net.URL;
-import java.sql.*;
-import java.util.Calendar;
-import java.util.Map;
-
-import org.apache.sis.internal.shapefile.jdbc.AbstractJDBC;
-
-
-/**
- * Holds all the unimplemented feature of a {@code ResultSet}.
- * This is in order to avoid having a ResultSet implementation of thousand lines and unreadable.
- *
- * <table class="sis">
- * <caption>Connection default values</caption>
- * <tr><th>Property</th> <th>Value</th></tr>
- * <tr><td>{@link #getType()}</td> <td>{@link Statement#getResultSetType()}</td></tr>
- * <tr><td>{@link #getConcurrency()}</td> <td>{@link Statement#getResultSetConcurrency()}</td></tr>
- * <tr><td>{@link #getHoldability()}</td> <td>{@link Statement#getResultSetHoldability()}</td></tr>
- * <tr><td>{@link #getFetchDirection()}</td> <td>{@link Statement#getFetchDirection()}</td></tr>
- * <tr><td>{@link #getFetchSize()}</td> <td>{@link Statement#getFetchSize()}</td></tr>
- * <tr><td>{@link #isBeforeFirst()}</td> <td>Compute from {@link #getRow()}</td></tr>
- * <tr><td>{@link #isFirst()}</td> <td>Compute from {@link #getRow()}</td></tr>
- * <tr><td>{@link #relative(int)}</td> <td>Use {@link #absolute(int)}</td></tr>
- * <tr><td>{@link #beforeFirst()}</td> <td>Use {@link #absolute(int)}</td></tr>
- * <tr><td>{@link #first()}</td> <td>Use {@link #absolute(int)}</td></tr>
- * <tr><td>{@link #last()}</td> <td>Use {@link #absolute(int)}</td></tr>
- * <tr><td>{@link #afterLast()}</td> <td>Use {@link #absolute(int)}</td></tr>
- * <tr><td>{@link #previous()}</td> <td>Use {@link #relative(int)}</td></tr>
- * <tr><td>{@link #getNString(int)}</td> <td>{@link #getString(int)}</td></tr>
- * <tr><td>{@link #getNCharacterStream(int)}</td> <td>{@link #getCharacterStream(int)}</td></tr>
- * <tr><td>{@link #getWarnings()}</td> <td>{@code null}</td></tr>
- * <tr><td>{@link #clearWarnings()}</td> <td>Ignored</td></tr>
- * </table>
- *
- * Furthermore, most methods expecting a column label of type {@code String} first invoke {@link #findColumn(String)},
- * then invoke the method of the same name expecting a column index as an {@code int}.
- *
- * @author Marc Le Bihan
- * @version 0.5
- * @since 0.5
- * @module
- */
-public abstract class AbstractResultSet extends AbstractJDBC implements ResultSet {
- /*
- * Note to developers : this class only offers methods that return unsupported exceptions : methods that are not implemented anywhere.
- * if any implementation is done, even a redirection to another class or method, please move the implementation on the next subclass.
- */
-
- /**
- * Constructs a new {@code ResultSet} instance.
- */
- public AbstractResultSet() {
- }
-
- /**
- * @see java.sql.ResultSet#getBoolean(java.lang.String)
- */
- @Override
- public boolean getBoolean(String columnLabel) throws SQLException {
- throw unsupportedOperation("getBoolean", columnLabel);
- }
-
- /**
- * @see java.sql.ResultSet#getByte(java.lang.String)
- */
- @Override
- public byte getByte(String columnLabel) throws SQLException {
- throw unsupportedOperation("getByte", columnLabel);
- }
-
- /**
- * @see java.sql.ResultSet#getBytes(java.lang.String)
- */
- @Override
- public byte[] getBytes(String columnLabel) throws SQLException {
- throw unsupportedOperation("getBytes", columnLabel);
- }
-
- /**
- * @see java.sql.ResultSet#getTime(java.lang.String)
- */
- @Override
- public Time getTime(String columnLabel) throws SQLException {
- throw unsupportedOperation("getTime", columnLabel);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void setFetchDirection(int direction) throws SQLException {
- throw unsupportedOperation("setFetchDirection", direction);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void setFetchSize(int rows) throws SQLException {
- throw unsupportedOperation("setFetchSize", rows);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public String getCursorName() throws SQLException {
- throw unsupportedOperation("getCursorName");
- }
-
- /**
- * Retrieves the current row number (first row is 1). This method is unsupported by default.
- * Implementing this method will allow {@link #relative(int)} and other methods to work with
- * their default implementation.
- */
- @Override
- public int getRow() throws SQLException {
- throw unsupportedOperation("getRow");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public boolean isLast() throws SQLException {
- throw unsupportedOperation("isLast");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public boolean isAfterLast() throws SQLException {
- throw unsupportedOperation("isAfterLast");
- }
-
- /**
- * Moves the cursor to the given row number (first row is 1).
- * Special cases:
- * <ul>
- * <li>Negative numbers move to an absolute row position with respect to the end of the result set.</li>
- * <li>-1 moves on the last row.</li>
- * <li> 0 moves the cursor before the first row.</li>
- * </ul>
- *
- * This method is unsupported by default. Implementing this method will allow
- * {@link #relative(int)} and other methods to work with their default implementation.
- *
- * @return {@code true} if the cursor is on a row.
- */
- @Override
- public boolean absolute(int row) throws SQLException {
- throw unsupportedOperation("absolute", row);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public RowId getRowId(int columnIndex) throws SQLException {
- throw unsupportedOperation("getRowId", columnIndex);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public boolean getBoolean(int columnIndex) throws SQLException {
- throw unsupportedOperation("getBoolean", columnIndex);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public byte getByte(int columnIndex) throws SQLException {
- throw unsupportedOperation("getByte", columnIndex);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public byte[] getBytes(int columnIndex) throws SQLException {
- throw unsupportedOperation("getBytes", columnIndex);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Date getDate(int columnIndex, Calendar cal) throws SQLException {
- throw unsupportedOperation("getDate", columnIndex, cal);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Time getTime(int columnIndex) throws SQLException {
- throw unsupportedOperation("getTime", columnIndex);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Time getTime(int columnIndex, Calendar cal) throws SQLException {
- throw unsupportedOperation("getTime", columnIndex, cal);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Timestamp getTimestamp(int columnIndex) throws SQLException {
- throw unsupportedOperation("getTimestamp", columnIndex);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
- throw unsupportedOperation("getTimestamp", columnIndex, cal);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public URL getURL(int columnIndex) throws SQLException {
- throw unsupportedOperation("getURL", columnIndex);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Array getArray(int columnIndex) throws SQLException {
- throw unsupportedOperation("getArray", columnIndex);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public SQLXML getSQLXML(int columnIndex) throws SQLException {
- throw unsupportedOperation("getSQLXML", columnIndex);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Object getObject(int columnIndex) throws SQLException {
- throw unsupportedOperation("getObject", columnIndex);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException {
- throw unsupportedOperation("getObject", columnIndex, map);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
- throw unsupportedOperation("getObject", columnIndex, type);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Ref getRef(int columnIndex) throws SQLException {
- throw unsupportedOperation("getRef", columnIndex);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Blob getBlob(int columnIndex) throws SQLException {
- throw unsupportedOperation("getBlob", columnIndex);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Clob getClob(int columnIndex) throws SQLException {
- throw unsupportedOperation("getClob", columnIndex);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public NClob getNClob(int columnIndex) throws SQLException {
- throw unsupportedOperation("getNClob", columnIndex);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public NClob getNClob(String columnLabel) throws SQLException {
- throw unsupportedOperation("getNClob", columnLabel);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public InputStream getAsciiStream(int columnIndex) throws SQLException {
- throw unsupportedOperation("getAsciiStream", columnIndex);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public Reader getCharacterStream(int columnIndex) throws SQLException {
- throw unsupportedOperation("getCharacterStream", columnIndex);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- @Deprecated
- public InputStream getUnicodeStream(int columnIndex) throws SQLException {
- throw unsupportedOperation("getUnicodeStream", columnIndex);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public InputStream getBinaryStream(int columnIndex) throws SQLException {
- throw unsupportedOperation("getBinaryStream", columnIndex);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateNull(int columnIndex) throws SQLException {
- throw unsupportedOperation("updateNull", columnIndex);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateRowId(int columnIndex, RowId x) throws SQLException {
- throw unsupportedOperation("updateRowId", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateString(int columnIndex, String x) throws SQLException {
- throw unsupportedOperation("updateString", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateBoolean(int columnIndex, boolean x) throws SQLException {
- throw unsupportedOperation("updateBoolean", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateByte(int columnIndex, byte x) throws SQLException {
- throw unsupportedOperation("updateByte", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateBytes(int columnIndex, byte[] x) throws SQLException {
- throw unsupportedOperation("updateBytes", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateShort(int columnIndex, short x) throws SQLException {
- throw unsupportedOperation("updateShort", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateInt(int columnIndex, int x) throws SQLException {
- throw unsupportedOperation("updateInt", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateLong(int columnIndex, long x) throws SQLException {
- throw unsupportedOperation("updateLong", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateFloat(int columnIndex, float x) throws SQLException {
- throw unsupportedOperation("updateFloat", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateDouble(int columnIndex, double x) throws SQLException {
- throw unsupportedOperation("updateDouble", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException {
- throw unsupportedOperation("updateBigDecimal", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateDate(int columnIndex, Date x) throws SQLException {
- throw unsupportedOperation("updateDate", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateTime(int columnIndex, Time x) throws SQLException {
- throw unsupportedOperation("updateTime", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException {
- throw unsupportedOperation("updateTimestamp", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateArray(int columnIndex, Array x) throws SQLException {
- throw unsupportedOperation("updateArray", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateObject(int columnIndex, Object x) throws SQLException {
- throw unsupportedOperation("updateObject", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException {
- throw unsupportedOperation("updateObject", columnIndex, x, scaleOrLength);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateSQLXML(int columnIndex, SQLXML x) throws SQLException {
- throw unsupportedOperation("updateSQLXML", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateRef(int columnIndex, Ref x) throws SQLException {
- throw unsupportedOperation("updateRef", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateBlob(int columnIndex, Blob x) throws SQLException {
- throw unsupportedOperation("updateBlob", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException {
- throw unsupportedOperation("updateBlob", columnIndex, inputStream, length);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateClob(int columnIndex, Clob x) throws SQLException {
- throw unsupportedOperation("updateClob", columnIndex, x);
- }
-
- /**
- * @see java.sql.ResultSet#updateClob(int, java.io.Reader, long)
- */
- @Override
- public void updateClob(int columnIndex, Reader reader, long length) throws SQLException {
- throw unsupportedOperation("updateClob", columnIndex, reader, length);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException {
- throw unsupportedOperation("updateAsciiStream", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException {
- throw unsupportedOperation("updateAsciiStream", columnIndex, x, length);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateCharacterStream(int columnIndex, Reader x) throws SQLException {
- throw unsupportedOperation("updateCharacterStream", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
- throw unsupportedOperation("updateCharacterStream", columnIndex, x, length);
- }
-
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException {
- throw unsupportedOperation("updateBinaryStream", columnIndex, x);
- }
-
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException {
- throw unsupportedOperation("updateBinaryStream", columnIndex, x, length);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateBlob(int columnIndex, InputStream x) throws SQLException {
- throw unsupportedOperation("updateBlob", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateClob(int columnIndex, Reader x) throws SQLException {
- throw unsupportedOperation("updateClob", columnIndex, x);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void insertRow() throws SQLException {
- throw unsupportedOperation("insertRow");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void updateRow() throws SQLException {
- throw unsupportedOperation("updateRow");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void deleteRow() throws SQLException {
- throw unsupportedOperation("deleteRow");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void refreshRow() throws SQLException {
- throw unsupportedOperation("refreshRow");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void cancelRowUpdates() throws SQLException {
- throw unsupportedOperation("cancelRowUpdates");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void moveToInsertRow() throws SQLException {
- throw unsupportedOperation("moveToInsertRow");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void moveToCurrentRow() throws SQLException {
- throw unsupportedOperation("moveToCurrentRow");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public boolean rowUpdated() throws SQLException {
- throw unsupportedOperation("rowUpdated");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public boolean rowInserted() throws SQLException {
- throw unsupportedOperation("rowInserted");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public boolean rowDeleted() throws SQLException {
- throw unsupportedOperation("rowDeleted");
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/BuiltInMemoryResultSet.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/BuiltInMemoryResultSet.java
deleted file mode 100644
index 91a11c4..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/BuiltInMemoryResultSet.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc.resultset;
-
-import java.math.BigDecimal;
-import java.sql.Date;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-
-import org.apache.sis.internal.shapefile.jdbc.statement.DBFStatement;
-
-
-/**
- * This Base ResultSet is only used for Descriptions function (getTables(..) and others functions in in Metadata).
- * @author Marc Le Bihan
- * @version 0.5
- * @since 0.5
- * @module
- */
-public abstract class BuiltInMemoryResultSet extends DBFResultSet {
- /**
- * Construct a ResultSet for descriptions.
- * @param stmt Statement.
- * @param sqlQuery SQLQuery.
- */
- public BuiltInMemoryResultSet(DBFStatement stmt, String sqlQuery) {
- super(stmt, sqlQuery);
- }
-
- /**
- * @see java.sql.ResultSet#getBigDecimal(java.lang.String, int)
- * @deprecated Deprecated API (from ResultSet Interface)
- */
- @Deprecated @Override
- public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException {
- throw unsupportedOperation("BigDecimal", columnLabel, scale);
- }
-
- /**
- * @see java.sql.ResultSet#getBigDecimal(int)
- */
- @Override
- public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
- return getBigDecimal(getFieldName(columnIndex, this.sql));
- }
-
- /**
- * @see java.sql.ResultSet#getBigDecimal(java.lang.String)
- */
- @Override
- public BigDecimal getBigDecimal(String columnLabel) throws SQLException {
- throw unsupportedOperation("getBigDecimal", columnLabel);
- }
-
- /**
- * @see java.sql.ResultSet#getDate(int)
- */
- @Override
- public Date getDate(int columnIndex) throws SQLException {
- return getDate(getFieldName(columnIndex, this.sql));
- }
-
- /**
- * @see java.sql.ResultSet#getDate(java.lang.String)
- */
- @Override
- public Date getDate(String columnLabel) throws SQLException {
- throw unsupportedOperation("getDate", columnLabel);
- }
-
- /**
- * @see java.sql.ResultSet#getDouble(java.lang.String)
- */
- @Override
- public double getDouble(String columnLabel) throws SQLException {
- throw unsupportedOperation("getDouble", columnLabel);
- }
-
- /**
- * @see java.sql.ResultSet#getDouble(int)
- */
- @Override
- public double getDouble(int columnIndex) throws SQLException {
- return getDouble(getFieldName(columnIndex, this.sql));
- }
-
- /**
- * @see java.sql.ResultSet#getFloat(int)
- */
- @Override
- public float getFloat(int columnIndex) throws SQLException {
- return getFloat(getFieldName(columnIndex, this.sql));
- }
-
- /**
- * @see java.sql.ResultSet#getFloat(java.lang.String)
- */
- @Override
- public float getFloat(String columnLabel) throws SQLException {
- throw unsupportedOperation("getFloat", columnLabel);
- }
-
- /**
- * @see java.sql.ResultSet#getInt(java.lang.String)
- */
- @Override
- public int getInt(String columnLabel) throws SQLException {
- throw unsupportedOperation("getInt", columnLabel);
- }
-
- /**
- * @see java.sql.ResultSet#getInt(int)
- */
- @Override
- public int getInt(int columnIndex) throws SQLException {
- return getInt(getFieldName(columnIndex, this.sql));
- }
-
- /**
- * @see java.sql.ResultSet#getLong(java.lang.String)
- */
- @Override public long getLong(String columnLabel) throws SQLException {
- throw unsupportedOperation("getLong", columnLabel);
- }
-
- /**
- * @see java.sql.ResultSet#getLong(int)
- */
- @Override public long getLong(int columnIndex) throws SQLException {
- return getLong(getFieldName(columnIndex, this.sql));
- }
-
- /**
- * @see java.sql.ResultSet#getShort(java.lang.String)
- */
- @Override public short getShort(String columnLabel) throws SQLException {
- throw unsupportedOperation("getShort", columnLabel);
- }
-
- /**
- * @see java.sql.ResultSet#getShort(int)
- */
- @Override
- public short getShort(int columnIndex) throws SQLException {
- return getShort(getFieldName(columnIndex, this.sql));
- }
-
- /**
- * @see java.sql.ResultSet#getString(java.lang.String)
- */
- @Override public String getString(String columnLabel) throws SQLException {
- throw unsupportedOperation("getString", columnLabel);
- }
-
- /**
- * @see java.sql.ResultSet#getString(int)
- */
- @Override
- public String getString(int columnIndex) throws SQLException {
- return(getString(getFieldName(columnIndex, this.sql)));
- }
-
- /**
- * @see java.sql.ResultSet#getMetaData()
- */
- @Override public ResultSetMetaData getMetaData() throws SQLException {
- throw unsupportedOperation("getMetaData");
- }
-
- /**
- * Returns the table name.
- * @return Table Name.
- */
- protected String getTableName() {
- // The table default to the file name (without its extension .dbf).
- String fileName = getFile().getName();
- int indexDBF = fileName.lastIndexOf(".");
- String tableName = fileName.substring(0, indexDBF);
-
- return tableName;
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForCatalogNamesListing.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForCatalogNamesListing.java
deleted file mode 100644
index 9e211db..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForCatalogNamesListing.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc.resultset;
-
-import org.apache.sis.internal.shapefile.jdbc.statement.DBFStatement;
-
-
-/**
- * Special ResultSet listing tables types contained in this DBase 3 (none).
- * @author Marc LE BIHAN
- */
-public class DBFBuiltInMemoryResultSetForCatalogNamesListing extends BuiltInMemoryResultSet {
- /**
- * Construct a ResultSet listing the catalog names of a database.
- * @param stmt Statement.
- */
- public DBFBuiltInMemoryResultSetForCatalogNamesListing(DBFStatement stmt) {
- super(stmt, "driver list catalog names");
- }
-
- /**
- * @see java.sql.ResultSet#next()
- */
- @Override public boolean next() {
- logStep("next");
- return false;
- }
-
- /**
- * @see java.sql.ResultSet#wasNull()
- */
- @Override
- public boolean wasNull() {
- logStep("wasNull");
- return true;
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForColumnsListing.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForColumnsListing.java
deleted file mode 100644
index de9a111..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForColumnsListing.java
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc.resultset;
-
-import java.sql.DatabaseMetaData;
-import java.sql.Types;
-import java.text.MessageFormat;
-import java.util.Iterator;
-import java.util.List;
-import java.util.logging.Level;
-
-import org.apache.sis.internal.shapefile.jdbc.DBase3FieldDescriptor;
-import org.apache.sis.internal.shapefile.jdbc.statement.DBFStatement;
-
-/**
- * Special ResultSet listing columns contained in this DBase 3.
- * @author Marc LE BIHAN
- */
-public class DBFBuiltInMemoryResultSetForColumnsListing extends BuiltInMemoryResultSet {
- /** Current field descriptor. */
- private DBase3FieldDescriptor current;
-
- /** Iterator. */
- private Iterator<DBase3FieldDescriptor> itDescriptor;
-
- /** Column index. */
- private int columnIndex;
-
- /** Indicates if the ResultSet is set after the last record. */
- private boolean afterLast = false;
-
- /**
- * Construct a ResultSet.
- * @param stmt Statement.
- * @param fieldsDescriptors Fields descriptors.
- */
- public DBFBuiltInMemoryResultSetForColumnsListing(DBFStatement stmt, List<DBase3FieldDescriptor> fieldsDescriptors) {
- super(stmt, "driver list columns in this DBase 3 file");
- this.itDescriptor = fieldsDescriptors.iterator();
- }
-
- /**
- * @see java.sql.ResultSet#getString(java.lang.String)
- * @throws SQLNoSuchFieldException if the column does not exist.
- */
- @Override public String getString(String columnLabel) throws SQLNoSuchFieldException {
- logStep("getString", columnLabel);
-
- switch(columnLabel) {
- // String => table name
- case "TABLE_NAME": {
- String tableName = getTableName();
- this.wasNull = (tableName == null);
- return tableName;
- }
-
- // String => column name
- case "COLUMN_NAME": {
- String columnName = this.current.getName();
- this.wasNull = (columnName == null);
- return columnName;
- }
-
- // String => Data source dependent type name, for a UDT the type name is fully qualified
- case "TYPE_NAME": {
- String typeName = this.current.getType() != null ? toColumnTypeName() : null;
- this.wasNull = (typeName == null);
- return typeName;
- }
-
- /**
- * Columns responding to features that aren't handled by DBase 3.
- * and return always a default value NULL or "NO"...
- */
-
- // String => table catalog (may be null)
- case "TABLE_CAT": {
- this.wasNull = true;
- return null;
- }
-
- // String => table schema (may be null)
- case "TABLE_SCHEM": {
- this.wasNull = true;
- return null;
- }
-
- // String => comment describing column (may be null)
- case "REMARKS":
- this.wasNull = true;
- return null;
-
- // String => default value for the column, which should be interpreted as a string when the value is enclosed in single quotes (may be null)
- case "COLUMN_DEF": {
- this.wasNull = true;
- return null;
- }
-
- // String => catalog of table that is the scope of a reference attribute (null if DATA_TYPE isn't REF)
- case "SCOPE_CATALOG": {
- this.wasNull = true;
- return null;
- }
-
- // String => schema of table that is the scope of a reference attribute (null if the DATA_TYPE isn't REF)
- case "SCOPE_SCHEMA": {
- this.wasNull = true;
- return null;
- }
-
- // String => table name that this the scope of a reference attribute (null if the DATA_TYPE isn't REF)
- case "SCOPE_TABLE": {
- this.wasNull = true;
- return null;
- }
-
- /**
- * String => Indicates whether this column is auto incremented
- * YES --- if the column is auto incremented
- * NO --- if the column is not auto incremented
- * empty string --- if it cannot be determined whether the column is auto incremented
- */
- case "IS_AUTOINCREMENT": {
- this.wasNull = false;
- return "NO";
- }
-
- /**
- * String => Indicates whether this is a generated column
- * YES --- if this a generated column
- * NO --- if this not a generated column
- * empty string --- if it cannot be determined whether this is a generated column
- */
- case "IS_GENERATEDCOLUMN": {
- this.wasNull = false;
- return "NO";
- }
-
- default: {
- // Attempt to load it from an Integer column and convert it.
- int value = getInt(columnLabel);
- return MessageFormat.format("{0,number,#0}", value); // Remove decimal separators.
- }
- }
- }
-
- /**
- * @see java.sql.ResultSet#getInt(java.lang.String)
- * @throws SQLNoSuchFieldException if the column does not exist.
- */
- @Override public int getInt(String columnLabel) throws SQLNoSuchFieldException {
- logStep("getInt", columnLabel);
-
- switch(columnLabel) {
- // int => SQL type from java.sql.Types
- case "DATA_TYPE": {
- this.wasNull = false;
- return toSQLDataType();
- }
-
- // int => column size.
- case "COLUMN_SIZE": {
- this.wasNull = false;
- return toPrecision();
- }
-
- // int => the number of fractional digits. Null is returned for data types where DECIMAL_DIGITS is not applicable.
- case "DECIMAL_DIGITS": {
- int scale = toScale();
- this.wasNull = toScale() == -1;
- return scale == -1 ? 0 : scale;
- }
-
- // int => Radix (typically either 10 or 2)
- case "NUM_PREC_RADIX": {
- return 10;
- }
-
- /**
- * int => is NULL allowed.
- * columnNoNulls - might not allow NULL values
- * columnNullable - definitely allows NULL values
- * columnNullableUnknown - nullability unknown
- */
- case "NULLABLE": {
- this.wasNull = false;
- return DatabaseMetaData.columnNullableUnknown;
- }
-
- // int => unused
- case "SQL_DATA_TYPE": {
- this.wasNull = false;
- return toSQLDataType();
- }
-
- // int => for char types the maximum number of bytes in the column
- case "CHAR_OCTET_LENGTH": {
- if (toSQLDataType() == Types.CHAR) {
- return toPrecision();
- }
-
- return 0;
- }
-
- // int => index of column in table (starting at 1)
- case "ORDINAL_POSITION": {
- return this.columnIndex;
- }
-
- /**
- * Columns responding to features that aren't handled by DBase 3.
- * and return always a default value NULL or "NO"...
- */
-
- // short => source type of a distinct type or user-generated Ref type, SQL type from java.sql.Types (null if DATA_TYPE isn't DISTINCT or user-generated REF)
- case "SOURCE_DATA_TYPE": {
- this.wasNull = true;
- return 0;
- }
-
- // is not used.
- case "BUFFER_LENGTH": {
- this.wasNull = false;
- return 0;
- }
-
- // int => unused
- case "SQL_DATETIME_SUB": {
- this.wasNull = false;
- return 0;
- }
-
- default:
- // FIXME : this function is not perfect. It a column label is given that refers to a field described in getString(..) this function
- // will tell that the field doesn't exist. It's not true : the field is not numeric. But as getString(..) defaults to getInt(...),
- // getInt(..) cannot default to getString(..), else the function will run in a cycle.
- String message = format(Level.WARNING, "excp.no_desc_field", columnLabel, getTableName());
- throw new SQLNoSuchFieldException(message, "asking columns desc", getFile(), columnLabel);
- }
- }
-
- /**
- * @see java.sql.ResultSet#next()
- */
- @Override public boolean next() throws SQLNoResultException {
- if (this.itDescriptor.hasNext()) {
- this.current = this.itDescriptor.next();
- this.columnIndex ++;
- return true;
- }
- else {
- if (this.afterLast) {
- // The ResultSet has no more records and has been call one time too much.
- this.afterLast = true;
-
- String message = format(Level.WARNING, "excp.no_more_desc", getTableName());
- throw new SQLNoResultException(message, "asking columns desc", getFile());
- }
- else {
- return false;
- }
- }
- }
-
- /**
- * Returns the SQL Datatype of the DBase 3 type for the current field.
- * @return SQL Datatype.
- */
- private int toSQLDataType() {
- switch(this.current.getType()) {
- case AutoIncrement:
- return Types.INTEGER;
-
- case Character:
- return Types.CHAR;
-
- case Integer:
- return Types.INTEGER;
-
- case Date:
- return Types.DATE;
-
- case Double:
- return Types.DOUBLE;
-
- case FloatingPoint:
- return Types.FLOAT;
-
- case Number:
- return Types.DECIMAL;
-
- case Logical:
- return Types.BOOLEAN;
-
- case Currency:
- return Types.NUMERIC;
-
- case DateTime:
- return Types.TIMESTAMP; // TODO : I think ?
-
- case TimeStamp:
- return Types.TIMESTAMP;
-
- case Memo:
- return Types.BLOB;
-
- case Picture:
- return Types.BLOB;
-
- case VariField:
- return Types.OTHER;
-
- case Variant:
- return Types.OTHER;
-
- default:
- return Types.OTHER;
- }
- }
-
- /**
- * Returns the column type name of the current field.
- * @return Column type name.
- */
- private String toColumnTypeName() {
- switch(this.current.getType()) {
- case AutoIncrement:
- return "AUTO_INCREMENT";
-
- case Character:
- return "CHAR";
-
- case Integer:
- return "INTEGER";
-
- case Date:
- return "DATE";
-
- case Double:
- return "DOUBLE";
-
- case FloatingPoint:
- return "FLOAT";
-
- case Number:
- return "DECIMAL";
-
- case Logical:
- return "BOOLEAN";
-
- case Currency:
- return "CURRENCY";
-
- case DateTime:
- return "DATETIME";
-
- case TimeStamp:
- return "TIMESTAMP";
-
- case Memo:
- return "MEMO";
-
- case Picture:
- return "PICTURE";
-
- case VariField:
- return "VARIFIELD";
-
- case Variant:
- return "VARIANT";
-
- default:
- return "UNKNOWN";
- }
- }
-
- /**
- * Returns the precision of the current field.
- * @return Precision of the current field.
- */
- public int toPrecision() {
- switch(this.current.getType()) {
- case AutoIncrement:
- case Character:
- case Integer:
- return this.current.getLength();
-
- case Date:
- return 8;
-
- case Double:
- case FloatingPoint:
- case Number:
- return this.current.getLength();
-
- case Logical:
- return 0;
-
- case Currency:
- case DateTime:
- case TimeStamp:
- return this.current.getLength();
-
- case Memo:
- case Picture:
- case VariField:
- case Variant:
- return 0;
-
- default:
- return this.current.getLength();
- }
- }
-
- /**
- * Returns the scale of the current field.
- * @return Scale of the current field, -1 means : this field is not numeric.
- */
- private int toScale() {
- switch(this.current.getType()) {
- case AutoIncrement:
- case Logical:
- return 0;
-
- case Integer:
- case Double:
- case FloatingPoint:
- case Number:
- case Currency:
- return this.current.getDecimalCount();
-
- case Character:
- case Date:
- case DateTime:
- case TimeStamp:
- case Memo:
- case Picture:
- case VariField:
- case Variant:
- return -1;
-
- default:
- return -1;
- }
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForSchemaListing.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForSchemaListing.java
deleted file mode 100644
index 69301e2..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForSchemaListing.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc.resultset;
-
-import org.apache.sis.internal.shapefile.jdbc.statement.DBFStatement;
-
-
-/**
- * Special ResultSet listing schemas contained in this DBase 3 (they are none).
- * @author Marc LE BIHAN
- */
-public class DBFBuiltInMemoryResultSetForSchemaListing extends BuiltInMemoryResultSet {
- /**
- * Construct a ResultSet listing the tables of a database.
- * @param stmt Statement.
- */
- public DBFBuiltInMemoryResultSetForSchemaListing(DBFStatement stmt) {
- super(stmt, "driver list schemas in this DBase file");
- }
-
- /**
- * @see java.sql.ResultSet#next()
- */
- @Override public boolean next() {
- logStep("next");
- return false;
- }
-
- /**
- * @see java.sql.ResultSet#wasNull()
- */
- @Override
- public boolean wasNull() {
- logStep("wasNull");
- return true;
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesListing.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesListing.java
deleted file mode 100644
index 6b0cb60..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesListing.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc.resultset;
-
-import java.util.logging.Level;
-
-import org.apache.sis.internal.shapefile.jdbc.statement.DBFStatement;
-
-/**
- * Special ResultSet listing tables contained in this DBase 3 (a single table).
- * @author Marc LE BIHAN
- */
-public class DBFBuiltInMemoryResultSetForTablesListing extends BuiltInMemoryResultSet {
- /** There's only one result in this ResultSet. */
- private int index = 0;
-
- /**
- * Construct a ResultSet.
- * @param stmt Statement.
- */
- public DBFBuiltInMemoryResultSetForTablesListing(DBFStatement stmt) {
- super(stmt, "driver list tables in this DBase 3 file");
- }
-
- /**
- * @see java.sql.ResultSet#getString(java.lang.String)
- */
- @Override public String getString(String columnLabel) {
- logStep("getString", columnLabel);
-
- switch(columnLabel) {
- case "TABLE_NAME": // String => table name.
- {
- String tableName = getTableName();
- this.wasNull = (tableName == null);
- return tableName;
- }
-
- case "TABLE_TYPE": // String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
- this.wasNull = false;
- return "TABLE";
-
- case "TYPE_NAME": // String => type name (may be null)
- case "TABLE_CAT": // String => table catalog (may be null)
- case "TABLE_SCHEM": // String => table schema (may be null)
- case "REMARKS": // String => explanatory comment on the table
- case "TYPE_CAT": // String => the types catalog (may be null)
- case "TYPE_SCHEM": // String => the types schema (may be null)
- case "SELF_REFERENCING_COL_NAME": // String => name of the designated "identifier" column of a typed table (may be null)
- case "REF_GENERATION": // String => specifies how values in SELF_REFERENCING_COL_NAME are created. Values are "SYSTEM", "USER", "DERIVED". (may be null)
- this.wasNull = true;
- return null;
-
- default:
- this.wasNull = true;
- return null;
- }
- }
-
- /**
- * @see java.sql.ResultSet#next()
- */
- @Override public boolean next() throws SQLNoResultException
- {
- logStep("next");
-
- if (this.index > 1) {
- throw new SQLNoResultException(format(Level.WARNING, "excp.only_one_table_per_dbf"), "Driver manager asks for table listing", getFile());
- }
-
- this.index ++;
- return (this.index == 1) ? true : false;
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesTypesListing.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesTypesListing.java
deleted file mode 100644
index 60676c9..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesTypesListing.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc.resultset;
-
-import java.util.logging.Level;
-
-import org.apache.sis.internal.shapefile.jdbc.statement.DBFStatement;
-
-/**
- * Special ResultSet listing tables types contained in this DBase 3 (only tables).
- * @author Marc LE BIHAN
- */
-public class DBFBuiltInMemoryResultSetForTablesTypesListing extends BuiltInMemoryResultSet {
- /** There's only one result in this ResultSet. */
- private int index = 0;
-
- /**
- * Construct a ResultSet listing the tables types of a database.
- * @param stmt Statement.
- */
- public DBFBuiltInMemoryResultSetForTablesTypesListing(DBFStatement stmt) {
- super(stmt, "driver list tables types handled by DBase 3");
- }
-
- /**
- * @see java.sql.ResultSet#getString(java.lang.String)
- */
- @Override public String getString(String columnLabel) {
- logStep("getString", columnLabel);
-
- switch(columnLabel) {
- case "OBJECTID": // FIXME Documentation of ObjectId for geTabletTypes() has not been found. What are the rules about this field ?
- this.wasNull = false;
- return "1";
-
- case "TABLE_TYPE": // String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
- this.wasNull = false;
- return "TABLE"; // and DBase 3 only knows tables.
-
- default:
- this.wasNull = true;
- return null;
- }
- }
-
- /**
- * @see java.sql.ResultSet#next()
- */
- @Override public boolean next() throws SQLNoResultException
- {
- logStep("next");
-
- if (this.index > 1) {
- throw new SQLNoResultException(format(Level.WARNING, "excp.only_one_table_type_handled"), "Driver manager asks for table types listing", getFile());
- }
-
- this.index ++;
- return (this.index == 1) ? true : false;
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet.java
deleted file mode 100644
index 4751416..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet.java
+++ /dev/null
@@ -1,609 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc.resultset;
-
-import java.math.BigDecimal;
-import java.math.MathContext;
-import java.math.RoundingMode;
-import java.nio.charset.Charset;
-import java.sql.Date;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLFeatureNotSupportedException;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.Map;
-import java.util.function.Function;
-import java.util.logging.Level;
-
-import org.apache.sis.internal.shapefile.jdbc.SQLConnectionClosedException;
-import org.apache.sis.internal.shapefile.jdbc.connection.DBFConnection;
-import org.apache.sis.internal.shapefile.jdbc.metadata.DBFResultSetMataData;
-import org.apache.sis.internal.shapefile.jdbc.sql.*;
-import org.apache.sis.internal.shapefile.jdbc.statement.DBFStatement;
-
-/**
- * A ResultSet based on a record.
- * @author Marc LE BIHAN
- */
-public class DBFRecordBasedResultSet extends DBFResultSet {
- /** The current record. */
- private Map<String, byte[]> record;
-
- /** Condition of where clause (currently, only one is handled). */
- private ConditionalClauseResolver singleConditionOfWhereClause;
-
- /** Indicates that the last result set record matching conditions has already been returned, and a further call of next() shall throw a "no more record" exception. */
- private boolean lastResultSetRecordAlreadyReturned;
-
- /** The record number of this record. */
- private int recordNumber;
-
- /**
- * Constructs a result set.
- * @param stmt Parent statement.
- * @param sqlQuery SQL Statment that produced this ResultSet.
- * @throws SQLInvalidStatementException if the SQL Statement is invalid.
- */
- public DBFRecordBasedResultSet(final DBFStatement stmt, String sqlQuery) throws SQLInvalidStatementException {
- super(stmt, sqlQuery);
- this.singleConditionOfWhereClause = new CrudeSQLParser(this).parse();
- }
-
- /**
- * @see org.apache.sis.internal.shapefile.jdbc.resultset.AbstractResultSet#getBigDecimal(java.lang.String)
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNoSuchFieldException if the field looked for doesn't exist.
- * @throws SQLNotNumericException if the field value is not numeric.
- */
- @Override
- public BigDecimal getBigDecimal(String columnLabel) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException {
- logStep("getBigDecimal", columnLabel);
-
- assertNotClosed();
-
- // Act as if we were a double, but store the result in a pre-created BigDecimal at the end.
- try(DBFBuiltInMemoryResultSetForColumnsListing field = (DBFBuiltInMemoryResultSetForColumnsListing)getFieldDesc(columnLabel, sql)) {
- MathContext mc = new MathContext(field.getInt("DECIMAL_DIGITS"), RoundingMode.HALF_EVEN);
- Double doubleValue = getDouble(columnLabel);
-
- if (doubleValue != null) {
- BigDecimal number = new BigDecimal(doubleValue, mc);
- this.wasNull = false;
- return number;
- }
- else {
- this.wasNull = true;
- return null;
- }
- }
- }
-
- /**
- * @see java.sql.ResultSet#getBigDecimal(int)
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNoSuchFieldException if the field looked for doesn't exist.
- * @throws SQLNotNumericException if the field value is not numeric.
- * @throws SQLIllegalColumnIndexException if the column index has an illegal value.
- */
- @Override
- public BigDecimal getBigDecimal(int columnIndex) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException, SQLIllegalColumnIndexException {
- logStep("getBigDecimal", columnIndex);
- return getBigDecimal(getFieldName(columnIndex, this.sql));
- }
-
- /**
- * @see java.sql.ResultSet#getBigDecimal(java.lang.String, int)
- * @deprecated Deprecated API (from ResultSet Interface)
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNoSuchFieldException if the field looked for doesn't exist.
- * @throws SQLNotNumericException if the field value is not numeric.
- */
- @Deprecated @Override
- public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException {
- logStep("getBigDecimal", columnLabel, scale);
- assertNotClosed();
-
- // Act as if we were a double, but store the result in a pre-created BigDecimal at the end.
- MathContext mc = new MathContext(scale, RoundingMode.HALF_EVEN);
- Double doubleValue = getDouble(columnLabel);
-
- if (doubleValue != null) {
- BigDecimal number = new BigDecimal(getDouble(columnLabel), mc);
- this.wasNull = false;
- return number;
- }
- else {
- this.wasNull = true;
- return null;
- }
- }
-
- /**
- * @see java.sql.ResultSet#getDate(java.lang.String)
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNoSuchFieldException if the field looked for doesn't exist.
- * @throws SQLNotDateException if the field is not a date.
- */
- @Override
- public Date getDate(String columnLabel) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotDateException {
- logStep("getDate", columnLabel);
- assertNotClosed();
-
- String value = getString(columnLabel);
-
- if (value == null || value.equals("00000000")) { // "00000000" is stored in Database to represent a null value too.
- this.wasNull = true;
- return null; // The ResultSet:getDate() contract is to return null when a null date is encountered.
- }
- else {
- this.wasNull = false;
- }
-
- // The DBase 3 date format is "YYYYMMDD".
- // if the length of the string isn't eight characters, the field format is incorrect.
- if (value.length() != 8) {
- String message = format(Level.WARNING, "excp.field_is_not_a_date", columnLabel, this.sql, value);
- throw new SQLNotDateException(message, this.sql, getFile(), columnLabel, value);
- }
-
- // Extract the date parts.
- int year, month, dayOfMonth;
-
- try {
- year = Integer.parseInt(value.substring(0, 4));
- month = Integer.parseInt(value.substring(5, 7));
- dayOfMonth = Integer.parseInt(value.substring(7));
- }
- catch(NumberFormatException e) {
- String message = format(Level.WARNING, "excp.field_is_not_a_date", columnLabel, this.sql, value);
- throw new SQLNotDateException(message, this.sql, getFile(), columnLabel, value);
- }
-
- // Create a date.
- Calendar calendar = new GregorianCalendar(year, month-1, dayOfMonth, 0, 0, 0);
- Date sqlDate = new Date(calendar.getTimeInMillis());
- return sqlDate;
- }
-
- /**
- * @see java.sql.ResultSet#getDate(int)
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNoSuchFieldException if the field looked for doesn't exist.
- * @throws SQLNotDateException if the field is not a date.
- * @throws SQLIllegalColumnIndexException if the column index has an illegal value.
- */
- @Override
- public Date getDate(int columnIndex) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotDateException, SQLIllegalColumnIndexException {
- logStep("getDate", columnIndex);
- return getDate(getFieldName(columnIndex, this.sql));
- }
-
- /**
- * @see java.sql.ResultSet#getDouble(java.lang.String)
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNoSuchFieldException if the field looked for doesn't exist.
- * @throws SQLNotNumericException if the field value is not numeric.
- */
- @Override
- public double getDouble(String columnLabel) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException {
- logStep("getDouble", columnLabel);
-
- Double value = getNumeric(columnLabel, Double::parseDouble);
- this.wasNull = (value == null);
- return value != null ? value : 0.0; // The ResultSet contract for numbers is to return 0 when a null value is encountered.
- }
-
- /**
- * @see java.sql.ResultSet#getDouble(int)
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNoSuchFieldException if the field looked for doesn't exist.
- * @throws SQLNotNumericException if the field value is not numeric.
- * @throws SQLIllegalColumnIndexException if the column index has an illegal value.
- */
- @Override
- public double getDouble(int columnIndex) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException, SQLIllegalColumnIndexException {
- logStep("getDouble", columnIndex);
- return getDouble(getFieldName(columnIndex, this.sql));
- }
-
- /**
- * @see java.sql.ResultSet#getFloat(java.lang.String)
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNoSuchFieldException if the field looked for doesn't exist.
- * @throws SQLNotNumericException if the field value is not numeric.
- */
- @Override
- public float getFloat(String columnLabel) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException {
- logStep("getFloat", columnLabel);
-
- Float value = getNumeric(columnLabel, Float::parseFloat);
- this.wasNull = (value == null);
- return value != null ? value : 0; // The ResultSet contract for numbers is to return 0 when a null value is encountered.
- }
-
- /**
- * @see java.sql.ResultSet#getFloat(int)
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNoSuchFieldException if the field looked for doesn't exist.
- * @throws SQLNotNumericException if the field value is not numeric.
- * @throws SQLIllegalColumnIndexException if the column index has an illegal value.
- */
- @Override
- public float getFloat(int columnIndex) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException, SQLIllegalColumnIndexException {
- logStep("getFloat", columnIndex);
- return getFloat(getFieldName(columnIndex, this.sql));
- }
-
- /**
- * @see org.apache.sis.internal.shapefile.jdbc.resultset.AbstractResultSet#getInt(java.lang.String)
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNoSuchFieldException if the field looked for doesn't exist.
- * @throws SQLNotNumericException if the field value is not numeric.
- */
- @Override
- public int getInt(String columnLabel) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException {
- logStep("getInt", columnLabel);
-
- Integer value = getNumeric(columnLabel, Integer::parseInt);
- this.wasNull = (value == null);
- return value != null ? value : 0; // The ResultSet contract for numbers is to return 0 when a null value is encountered.
- }
-
- /**
- * @see java.sql.ResultSet#getInt(int)
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNoSuchFieldException if the field looked for doesn't exist.
- * @throws SQLNotNumericException if the field value is not numeric.
- * @throws SQLIllegalColumnIndexException if the column index has an illegal value.
- */
- @Override
- public int getInt(int columnIndex) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException, SQLIllegalColumnIndexException {
- logStep("getInt", columnIndex);
- return getInt(getFieldName(columnIndex, this.sql));
- }
-
- /**
- * @see java.sql.ResultSet#getLong(java.lang.String)
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNoSuchFieldException if the field looked for doesn't exist.
- * @throws SQLNotNumericException if the field value is not numeric.
- */
- @Override
- public long getLong(String columnLabel) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException {
- logStep("getLong", columnLabel);
-
- Long value = getNumeric(columnLabel, Long::parseLong);
- this.wasNull = (value == null);
- return value != null ? value : 0; // The ResultSet contract for numbers is to return 0 when a null value is encountered.
- }
-
- /**
- * @see java.sql.ResultSet#getLong(int)
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNoSuchFieldException if the field looked for doesn't exist.
- * @throws SQLNotNumericException if the field value is not numeric.
- * @throws SQLIllegalColumnIndexException if the column index has an illegal value.
- */
- @Override public long getLong(int columnIndex) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException, SQLIllegalColumnIndexException {
- logStep("getLong", columnIndex);
- return getLong(getFieldName(columnIndex, this.sql));
- }
-
- /**
- * @see java.sql.ResultSet#getMetaData()
- */
- @Override
- public ResultSetMetaData getMetaData() {
- logStep("getMetaData");
-
- DBFResultSetMataData meta = new DBFResultSetMataData(this);
- return meta;
- }
-
- /**
- * @see org.apache.sis.internal.shapefile.jdbc.resultset.AbstractResultSet#getObject(int)
- */
- @Override
- public Object getObject(int column) throws SQLConnectionClosedException, SQLIllegalColumnIndexException, SQLFeatureNotSupportedException, SQLNoSuchFieldException, SQLNotNumericException, SQLNotDateException {
- try(DBFBuiltInMemoryResultSetForColumnsListing field = (DBFBuiltInMemoryResultSetForColumnsListing)getFieldDesc(column, this.sql)) {
- String fieldType;
-
- try {
- fieldType = field.getString("TYPE_NAME");
- }
- catch(SQLNoSuchFieldException e) {
- // This is an internal trouble because the field type must be found.
- throw new RuntimeException(e.getMessage(), e);
- }
-
- switch(fieldType) {
- case "AUTO_INCREMENT":
- case "INTEGER":
- return getInt(column);
-
- case "CHAR":
- return getString(column);
-
- case "DATE":
- return getDate(column);
-
- case "DECIMAL": {
- // Choose Integer or Long type, if no decimal and that the field is not to big.
- if (field.getInt("DECIMAL_DIGITS") == 0 && field.getInt("COLUMN_SIZE") <= 18) {
- if (field.getInt("COLUMN_SIZE") <= 9)
- return getInt(column);
- else
- return getLong(column);
- }
-
- return getDouble(column);
- }
-
- case "DOUBLE":
- case "CURRENCY":
- return getDouble(column);
-
- case "FLOAT":
- return getFloat(column);
-
- case "BOOLEAN":
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on Boolean");
-
- case "DATETIME":
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on DateTime");
-
- case "TIMESTAMP":
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on TimeStamp");
-
- case "MEMO":
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on Memo");
-
- case "PICTURE":
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on Picture");
-
- case "VARIFIELD":
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on VariField");
-
- case "VARIANT":
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on Variant");
-
- case "UNKNOWN":
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on " + fieldType);
-
- default:
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on " + fieldType);
- }
- }
- }
-
- /**
- * @see org.apache.sis.internal.shapefile.jdbc.resultset.DBFResultSet#getObject(java.lang.String)
- */
- @Override
- public Object getObject(String columnLabel) throws SQLConnectionClosedException, SQLFeatureNotSupportedException, SQLNoSuchFieldException, SQLNotNumericException, SQLNotDateException {
- int index = -1;
-
- try {
- index = findColumn(columnLabel);
- return getObject(index);
- }
- catch(SQLIllegalColumnIndexException e) {
- String message = format(Level.SEVERE, "assert.wrong_index_for_column_name", index, columnLabel);
- throw new RuntimeException(message, e);
- }
- }
-
- /**
- * Return the record number of this record.
- * @return Record number of this record.
- */
- public int getRowNum() {
- return this.recordNumber;
- }
-
- /**
- * @see java.sql.ResultSet#getShort(java.lang.String)
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNoSuchFieldException if the field looked for doesn't exist.
- * @throws SQLNotNumericException if the field value is not numeric or has a NULL value.
- */
- @Override
- public short getShort(String columnLabel) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException {
- logStep("getShort", columnLabel);
-
- Short value = getNumeric(columnLabel, Short::parseShort);
- this.wasNull = (value == null);
- return value != null ? value : 0; // The ResultSet contract for numbers is to return 0 when a null value is encountered.
- }
-
- /**
- * @see java.sql.ResultSet#getShort(int)
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNoSuchFieldException if the field looked for doesn't exist.
- * @throws SQLNotNumericException if the field value is not numeric or has a NULL value.
- * @throws SQLIllegalColumnIndexException if the column index has an illegal value.
- */
- @Override
- public short getShort(int columnIndex) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException, SQLIllegalColumnIndexException {
- logStep("getShort", columnIndex);
- return getShort(getFieldName(columnIndex, this.sql));
- }
-
- /**
- * Returns the value in the current row for the given column.
- * @param columnLabel Column name.
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNoSuchFieldException if the field does not exist.
- */
- @Override
- @SuppressWarnings("resource") // Only read the current connection to get the Charset.
- public String getString(String columnLabel) throws SQLConnectionClosedException, SQLNoSuchFieldException {
- logStep("getString", columnLabel);
- assertNotClosed();
-
- getFieldDesc(columnLabel, this.sql); // Ensure that the field queried exists, else a null value here can be interpreted as "not existing" or "has a null value".
- byte[] bytes = this.record.get(columnLabel);
-
- if (bytes == null) {
- this.wasNull = true;
- return null;
- }
- else {
- this.wasNull = false;
- }
-
- // If a non null value has been readed, convert it to the wished Charset (provided one has been given).
- DBFConnection cnt = (DBFConnection)((DBFStatement)getStatement()).getConnection();
- Charset charset = cnt.getCharset();
-
- if (charset == null) {
- return new String(bytes);
- }
- else {
- String withDatabaseCharset = new String(bytes, charset);
- log(Level.FINER, "log.string_field_charset", columnLabel, withDatabaseCharset, charset);
- return withDatabaseCharset;
- }
- }
-
- /**
- * @see java.sql.ResultSet#getString(int)
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNoSuchFieldException if the field looked for doesn't exist.
- * @throws SQLIllegalColumnIndexException if the column index has an illegal value.
- */
- @Override
- public String getString(int columnIndex) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLIllegalColumnIndexException {
- logStep("getString", columnIndex);
- return(getString(getFieldName(columnIndex, this.sql)));
- }
-
- /**
- * Moves the cursor forward one row from its current position.
- * @throws SQLInvalidStatementException if the SQL statement is invalid.
- * @throws SQLIllegalParameterException if the value of one parameter of a condition is invalid.
- * @throws SQLNoSuchFieldException if a field mentionned in the condition doesn't exist.
- * @throws SQLUnsupportedParsingFeatureException if the caller asked for a not yet supported feature of the driver.
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNotNumericException if a value or data expected to be numeric isn't.
- * @throws SQLNotDateException if a value or data expected to be a date isn't.
- */
- @Override
- @SuppressWarnings("resource") // Only read the current connection to find if a next row is available and read it.
- public boolean next() throws SQLNoResultException, SQLConnectionClosedException, SQLInvalidStatementException, SQLIllegalParameterException, SQLNoSuchFieldException, SQLUnsupportedParsingFeatureException, SQLNotNumericException, SQLNotDateException {
- logStep("next");
- assertNotClosed();
-
- DBFConnection cnt = (DBFConnection)((DBFStatement)getStatement()).getConnection();
-
- // Check that we aren't at the end of the Database file.
- if (cnt.nextRowAvailable() == false) {
- if (this.lastResultSetRecordAlreadyReturned) {
- throw new SQLNoResultException(format(Level.WARNING, "excp.no_more_results", this.sql, getFile().getName()), this.sql, getFile());
- }
- else {
- this.lastResultSetRecordAlreadyReturned = true;
- return false;
- }
- }
-
- return nextRecordMatchingConditions();
- }
-
- /**
- * Find the next record that match the where condition.
- * @return true if a record has been found.
- * @throws SQLInvalidStatementException if the SQL statement is invalid.
- * @throws SQLIllegalParameterException if the value of one parameter of a condition is invalid.
- * @throws SQLNoSuchFieldException if a field mentionned in the condition doesn't exist.
- * @throws SQLUnsupportedParsingFeatureException if the caller asked for a not yet supported feature of the driver.
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNotNumericException if a value or data expected to be numeric isn't.
- * @throws SQLNotDateException if a value or data expected to be a date isn't.
- */
- @SuppressWarnings("resource") // Only read the current connection to find if a next row is available and read it.
- private boolean nextRecordMatchingConditions() throws SQLInvalidStatementException, SQLIllegalParameterException, SQLNoSuchFieldException, SQLUnsupportedParsingFeatureException, SQLConnectionClosedException, SQLNotNumericException, SQLNotDateException {
- boolean recordMatchesConditions = false;
- DBFConnection cnt = (DBFConnection)((DBFStatement)getStatement()).getConnection();
-
- while(cnt.nextRowAvailable() && recordMatchesConditions == false) {
- this.record = cnt.readNextRowAsObjects();
- this.recordNumber = cnt.getRowNum();
- recordMatchesConditions = this.singleConditionOfWhereClause == null || this.singleConditionOfWhereClause.isVerified(this);
- }
-
- return recordMatchesConditions;
- }
-
- /**
- * @see java.sql.Wrapper#isWrapperFor(java.lang.Class)
- */
- @Override
- public boolean isWrapperFor(Class<?> iface) {
- logStep("isWrapperFor", iface);
- return iface.isAssignableFrom(getInterface());
- }
-
- /**
- * @see java.sql.ResultSet#wasNull()
- */
- @Override
- public boolean wasNull() {
- logStep("wasNull");
- return this.wasNull;
- }
-
- /**
- * Get a numeric value.
- * @param <T> Type of the number.
- * @param columnLabel Column Label.
- * @param parse Parsing function : Integer.parseInt, Float.parseFloat, Long.parseLong, ...
- * @return The expected value or null if null was encountered.
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNoSuchFieldException if the field looked for doesn't exist.
- * @throws SQLNotNumericException if the field value is not numeric or has a NULL value.
- */
- private <T extends Number> T getNumeric(String columnLabel, Function<String, T> parse) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException {
- assertNotClosed();
-
- try(DBFBuiltInMemoryResultSetForColumnsListing rs = (DBFBuiltInMemoryResultSetForColumnsListing)getFieldDesc(columnLabel, this.sql)) {
- String textValue = getString(columnLabel);
-
- if (textValue == null) {
- return null;
- }
-
- try {
- textValue = textValue.trim(); // Field must be trimed before being converted.
- T value = parse.apply(textValue);
- return(value);
- }
- catch(NumberFormatException e) {
- String message = format(Level.WARNING, "excp.field_is_not_numeric", columnLabel, rs.getString("TYPE_NAME"), this.sql, textValue);
- throw new SQLNotNumericException(message, this.sql, getFile(), columnLabel, textValue);
- }
- }
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return format("toString", this.statement != null ? this.statement.toString() : null, this.sql, isClosed() == false);
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFResultSet.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFResultSet.java
deleted file mode 100644
index 1e664a5..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFResultSet.java
+++ /dev/null
@@ -1,965 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc.resultset;
-
-import java.io.File;
-import java.io.InputStream;
-import java.io.Reader;
-import java.math.BigDecimal;
-import java.net.URL;
-import java.sql.*;
-import java.util.Calendar;
-import java.util.Map;
-import java.util.Objects;
-import java.util.logging.Level;
-
-import org.apache.sis.internal.shapefile.jdbc.SQLConnectionClosedException;
-import org.apache.sis.internal.shapefile.jdbc.connection.DBFConnection;
-import org.apache.sis.internal.shapefile.jdbc.statement.DBFStatement;
-
-/**
- * Common implemented features of all ResultSets : those based on a record, but also those returning results forged in memory.
- * @author Marc LE BIHAN
- */
-public abstract class DBFResultSet extends AbstractResultSet {
- /** Indicates if the ResultSet is closed. */
- protected boolean isClosed;
-
- /** SQL Statement. */
- protected String sql;
-
- /** true, if the last column had the SQL NULL value (for the ResultSet.wasNull() method). */
- protected boolean wasNull;
-
- /** Parent statement. */
- protected DBFStatement statement;
-
- /**
- * Constructs a result set.
- * @param stmt Parent statement.
- * @param sqlQuery SQL Statment that produced this ResultSet.
- */
- public DBFResultSet(final DBFStatement stmt, String sqlQuery) {
- Objects.requireNonNull(stmt, "the statement referred by the ResultSet cannot be null.");
-
- this.statement = stmt;
- this.sql = sqlQuery;
- }
-
- /**
- * Defaults to {@link #last()} followed by {@link #next()}.
- */
- @Override
- public void afterLast() throws SQLException {
- if (last()) next();
- }
-
- /**
- * Asserts that the connection, statement and result set are together opened.
- * @throws SQLConnectionClosedException if one of them is closed.
- */
- protected void assertNotClosed() throws SQLConnectionClosedException {
- this.statement.assertNotClosed();
-
- if (this.isClosed) {
- throw new SQLConnectionClosedException(format(Level.WARNING, "excp.closed_resultset", this.sql, getFile().getName()), this.sql, getFile());
- }
- }
-
- /**
- * Defaults to {@link #absolute(int)}.
- */
- @Override
- public void beforeFirst() throws SQLException {
- absolute(0);
- }
-
- /**
- * @see java.sql.ResultSet#close()
- */
- @Override
- public void close() {
- if (isClosed())
- return;
-
- this.statement.notifyCloseResultSet(this);
- this.isClosed = true;
- }
-
- /**
- * Returns the column index for the given column name.
- * The default implementation of all methods expecting a column label will invoke this method.
- * @param columnLabel The name of the column.
- * @return The index of the given column name : first column is 1.
- * @throws SQLNoSuchFieldException if there is no field with this name in the query.
- * @throws SQLConnectionClosedException if the connection is closed.
- */
- @Override
- @SuppressWarnings("resource") // The connection is only used to get the column index.
- public int findColumn(String columnLabel) throws SQLNoSuchFieldException, SQLConnectionClosedException {
- DBFConnection cnt = (DBFConnection)this.statement.getConnection();
- return cnt.findColumn(columnLabel, getSQL());
- }
-
- /**
- * Defaults to {@link #absolute(int)}.
- */
- @Override
- public boolean first() throws SQLException {
- return absolute(1);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public Array getArray(String columnLabel) throws SQLException {
- return getArray(findColumn(columnLabel));
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public InputStream getAsciiStream(String columnLabel) throws SQLException {
- return getAsciiStream(findColumn(columnLabel));
- }
-
- /**
- * @deprecated Replaced by {@link #getBigDecimal(int)}.
- * Defaults to {@link #getBigDecimal(int)} followed by {@link BigDecimal#setScale(int)}.
- */
- @Override
- @Deprecated
- public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
- final BigDecimal d = getBigDecimal(columnIndex);
- return (d != null) ? d.setScale(scale) : null;
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public InputStream getBinaryStream(String columnLabel) throws SQLException {
- return getBinaryStream(findColumn(columnLabel));
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public Blob getBlob(String columnLabel) throws SQLException {
- return getBlob(findColumn(columnLabel));
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public Reader getCharacterStream(String columnLabel) throws SQLException {
- return getCharacterStream(findColumn(columnLabel));
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public Clob getClob(String columnLabel) throws SQLException {
- return getClob(findColumn(columnLabel));
- }
-
- /**
- * Defaults to {@link Statement#getResultSetConcurrency()}.
- */
- @Override
- public int getConcurrency() throws SQLException {
- return getStatement().getResultSetConcurrency();
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public Date getDate(String columnLabel, Calendar cal) throws SQLException {
- return getDate(findColumn(columnLabel), cal);
- }
-
- /**
- * Defaults to {@link Statement#getFetchDirection()}.
- */
- @Override
- public int getFetchDirection() throws SQLException {
- return getStatement().getFetchDirection();
- }
-
- /**
- * @see java.sql.ResultSet#getFetchSize()
- */
- @Override
- public int getFetchSize() throws SQLException {
- return getStatement().getFetchSize();
- }
-
- /**
- * Return a field name.
- * @param columnIndex Column index.
- * @param sqlStatement For information, the SQL statement that is attempted.
- * @return Field Name.
- * @throws SQLIllegalColumnIndexException if the index is out of bounds.
- * @throws SQLConnectionClosedException if the connection is closed.
- */
- @SuppressWarnings("resource") // Only use the current connection to get the field name.
- public String getFieldName(int columnIndex, String sqlStatement) throws SQLIllegalColumnIndexException, SQLConnectionClosedException {
- DBFConnection cnt = (DBFConnection)this.statement.getConnection();
- return cnt.getFieldName(columnIndex, sqlStatement);
- }
-
- /**
- * Returns the Database File.
- * @return Database File.
- */
- @Override
- public File getFile() {
- return this.statement.getFile();
- }
-
- /**
- * Defaults to {@link Statement#getResultSetHoldability()}.
- */
- @Override
- public int getHoldability() throws SQLException {
- return getStatement().getResultSetHoldability();
- }
-
- /**
- * Returns the JDBC interface implemented by this class.
- * This is used for formatting error messages.
- */
- @Override
- public Class<?> getInterface() {
- return ResultSet.class;
- }
-
- /**
- * Defaults to {@link #getCharacterStream(int)} on the assumption that the fact that Java use UTF-16 internally
- * makes the two methods identical in behavior.
- */
- @Override
- public Reader getNCharacterStream(int columnIndex) throws SQLException {
- return getCharacterStream(columnIndex);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public Reader getNCharacterStream(String columnLabel) throws SQLException {
- return getNCharacterStream(findColumn(columnLabel));
- }
-
- /**
- * Defaults to {@link #getString(int)} on the assumption that the fact that
- * Java use UTF-16 internally makes the two methods identical in behavior.
- */
- @Override
- public String getNString(int columnIndex) throws SQLException {
- return getString(columnIndex);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public String getNString(String columnLabel) throws SQLException {
- return getNString(findColumn(columnLabel));
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public RowId getRowId(String columnLabel) throws SQLException {
- return getRowId(findColumn(columnLabel));
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public Time getTime(String columnLabel, Calendar cal) throws SQLException {
- return getTime(findColumn(columnLabel), cal);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public Timestamp getTimestamp(String columnLabel) throws SQLException {
- return getTimestamp(findColumn(columnLabel));
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException {
- return getTimestamp(findColumn(columnLabel), cal);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public URL getURL(String columnLabel) throws SQLException {
- return getURL(findColumn(columnLabel));
- }
-
- /**
- * @see java.sql.Wrapper#isWrapperFor(java.lang.Class)
- */
- @Override
- public boolean isWrapperFor(Class<?> iface) {
- return iface.isAssignableFrom(getInterface());
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public Object getObject(String columnLabel) throws SQLException {
- return getObject(findColumn(columnLabel));
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public Object getObject(String columnLabel, Map<String, Class<?>> map) throws SQLException {
- return getObject(findColumn(columnLabel), map);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public <T> T getObject(String columnLabel, Class<T> type) throws SQLException {
- return getObject(findColumn(columnLabel), type);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public Ref getRef(String columnLabel) throws SQLException {
- return getRef(findColumn(columnLabel));
- }
-
- /**
- * Returns the SQL query that created that ResultSet.
- * @return SQL query.
- */
- public String getSQL() {
- return this.sql;
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public SQLXML getSQLXML(String columnLabel) throws SQLException {
- return getSQLXML(findColumn(columnLabel));
- }
-
- /**
- * Returns the parent statement.
- * @throws SQLConnectionClosedException if the statement is closed.
- */
- @Override
- public Statement getStatement() throws SQLConnectionClosedException {
- assertNotClosed();
- return this.statement;
- }
-
- /**
- * Defaults to {@link Statement#getResultSetType()}.
- */
- @Override
- public int getType() throws SQLException {
- return getStatement().getResultSetType();
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- @Deprecated
- public InputStream getUnicodeStream(String columnLabel) throws SQLException {
- return getUnicodeStream(findColumn(columnLabel));
- }
-
- /**
- * @see java.sql.ResultSet#isBeforeFirst()
- */
- @Override
- public boolean isBeforeFirst() throws SQLException {
- return getRow() == 0;
- }
-
- /**
- * Returns {@code true} if this result set has been closed.
- * @return true if the database is closed.
- */
- @Override
- public boolean isClosed() {
- return this.isClosed || this.statement.isClosed();
- }
-
- /**
- * @see java.sql.ResultSet#isFirst()
- */
- @Override
- public boolean isFirst() throws SQLException {
- return getRow() == 1;
- }
-
- /**
- * Defaults to {@link #absolute(int)}.
- */
- @Override
- public boolean last() throws SQLException {
- return absolute(-1);
- }
-
- /**
- * Defaults to {@link #relative(int)}.
- */
- @Override
- public boolean previous() throws SQLException {
- return relative(-1);
- }
-
- /**
- * Defaults to {@link #absolute(int)} with an offset computed from {@link #getRow()}.
- */
- @Override
- public boolean relative(int rows) throws SQLException {
- return absolute(rows - getRow());
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateArray(String columnLabel, Array x) throws SQLException {
- updateArray(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException {
- updateAsciiStream(findColumn(columnLabel), x);
- }
-
- /**
- * Delegates to {@link #updateAsciiStream(int, InputStream, long)}
- */
- @Override
- public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException {
- updateAsciiStream(columnIndex, x, (long) length);
- }
-
- /**
- * Delegates to {@link #updateAsciiStream(String, InputStream, long)}
- */
- @Override
- public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException {
- updateAsciiStream(columnLabel, x, (long) length);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException {
- updateAsciiStream(findColumn(columnLabel), x, length);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException {
- updateBigDecimal(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException {
- updateBinaryStream(findColumn(columnLabel), x);
- }
-
- /**
- * Delegates to {@link #updateBinaryStream(int, InputStream, long)}.
- */
- @Override
- public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException {
- updateBinaryStream(columnIndex, x, (long) length);
- }
-
- /**
- * Delegates to {@link #updateBinaryStream(String, InputStream, long)}.
- */
- @Override
- public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException {
- updateBinaryStream(columnLabel, x, (long) length);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException {
- updateBinaryStream(findColumn(columnLabel), x, length);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateBlob(String columnLabel, Blob x) throws SQLException {
- updateBlob(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateBlob(String columnLabel, InputStream x, long length) throws SQLException {
- updateBlob(findColumn(columnLabel), x, length);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateBlob(String columnLabel, InputStream x) throws SQLException {
- updateBlob(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateBoolean(String columnLabel, boolean x) throws SQLException {
- updateBoolean(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateByte(String columnLabel, byte x) throws SQLException {
- updateByte(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateBytes(String columnLabel, byte[] x) throws SQLException {
- updateBytes(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateCharacterStream(String columnLabel, Reader x) throws SQLException {
- updateCharacterStream(findColumn(columnLabel), x);
- }
-
- /**
- * Delegates to {@link #updateCharacterStream(int, Reader, long)}
- */
- @Override
- public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException {
- updateCharacterStream(columnIndex, x, (long) length);
- }
-
- /**
- * Delegates to {@link #updateCharacterStream(String, Reader, long)}
- */
- @Override
- public void updateCharacterStream(String columnLabel, Reader x, int length) throws SQLException {
- updateCharacterStream(columnLabel, x, (long) length);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateClob(String columnLabel, Clob x) throws SQLException {
- updateClob(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateClob(String columnLabel, Reader x, long length) throws SQLException {
- updateClob(findColumn(columnLabel), x, length);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateClob(String columnLabel, Reader x) throws SQLException {
- updateClob(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateCharacterStream(String columnLabel, Reader x, long length) throws SQLException {
- updateCharacterStream(findColumn(columnLabel), x, length);
- }
-
- /**
- * Defaults to {@link #updateCharacterStream(int, Reader)} on the assumption that the fact that
- * Java use UTF-16 internally makes the two methods identical in behavior.
- */
- @Override
- public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException {
- updateCharacterStream(columnIndex, x);
- }
-
- /**
- * Defaults to {@link #updateCharacterStream(String, Reader)} on the assumption that the fact that
- * Java use UTF-16 internally makes the two methods identical in behavior.
- */
- @Override
- public void updateNCharacterStream(String columnLabel, Reader x) throws SQLException {
- updateCharacterStream(columnLabel, x);
- }
-
- /**
- * Defaults to {@link #updateCharacterStream(int, Reader, int)} on the assumption that the fact that
- * Java use UTF-16 internally makes the two methods identical in behavior.
- */
- @Override
- public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
- updateCharacterStream(columnIndex, x, length);
- }
-
- /**
- * Defaults to {@link #updateCharacterStream(String, Reader, int)} on the assumption that the fact that
- * Java use UTF-16 internally makes the two methods identical in behavior.
- */
- @Override
- public void updateNCharacterStream(String columnLabel, Reader x, long length) throws SQLException {
- updateCharacterStream(columnLabel, x, length);
- }
- /**
- * Defaults to {@link #updateClob(int, Clob)} on the assumption that the fact that Java use UTF-16 internally
- * makes the two methods identical in behavior.
- */
- @Override
- public void updateNClob(int columnIndex, NClob x) throws SQLException {
- updateClob(columnIndex, x);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateNClob(String columnLabel, NClob x) throws SQLException {
- updateNClob(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to {@link #updateClob(int, Reader, long)} on the assumption that the fact that Java use UTF-16 internally
- * makes the two methods identical in behavior.
- */
- @Override
- public void updateNClob(int columnIndex, Reader x, long length) throws SQLException {
- updateClob(columnIndex, x, length);
- }
-
- /**
- * Defaults to {@link #updateClob(String, Reader, long)} on the assumption that the fact that Java use UTF-16 internally
- * makes the two methods identical in behavior.
- */
- @Override
- public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException {
- updateClob(columnLabel, reader, length);
- }
-
- /**
- * Defaults to {@link #updateClob(int, Reader)} on the assumption that the fact that
- * Java use UTF-16 internally makes the two methods identical in behavior.
- */
- @Override
- public void updateNClob(int columnIndex, Reader reader) throws SQLException {
- updateClob(columnIndex, reader);
- }
-
- /**
- * Defaults to {@link #updateClob(String, Reader)} on the assumption that the fact that
- * Java use UTF-16 internally makes the two methods identical in behavior.
- */
- @Override
- public void updateNClob(String columnLabel, Reader reader) throws SQLException {
- updateClob(columnLabel, reader);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateDate(String columnLabel, Date x) throws SQLException {
- updateDate(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateDouble(String columnLabel, double x) throws SQLException {
- updateDouble(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateFloat(String columnLabel, float x) throws SQLException {
- updateFloat(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateInt(String columnLabel, int x) throws SQLException {
- updateInt(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateLong(String columnLabel, long x) throws SQLException {
- updateLong(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateNull(String columnLabel) throws SQLException {
- updateNull(findColumn(columnLabel));
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateObject(String columnLabel, Object x) throws SQLException {
- updateObject(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException {
- updateObject(findColumn(columnLabel), x, scaleOrLength);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateRef(String columnLabel, Ref x) throws SQLException {
- updateRef(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateRowId(String columnLabel, RowId x) throws SQLException {
- updateRowId(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateShort(String columnLabel, short x) throws SQLException {
- updateShort(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateSQLXML(String columnLabel, SQLXML x) throws SQLException {
- updateSQLXML(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateString(String columnLabel, String x) throws SQLException {
- updateString(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to {@link #updateString(int, String)} on the assumption that the fact that
- * Java use UTF-16 internally makes the two methods identical in behavior.
- */
- @Override
- public void updateNString(int columnIndex, String nString) throws SQLException {
- updateString(columnIndex, nString);
- }
-
- /**
- * Defaults to {@link #updateString(String, String)} on the assumption that the fact that
- * Java use UTF-16 internally makes the two methods identical in behavior.
- */
- @Override
- public void updateNString(String columnLabel, String nString) throws SQLException {
- updateString(columnLabel, nString);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateTime(String columnLabel, Time x) throws SQLException {
- updateTime(findColumn(columnLabel), x);
- }
-
- /**
- * Defaults to the index-based version of this method.
- * The given column name is mapped to a column index by {@link #findColumn(String)}.
- */
- @Override
- public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException {
- updateTimestamp(findColumn(columnLabel), x);
- }
-
- /**
- * @see java.sql.ResultSet#wasNull()
- */
- @Override
- public boolean wasNull() {
- return this.wasNull;
- }
-
- /**
- * Get a field description.
- * @param columnLabel Column label.
- * @param sqlStatement SQL Statement.
- * @return ResultSet with current row set on the wished field.
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLNoSuchFieldException if no column with that name exists.
- */
- public ResultSet getFieldDesc(String columnLabel, String sqlStatement) throws SQLConnectionClosedException, SQLNoSuchFieldException {
- return ((DBFConnection)((DBFStatement)getStatement()).getConnection()).getFieldDesc(columnLabel, sqlStatement);
- }
-
- /**
- * Get a field description.
- * @param column Column index.
- * @param sqlStatement SQL Statement.
- * @return ResultSet with current row set on the wished field.
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLIllegalColumnIndexException if the column index is out of bounds.
- */
- public ResultSet getFieldDesc(int column, String sqlStatement) throws SQLConnectionClosedException, SQLIllegalColumnIndexException {
- return ((DBFConnection)((DBFStatement)getStatement()).getConnection()).getFieldDesc(column, sqlStatement);
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return format("toString", this.statement != null ? this.statement.toString() : null, this.sql, isClosed() == false);
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLIllegalColumnIndexException.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLIllegalColumnIndexException.java
deleted file mode 100644
index b8efa6b..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLIllegalColumnIndexException.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc.resultset;
-
-import java.io.File;
-import java.sql.SQLException;
-
-/**
- * Exception thrown when a column index is invalid.
- * @author Marc LE BIHAN
- */
-public class SQLIllegalColumnIndexException extends SQLException {
- /** Serial ID. */
- private static final long serialVersionUID = 7525295716068215255L;
-
- /** The SQL Statement (if known). */
- private String sql;
-
- /** The database file. */
- private File database;
-
- /** Column Index that is invalid. */
- private int columnIndex;
-
- /**
- * Build the exception.
- * @param message Exception message.
- * @param sqlStatement SQL Statement who encountered the trouble, if known.
- * @param dbf The database that was queried.
- * @param colIndex The column index that is invalid.
- */
- public SQLIllegalColumnIndexException(String message, String sqlStatement, File dbf, int colIndex) {
- super(message);
- this.sql = sqlStatement;
- this.database = dbf;
- this.columnIndex = colIndex;
- }
-
- /**
- * Returns the SQL statement.
- * @return SQL statement or null.
- */
- public String getSQL() {
- return this.sql;
- }
-
- /**
- * Returns the column index.
- * @return Column index.
- */
- public int getColumnIndex() {
- return this.columnIndex;
- }
-
- /**
- * Returns the database file.
- * @return Database file.
- */
- public File getDatabase() {
- return this.database;
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNoResultException.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNoResultException.java
deleted file mode 100644
index 4756da3..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNoResultException.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc.resultset;
-
-import java.io.File;
-import java.sql.SQLException;
-
-/**
- * Exception thrown when there is no more result.
- * @author Marc LE BIHAN
- */
-public class SQLNoResultException extends SQLException {
- /** Serial ID. */
- private static final long serialVersionUID = -6685966109486353932L;
-
- /** The SQL Statement that whas attempted. */
- private String sql;
-
- /** The database that was queried. */
- private File database;
-
- /**
- * Build the exception.
- * @param message Exception message.
- * @param sqlStatement SQL Statement who encountered the trouble.
- * @param dbf The database that was queried.
- */
- public SQLNoResultException(String message, String sqlStatement, File dbf) {
- super(message);
- this.sql = sqlStatement;
- this.database = dbf;
- }
-
- /**
- * Returns the SQL statement who encountered the "end of data" alert.
- * @return SQL statement.
- */
- public String getSQL() {
- return this.sql;
- }
-
- /**
- * Returns the database file that was queried.
- * @return The database that was queried.
- */
- public File getDatabase() {
- return this.database;
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNoSuchFieldException.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNoSuchFieldException.java
deleted file mode 100644
index 337a8bb..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNoSuchFieldException.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc.resultset;
-
-import java.io.File;
-import java.sql.SQLException;
-
-/**
- * Exception thrown when a column name is not found in a request or in the database structure.
- * @author Marc LE BIHAN
- */
-public class SQLNoSuchFieldException extends SQLException {
- /** Serial ID. */
- private static final long serialVersionUID = 1118679516090878177L;
-
- /** The SQL Statement (if known). */
- private String sql;
-
- /** The database file. */
- private File database;
-
- /** Column name that doesn't exist. */
- private String columnName;
-
- /**
- * Build the exception.
- * @param message Exception message.
- * @param sqlStatement SQL Statement who encountered the trouble, if known.
- * @param dbf The database that was queried.
- * @param colName The column name that doesn't exist.
- */
- public SQLNoSuchFieldException(String message, String sqlStatement, File dbf, String colName) {
- super(message);
- this.sql = sqlStatement;
- this.database = dbf;
- this.columnName = colName;
- }
-
- /**
- * Returns the SQL statement.
- * @return SQL statement or null.
- */
- public String getSQL() {
- return this.sql;
- }
-
- /**
- * Returns the column name that doesn't exist.
- * @return Column name.
- */
- public String getColumnName() {
- return this.columnName;
- }
-
- /**
- * Returns the database file.
- * @return Database file.
- */
- public File getDatabase() {
- return this.database;
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNotDateException.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNotDateException.java
deleted file mode 100644
index 3baeefa..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNotDateException.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc.resultset;
-
-import java.io.File;
-import java.sql.SQLException;
-
-/**
- * Exception thrown when a column value was expected to be a date but wasn't.
- * @author Marc LE BIHAN
- */
-public class SQLNotDateException extends SQLException {
- /** Serial ID. */
- private static final long serialVersionUID = 848673127131548693L;
-
- /** The SQL Statement (if known). */
- private String sql;
-
- /** The database file. */
- private File database;
-
- /** Column name. */
- private String columnName;
-
- /** The value that is not numeric. */
- private String value;
-
- /**
- * Build the exception.
- * @param message Exception message.
- * @param sqlStatement SQL Statement who encountered the trouble, if known.
- * @param dbf The database that was queried.
- * @param colName The column name that has a non numeric value.
- * @param wrongValue The wrong value.
- */
- public SQLNotDateException(String message, String sqlStatement, File dbf, String colName, String wrongValue) {
- super(message);
- this.sql = sqlStatement;
- this.database = dbf;
- this.columnName = colName;
- this.value = wrongValue;
- }
-
- /**
- * Returns the SQL statement.
- * @return SQL statement or null.
- */
- public String getSQL() {
- return this.sql;
- }
-
- /**
- * Returns the column name.
- * @return Column name.
- */
- public String getColumnName() {
- return this.columnName;
- }
-
- /**
- * Returns the value that is not numeric.
- * @return Value.
- */
- public String getValue() {
- return this.value;
- }
-
- /**
- * Returns the database file.
- * @return Database file.
- */
- public File getDatabase() {
- return this.database;
- }
... 4464 lines suppressed ...