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 2018/06/21 10:52:59 UTC
[sis] annotated tag 0.6 created (now 647d5a0)
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a change to annotated tag 0.6
in repository https://gitbox.apache.org/repos/asf/sis.git.
at 647d5a0 (tag)
tagging e0af4575286585866620b191d39da1950db0e156 (commit)
by Martin Desruisseaux
on Thu Jun 21 12:36:02 2018 +0200
- Log -----------------------------------------------------------------
Tag Apache SIS 0.6, released on 2015-09-16.
-----------------------------------------------------------------------
This annotated tag includes the following new commits:
new 3d90d38 Prepare the branch for the 0.6 release.
new 276520b Remove modules that are not yet ready.
new 0ba15a6 Remove the workaround for the bug in JDK6 javadoc, since we perform release with JDK7 or JDK8 + bootstrap classpath.
new 17df794 Clarification in the prepare-release.xml Ant script.
new 06d8c6d Update NetBeans project configuration.
new 7bc16fb Fix a javadoc error.
new e0af457 Fix version number and SVN directory.
The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[sis] 03/07: Remove the workaround for the bug in JDK6 javadoc,
since we perform release with JDK7 or JDK8 + bootstrap classpath.
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to annotated tag 0.6
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 0ba15a66bb9ac3f92dfb323cb9df6e167d21904e
Author: Martin Desruisseaux <de...@apache.org>
AuthorDate: Fri Sep 11 20:14:40 2015 +0000
Remove the workaround for the bug in JDK6 javadoc, since we perform release with JDK7 or JDK8 + bootstrap classpath.
git-svn-id: https://svn.apache.org/repos/asf/sis/branches/0.6@1702545 13f79535-47bb-0310-9956-ffa450edef68
---
.../java/org/opengis/annotation/Obligation.java | 30 -----------
.../java/org/opengis/annotation/Specification.java | 30 -----------
.../src/main/java/org/opengis/annotation/UML.java | 58 ----------------------
3 files changed, 118 deletions(-)
diff --git a/core/sis-build-helper/src/main/java/org/opengis/annotation/Obligation.java b/core/sis-build-helper/src/main/java/org/opengis/annotation/Obligation.java
deleted file mode 100644
index 14af392..0000000
--- a/core/sis-build-helper/src/main/java/org/opengis/annotation/Obligation.java
+++ /dev/null
@@ -1,30 +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.opengis.annotation;
-
-
-/**
- * A dependency required for the {@link UML} workaround.
- *
- * @author Martin Desruisseaux (Geomatys)
- * @since 0.5
- * @version 0.5
- * @module
- */
-public enum Obligation {
- MANDATORY, OPTIONAL, CONDITIONAL, FORBIDDEN
-}
diff --git a/core/sis-build-helper/src/main/java/org/opengis/annotation/Specification.java b/core/sis-build-helper/src/main/java/org/opengis/annotation/Specification.java
deleted file mode 100644
index 6fd5267..0000000
--- a/core/sis-build-helper/src/main/java/org/opengis/annotation/Specification.java
+++ /dev/null
@@ -1,30 +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.opengis.annotation;
-
-
-/**
- * A dependency required for the {@link UML} workaround.
- *
- * @author Martin Desruisseaux (Geomatys)
- * @since 0.5
- * @version 0.5
- * @module
- */
-public enum Specification {
- ISO_19103, ISO_19107, ISO_19108, ISO_19111, ISO_19115, ISO_19115_2, ISO_19139, OGC_01004, OGC_01009
-}
diff --git a/core/sis-build-helper/src/main/java/org/opengis/annotation/UML.java b/core/sis-build-helper/src/main/java/org/opengis/annotation/UML.java
deleted file mode 100644
index b0a0a4a..0000000
--- a/core/sis-build-helper/src/main/java/org/opengis/annotation/UML.java
+++ /dev/null
@@ -1,58 +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.opengis.annotation;
-
-
-/**
- * Workaround for a bug in the JDK6 Javadoc tools.
- * Attempt to generate Javadoc on the Apache SIS trunk with JDK6 crashes with the following exception:
- *
- * <pre>java.lang.ClassCastException: com.sun.tools.javadoc.MethodDocImpl cannot be cast to com.sun.tools.javadoc.AnnotationTypeElementDocImpl</pre>
- *
- * The problem is caused by existence of the <code>@UML</code> annotation, defined in GeoAPI.
- * Adding dependency to the GeoAPI JAR file does not help. The workaround applied here is to
- * redefine the UML annotation without the <code>@Documented</code> meta-annotation.
- * The {@code UML} annotation defined here should have precedence over the GeoAPI annotation
- * at Javadoc generation time only (not at compile-time).
- *
- * @author Martin Desruisseaux (Geomatys)
- * @since 0.5
- * @version 0.5
- * @module
- */
-public @interface UML {
- /**
- * The UML identifier for the annotated interface, method or code list element.
- *
- * @return The UML identifier used in the standard.
- */
- String identifier();
-
- /**
- * The obligation declared in the UML.
- *
- * @return The obligation declared in the standard.
- */
- Obligation obligation() default Obligation.MANDATORY;
-
- /**
- * The specification where this UML come from.
- *
- * @return The originating specification.
- */
- Specification specification();
-}
[sis] 05/07: Update NetBeans project configuration.
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to annotated tag 0.6
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 06d8c6ddca19ecb187cbe16178af1bf2ed63ff70
Author: Martin Desruisseaux <de...@apache.org>
AuthorDate: Fri Sep 11 21:45:59 2015 +0000
Update NetBeans project configuration.
git-svn-id: https://svn.apache.org/repos/asf/sis/branches/0.6@1702560 13f79535-47bb-0310-9956-ffa450edef68
---
ide-project/NetBeans/nbproject/build-impl.xml | 38 +++++-----------------
ide-project/NetBeans/nbproject/genfiles.properties | 4 +--
2 files changed, 10 insertions(+), 32 deletions(-)
diff --git a/ide-project/NetBeans/nbproject/build-impl.xml b/ide-project/NetBeans/nbproject/build-impl.xml
index 93828a3..f685451 100644
--- a/ide-project/NetBeans/nbproject/build-impl.xml
+++ b/ide-project/NetBeans/nbproject/build-impl.xml
@@ -124,7 +124,6 @@ is divided into following sections:
<or>
<available file="${test.console.dir}"/>
<available file="${test.netcdf.dir}"/>
- <available file="${test.shapefile.dir}"/>
<available file="${test.storage.dir}"/>
<available file="${test.feature.dir}"/>
<available file="${test.referencing.dir}"/>
@@ -139,7 +138,6 @@ is divided into following sections:
<available file="${src.webapp.dir}"/>
<available file="${src.console.dir}"/>
<available file="${src.netcdf.dir}"/>
- <available file="${src.shapefile.dir}"/>
<available file="${src.storage.dir}"/>
<available file="${src.feature.dir}"/>
<available file="${src.referencing.dir}"/>
@@ -245,7 +243,6 @@ is divided into following sections:
<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.netcdf.dir">Must set src.netcdf.dir</fail>
- <fail unless="src.shapefile.dir">Must set src.shapefile.dir</fail>
<fail unless="src.storage.dir">Must set src.storage.dir</fail>
<fail unless="src.feature.dir">Must set src.feature.dir</fail>
<fail unless="src.referencing.dir">Must set src.referencing.dir</fail>
@@ -254,7 +251,6 @@ is divided into following sections:
<fail unless="src.fra-profile.dir">Must set src.fra-profile.dir</fail>
<fail unless="test.console.dir">Must set test.console.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.storage.dir">Must set test.storage.dir</fail>
<fail unless="test.feature.dir">Must set test.feature.dir</fail>
<fail unless="test.referencing.dir">Must set test.referencing.dir</fail>
@@ -281,7 +277,7 @@ is divided into following sections:
</target>
<target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
- <attribute default="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}" name="srcdir"/>
+ <attribute default="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.netcdf.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/>
<attribute default="${javac.processorpath}" name="processorpath"/>
@@ -322,7 +318,7 @@ is divided into following sections:
</target>
<target depends="-init-ap-cmdline-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.webapp.dir}:${src.console.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}" name="srcdir"/>
+ <attribute default="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.netcdf.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/>
<attribute default="${javac.processorpath}" name="processorpath"/>
@@ -355,7 +351,7 @@ is divided into following sections:
</target>
<target depends="-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.webapp.dir}:${src.console.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}" name="srcdir"/>
+ <attribute default="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.netcdf.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/>
<sequential>
@@ -448,9 +444,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.storage.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
@@ -504,9 +497,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.storage.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
@@ -640,9 +630,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.storage.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
@@ -1025,7 +1012,7 @@ is divided into following sections:
<include name="*"/>
</dirset>
</pathconvert>
- <j2seproject3:depend srcdir="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${build.generated.subdirs}"/>
+ <j2seproject3:depend srcdir="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.netcdf.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-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}"/>
@@ -1034,7 +1021,6 @@ is divided into following sections:
<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.netcdf.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
- <fileset dir="${src.shapefile.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.storage.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.feature.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.referencing.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
@@ -1061,7 +1047,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}" sourcepath="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}"/>
+ <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.netcdf.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}"/>
</target>
<target name="-post-compile-single">
<!-- Empty placeholder for easier customization. -->
@@ -1339,9 +1325,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.storage.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
<filename name="**/*.java"/>
</fileset>
@@ -1379,9 +1362,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.storage.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/doc-files/**"/>
</fileset>
@@ -1422,14 +1402,13 @@ is divided into following sections:
<!-- You can override this target in the ../build.xml file. -->
</target>
<target if="do.depend.true" name="-compile-test-depend">
- <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.console.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}"/>
+ <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.console.dir}:${test.netcdf.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}"/>
</target>
<target depends="init,deps-jar,compile,-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}" processorpath="${javac.test.processorpath}" srcdir="${test.console.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}"/>
+ <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.console.dir}:${test.netcdf.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.console.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.storage.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.feature.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.referencing.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
@@ -1450,11 +1429,10 @@ is divided into following sections:
<target depends="init,deps-jar,compile,-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}" processorpath="${javac.test.processorpath}" sourcepath="${test.console.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}" srcdir="${test.console.dir}:${test.netcdf.dir [...]
+ <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.console.dir}:${test.netcdf.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}" srcdir="${test.console.dir}:${test.netcdf.dir}:${test.storage.dir}: [...]
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.console.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.storage.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.feature.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.referencing.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 db5e277..a472e48 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=8bd6b764
-nbproject/build-impl.xml.script.CRC32=fc0a5456
+nbproject/build-impl.xml.data.CRC32=11a909c4
+nbproject/build-impl.xml.script.CRC32=77576dce
nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48
[sis] 06/07: Fix a javadoc error.
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to annotated tag 0.6
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 7bc16fbe4217ed0f343b77f0ded83ec67215eb96
Author: Martin Desruisseaux <de...@apache.org>
AuthorDate: Fri Sep 11 22:10:18 2015 +0000
Fix a javadoc error.
git-svn-id: https://svn.apache.org/repos/asf/sis/branches/0.6@1702561 13f79535-47bb-0310-9956-ffa450edef68
---
core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java b/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java
index 392efa5..89e8243 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java
@@ -126,7 +126,7 @@ public class OptionKey<T> implements Serializable {
* <tr><td>{@code "CREATE"}</td> <td>Creates a new storage object (file or database) if it does not exist.</td></tr>
* </table>
*
- * {@section Differences between the JDK6 and JDK7 branches of SIS}
+ * <div class="section">Differences between the JDK6 and JDK7 branches of SIS</div>
* In the JDK7 branch of SIS, the array type for this key is {@code java.nio.file.OpenOption[]} instead than
* {@code Object[]} and the constants listed in the above table are {@code java.nio.file.StandardOpenOption}
* enumeration values.
[sis] 02/07: Remove modules that are not yet ready.
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to annotated tag 0.6
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 276520bb1bb9ad3949511e3cc387c467007a9914
Author: Martin Desruisseaux <de...@apache.org>
AuthorDate: Fri Sep 11 20:12:39 2015 +0000
Remove modules that are not yet ready.
git-svn-id: https://svn.apache.org/repos/asf/sis/branches/0.6@1702544 13f79535-47bb-0310-9956-ffa450edef68
---
application/sis-javafx/pom.xml | 93 --
.../java/org/apache/sis/gui/ClientApplication.java | 46 -
ide-project/NetBeans/build.xml | 15 -
ide-project/NetBeans/nbproject/project.properties | 2 -
ide-project/NetBeans/nbproject/project.xml | 2 -
storage/pom.xml | 1 -
storage/sis-shapefile/pom.xml | 114 --
.../apache/sis/internal/shapefile/AutoChecker.java | 178 ---
.../shapefile/SQLShapefileNotFoundException.java | 50 -
.../internal/shapefile/ShapefileByteReader.java | 283 -----
.../internal/shapefile/ShapefileDescriptor.java | 121 --
.../shapefile/jdbc/AbstractDbase3ByteReader.java | 281 -----
.../sis/internal/shapefile/jdbc/AbstractJDBC.java | 160 ---
.../internal/shapefile/jdbc/CommonByteReader.java | 134 --
.../sis/internal/shapefile/jdbc/DBFDriver.java | 145 ---
.../shapefile/jdbc/DBase3FieldDescriptor.java | 141 ---
.../sis/internal/shapefile/jdbc/DBaseDataType.java | 102 --
.../internal/shapefile/jdbc/Dbase3ByteReader.java | 118 --
.../internal/shapefile/jdbc/MappedByteReader.java | 240 ----
.../jdbc/SQLConnectionClosedException.java | 63 -
.../jdbc/SQLDbaseFileNotFoundException.java | 50 -
.../jdbc/SQLInvalidDbaseFileFormatException.java | 50 -
.../jdbc/connection/AbstractConnection.java | 413 -------
.../shapefile/jdbc/connection/DBFConnection.java | 330 -----
.../connection/SQLClosingIOFailureException.java | 63 -
.../shapefile/jdbc/connection/package-info.java | 19 -
.../jdbc/metadata/AbstractDatabaseMetaData.java | 202 ---
.../jdbc/metadata/DBFDatabaseMetaData.java | 1306 --------------------
.../jdbc/metadata/DBFResultSetMataData.java | 505 --------
.../shapefile/jdbc/metadata/package-info.java | 21 -
.../sis/internal/shapefile/jdbc/package-info.java | 26 -
.../jdbc/resultset/AbstractResultSet.java | 706 -----------
.../jdbc/resultset/BuiltInMemoryResultSet.java | 196 ---
...iltInMemoryResultSetForCatalogNamesListing.java | 51 -
...DBFBuiltInMemoryResultSetForColumnsListing.java | 453 -------
.../DBFBuiltInMemoryResultSetForSchemaListing.java | 51 -
.../DBFBuiltInMemoryResultSetForTablesListing.java | 86 --
...uiltInMemoryResultSetForTablesTypesListing.java | 71 --
.../jdbc/resultset/DBFRecordBasedResultSet.java | 628 ----------
.../shapefile/jdbc/resultset/DBFResultSet.java | 967 ---------------
.../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 | 382 ------
.../jdbc/sql/ConditionalClauseResolver.java | 38 -
.../shapefile/jdbc/sql/CrudeSQLParser.java | 140 ---
.../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 | 306 -----
.../shapefile/jdbc/statement/DBFStatement.java | 245 ----
.../shapefile/jdbc/statement/package-info.java | 19 -
.../sis/internal/shapefile/package-info.java | 25 -
.../storage/shapefile/DataStoreQueryException.java | 50 -
.../shapefile/DataStoreQueryResultException.java | 50 -
.../shapefile/DbaseFileNotFoundException.java | 50 -
.../sis/storage/shapefile/InputFeatureStream.java | 255 ----
.../shapefile/InvalidDbaseFileFormatException.java | 32 -
.../shapefile/InvalidShapefileFormatException.java | 49 -
.../apache/sis/storage/shapefile/ShapeFile.java | 69 --
.../sis/storage/shapefile/ShapeTypeEnum.java | 73 --
.../shapefile/ShapefileNotFoundException.java | 50 -
.../apache/sis/storage/shapefile/package-info.java | 27 -
.../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 | 15 -
.../shapefile/jdbc/MappedByteReader_fr.properties | 15 -
.../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 | 29 -
.../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 -
.../jdbc/AbstractTestBaseForInternalJDBC.java | 68 -
.../internal/shapefile/jdbc/DBFConnectionTest.java | 72 --
.../internal/shapefile/jdbc/DBFResultSetTest.java | 225 ----
.../internal/shapefile/jdbc/DBFStatementTest.java | 103 --
.../apache/sis/internal/shapefile/jdbc/readme.txt | 58 -
.../shapefile/jdbc/sql/WhereClauseTest.java | 169 ---
.../sis/storage/shapefile/ShapeFileTest.java | 97 --
.../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
115 files changed, 12236 deletions(-)
diff --git a/application/sis-javafx/pom.xml b/application/sis-javafx/pom.xml
deleted file mode 100644
index 91c8580..0000000
--- a/application/sis-javafx/pom.xml
+++ /dev/null
@@ -1,93 +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>0.6-SNAPSHOT</version>
- </parent>
-
-
- <!-- ===========================================================
- Module Description
- =========================================================== -->
- <groupId>org.apache.sis.application</groupId>
- <artifactId>sis-javafx</artifactId>
- <packaging>bundle</packaging>
- <name>Apache SIS application for JavaFX</name>
- <description>
- <!-- Left alignment because this description will be copied in META-INF/MANIFEST.MF
- The leading space after the first line is necessary for proper formatting. -->
-Client application for JavaFX.
- </description>
-
-
- <!-- ===========================================================
- Developers and Contributors
- =========================================================== -->
- <developers>
- <developer>
- <name>Roshan Lakmal</name>
- <roles>
- <role>developer</role>
- </roles>
- </developer>
- </developers>
-
-
- <!-- ===========================================================
- Build configuration
- =========================================================== -->
- <build>
- <plugins>
-
- <!-- Package as OSGi bundle -->
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>org.apache.sis.gui</Bundle-SymbolicName>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-
- <!-- ===========================================================
- Dependencies
- =========================================================== -->
- <dependencies>
- <dependency>
- <groupId>org.apache.sis.core</groupId>
- <artifactId>sis-metadata</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/ClientApplication.java b/application/sis-javafx/src/main/java/org/apache/sis/gui/ClientApplication.java
deleted file mode 100644
index 5c60c4e..0000000
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/ClientApplication.java
+++ /dev/null
@@ -1,46 +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.gui;
-
-import javafx.application.Application;
-import javafx.stage.Stage;
-
-
-/**
- * The starting point of SIS application for JavaFX.
- *
- * @author Roshan Lakmal
- * @since 0.5
- * @version 0.5
- * @module
- */
-public class ClientApplication extends Application {
- /**
- * Creates a new SIS application.
- */
- public ClientApplication() {
- }
-
- /**
- * Creates and show the Graphical User Interface (GUI).
- *
- * @param stage The window where to display the GUI.
- */
- @Override
- public void start(final Stage stage) {
- }
-}
diff --git a/ide-project/NetBeans/build.xml b/ide-project/NetBeans/build.xml
index 3505ab2..3f2481b 100644
--- a/ide-project/NetBeans/build.xml
+++ b/ide-project/NetBeans/build.xml
@@ -42,13 +42,6 @@
<include name="*.utf"/>
</fileset>
</copy>
- <!-- Pending discussion about how to handle resources in the Shapefile module.
- <copy todir="${build.classes.dir}/org/apache/sis/internal/shapefile/jdbc">
- <fileset dir="${project.root}/storage/sis-shapefile/target/generated-resources/org/apache/sis/internal/shapefile/jdbc">
- <include name="*.utf"/>
- </fileset>
- </copy>
- -->
<!-- Following are classical properties resources files. -->
<copy todir="${build.classes.dir}">
@@ -172,14 +165,6 @@
</fileset>
</copy>
<copy todir="${build.test.classes.dir}">
- <fileset dir="${project.root}/storage/sis-shapefile/src/test/resources">
- <include name="**/*.dbf"/>
- <include name="**/*.prj"/>
- <include name="**/*.shp"/>
- <include name="**/*.shx"/>
- </fileset>
- </copy>
- <copy todir="${build.test.classes.dir}">
<fileset dir="${project.root}/profiles/sis-french-profile/src/test/resources">
<include name="**/*.xml"/>
</fileset>
diff --git a/ide-project/NetBeans/nbproject/project.properties b/ide-project/NetBeans/nbproject/project.properties
index 1fe5c74..d756cb7 100644
--- a/ide-project/NetBeans/nbproject/project.properties
+++ b/ide-project/NetBeans/nbproject/project.properties
@@ -50,8 +50,6 @@ src.console.dir = ${project.root}/application/sis-console/src/main/java
test.console.dir = ${project.root}/application/sis-console/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.storage.dir = ${project.root}/storage/sis-storage/src/main/java
test.storage.dir = ${project.root}/storage/sis-storage/src/test/java
src.feature.dir = ${project.root}/core/sis-feature/src/main/java
diff --git a/ide-project/NetBeans/nbproject/project.xml b/ide-project/NetBeans/nbproject/project.xml
index 187c2bc..603f03c 100644
--- a/ide-project/NetBeans/nbproject/project.xml
+++ b/ide-project/NetBeans/nbproject/project.xml
@@ -27,7 +27,6 @@
<root id="src.webapp.dir" name="Web application"/>
<root id="src.console.dir" name="Console"/>
<root id="src.netcdf.dir" name="NetCDF"/>
- <root id="src.shapefile.dir" name="Shapefile"/>
<root id="src.storage.dir" name="Storage"/>
<root id="src.feature.dir" name="Feature"/>
<root id="src.referencing.dir" name="Referencing"/>
@@ -38,7 +37,6 @@
<test-roots>
<root id="test.console.dir" name="Test Console"/>
<root id="test.netcdf.dir" name="Test NetCDF"/>
- <root id="test.shapefile.dir" name="Test Shapefile"/>
<root id="test.storage.dir" name="Test Storage"/>
<root id="test.feature.dir" name="Test Feature"/>
<root id="test.referencing.dir" name="Test Referencing"/>
diff --git a/storage/pom.xml b/storage/pom.xml
index 421d5dc..c41bd44 100644
--- a/storage/pom.xml
+++ b/storage/pom.xml
@@ -136,7 +136,6 @@
=========================================================== -->
<modules>
<module>sis-storage</module>
- <module>sis-shapefile</module>
<module>sis-netcdf</module>
</modules>
diff --git a/storage/sis-shapefile/pom.xml b/storage/sis-shapefile/pom.xml
deleted file mode 100644
index 2963434..0000000
--- a/storage/sis-shapefile/pom.xml
+++ /dev/null
@@ -1,114 +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>0.6-SNAPSHOT</version>
- </parent>
-
-
- <!-- ===========================================================
- Module Description
- =========================================================== -->
- <groupId>org.apache.sis.storage</groupId>
- <artifactId>sis-shapefile</artifactId>
- <packaging>bundle</packaging>
- <name>Apache SIS Shapefile storage</name>
- <description>
- <!-- Left alignment because this description will be copied in META-INF/MANIFEST.MF
- The leading space after the first line is necessary for proper formatting. -->
-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>
-
- <!-- Package as OSGi bundle -->
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>org.apache.sis.storage.shapefile</Bundle-SymbolicName>
- </instructions>
- </configuration>
- </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>
- </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 5742ceb..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/AutoChecker.java
+++ /dev/null
@@ -1,178 +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.ResourceBundle;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.sis.util.logging.Logging;
-
-// Branch-dependent imports
-import org.apache.sis.internal.jdk7.Objects;
-
-
-/**
- * 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. */
- private Logger logger = Logging.getLogger(getClass().getSimpleName());
-
- /**
- * 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);
- }
-
- /**
- * 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/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 586d742..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileByteReader.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;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.ByteOrder;
-import java.text.MessageFormat;
-import java.util.*;
-
-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.*;
-
-// Branch-dependent imports
-import org.apache.sis.internal.jdk7.Objects;
-
-
-/**
- * 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;
-
- /**
- * Construct a shapefile byte reader.
- * @param shapefile Shapefile.
- * @param dbaseFile underlying database file name.
- * @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) throws InvalidShapefileFormatException, SQLInvalidDbaseFileFormatException, SQLShapefileNotFoundException, SQLDbaseFileNotFoundException {
- super(shapefile, InvalidShapefileFormatException.class, SQLShapefileNotFoundException.class);
- loadDatabaseFieldDescriptors(dbaseFile);
- loadDescriptor();
-
- featuresType = getFeatureType(shapefile.getName());
- }
-
- /**
- * Returns the DBase 3 fields descriptors.
- * @return Fields descriptors.
- */
- public List<DBase3FieldDescriptor> getFieldsDescriptors() {
- return databaseFieldsDescriptors;
- }
-
- /**
- * Returns the shapefile descriptor.
- * @return Shapefile descriptor.
- */
- public ShapefileDescriptor getShapefileDescriptor() {
- return shapefileDescriptor;
- }
-
- /**
- * Returns the type of the features contained in this shapefile.
- * @return Features type.
- */
- public DefaultFeatureType getFeaturesType() {
- return 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 = databaseFieldsDescriptors.size();
- final DefaultAttributeType<?>[] attributes = new DefaultAttributeType<?>[n + 1];
- final Map<String, Object> properties = new HashMap<String, Object>(4);
-
- // Load data field.
- for (int i = 0; i < n; i++) {
- properties.put(DefaultAttributeType.NAME_KEY, databaseFieldsDescriptors.get(i).getName());
- attributes[i] = new DefaultAttributeType<String>(properties, String.class, 1, 1, null);
- }
-
- // Add geometry field.
- properties.put(DefaultAttributeType.NAME_KEY, GEOMETRY_NAME);
- attributes[n] = new DefaultAttributeType<Geometry>(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() {
- shapefileDescriptor = new ShapefileDescriptor(getByteBuffer());
- }
-
- /**
- * 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);
- databaseFieldsDescriptors = databaseReader.getFieldsDescriptors();
- }
- finally {
- if (databaseReader != null) {
- try {
- databaseReader.close();
- }
- catch(IOException 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.", 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.
- * @throws InvalidShapefileFormatException if the polygon cannot be handled.
- */
- private void loadPolygonFeature(AbstractFeature feature) throws InvalidShapefileFormatException {
- /* double xmin = */getByteBuffer().getDouble();
- /* double ymin = */getByteBuffer().getDouble();
- /* double xmax = */getByteBuffer().getDouble();
- /* double ymax = */getByteBuffer().getDouble();
- int NumParts = getByteBuffer().getInt();
- int NumPoints = getByteBuffer().getInt();
-
- if (NumParts > 1) {
- throw new InvalidShapefileFormatException("Polygons with multiple linear rings have not implemented yet.");
- }
-
- // read the one part
- @SuppressWarnings("unused")
- int Part = getByteBuffer().getInt();
- Polygon poly = new Polygon();
-
- // create a line from the points
- double xpnt = getByteBuffer().getDouble();
- double ypnt = getByteBuffer().getDouble();
- // Point oldpnt = new Point(xpnt, ypnt);
- poly.startPath(xpnt, ypnt);
-
- for (int j = 0; j < NumPoints - 1; j++) {
- xpnt = getByteBuffer().getDouble();
- ypnt = getByteBuffer().getDouble();
- poly.lineTo(xpnt, ypnt);
- }
-
- feature.setPropertyValue(GEOMETRY_NAME, 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 de5154b..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileDescriptor.java
+++ /dev/null
@@ -1,121 +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) {
- fileCode = byteBuffer.getInt();
- byteBuffer.getInt();
- byteBuffer.getInt();
- byteBuffer.getInt();
- byteBuffer.getInt();
- byteBuffer.getInt();
- fileLength = byteBuffer.getInt() * 2;
-
- byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
- version = byteBuffer.getInt();
- shapeType = ShapeTypeEnum.get(byteBuffer.getInt());
- xmin = byteBuffer.getDouble();
- ymin = byteBuffer.getDouble();
- xmax = byteBuffer.getDouble();
- ymax = byteBuffer.getDouble();
- zmin = byteBuffer.getDouble();
- zmax = byteBuffer.getDouble();
- mmin = byteBuffer.getDouble();
- mmax = byteBuffer.getDouble();
- byteBuffer.order(ByteOrder.BIG_ENDIAN);
-
- //dbf.byteBuffer.get(); // should be 0d for field terminator
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- StringBuilder s = new StringBuilder();
- String lineSeparator = System.getProperty("line.separator", "\n");
-
- s.append("FileCode: ").append(fileCode).append(lineSeparator);
- s.append("FileLength: ").append(fileLength).append(lineSeparator);
- s.append("Version: ").append(version).append(lineSeparator);
- s.append("ShapeType: ").append(shapeType).append(lineSeparator);
- s.append("xmin: ").append(xmin).append(lineSeparator);
- s.append("ymin: ").append(ymin).append(lineSeparator);
- s.append("xmax: ").append(xmax).append(lineSeparator);
- s.append("ymax: ").append(ymax).append(lineSeparator);
- s.append("zmin: ").append(zmin).append(lineSeparator);
- s.append("zmax: ").append(zmax).append(lineSeparator);
- s.append("mmin: ").append(mmin).append(lineSeparator);
- s.append("mmax: ").append(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 15704e5..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java
+++ /dev/null
@@ -1,281 +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.logging.Level;
-
-// Branch-dependent imports
-import org.apache.sis.internal.jdk7.Objects;
-
-
-/**
- * The Abstract Byte Reader.
- * @author Marc Le Bihan
- * @version 0.5
- * @since 0.5
- * @module
- */
-abstract class AbstractDbase3ByteReader extends CommonByteReader<SQLInvalidDbaseFileFormatException, SQLDbaseFileNotFoundException> implements Dbase3ByteReader {
- /** Number of bytes in the header. */
- protected short dbaseHeaderBytes;
-
- /** Number of bytes in the record. */
- protected short dbaseRecordBytes;
-
- /** 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];
-
- /** Current row rumber. */
- protected int rowNum;
-
- /**
- * 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 charset;
- }
-
- /**
- * Returns the database last update date.
- * @return Date of the last update.
- */
- @Override public Date getDateOfLastUpdate() {
- return toDate(dbaseLastUpdate);
- }
-
- /**
- * Returns the record count.
- * @return Record count.
- */
- @Override public int getRowCount() {
- return rowCount;
- }
-
- /**
- * Returns the current record number.
- * @return Current record number.
- */
- @Override public int getRowNum() {
- return rowNum;
- }
-
- /**
- * Convert the binary code page value of the Dbase 3 file to a recent Charset.
- * @param codePageBinaryValue page code binary value.
- * @return Charset.
- * @throws SQLInvalidDbaseFileFormatException if the binary value is not one of the standard values that the DBF file should carry : the Dbase 3
- * file might be corrupted.
- * @throws UnsupportedCharsetException if the code page as no representation in recents Charset (legacy DOS or macintosh charsets).
- */
- protected Charset toCharset(byte codePageBinaryValue) throws SQLInvalidDbaseFileFormatException, 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(codePageBinaryValue & 0xFF) {
- 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 = "invalid"; break;
- }
- }
-
- assert dbfCodePage != null;
-
- // If the code page is invalid, the database itself has chances to be invalid too.
- if (dbfCodePage.equals("invalid")) {
- String message = format(Level.WARNING, "excp.illegal_codepage", codePageBinaryValue, getFile().getAbsolutePath());
- throw new SQLInvalidDbaseFileFormatException(message);
- }
-
- // 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", dbfCodePage, 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<Integer,String>();
- 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(pageCodeBinaryValue & 0xFF));
- }
-
- /**
- * 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 2a9ce79..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC.java
+++ /dev/null
@@ -1,160 +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) {
- format(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) {
- format(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) {
- format(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) {
- format(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 9582ced..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/CommonByteReader.java
+++ /dev/null
@@ -1,134 +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.logging.Level;
-
-import org.apache.sis.internal.shapefile.AutoChecker;
-
-// Branch-dependent imports
-import org.apache.sis.internal.jdk7.Objects;
-
-
-/**
- * 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 {
- /** 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.");
- classInvalidFormatException = invalidFormatException;
- classFNFException = fileNotFoundException;
-
- file = f;
-
- try {
- fis = new FileInputStream(file);
- }
- catch(FileNotFoundException e) {
- throwException(classInvalidFormatException, e.getMessage(), e);
- throw new RuntimeException("this place should not be reached.");
- }
-
- fc = fis.getChannel();
-
- try {
- int fsize = (int)fc.size();
- byteBuffer = fc.map(FileChannel.MapMode.READ_ONLY, 0, fsize);
- }
- catch(IOException e) {
- String message = format(Level.WARNING, "excp.reader_cannot_be_created", file.getAbsolutePath(), e.getMessage());
- throwException(classFNFException, message, e);
- throw new RuntimeException("this place should not be reached.");
- }
- }
-
- /**
- * Close the MappedByteReader.
- * @throws IOException if the close operation fails.
- */
- public void close() throws IOException {
- if (fc != null)
- fc.close();
-
- if (fis != null)
- fis.close();
-
- isClosed = true;
- }
-
- /**
- * Returns the closed state of this binary reader.
- * @return true if it is closed.
- */
- public boolean isClosed() {
- return isClosed;
- }
-
- /**
- * Returns the byte buffer.
- * @return Byte Buffer.
- */
- public MappedByteBuffer getByteBuffer() {
- return byteBuffer;
- }
-
- /**
- * Return the file mapped.
- * @return File.
- */
- public File getFile() {
- return 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 2404658..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.*;
-import java.sql.*;
-import java.util.*;
-import java.util.logging.*;
-
-import org.apache.sis.internal.shapefile.jdbc.connection.DBFConnection;
-import org.apache.sis.internal.system.*;
-
-// Branch-dependent imports
-import org.apache.sis.internal.jdk7.Objects;
-
-
-/**
- * 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 Ignored in current implementation.
- * @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, @SuppressWarnings("unused") 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));
- }
-
- /**
- * 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.
- */
- 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 54f1177..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBase3FieldDescriptor.java
+++ /dev/null
@@ -1,141 +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
- * @since 0.5
- * @version 0.5
- * @module
- */
-public class DBase3FieldDescriptor extends AutoChecker {
- /** Field name. */
- private byte[] fieldName = new byte[11];
-
- /** 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(fieldName);
-
- // Field type.
- char dt = (char)byteBuffer.get();
- fieldType = DBaseDataType.valueOfDataType(dt);
-
- // Field address.
- byteBuffer.get(fieldAddress);
-
- // Length and scale.
- fieldLength = byteBuffer.get();
- fieldDecimalCount = byteBuffer.get();
-
- byteBuffer.getShort(); // reserved
-
- byteBuffer.get(dbasePlusLanReserved2);
-
- // Work area id.
- workAreaID = byteBuffer.get();
-
- byteBuffer.get(dbasePlusLanReserved3);
-
- // Fields.
- 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 this.fieldDecimalCount & 0xFF;
- }
-
- /**
- * Returns the field length.
- * @return field length.
- */
- public int getLength() {
- return this.fieldLength & 0xFF;
- }
-
- /**
- * Return the field name.
- * @return Field name.
- */
- public String getName() {
- int length = fieldName.length;
- while (length != 0 && fieldName[length - 1] <= ' ') {
- length--;
- }
- return new String(this.fieldName, 0, length);
- }
-
- /**
- * Return the field data type.
- * @return Data type.
- */
- public DBaseDataType getType() {
- return(fieldType);
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- String text = format("toString", getName(), fieldType, fieldLength, 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 2d725c0..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBaseDataType.java
+++ /dev/null
@@ -1,102 +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
- * @since 0.5
- * @version 0.5
- * @module
- *
- * @see <a href="http://www.clicketyclick.dk/databases/xbase/format/data_types.html">Xbase Data Types</a>
- */
-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 65bc200..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/Dbase3ByteReader.java
+++ /dev/null
@@ -1,118 +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 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, Object> 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 1a07966..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/MappedByteReader.java
+++ /dev/null
@@ -1,240 +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.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 {
- /** List of field descriptors. */
- private List<DBase3FieldDescriptor> fieldsDescriptors = new ArrayList<DBase3FieldDescriptor>();
-
- /**
- * Construct a mapped byte reader on a file.
- * @param dbase3File File.
- * @throws SQLInvalidDbaseFileFormatException if the database seems to be invalid.
- * @throws SQLDbaseFileNotFoundException if the Dbase file has not been found.
- */
- public MappedByteReader(File dbase3File) throws SQLInvalidDbaseFileFormatException, SQLDbaseFileNotFoundException {
- super(dbase3File);
- 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 : fieldsDescriptors) {
- byte[] data = new byte[fd.getLength()];
- getByteBuffer().get(data);
-
- int length = data.length;
- while (length != 0 && data[length - 1] <= ' ') {
- length--;
- }
-
- String value = new String(data, 0, length);
- feature.setPropertyValue(fd.getName(), value);
- }
-
- rowNum ++;
- }
-
- /**
- * 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() {
- return getByteBuffer().hasRemaining();
- }
-
- /**
- * Read the next row as a set of objects.
- * @return Map of field name / object value.
- */
- @Override
- public Map<String, Object> readNextRowAsObjects() {
- // TODO: ignore deleted records
- /* byte isDeleted = */ getByteBuffer().get(); // denotes whether deleted or current
- // read first part of record
-
- HashMap<String, Object> fieldsValues = new HashMap<String,Object>();
-
- for (DBase3FieldDescriptor fd : fieldsDescriptors) {
- byte[] data = new byte[fd.getLength()];
- getByteBuffer().get(data);
-
- int length = data.length;
- while (length != 0 && data[length - 1] <= ' ') {
- length--;
- }
-
- String value = new String(data, 0, length);
- fieldsValues.put(fd.getName(), value);
- }
-
- rowNum ++;
- 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.dbaseHeaderBytes = getByteBuffer().getShort();
- this.dbaseRecordBytes = getByteBuffer().getShort();
- getByteBuffer().order(ByteOrder.BIG_ENDIAN);
-
- getByteBuffer().get(reservedFiller1);
- this.reservedIncompleteTransaction = getByteBuffer().get();
- this.reservedEncryptionFlag = getByteBuffer().get();
- getByteBuffer().get(reservedFreeRecordThread);
- getByteBuffer().get(reservedMultiUser);
- reservedMDXFlag = getByteBuffer().get();
-
- // Translate code page value to a known charset.
- this.codePage = getByteBuffer().get();
- this.charset = toCharset(this.codePage);
-
- getByteBuffer().get(reservedFiller2);
-
- while(getByteBuffer().position() < this.dbaseHeaderBytes - 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 (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 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 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 < fieldsDescriptors.size(); index ++) {
- if (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 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 0def292..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);
- sql = sqlStatement;
- database = dbf;
- }
-
- /**
- * Returns the SQL statement who encountered the "connection closed" alert, if known.
- * @return SQL statement or null.
- */
- public String getSQL() {
- return sql;
- }
-
- /**
- * Returns the database file that is not opened for connection.
- * @return Database file.
- */
- public File getDatabase() {
- return 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 17877e4..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/AbstractConnection.java
+++ /dev/null
@@ -1,413 +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.
- */
- public String getSchema() throws SQLException {
- throw unsupportedOperation("getSchema");
- }
-
- /**
- * Unsupported by default.
- */
- 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) {
- format(Level.FINE, "log.auto_commit_ignored", autoCommit);
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void commit() {
- format(Level.FINE, "log.commit_rollback_ignored");
- }
-
- /**
- * Unsupported by default.
- */
- @Override
- public void rollback() {
- format(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.
- */
- public int getNetworkTimeout() {
- return 0; // Means there is no limt.
- }
-
- /**
- * Unsupported by default.
- */
- public void setNetworkTimeout(Executor executor, int milliseconds) {
- logUnsupportedOperation("setNetworkTimeout");
- }
-
- /**
- * Unsupported by default.
- */
- 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 15e6aa4..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/DBFConnection.java
+++ /dev/null
@@ -1,330 +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 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;
-
-// Branch-dependent imports
-import org.apache.sis.internal.jdk7.Objects;
-
-
-/**
- * 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<DBFStatement>();
-
- /** 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()));
- }
-
- databaseFile = datafile;
- byteReader = br;
- format(Level.FINE, "log.database_connection_opened", 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 developper.
- if (openedStatements.size() > 0) {
- format(Level.WARNING, "log.statements_left_opened", openedStatements.size(), openedStatements.toString());
- }
-
- byteReader.close();
- } catch (IOException e) {
- format(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);
- 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 byteReader.getCharset();
- }
-
- /**
- * Returns the database File.
- * @return File.
- */
- @Override
- public File getFile() {
- return 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 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 (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 byteReader.findColumn(columnLabel, sql);
- }
-
- /**
- * Returns the column count of the table of the database.
- * @return Column count.
- */
- public int getColumnCount() {
- return 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 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 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 byteReader.nextRowAvailable();
- }
-
- /**
- * Read the next row as a set of objects.
- * @return Map of field name / object value.
- */
- public Map<String, Object> readNextRowAsObjects() {
- return byteReader.readNextRowAsObjects();
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return format("toString", 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 8c68fd3..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);
- sql = sqlStatement;
- database = dbf;
- }
-
- /**
- * Returns the SQL statement who encountered the "connection closed" alert, if known.
- * @return SQL statement or null.
- */
- public String getSQL() {
- return sql;
- }
-
- /**
- * Returns the database file that is not opened for connection.
- * @return Database file.
- */
- public File getDatabase() {
- return 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 fdf799d..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)
- */
- 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 8d3e9b1..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/DBFDatabaseMetaData.java
+++ /dev/null
@@ -1,1306 +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 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;
-
-// Branch-dependent imports
-import org.apache.sis.internal.jdk7.Objects;
-
-
-/**
- * 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.");
- 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 {
- DBFStatement stmt = (DBFStatement)connection.createStatement();
- try {
- return new DBFBuiltInMemoryResultSetForColumnsListing(stmt, connection.getFieldsDescriptors());
- } finally {
- stmt.close();
- }
- }
-
- /**
- * Returns the Database File.
- * @return Database File.
- */
- @Override
- public File getFile() {
- return 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(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(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(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(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 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()
- */
- 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 5867dbf..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/DBFResultSetMataData.java
+++ /dev/null
@@ -1,505 +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.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.*;
-
-// Branch-dependent imports
-import org.apache.sis.internal.jdk7.Objects;
-
-
-/**
- * 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.");
- rs = resultset;
-
- try {
- 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)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);
-
- DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = desc(column);
- try {
- 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);
- } finally {
- rsDatabase.close();
- }
- }
-
- /**
- * @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);
-
- DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = desc(column);
- try {
- 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);
- } finally {
- rsDatabase.close();
- }
- }
-
- /**
- * @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);
-
- DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = desc(column);
- try {
- final String v = rsDatabase.getString("TYPE_NAME");
- if (v.equals("AUTO_INCREMENT") ||
- v.equals("CHAR") ||
- v.equals("INTEGER"))
- {
- return rsDatabase.getInt("COLUMN_SIZE");
- }
- if (v.equals("DATE")) {
- return 8;
- }
- if (v.equals("DOUBLE") ||
- v.equals("FLOAT") ||
- v.equals("DECIMAL"))
- {
- // Add decimal separator for decimal numbers.
- return rsDatabase.getInt("COLUMN_SIZE") + 1;
- }
- if (v.equals("BOOLEAN")) {
- return 5; // Translation for true, false, null.
- }
- if (v.equals("CURRENCY") ||
- v.equals("DATETIME") ||
- v.equals("TIMESTAMP") ||
- v.equals("MEMO") ||
- v.equals("PICTURE") ||
- v.equals("VARIFIELD") ||
- v.equals("VARIANT") ||
- v.equals("UNKNOWN"))
- {
- // Unhandled types default to field length.
- return rsDatabase.getInt("COLUMN_SIZE");
- }
- 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);
- } finally {
- rsDatabase.close();
- }
- }
-
- /**
- * @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);
-
- DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = desc(column);
- try {
- 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);
- } finally {
- rsDatabase.close();
- }
- }
-
- /**
- * @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);
-
- DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = desc(column);
- try {
- 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);
- } finally {
- rsDatabase.close();
- }
- }
-
- /**
- * @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);
-
- DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = desc(column);
- try {
- 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);
- } finally {
- rsDatabase.close();
- }
- }
-
- /**
- * @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);
-
- DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = desc(column);
- try {
- 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);
- } finally {
- rsDatabase.close();
- }
- }
-
- /**
- * @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 = 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);
-
- DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = desc(column);
- try {
- 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);
- } finally {
- rsDatabase.close();
- }
- }
-
- /**
- * @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);
-
- DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = desc(column);
- try {
- 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);
- } finally {
- rsDatabase.close();
- }
- }
-
- /**
- * @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);
-
- DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = desc(column);
- try {
- final String v = rsDatabase.getString("TYPE_NAME");
- if (v.equals("AUTO_INCREMENT"))
- return Integer.class.getName();
-
- if (v.equals("CHAR"))
- return String.class.getName();
-
- if (v.equals("INTEGER"))
- return Integer.class.getName();
-
- if (v.equals("DATE"))
- return java.sql.Date.class.getName();
-
- if (v.equals("DOUBLE"))
- return Double.class.getName();
-
- if (v.equals("FLOAT"))
- return Float.class.getName();
-
- if (v.equals("DECIMAL"))
- return Double.class.getName();
-
- if (v.equals("BOOLEAN"))
- return Boolean.class.getName();
-
- if (v.equals("CURRENCY"))
- return Double.class.getName();
-
- if (v.equals("DATETIME"))
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on DateTime");
-
- if (v.equals("TIMESTAMP"))
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on TimeStamp");
-
- if (v.equals("MEMO"))
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on Memo");
-
- if (v.equals("PICTURE"))
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on Picture");
-
- if (v.equals("VARIFIELD"))
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on VariField");
-
- if (v.equals("VARIANT"))
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on Variant");
-
- if (v.equals("UNKNOWN"))
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on " + rsDatabase.getString("TYPE_NAME"));
-
- 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);
- } finally {
- rsDatabase.close();
- }
- }
-
- /**
- * @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 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)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, 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 8b0a6d7..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/AbstractResultSet.java
+++ /dev/null
@@ -1,706 +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 developpers : 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.
- */
- 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 78b1677..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, 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, 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, sql));
- }
-
- /**
- * @see java.sql.ResultSet#getFloat(int)
- */
- @Override
- public float getFloat(int columnIndex) throws SQLException {
- return getFloat(getFieldName(columnIndex, 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, 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, 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, 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, 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 f9c035f..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForColumnsListing.java
+++ /dev/null
@@ -1,453 +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");
- 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);
-
- // String => table name
- if (columnLabel.equals("TABLE_NAME")) {
- String tableName = getTableName();
- wasNull = (tableName == null);
- return tableName;
- }
-
- // String => column name
- if (columnLabel.equals("COLUMN_NAME")) {
- String columnName = current.getName();
- wasNull = (columnName == null);
- return columnName;
- }
-
- // String => Data source dependent type name, for a UDT the type name is fully qualified
- if (columnLabel.equals("TYPE_NAME")) {
- String typeName = current.getType() != null ? toColumnTypeName() : null;
- 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)
- if (columnLabel.equals("TABLE_CAT")) {
- wasNull = true;
- return null;
- }
-
- // String => table schema (may be null)
- if (columnLabel.equals("TABLE_SCHEM")) {
- wasNull = true;
- return null;
- }
-
- // String => comment describing column (may be null)
- if (columnLabel.equals("REMARKS")) {
- 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)
- if (columnLabel.equals("COLUMN_DEF")) {
- wasNull = true;
- return null;
- }
-
- // String => catalog of table that is the scope of a reference attribute (null if DATA_TYPE isn't REF)
- if (columnLabel.equals("SCOPE_CATALOG")) {
- wasNull = true;
- return null;
- }
-
- // String => schema of table that is the scope of a reference attribute (null if the DATA_TYPE isn't REF)
- if (columnLabel.equals("SCOPE_SCHEMA")) {
- wasNull = true;
- return null;
- }
-
- // String => table name that this the scope of a reference attribute (null if the DATA_TYPE isn't REF)
- if (columnLabel.equals("SCOPE_TABLE")) {
- 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
- */
- if (columnLabel.equals("IS_AUTOINCREMENT")) {
- 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
- */
- if (columnLabel.equals("IS_GENERATEDCOLUMN")) {
- wasNull = false;
- return "NO";
- }
-
- // 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);
-
- // int => SQL type from java.sql.Types
- if (columnLabel.equals("DATA_TYPE")) {
- wasNull = false;
- return toSQLDataType();
- }
-
- // int => column size.
- if (columnLabel.equals("COLUMN_SIZE")) {
- wasNull = false;
- return toPrecision();
- }
-
- // int => the number of fractional digits. Null is returned for data types where DECIMAL_DIGITS is not applicable.
- if (columnLabel.equals("DECIMAL_DIGITS")) {
- int scale = toScale();
- wasNull = toScale() == -1;
- return scale == -1 ? 0 : scale;
- }
-
- // int => Radix (typically either 10 or 2)
- if (columnLabel.equals("NUM_PREC_RADIX")) {
- return 10;
- }
-
- /**
- * int => is NULL allowed.
- * columnNoNulls - might not allow NULL values
- * columnNullable - definitely allows NULL values
- * columnNullableUnknown - nullability unknown
- */
- if (columnLabel.equals("NULLABLE")) {
- wasNull = false;
- return DatabaseMetaData.columnNullableUnknown;
- }
-
- // int => unused
- if (columnLabel.equals("SQL_DATA_TYPE")) {
- wasNull = false;
- return toSQLDataType();
- }
-
- // int => for char types the maximum number of bytes in the column
- if (columnLabel.equals("CHAR_OCTET_LENGTH")) {
- if (toSQLDataType() == Types.CHAR) {
- return toPrecision();
- }
-
- return 0;
- }
-
- // int => index of column in table (starting at 1)
- if (columnLabel.equals("ORDINAL_POSITION")) {
- return 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)
- if (columnLabel.equals("SOURCE_DATA_TYPE")) {
- wasNull = true;
- return 0;
- }
-
- // is not used.
- if (columnLabel.equals("BUFFER_LENGTH")) {
- wasNull = false;
- return 0;
- }
-
- // int => unused
- if (columnLabel.equals("SQL_DATETIME_SUB")) {
- wasNull = false;
- return 0;
- }
-
- // 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 (itDescriptor.hasNext()) {
- current = itDescriptor.next();
- columnIndex ++;
- return true;
- }
- else {
- if (afterLast) {
- // The ResultSet has no more records and has been call one time too much.
- 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(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(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(current.getType()) {
- case AutoIncrement:
- case Character:
- case Integer:
- return current.getLength();
-
- case Date:
- return 8;
-
- case Double:
- case FloatingPoint:
- case Number:
- return current.getLength();
-
- case Logical:
- return 0;
-
- case Currency:
- case DateTime:
- case TimeStamp:
- return current.getLength();
-
- case Memo:
- case Picture:
- case VariField:
- case Variant:
- return 0;
-
- default:
- return 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(current.getType()) {
- case AutoIncrement:
- case Logical:
- return 0;
-
- case Integer:
- case Double:
- case FloatingPoint:
- case Number:
- case Currency:
- return 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 5ccd958..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesListing.java
+++ /dev/null
@@ -1,86 +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);
-
- if (columnLabel.equals("TABLE_NAME")) // String => table name.
- {
- String tableName = getTableName();
- wasNull = (tableName == null);
- return tableName;
- }
-
- if (columnLabel.equals("TABLE_TYPE")) { // String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
- wasNull = false;
- return "TABLE";
- }
- if (columnLabel.equals("TYPE_NAME") || // String => type name (may be null)
- columnLabel.equals("TABLE_CAT") || // String => table catalog (may be null)
- columnLabel.equals("TABLE_SCHEM") || // String => table schema (may be null)
- columnLabel.equals("REMARKS") || // String => explanatory comment on the table
- columnLabel.equals("TYPE_CAT") || // String => the types catalog (may be null)
- columnLabel.equals("TYPE_SCHEM") || // String => the types schema (may be null)
- columnLabel.equals("SELF_REFERENCING_COL_NAME") || // String => name of the designated "identifier" column of a typed table (may be null)
- columnLabel.equals("REF_GENERATION")) // String => specifies how values in SELF_REFERENCING_COL_NAME are created. Values are "SYSTEM", "USER", "DERIVED". (may be null)
- {
- wasNull = true;
- return null;
- }
- wasNull = true;
- return null;
- }
-
- /**
- * @see java.sql.ResultSet#next()
- */
- @Override public boolean next() throws SQLNoResultException
- {
- logStep("next");
-
- if (index > 1) {
- throw new SQLNoResultException(format(Level.WARNING, "excp.only_one_table_per_dbf"), "Driver manager asks for table listing", getFile());
- }
-
- index ++;
- return (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 2a73ab8..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesTypesListing.java
+++ /dev/null
@@ -1,71 +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);
-
- if (columnLabel.equals("OBJECTID")) { // FIXME Documentation of ObjectId for geTabletTypes() has not been found. What are the rules about this field ?
- wasNull = false;
- return "1";
- }
- if (columnLabel.equals("TABLE_TYPE")) { // String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
- wasNull = false;
- return "TABLE"; // and DBase 3 only knows tables.
- }
- wasNull = true;
- return null;
- }
-
- /**
- * @see java.sql.ResultSet#next()
- */
- @Override public boolean next() throws SQLNoResultException
- {
- logStep("next");
-
- if (index > 1) {
- throw new SQLNoResultException(format(Level.WARNING, "excp.only_one_table_type_handled"), "Driver manager asks for table types listing", getFile());
- }
-
- index ++;
- return (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 37b2fb0..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet.java
+++ /dev/null
@@ -1,628 +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.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;
-
-// Branch-dependent imports
-import org.apache.sis.internal.jdk8.Function;
-
-
-/**
- * A ResultSet based on a record.
- * @author Marc LE BIHAN
- */
-public class DBFRecordBasedResultSet extends DBFResultSet {
- /** The current record. */
- private Map<String, Object> record;
-
- /** Condition of where clause (currently, only one is handled). */
- private ConditionalClauseResolver singleConditionOfWhereClause;
-
- /** UTF-8 charset. */
- private static Charset UTF8 = Charset.forName("UTF-8");
-
- /**
- * 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);
- 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.
- DBFBuiltInMemoryResultSetForColumnsListing field = (DBFBuiltInMemoryResultSetForColumnsListing)getFieldDesc(columnLabel, sql);
- try {
- MathContext mc = new MathContext(field.getInt("DECIMAL_DIGITS"), RoundingMode.HALF_EVEN);
- Double doubleValue = getDouble(columnLabel);
-
- if (doubleValue != null) {
- BigDecimal number = new BigDecimal(doubleValue, mc);
- wasNull = false;
- return number;
- }
- else {
- wasNull = true;
- return null;
- }
- } finally {
- field.close();
- }
- }
-
- /**
- * @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, 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);
- wasNull = false;
- return number;
- }
- else {
- 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.
- wasNull = true;
- return null; // The ResultSet:getDate() contract is to return null when a null date is encountered.
- }
- else {
- 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, sql, value);
- throw new SQLNotDateException(message, 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, sql, value);
- throw new SQLNotDateException(message, 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, 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, new Function<String,Double>() {
- @Override public Double apply(final String value) {
- return Double.parseDouble(value);
- }
- });
- 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, 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, new Function<String,Float>() {
- @Override public Float apply(final String value) {
- return Float.parseFloat(value);
- }
- });
- 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, 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, new Function<String,Integer>() {
- @Override public Integer apply(final String value) {
- return Integer.parseInt(value);
- }
- });
- 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, 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, new Function<String,Long>() {
- @Override public Long apply(final String value) {
- return Long.parseLong(value);
- }
- });
- 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, 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 {
- DBFBuiltInMemoryResultSetForColumnsListing field = (DBFBuiltInMemoryResultSetForColumnsListing)getFieldDesc(column, sql);
- try {
- 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);
- }
-
- if (fieldType.equals("AUTO_INCREMENT") ||
- fieldType.equals("INTEGER"))
- return getInt(column);
-
- if (fieldType.equals("CHAR"))
- return getString(column);
-
- if (fieldType.equals("DATE"))
- return getDate(column);
-
- if (fieldType.equals("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);
- }
-
- if (fieldType.equals("DOUBLE") ||
- fieldType.equals("CURRENCY"))
- return getDouble(column);
-
- if (fieldType.equals("FLOAT"))
- return getFloat(column);
-
- if (fieldType.equals("BOOLEAN"))
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on Boolean");
-
- if (fieldType.equals("DATETIME"))
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on DateTime");
-
- if (fieldType.equals("TIMESTAMP"))
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on TimeStamp");
-
- if (fieldType.equals("MEMO"))
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on Memo");
-
- if (fieldType.equals("PICTURE"))
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on Picture");
-
- if (fieldType.equals("VARIFIELD"))
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on VariField");
-
- if (fieldType.equals("VARIANT"))
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on Variant");
-
- if (fieldType.equals("UNKNOWN"))
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on " + fieldType);
-
- throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on " + fieldType);
- } finally {
- field.close();
- }
- }
-
- /**
- * @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);
- }
- }
-
- /**
- * @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, new Function<String,Short>() {
- @Override public Short apply(final String value) {
- return Short.parseShort(value);
- }
- });
- 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, 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, sql); // Ensure that the field queried exists, else a null value here can be interpreted as "not existing" or "has a null value".
- String withoutCharset = (String)record.get(columnLabel);
-
- if (withoutCharset == null) {
- wasNull = true;
- return withoutCharset;
- }
- else {
- wasNull = false;
- }
-
- // If a non null value has been readed, convert it to the wished Charset.
- DBFConnection cnt = (DBFConnection)((DBFStatement)getStatement()).getConnection();
- String withDatabaseCharset = new String(withoutCharset.getBytes(), cnt.getCharset());
- log(Level.FINER, "log.string_field_charset", columnLabel, withoutCharset, withDatabaseCharset, cnt.getCharset());
-
- // Because the Database is old (end of 1980's), it has not been made to support UTF-8 encoding.
- // But must users of DBase 3 don't know this, and sometimes a String field may carry such characters.
- // Attempt to determine if the string could be an UTF-8 String instead.
- String withUtf8Encoding = new String(withoutCharset.getBytes(), UTF8);
-
- // If conversion contains a not convertible character, it's not an UTF-8 string.
- // If the UTF-8 string is shorter than the one that would have given the database charset, it's a good sign : it has chances to be better.
- boolean unsureResult = withUtf8Encoding.indexOf('\ufffd') != -1 || withUtf8Encoding.length() >= withDatabaseCharset.length();
-
- if (unsureResult)
- return withDatabaseCharset;
- else {
- log(Level.FINER, "log.string_field_charset", columnLabel, withoutCharset, withUtf8Encoding, UTF8);
- return withUtf8Encoding;
- }
- }
-
- /**
- * @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, 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) {
- throw new SQLNoResultException(format(Level.WARNING, "excp.no_more_results", sql, getFile().getName()), sql, getFile());
- }
-
- 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) {
- record = cnt.readNextRowAsObjects();
- recordMatchesConditions = singleConditionOfWhereClause == null || singleConditionOfWhereClause.isVerified(this);
- }
-
- return recordMatchesConditions && cnt.nextRowAvailable(); // Beware of the end of database !
- }
-
- /**
- * @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 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();
-
- DBFBuiltInMemoryResultSetForColumnsListing rs = (DBFBuiltInMemoryResultSetForColumnsListing)getFieldDesc(columnLabel, sql);
- try {
- String textValue = (String)record.get(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"), sql, textValue);
- throw new SQLNotNumericException(message, sql, getFile(), columnLabel, textValue);
- }
- } finally {
- rs.close();
- }
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return format("toString", statement != null ? statement.toString() : null, 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 0f2f887..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFResultSet.java
+++ /dev/null
@@ -1,967 +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.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;
-
-// Branch-dependent imports
-import org.apache.sis.internal.jdk7.Objects;
-
-
-/**
- * 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.");
-
- statement = stmt;
- 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 {
- statement.assertNotClosed();
-
- if (isClosed) {
- throw new SQLConnectionClosedException(format(Level.WARNING, "excp.closed_resultset", sql, getFile().getName()), 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;
-
- statement.notifyCloseResultSet(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)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)statement.getConnection();
- return cnt.getFieldName(columnIndex, sqlStatement);
- }
-
- /**
- * Returns the Database File.
- * @return Database File.
- */
- @Override
- public File getFile() {
- return 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)}.
- */
- 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 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 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 isClosed || 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 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", statement != null ? statement.toString() : null, 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 f428fea..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);
- sql = sqlStatement;
- database = dbf;
- columnIndex = colIndex;
- }
-
- /**
- * Returns the SQL statement.
- * @return SQL statement or null.
- */
- public String getSQL() {
- return sql;
- }
-
- /**
- * Returns the column index.
- * @return Column index.
- */
- public int getColumnIndex() {
- return columnIndex;
- }
-
- /**
- * Returns the database file.
- * @return Database file.
- */
- public File getDatabase() {
- return 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 ca72fe1..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);
- sql = sqlStatement;
- database = dbf;
- }
-
- /**
- * Returns the SQL statement who encountered the "end of data" alert.
- * @return SQL statement.
- */
- public String getSQL() {
- return sql;
- }
-
- /**
- * Returns the database file that was queried.
- * @return The database that was queried.
- */
- public File getDatabase() {
- return 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 4a20f9d..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);
- sql = sqlStatement;
- database = dbf;
- columnName = colName;
- }
-
- /**
- * Returns the SQL statement.
- * @return SQL statement or null.
- */
- public String getSQL() {
- return sql;
- }
-
- /**
- * Returns the column name that doesn't exist.
- * @return Column name.
- */
- public String getColumnName() {
- return columnName;
- }
-
- /**
- * Returns the database file.
- * @return Database file.
- */
- public File getDatabase() {
- return 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 4ba08ba..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);
- sql = sqlStatement;
- database = dbf;
- columnName = colName;
- value = wrongValue;
- }
-
- /**
- * Returns the SQL statement.
- * @return SQL statement or null.
- */
- public String getSQL() {
- return sql;
- }
-
- /**
- * Returns the column name.
- * @return Column name.
- */
- public String getColumnName() {
- return columnName;
- }
-
- /**
- * Returns the value that is not numeric.
- * @return Value.
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Returns the database file.
- * @return Database file.
- */
- public File getDatabase() {
- return database;
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNotNumericException.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNotNumericException.java
deleted file mode 100644
index df11ca6..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNotNumericException.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 numeric but wasn't.
- * @author Marc LE BIHAN
- */
-public class SQLNotNumericException extends SQLException {
- /** Serial ID. */
- private static final long serialVersionUID = -1065338463289030584L;
-
- /** 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 SQLNotNumericException(String message, String sqlStatement, File dbf, String colName, String wrongValue) {
- super(message);
- sql = sqlStatement;
- database = dbf;
- columnName = colName;
- value = wrongValue;
- }
-
- /**
- * Returns the SQL statement.
- * @return SQL statement or null.
- */
- public String getSQL() {
- return sql;
- }
-
- /**
- * Returns the column name.
- * @return Column name.
- */
- public String getColumnName() {
- return columnName;
- }
-
- /**
- * Returns the value that is not numeric.
- * @return Value.
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Returns the database file.
- * @return Database file.
- */
- public File getDatabase() {
- return database;
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/package-info.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/package-info.java
deleted file mode 100644
index af21cf7..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/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.
- */
-
-/**
- * Result sets for SQL statements and DB Metadata querying.
- */
-package org.apache.sis.internal.shapefile.jdbc.resultset;
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/ClauseResolver.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/ClauseResolver.java
deleted file mode 100644
index b913668..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/ClauseResolver.java
+++ /dev/null
@@ -1,382 +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.sql;
-
-import java.util.logging.Level;
-
-import org.apache.sis.internal.shapefile.AutoChecker;
-import org.apache.sis.internal.shapefile.jdbc.SQLConnectionClosedException;
-import org.apache.sis.internal.shapefile.jdbc.resultset.*;
-
-// Branch-dependent imports
-import org.apache.sis.internal.jdk8.Function;
-import org.apache.sis.internal.jdk7.Objects;
-import org.apache.sis.util.Numbers;
-
-
-/**
- * Base class for clause resolver.
- * @author Marc LE BIHAN
- */
-public abstract class ClauseResolver extends AutoChecker {
- /** First comparand. */
- private Object comparand1;
-
- /** Second comparand. */
- private Object comparand2;
-
- /** Operator. */
- private String operator;
-
- /**
- * Construct a where clause resolver.
- * @param cmp1 The first comparand that might be a primitive or a Field.
- * @param cmp2 The second comparand that might be a primitive or a Field.
- * @param op The operator to apply.
- */
- public ClauseResolver(Object cmp1, Object cmp2, String op) {
- comparand1 = cmp1;
- comparand2 = cmp2;
- operator = op;
- }
-
- /**
- * Returns first comparand.
- * @return First comparand.
- */
- public Object getComparand1() {
- return comparand1;
- }
-
- /**
- * Returns second comparand.
- * @return Second comparand.
- */
- public Object getComparand2() {
- return comparand2;
- }
-
- /**
- * Returns operator.
- * @return Operator.
- */
- public String getOperator() {
- return operator;
- }
-
- /**
- * Set the first comparand.
- * @param comparand First comparand.
- */
- public void setComparand1(Object comparand) {
- comparand1 = comparand;
- }
-
- /**
- * Set the second comparand.
- * @param comparand Second comparand.
- */
- public void setComparand2(Object comparand) {
- comparand2 = comparand;
- }
-
- /**
- * Set the operator.
- * @param op Operator.
- */
- public void setOperator(String op) {
- operator = op;
- }
-
- /**
- * Check if a condition is verified.
- * @param rs ResultSet where the value shall be taken.
- * @return true if the current record of the ResultSet matches this condition.
- * @throws SQLInvalidStatementException if the operator is not valid.
- * @throws SQLIllegalParameterException if a parameter has a value that is not parsable.
- * @throws SQLNoSuchFieldException if a field name doesn't exist in the query.
- * @throws SQLUnsupportedParsingFeatureException if our implementation of the driver still not handle this data type.
- * @throws SQLNotDateException if a field announced being a date isn't.
- * @throws SQLUnsupportedParsingFeatureException if the driver encounter a type it cannot handle.
- * @throws SQLNotNumericException if a field doesn't carry a numeric value when expected to.
- * @throws SQLConnectionClosedException if the connection is closed.
- */
- public boolean isVerified(DBFRecordBasedResultSet rs) throws SQLInvalidStatementException, SQLIllegalParameterException, SQLNoSuchFieldException, SQLUnsupportedParsingFeatureException, SQLConnectionClosedException, SQLNotNumericException, SQLNotDateException {
- final String v = getOperator();
- if (v.equals("="))
- return compare(rs) == 0;
-
- if (v.equals(">"))
- return compare(rs) > 0;
-
- if (v.equals(">="))
- return compare(rs) >= 0;
-
- if (v.equals("<"))
- return compare(rs) < 0;
-
- if (v.equals("<="))
- return compare(rs) <= 0;
-
- String message = format(Level.WARNING, "excp.invalid_statement_operator", getOperator(), rs.getSQL());
- throw new SQLInvalidStatementException(message, rs.getSQL(), rs.getFile());
- }
-
- /**
- * Returns true if this condition is verified.
- * @param rs The record containing the values to extract, if needed.
- * @return true if it is the case.
- * @throws SQLIllegalParameterException if a parameter has a value that is not parsable.
- * @throws SQLNoSuchFieldException if a field name doesn't exist in the query.
- * @throws SQLUnsupportedParsingFeatureException if our implementation of the driver still not handle this data type.
- * @throws SQLNotDateException if a field announced being a date isn't.
- * @throws SQLUnsupportedParsingFeatureException if the driver encounter a type it cannot handle.
- * @throws SQLNotNumericException if a field doesn't carry a numeric value when expected to.
- * @throws SQLConnectionClosedException if the connection is closed.
- */
- private int compare(DBFRecordBasedResultSet rs) throws SQLIllegalParameterException, SQLNoSuchFieldException, SQLUnsupportedParsingFeatureException, SQLConnectionClosedException, SQLNotNumericException, SQLNotDateException {
- Object value1 = valueOf(rs, getComparand1());
- Object value2 = valueOf(rs, getComparand2());
-
- // Handle NULL value cases.
- if (value1 == null && value2 == null)
- return 0;
- else
- {
- if (value1 == null)
- return -1;
- else
- {
- if (value2 == null)
- return 1;
- }
- }
-
- assert(value1 != null && value2 != null) : "Null values should have been handled in comparison.";
-
- // If comparands have already the same type, compare them immediately.
- if (value1.getClass().equals(value2.getClass())) {
- return compare(rs, value1, value2);
- }
- else {
- // Else, attempt to promote their types to something equivalent on the two sides.
- if (value1 instanceof Number && value2 instanceof Number) {
- // Promote Short to Integer, Long, Float or Double.
- final Class<? extends Number> widestClass = Numbers.widestClass(
- value1.getClass().asSubclass(Number.class),
- value2.getClass().asSubclass(Number.class));
- Number n1 = Numbers.cast((Number) value1, widestClass);
- Number n2 = Numbers.cast((Number) value2, widestClass);
- return compare(rs, n1, n2);
- }
-
- // if we are here, we have found no matching at all.
- // Default to String comparison.
- String default1 = value1.toString();
- String default2 = value2.toString();
- return compare(rs, default1, default2);
- }
- }
-
- /**
- * Perform a comparison after having attempted to promote compared types : one of the parameter must belongs to one class and the other
- * one to the second one to allow the conversion and comparison to be done, else a null value will be returned, meaning that no promotion were possible.
- * @param <W> the worst class expected, the one that will be promoted to the best class through the mean of the promoter function.
- * @param <B> the best class expected : one of the parameter will be promoted to this class to allow comparison to be done.
- * @param rs ResultSet where field values has been taken.
- * @param value1 First value.
- * @param value2 Second value.
- * @param worstHas The worst class expected.
- * @param bestHas The best class expected.
- * @param promoter Promoting function.
- * @return Comparison result, or null if no comparison can be done because a parameter value cannot be promoted.
- * @throws SQLUnsupportedParsingFeatureException if a comparison fails eventually on a Java type not belonging to {link #java.lang.Comparable}.
- */
- private <W, B> Integer compareIfPromoted(DBFRecordBasedResultSet rs, Object value1, Object value2, Class<W> worstHas, Class<B> bestHas, Function<W, B> promoter) throws SQLUnsupportedParsingFeatureException {
- boolean w1 = value1.getClass().equals(worstHas);
- boolean b1 = value1.getClass().equals(bestHas);
- boolean w2 = value2.getClass().equals(worstHas);
- boolean b2 = value2.getClass().equals(bestHas);
-
- // if the values has the same class, they should have been already compared. But let's to it.
- if ((w1 && w2) || (b1 && b2))
- return compare(rs, value1, value2);
- else
- {
- // if one value doesn't match to a type, we can't perform the comparison.
- if ((w1 == false && b1 == false) || (w2 == false && b2 == false))
- return null;
- else {
- assert((w1 != b1 && w2 != b2) && (w1 != w2 && b1 != b2)) : "Parameters are not of different types.";
-
- // Suppress the warnings because we have done the checkings before.
- @SuppressWarnings("unchecked") B sameType1 = w1 ? promoter.apply((W)value1) : (B)value1;
- @SuppressWarnings("unchecked") B sameType2 = w2 ? promoter.apply((W)value2) : (B)value2;
- return compare(rs, sameType1, sameType2);
- }
- }
- }
-
- /**
- * Compare two values of the same type.
- * @param <T> Class of their type.
- * @param rs ResultSet where field values has been taken.
- * @param value1 First comparand.
- * @param value2 Second comparand.
- * @return Result of the comparison.
- * @throws SQLUnsupportedParsingFeatureException if this type doesn't implements {link #java.lang.Comparable} and cannot be handled by this driver.
- */
- @SuppressWarnings({"rawtypes", "unchecked"}) // Wished : Types are checked by the caller.
- private <T> int compare(DBFRecordBasedResultSet rs, T value1, T value2) throws SQLUnsupportedParsingFeatureException {
- Comparable comparable1 = null;
- Comparable comparable2 = null;
-
- if (value1 instanceof Comparable<?>) {
- comparable1 = (Comparable)value1;
- }
-
- if (value2 instanceof Comparable<?>) {
- comparable2 = (Comparable)value2;
- }
-
- // If one of the comparands doesn't belong to java.lang.Comparable, our driver is taken short.
- if (comparable1 == null) {
- String message = format(Level.WARNING, "excp.uncomparable_type", value1, value1.getClass().getName(), rs.getSQL());
- throw new SQLUnsupportedParsingFeatureException(message, rs.getSQL(), rs.getFile());
- }
-
- if (comparable2 == null) {
- String message = format(Level.WARNING, "excp.uncomparable_type", value2, value2.getClass().getName(), rs.getSQL());
- throw new SQLUnsupportedParsingFeatureException(message, rs.getSQL(), rs.getFile());
- }
-
- return comparable1.compareTo(comparable2);
- }
-
- /**
- * Returns the value of a comparand.
- * @param rs ResultSet.
- * @param comparand Comparand.
- * @return Value of that comparand :
- * <br>- itself, it is a primitive type or an enclosed string.
- * <br>-a field value if the given string is not enclosed by ' characters : the parser see it a field name, then.
- * @throws SQLIllegalParameterException if a literal string value is not well enclosed by '...'.
- * @throws SQLNoSuchFieldException if the comparand designs a field name that doesn't exist.
- * @throws SQLNotDateException if a field announced being a date isn't.
- * @throws SQLUnsupportedParsingFeatureException if the driver encounter a type it cannot handle.
- * @throws SQLNotNumericException if a field doesn't carry a numeric value when expected to.
- * @throws SQLConnectionClosedException if the connection is closed.
- */
- private Object valueOf(DBFRecordBasedResultSet rs, Object comparand) throws SQLIllegalParameterException, SQLNoSuchFieldException, SQLConnectionClosedException, SQLNotNumericException, SQLUnsupportedParsingFeatureException, SQLNotDateException {
- Objects.requireNonNull(rs, "ResultSet cannot be null when taking the value of a ResultSet comparand.");
- Objects.requireNonNull(comparand, "Comparand cannot be null.");
-
- // All comparands that are litterals are returned as they are.
- if (comparand instanceof String == false)
- return comparand;
-
- String text = (String)comparand;
- text = text.trim();
-
- // If the field is enclosed by ' characters, it is considered a litteral too, but these ' are removed before returning the string.
- boolean wannaBeLiteral = text.startsWith("'") || text.endsWith("'"); // A ' at the beginning or the end.
- boolean uncompleteLiteral = text.startsWith("'") == false || text.endsWith("'") == false || text.length() < 2; // But not at the two sides, or a string made of a single one.
-
- if (wannaBeLiteral) {
- if (wannaBeLiteral && uncompleteLiteral) {
- String message = format(Level.WARNING, "excp.illegal_parameter_where", text, rs.getSQL());
- throw new SQLIllegalParameterException(message, rs.getSQL(), rs.getFile(), "literal", text);
- }
-
- assert(text.indexOf("'") == 0 && text.indexOf("'") < text.lastIndexOf("'") && text.lastIndexOf("'") == text.length()-1 && text.length() >= 2) : "The litteral string is not enclosed into '...'";
-
- String literal = text.substring(1, text.length()-1);
- return literal;
- }
- else {
- // The string designs a field name, return its value.
- DBFBuiltInMemoryResultSetForColumnsListing field = (DBFBuiltInMemoryResultSetForColumnsListing)rs.getFieldDesc(text, rs.getSQL());
- try {
- return valueOf(rs, field);
- } finally {
- field.close();
- }
- }
- }
-
- /**
- * Returns the field value in a ResultSet.
- * @param rs ResultSet.
- * @param field Field.
- * @return Field value.
- * @throws SQLNotNumericException if the value of a numeric field queried isn't numeric.
- * @throws SQLNoSuchFieldException if a field name doesn't exist in the query.
- * @throws SQLConnectionClosedException if the connection is closed.
- * @throws SQLUnsupportedParsingFeatureException if our implementation of the driver still not handle this data type.
- * @throws SQLNotDateException if the value of a date field is not a date.
- */
- private Object valueOf(DBFRecordBasedResultSet rs, DBFBuiltInMemoryResultSetForColumnsListing field) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException, SQLUnsupportedParsingFeatureException, SQLNotDateException {
- String columnName = field.getString("COLUMN_NAME");
-
- final String v = field.getString("TYPE_NAME");
- if (v.equals("AUTO_INCREMENT"))
- return rs.getInt(columnName);
-
- if (v.equals("CHAR"))
- return rs.getString(columnName);
-
- if (v.equals("INTEGER"))
- return rs.getInt(columnName);
-
- if (v.equals("DATE"))
- return rs.getDate(columnName);
-
- if (v.equals("DOUBLE"))
- return rs.getDouble(columnName);
-
- if (v.equals("FLOAT"))
- return rs.getFloat(columnName);
-
-
- if (v.equals("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 rs.getInt(columnName);
- else
- return rs.getLong(columnName);
- }
-
- return rs.getDouble(columnName);
- }
-
- if (v.equals("BOOLEAN") ||
- v.equals("CURRENCY") ||
- v.equals("DATETIME") ||
- v.equals("TIMESTAMP") ||
- v.equals("MEMO") ||
- v.equals("PICTURE") ||
- v.equals("VARIFIELD") ||
- v.equals("VARIANT") ||
- v.equals("UNKNOWN"))
- {
- String message = format(Level.WARNING, "excp.unparsable_field_type", columnName, field.getString("TYPE_NAME"), rs.getSQL());
- throw new SQLUnsupportedParsingFeatureException(message, rs.getSQL(), rs.getFile());
- }
- throw new RuntimeException(format(Level.WARNING, "assert.unknown_field_type", field.getString("TYPE_NAME")));
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/ConditionalClauseResolver.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/ConditionalClauseResolver.java
deleted file mode 100644
index 526a805..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/ConditionalClauseResolver.java
+++ /dev/null
@@ -1,38 +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.sql;
-
-/**
- * Conditional Clause resolver : resolves a single part of an expression :
- * <br>- Only resolve comparison of simple statements like F = 2, not those involving intermediate calculations (F + 4 = 6).
- * <br>- Only resolve a part of an expression : in "A = 5 and (B = 3 or C = 6)" will treat A = 5, for example.
- * <br>- If many clauseResolvers are chained, operator precedence checking has to be done by the caller.
- * <br>- This class is only here temporary, and will be replaced by a good SQL parser as soon as possible.
- * @author Marc LE BIHAN
- */
-public class ConditionalClauseResolver extends ClauseResolver
-{
- /**
- * Construct a where clause resolver.
- * @param comparand1 The first comparand that might be a primitive or a Field.
- * @param comparand2 The second comparand that might be a primitive or a Field.
- * @param operator The operator to apply.
- */
- public ConditionalClauseResolver(Object comparand1, Object comparand2, String operator) {
- super(comparand1, comparand2, operator);
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/CrudeSQLParser.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/CrudeSQLParser.java
deleted file mode 100644
index 45c1b89..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/CrudeSQLParser.java
+++ /dev/null
@@ -1,140 +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.sql;
-
-import java.io.File;
-import java.util.logging.Level;
-
-import org.apache.sis.internal.shapefile.jdbc.AbstractJDBC;
-import org.apache.sis.internal.shapefile.jdbc.resultset.DBFRecordBasedResultSet;
-
-// Branch-dependent imports
-import org.apache.sis.internal.jdk7.Objects;
-
-
-/**
- * Simple and temporary SQL parser.
- * @author Marc LE BIHAN
- */
-public class CrudeSQLParser extends AbstractJDBC {
- /** ResultSet followed straight forward. */
- private DBFRecordBasedResultSet rs;
-
- /**
- * Construct a crude SQL parser.
- * @param resultset Target ResultSet.
- */
- public CrudeSQLParser(DBFRecordBasedResultSet resultset) {
- Objects.requireNonNull(resultset, "The ResultSet given to the SQL parser cannot be null.");
- rs = resultset;
- }
-
- /**
- * Get the unique conditional statement contained in an SQL statement.
- * @return Conditional clause or null if the statement wasn't accompanied by a where clause.
- * @throws SQLInvalidStatementException if the SQL statement is invalid.
- */
- public ConditionalClauseResolver parse() throws SQLInvalidStatementException {
- logStep("parse");
-
- String sql = rs.getSQL().trim();
-
- if (sql.toLowerCase().startsWith("select * from ") == false) {
- String message = format(Level.WARNING, "excp.limited_feature_syntax", sql);
- throw new SQLInvalidStatementException(message, rs.getSQL(), rs.getFile());
- }
-
- final String whereWord = " where ";
- int whereIndex = sql.toLowerCase().indexOf(whereWord);
-
- // If the where clause has not been found, its not an error : there is no condition to set, that's all.
- if (whereIndex == -1)
- return null;
-
- // Get the conditions.
- int endOfwhereClause = whereIndex + whereWord.length();
- String whereCondition = sql.substring(endOfwhereClause).trim();
-
- // If the condition is empty, it's a syntax error because a WHERE clause went before.
- if (whereCondition.isEmpty()) {
- String message = format(Level.WARNING, "excp.where_without_conditions", sql);
- throw new SQLInvalidStatementException(message, rs.getSQL(), rs.getFile());
- }
-
- // Currently, all the condition are made of three parts :
- // <Comparand 1> <operator> <Comparand 2>
- // i.e. : A < 5, CITY = 'Kratie', B >= 15.3
- // Spaces are currently expected between parts of the conditional expression.
- String[] parts = whereCondition.split(" ");
-
- if (parts.length != 3) {
- String message = format(Level.WARNING, "excp.limited_feature_conditional_parsing", whereCondition, sql);
- throw new SQLInvalidStatementException(message, rs.getSQL(), rs.getFile());
- }
-
- // Detect and promote litterals in parameters to their best types.
- Object comparand1 = convertToNearestParameterType(parts[0]);
- Object comparand2 = convertToNearestParameterType(parts[2]);
- String operand = parts[1];
-
- ConditionalClauseResolver resolver = new ConditionalClauseResolver(comparand1, comparand2, operand);
- return resolver;
- }
-
- /**
- * Promote a value to the best parameter available : Integer, then Double, then String.
- * TODO Convert to Date, and admit null values.
- * @param value Value.
- * @return Converted value or value kept as String if no convertion applies.
- */
- private Object convertToNearestParameterType(String value) {
- try {
- return Integer.parseInt(value);
- }
- catch(NumberFormatException e) {
- try {
- return Double.parseDouble(value);
- }
- catch(NumberFormatException ex) {
- return value;
- }
- }
- }
-
- /**
- * @see java.sql.Wrapper#isWrapperFor(java.lang.Class)
- */
- @Override public boolean isWrapperFor(Class<?> iface) {
- logStep("isWrapperFor", iface);
- return false;
- }
-
- /**
- * @see org.apache.sis.internal.shapefile.jdbc.AbstractJDBC#getFile()
- */
- @Override protected File getFile() {
- return rs.getFile();
- }
-
- /**
- * @see org.apache.sis.internal.shapefile.jdbc.AbstractJDBC#getInterface()
- */
- @Override protected Class<?> getInterface() {
- logStep("getInterface");
- return getClass();
- }
-}
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/SQLIllegalParameterException.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/SQLIllegalParameterException.java
deleted file mode 100644
index 59e00f5..0000000
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/SQLIllegalParameterException.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.sql;
-
-import java.io.File;
-import java.sql.SQLException;
-
-/**
- * Exception thrown when a parameter is invalid.
- * @author Marc LE BIHAN
- */
-public class SQLIllegalParameterException extends SQLException {
- /** Serial ID. */
- private static final long serialVersionUID = -3173798942882143448L;
-
- /** The SQL Statement (if known). */
- private String sql;
-
- /** The database file. */
- private File database;
-
- /** Parameter name (if known) that is invalid. */
- private String parameterName;
-
- /** Parameter value that is invalid. */
- private String parameterValue;
-
- /**
- * 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 name The parameter name that is invalid.
- * @param value The parameter value that is invalid.
- */
- public SQLIllegalParameterException(String message, String sqlStatement, File dbf, String name, String value) {
- super(message);
- sql = sqlStatement;
- database = dbf;
- parameterName = name;
- parameterValue = value;
- }
-
- /**
- * Returns the SQL statement.
- * @return SQL statement or null.
- */
- public String getSQL() {
- return sql;
- }
-
- /**
- * Returns the parameter name that is invalid, if known.
- * @return Parameter name.
- */
- public String geParameterName() {
- return parameterName;
- }
-
- /**
- * Returns the parameter value that is invalid.
- * @return Parameter name.
- */
- public String geParameterValue() {
- return parameterValue;
- }
-
- /**
- * Returns the database file.
... 3076 lines suppressed ...
[sis] 01/07: Prepare the branch for the 0.6 release.
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to annotated tag 0.6
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 3d90d388225fec00b158d39e001dd4164c31ef81
Author: Martin Desruisseaux <de...@apache.org>
AuthorDate: Fri Sep 11 20:08:02 2015 +0000
Prepare the branch for the 0.6 release.
git-svn-id: https://svn.apache.org/repos/asf/sis/branches/0.6@1702543 13f79535-47bb-0310-9956-ffa450edef68
---
.../src/main/ant/prepare-release.xml | 2 +-
.../operation/projection/ConformalProjection.java | 2 +-
.../operation/projection/TransverseMercator.java | 3 ++-
.../org/apache/sis/internal/system/Supervisor.java | 2 +-
.../sis/internal/util/TemporalUtilities.java | 2 +-
.../src/main/java/org/apache/sis/util/Version.java | 2 +-
pom.xml | 27 ++++------------------
7 files changed, 11 insertions(+), 29 deletions(-)
diff --git a/core/sis-build-helper/src/main/ant/prepare-release.xml b/core/sis-build-helper/src/main/ant/prepare-release.xml
index 563f60d..533b433 100644
--- a/core/sis-build-helper/src/main/ant/prepare-release.xml
+++ b/core/sis-build-helper/src/main/ant/prepare-release.xml
@@ -32,7 +32,7 @@
<!-- Ensure that the "sis-build-helper" plugin used by the build is the released version. -->
<replaceregexp file = "${user.dir}/pom.xml"
match = "<sis\.plugin\.version>.+</sis\.plugin\.version>"
- replace = "<sis.plugin.version>${sis.version}-SNAPSHOT</sis.plugin.version>"/>
+ replace = "<sis.plugin.version>${sis.version}</sis.plugin.version>"/>
<!-- Replace the version number in Java code. -->
<replaceregexp file = "${user.dir}/core/sis-utility/src/main/java/org/apache/sis/util/Version.java"
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ConformalProjection.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ConformalProjection.java
index b9ef4ed..0e26539 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ConformalProjection.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ConformalProjection.java
@@ -85,7 +85,7 @@ abstract class ConformalProjection extends NormalizedProjection {
* Note that since this boolean is static final, the compiler should exclude the code in the branch that is never
* executed (no need to comment-out that code).
*/
- private static final boolean ORIGINAL_FORMULA = false;
+ private static final boolean ORIGINAL_FORMULA = true;
/**
* Coefficients in the series expansion used by {@link #φ(double)}.
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/TransverseMercator.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/TransverseMercator.java
index 758d1e3..2d288a3 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/TransverseMercator.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/TransverseMercator.java
@@ -100,7 +100,7 @@ public class TransverseMercator extends NormalizedProjection {
* Note that since this boolean is static final, the compiler should exclude the code in the branch that is never
* executed (no need to comment-out that code).
*/
- private static final boolean ORIGINAL_FORMULA = false;
+ private static final boolean ORIGINAL_FORMULA = true;
/**
* Internal coefficients for computation, depending only on value of excentricity.
@@ -485,6 +485,7 @@ public class TransverseMercator extends NormalizedProjection {
sin_8ξ = sin(8*ξ);
cos_8ξ = cos(8*ξ);
+ sinh_2η = sinh(2*η);
cosh_2η = cosh(2*η);
sinh_4η = sinh(4*η);
cosh_4η = cosh(4*η);
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/system/Supervisor.java b/core/sis-utility/src/main/java/org/apache/sis/internal/system/Supervisor.java
index f96776b..ebd94d3 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/system/Supervisor.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/system/Supervisor.java
@@ -60,7 +60,7 @@ public final class Supervisor extends StandardMBean implements SupervisorMBean,
* Whatever JMX agent is enabled. Setting this variable to {@code false} allows the
* Java compiler to omit any dependency to this {@code Supervisor} class.
*/
- static final boolean ENABLED = true;
+ static final boolean ENABLED = false;
/**
* The JMX object name for the {@code Supervisor} service.
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/util/TemporalUtilities.java b/core/sis-utility/src/main/java/org/apache/sis/internal/util/TemporalUtilities.java
index 0700ccc..91579a7 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/util/TemporalUtilities.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/util/TemporalUtilities.java
@@ -43,7 +43,7 @@ public final class TemporalUtilities extends Static {
*
* This constant will be removed after SIS release a sis-temporal module.
*/
- public static final boolean REPORT_MISSING_MODULE = true;
+ public static final boolean REPORT_MISSING_MODULE = false;
/**
* Do not allow instantiation of this class.
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/Version.java b/core/sis-utility/src/main/java/org/apache/sis/util/Version.java
index 78ffd48..9b966df 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/Version.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/Version.java
@@ -60,7 +60,7 @@ public class Version implements CharSequence, Comparable<Version>, Serializable
/**
* The version of this Apache SIS distribution.
*/
- public static final Version SIS = new Version(MAJOR_VERSION + "." + MINOR_VERSION + "-SNAPSHOT");
+ public static final Version SIS = new Version(MAJOR_VERSION + "." + MINOR_VERSION);
/**
* A few commonly used version numbers. This list is based on SIS needs, e.g. in {@code DataStore}
diff --git a/pom.xml b/pom.xml
index e416526..a17a1e2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -68,12 +68,12 @@ Apache SIS is a free software, Java language library for developing geospatial a
============================================================== -->
<scm>
<connection>
- scm:svn:http://svn.apache.org/repos/asf/sis/trunk
+ scm:svn:http://svn.apache.org/repos/asf/sis/branches/0.6
</connection>
<developerConnection>
- scm:svn:https://svn.apache.org/repos/asf/sis/trunk
+ scm:svn:https://svn.apache.org/repos/asf/sis/branches/0.6
</developerConnection>
- <url>http://svn.apache.org/viewvc/sis/trunk</url>
+ <url>http://svn.apache.org/viewvc/sis/branches/0.6</url>
</scm>
<ciManagement>
@@ -410,7 +410,7 @@ Apache SIS is a free software, Java language library for developing geospatial a
<!-- Following properties are branch-specific -->
<maven.compile.source>1.6</maven.compile.source>
<maven.compile.target>1.6</maven.compile.target>
- <sis.plugin.version>${project.version}</sis.plugin.version>
+ <sis.plugin.version>0.6</sis.plugin.version>
<geoapi.version>3.0.0</geoapi.version>
</properties>
@@ -700,25 +700,6 @@ Apache SIS is a free software, Java language library for developing geospatial a
<!-- ==============================================================
- Additional repositories from which to download artifacts.
- The parent pom.xml already declares the apache.snapshots
- repository for library artifacts. But we also need it for
- Maven plugins in order to download sis-build-helper when
- the user did not built it himself.
- ============================================================== -->
- <pluginRepositories>
- <pluginRepository>
- <id>apache.snapshots</id>
- <name>Apache Snapshot Repository</name>
- <url>http://repository.apache.org/snapshots</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- </pluginRepository>
- </pluginRepositories>
-
-
- <!-- ==============================================================
Group of modules to build in approximate dependency order.
============================================================== -->
<modules>
[sis] 07/07: Fix version number and SVN directory.
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to annotated tag 0.6
in repository https://gitbox.apache.org/repos/asf/sis.git
commit e0af4575286585866620b191d39da1950db0e156
Author: Martin Desruisseaux <de...@apache.org>
AuthorDate: Fri Sep 11 22:14:21 2015 +0000
Fix version number and SVN directory.
git-svn-id: https://svn.apache.org/repos/asf/sis/tags/0.6@1702563 13f79535-47bb-0310-9956-ffa450edef68
---
application/pom.xml | 2 +-
application/sis-console/pom.xml | 2 +-
application/sis-webapp/pom.xml | 2 +-
core/pom.xml | 2 +-
core/sis-build-helper/pom.xml | 2 +-
core/sis-feature/pom.xml | 2 +-
core/sis-metadata/pom.xml | 2 +-
core/sis-referencing/pom.xml | 2 +-
core/sis-utility/pom.xml | 2 +-
pom.xml | 10 +++++-----
profiles/pom.xml | 2 +-
profiles/sis-french-profile/pom.xml | 2 +-
storage/pom.xml | 2 +-
storage/sis-netcdf/pom.xml | 2 +-
storage/sis-storage/pom.xml | 2 +-
15 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/application/pom.xml b/application/pom.xml
index d27979a..dc8ea18 100644
--- a/application/pom.xml
+++ b/application/pom.xml
@@ -28,7 +28,7 @@
<parent>
<groupId>org.apache.sis</groupId>
<artifactId>parent</artifactId>
- <version>0.6-SNAPSHOT</version>
+ <version>0.6</version>
</parent>
diff --git a/application/sis-console/pom.xml b/application/sis-console/pom.xml
index 7b7ee77..86758d8 100644
--- a/application/sis-console/pom.xml
+++ b/application/sis-console/pom.xml
@@ -28,7 +28,7 @@
<parent>
<groupId>org.apache.sis</groupId>
<artifactId>application</artifactId>
- <version>0.6-SNAPSHOT</version>
+ <version>0.6</version>
</parent>
diff --git a/application/sis-webapp/pom.xml b/application/sis-webapp/pom.xml
index 54b1ce2..547b6d8 100644
--- a/application/sis-webapp/pom.xml
+++ b/application/sis-webapp/pom.xml
@@ -28,7 +28,7 @@
<parent>
<groupId>org.apache.sis</groupId>
<artifactId>application</artifactId>
- <version>0.6-SNAPSHOT</version>
+ <version>0.6</version>
</parent>
<groupId>org.apache.sis.application</groupId>
diff --git a/core/pom.xml b/core/pom.xml
index c0f6978..77f3fc0 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -28,7 +28,7 @@
<parent>
<groupId>org.apache.sis</groupId>
<artifactId>parent</artifactId>
- <version>0.6-SNAPSHOT</version>
+ <version>0.6</version>
</parent>
diff --git a/core/sis-build-helper/pom.xml b/core/sis-build-helper/pom.xml
index e57f272..5f5f803 100644
--- a/core/sis-build-helper/pom.xml
+++ b/core/sis-build-helper/pom.xml
@@ -29,7 +29,7 @@
<parent>
<groupId>org.apache.sis</groupId>
<artifactId>parent</artifactId>
- <version>0.6-SNAPSHOT</version>
+ <version>0.6</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/core/sis-feature/pom.xml b/core/sis-feature/pom.xml
index 89fbabd..68f0126 100644
--- a/core/sis-feature/pom.xml
+++ b/core/sis-feature/pom.xml
@@ -28,7 +28,7 @@
<parent>
<groupId>org.apache.sis</groupId>
<artifactId>core</artifactId>
- <version>0.6-SNAPSHOT</version>
+ <version>0.6</version>
</parent>
diff --git a/core/sis-metadata/pom.xml b/core/sis-metadata/pom.xml
index 6933768..44c3b06 100644
--- a/core/sis-metadata/pom.xml
+++ b/core/sis-metadata/pom.xml
@@ -28,7 +28,7 @@
<parent>
<groupId>org.apache.sis</groupId>
<artifactId>core</artifactId>
- <version>0.6-SNAPSHOT</version>
+ <version>0.6</version>
</parent>
diff --git a/core/sis-referencing/pom.xml b/core/sis-referencing/pom.xml
index 22add08..8e1e072 100644
--- a/core/sis-referencing/pom.xml
+++ b/core/sis-referencing/pom.xml
@@ -28,7 +28,7 @@
<parent>
<groupId>org.apache.sis</groupId>
<artifactId>core</artifactId>
- <version>0.6-SNAPSHOT</version>
+ <version>0.6</version>
</parent>
<groupId>org.apache.sis.core</groupId>
diff --git a/core/sis-utility/pom.xml b/core/sis-utility/pom.xml
index b77a8b5..f89b745 100644
--- a/core/sis-utility/pom.xml
+++ b/core/sis-utility/pom.xml
@@ -28,7 +28,7 @@
<parent>
<groupId>org.apache.sis</groupId>
<artifactId>core</artifactId>
- <version>0.6-SNAPSHOT</version>
+ <version>0.6</version>
</parent>
diff --git a/pom.xml b/pom.xml
index 21696cc..0b704cf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,7 +39,7 @@
============================================================== -->
<groupId>org.apache.sis</groupId>
<artifactId>parent</artifactId>
- <version>0.6-SNAPSHOT</version>
+ <version>0.6</version>
<packaging>pom</packaging>
<name>Apache SIS</name>
@@ -68,12 +68,12 @@ Apache SIS is a free software, Java language library for developing geospatial a
============================================================== -->
<scm>
<connection>
- scm:svn:http://svn.apache.org/repos/asf/sis/branches/0.6
+ scm:svn:http://svn.apache.org/repos/asf/sis/tags/0.6
</connection>
<developerConnection>
- scm:svn:https://svn.apache.org/repos/asf/sis/branches/0.6
+ scm:svn:https://svn.apache.org/repos/asf/sis/tags/0.6
</developerConnection>
- <url>http://svn.apache.org/viewvc/sis/branches/0.6</url>
+ <url>http://svn.apache.org/viewvc/sis/tags/0.6</url>
</scm>
<ciManagement>
@@ -410,7 +410,7 @@ Apache SIS is a free software, Java language library for developing geospatial a
<!-- Following properties are branch-specific -->
<maven.compile.source>1.6</maven.compile.source>
<maven.compile.target>1.6</maven.compile.target>
- <sis.plugin.version>0.6-SNAPSHOT</sis.plugin.version>
+ <sis.plugin.version>0.6</sis.plugin.version>
<geoapi.version>3.0.0</geoapi.version>
</properties>
diff --git a/profiles/pom.xml b/profiles/pom.xml
index 8ba28c9..fca453c 100644
--- a/profiles/pom.xml
+++ b/profiles/pom.xml
@@ -28,7 +28,7 @@
<parent>
<groupId>org.apache.sis</groupId>
<artifactId>parent</artifactId>
- <version>0.6-SNAPSHOT</version>
+ <version>0.6</version>
</parent>
diff --git a/profiles/sis-french-profile/pom.xml b/profiles/sis-french-profile/pom.xml
index ef9b039..e87fa9c 100644
--- a/profiles/sis-french-profile/pom.xml
+++ b/profiles/sis-french-profile/pom.xml
@@ -28,7 +28,7 @@
<parent>
<groupId>org.apache.sis</groupId>
<artifactId>profiles</artifactId>
- <version>0.6-SNAPSHOT</version>
+ <version>0.6</version>
</parent>
diff --git a/storage/pom.xml b/storage/pom.xml
index c41bd44..7016fd0 100644
--- a/storage/pom.xml
+++ b/storage/pom.xml
@@ -28,7 +28,7 @@
<parent>
<groupId>org.apache.sis</groupId>
<artifactId>parent</artifactId>
- <version>0.6-SNAPSHOT</version>
+ <version>0.6</version>
</parent>
diff --git a/storage/sis-netcdf/pom.xml b/storage/sis-netcdf/pom.xml
index 6d4a9d6..6c09def 100644
--- a/storage/sis-netcdf/pom.xml
+++ b/storage/sis-netcdf/pom.xml
@@ -28,7 +28,7 @@
<parent>
<groupId>org.apache.sis</groupId>
<artifactId>storage</artifactId>
- <version>0.6-SNAPSHOT</version>
+ <version>0.6</version>
</parent>
diff --git a/storage/sis-storage/pom.xml b/storage/sis-storage/pom.xml
index 8f9f168..6370899 100644
--- a/storage/sis-storage/pom.xml
+++ b/storage/sis-storage/pom.xml
@@ -28,7 +28,7 @@
<parent>
<groupId>org.apache.sis</groupId>
<artifactId>storage</artifactId>
- <version>0.6-SNAPSHOT</version>
+ <version>0.6</version>
</parent>
[sis] 04/07: Clarification in the prepare-release.xml Ant script.
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to annotated tag 0.6
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 17df794e935067e4f49fa0aa8fb3ce0062874e78
Author: Martin Desruisseaux <de...@apache.org>
AuthorDate: Fri Sep 11 20:20:13 2015 +0000
Clarification in the prepare-release.xml Ant script.
git-svn-id: https://svn.apache.org/repos/asf/sis/branches/0.6@1702547 13f79535-47bb-0310-9956-ffa450edef68
---
core/sis-build-helper/src/main/ant/prepare-release.xml | 3 ++-
pom.xml | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/core/sis-build-helper/src/main/ant/prepare-release.xml b/core/sis-build-helper/src/main/ant/prepare-release.xml
index 533b433..08e3028 100644
--- a/core/sis-build-helper/src/main/ant/prepare-release.xml
+++ b/core/sis-build-helper/src/main/ant/prepare-release.xml
@@ -32,7 +32,8 @@
<!-- Ensure that the "sis-build-helper" plugin used by the build is the released version. -->
<replaceregexp file = "${user.dir}/pom.xml"
match = "<sis\.plugin\.version>.+</sis\.plugin\.version>"
- replace = "<sis.plugin.version>${sis.version}</sis.plugin.version>"/>
+ replace = "<sis.plugin.version>${sis.version}-SNAPSHOT</sis.plugin.version>"/>
+ <!-- The -SNAPSHOT part will be removed later, at tag creation. -->
<!-- Replace the version number in Java code. -->
<replaceregexp file = "${user.dir}/core/sis-utility/src/main/java/org/apache/sis/util/Version.java"
diff --git a/pom.xml b/pom.xml
index a17a1e2..21696cc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -410,7 +410,7 @@ Apache SIS is a free software, Java language library for developing geospatial a
<!-- Following properties are branch-specific -->
<maven.compile.source>1.6</maven.compile.source>
<maven.compile.target>1.6</maven.compile.target>
- <sis.plugin.version>0.6</sis.plugin.version>
+ <sis.plugin.version>0.6-SNAPSHOT</sis.plugin.version>
<geoapi.version>3.0.0</geoapi.version>
</properties>