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 2017/01/11 18:28:20 UTC
svn commit: r1778333 - in /sis/branches/JDK7:
core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/
ide-project/NetBeans/ ide-project/NetBeans/nbproject/ storage/
storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/
storage/sis...
Author: desruisseaux
Date: Wed Jan 11 18:28:20 2017
New Revision: 1778333
URL: http://svn.apache.org/viewvc?rev=1778333&view=rev
Log:
Merge the sis-xmlstore module from JDK8 branch.
Added:
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/IteratorSpliterator.java (with props)
sis/branches/JDK7/storage/sis-xmlstore/
- copied from r1778247, sis/branches/JDK8/storage/sis-xmlstore/
Modified:
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Instant.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Predicate.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Spliterator.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Stream.java
sis/branches/JDK7/ide-project/NetBeans/build.xml
sis/branches/JDK7/ide-project/NetBeans/nbproject/build-impl.xml
sis/branches/JDK7/ide-project/NetBeans/nbproject/genfiles.properties
sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties
sis/branches/JDK7/ide-project/NetBeans/nbproject/project.xml
sis/branches/JDK7/storage/pom.xml
sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java
sis/branches/JDK7/storage/sis-xmlstore/pom.xml
sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Copyright.java
sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Metadata.java
sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Person.java
sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Reader.java
sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Store.java
sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java
sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamReader.java
sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamWriter.java
sis/branches/JDK7/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/ReaderTest.java
sis/branches/JDK7/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/WriterTest.java
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Instant.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Instant.java?rev=1778333&r1=1778332&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Instant.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Instant.java [UTF-8] Wed Jan 11 18:28:20 2017
@@ -40,6 +40,18 @@ public final class Instant extends Tempo
}
/**
+ * Not a JDK method - used as a replacement of {@code Date.toInstant()}.
+ *
+ * @param date the date to convert, or {@code null}.
+ * @return the date as an instant, or {@code null}.
+ *
+ * @see #toDate()
+ */
+ public static Instant create(final Date date) {
+ return (date != null) ? new Instant(date.getTime()) : null;
+ }
+
+ /**
* Parses the given text.
*
* @param text the text to parse.
@@ -81,6 +93,8 @@ public final class Instant extends Tempo
* Not a JDK method - used as a replacement of {@code Date.from(Instant)}.
*
* @return this instant as a legacy date object.
+ *
+ * @see #create(Date)
*/
public Date toDate() {
return new Date(millis);
@@ -95,4 +109,14 @@ public final class Instant extends Tempo
public Instant plusNanos(final long n) {
return (n == 0) ? this : new Instant(JDK8.addExact(millis, n/1000000));
}
+
+ /**
+ * Returns this instant in XML format.
+ *
+ * @return string representation of this instant.
+ */
+ @Override
+ public String toString() {
+ return JDK8.printDateTime(toDate());
+ }
}
Added: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/IteratorSpliterator.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/IteratorSpliterator.java?rev=1778333&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/IteratorSpliterator.java (added)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/IteratorSpliterator.java [UTF-8] Wed Jan 11 18:28:20 2017
@@ -0,0 +1,67 @@
+/*
+ * 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.jdk8;
+
+import java.util.Iterator;
+
+
+/**
+ * A {@code Spliterator} backed by an iterator.
+ */
+final class IteratorSpliterator<T> implements Spliterator<T> {
+ /**
+ * The iterator from which to get the data.
+ */
+ private final Iterator<T> it;
+
+ /**
+ * Creates a new {@code Spliterator} for the given iterator.
+ */
+ IteratorSpliterator(final Iterator<T> it) {
+ this.it = it;
+ }
+
+ @Override
+ public boolean tryAdvance(Consumer<? super T> action) {
+ final boolean hasNext = it.hasNext();
+ if (hasNext) {
+ action.accept(it.next());
+ }
+ return hasNext;
+ }
+
+ @Override
+ @SuppressWarnings("empty-statement")
+ public void forEachRemaining(Consumer<? super T> action) {
+ while (tryAdvance(action));
+ }
+
+ @Override
+ public Spliterator<T> trySplit() {
+ return null;
+ }
+
+ @Override
+ public long estimateSize() {
+ return -1;
+ }
+
+ @Override
+ public int characteristics() {
+ return 0;
+ }
+}
Propchange: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/IteratorSpliterator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/IteratorSpliterator.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Predicate.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Predicate.java?rev=1778333&r1=1778332&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Predicate.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Predicate.java [UTF-8] Wed Jan 11 18:28:20 2017
@@ -20,14 +20,14 @@ package org.apache.sis.internal.jdk8;
/**
* Placeholder for the {@link java.util.function.Predicate} interface.
*
- * @param <T> The type of input.
+ * @param <T> the type of input.
*/
public interface Predicate<T> {
/**
* Evaluates the conditions on the given value.
*
- * @param value The value to test.
- * @return The predicate result for the given value.
+ * @param value the value to test.
+ * @return the predicate result for the given value.
*/
boolean test(T value);
}
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Spliterator.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Spliterator.java?rev=1778333&r1=1778332&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Spliterator.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Spliterator.java [UTF-8] Wed Jan 11 18:28:20 2017
@@ -22,13 +22,23 @@ package org.apache.sis.internal.jdk8;
*
* @param <T> type of values on which to iterate.
*/
-public abstract class Spliterator<T> {
+public abstract interface Spliterator<T> {
+ /**
+ * Flag for iterators that return the values in some specified order.
+ */
+ public static final int ORDERED = 0x10;
+
/**
* Flag for iterators that do not return null values.
*/
public static final int NONNULL = 0x100;
/**
+ * Flag telling that no element addition, replacement or removal will happen during iteration.
+ */
+ public static final int IMMUTABLE = 0x400;
+
+ /**
* Performs the given action on it on the next element, if it exists.
*
* @param action the action to execute.
@@ -41,10 +51,7 @@ public abstract class Spliterator<T> {
*
* @param action the action to execute.
*/
- @SuppressWarnings("empty-statement")
- public void forEachRemaining(Consumer<? super T> action) {
- while (tryAdvance(action));
- }
+ public abstract void forEachRemaining(Consumer<? super T> action);
/**
* Partitions this iterator if possible.
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Stream.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Stream.java?rev=1778333&r1=1778332&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Stream.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Stream.java [UTF-8] Wed Jan 11 18:28:20 2017
@@ -16,6 +16,8 @@
*/
package org.apache.sis.internal.jdk8;
+import java.util.List;
+import java.util.LinkedList;
import java.util.Iterator;
import java.util.NoSuchElementException;
@@ -25,13 +27,18 @@ import java.util.NoSuchElementException;
*
* @param <T> type of values on which to iterate.
*/
-public class Stream<T> {
+public final class Stream<T> implements AutoCloseable {
/**
* The iterator wrapped by this stream.
*/
private final Spliterator<T> it;
/**
+ * The handles to execute when this stream is closed.
+ */
+ private final List<Runnable> closeHandlers = new LinkedList<>();
+
+ /**
* Wraps the given iterator.
*/
Stream(final Spliterator<T> it) {
@@ -39,6 +46,32 @@ public class Stream<T> {
}
/**
+ * Note a JDK method - provided as a placeholder for {@code Collection.stream()}.
+ *
+ * @param <T> the type of objects in the collection.
+ * @param c the collection from which to get the stream.
+ * @return a stream over the given collection.
+ */
+ public static <T> Stream<T> create(final Iterable<T> c) {
+ if (c != null) {
+ return StreamSupport.stream(new IteratorSpliterator<>(c.iterator()), false);
+ }
+ return null;
+ }
+
+ /**
+ * Performs an action for each element of this stream.
+ *
+ * @param action a non-interfering action to perform on the elements.
+ */
+ public void forEachOrdered(final Consumer<? super T> action) {
+ final Iterator<T> it = iterator();
+ while (it.hasNext()) {
+ action.accept(it.next());
+ }
+ }
+
+ /**
* Returns an iterator for this stream elements.
*
* @return iterator for this stream elements.
@@ -89,4 +122,25 @@ public class Stream<T> {
throw new UnsupportedOperationException();
}
}
+
+ /**
+ * Returns an equivalent stream with an additional close handler.
+ *
+ * @param handler a task to execute when the stream is closed.
+ * @return a stream with a handler that is run if the stream is closed.
+ */
+ public Stream<T> onClose(final Runnable handler) {
+ closeHandlers.add(handler);
+ return this;
+ }
+
+ /**
+ * Closes this stream.
+ */
+ @Override
+ public void close() {
+ for (final Runnable handler : closeHandlers) {
+ handler.run();
+ }
+ }
}
Modified: sis/branches/JDK7/ide-project/NetBeans/build.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/ide-project/NetBeans/build.xml?rev=1778333&r1=1778332&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/ide-project/NetBeans/build.xml (original)
+++ sis/branches/JDK7/ide-project/NetBeans/build.xml Wed Jan 11 18:28:20 2017
@@ -206,6 +206,10 @@
<include name="**/*.laa"/>
<include name="**/*.loa"/>
</fileset>
+ <fileset dir="${project.root}/storage/sis-xmlstore/src/test/resources">
+ <include name="**/*.gpx"/>
+ <include name="**/*.xml"/>
+ </fileset>
<fileset dir="${project.root}/storage/sis-earth-observation/src/test/resources">
<include name="**/*.txt"/>
</fileset>
Modified: sis/branches/JDK7/ide-project/NetBeans/nbproject/build-impl.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/ide-project/NetBeans/nbproject/build-impl.xml?rev=1778333&r1=1778332&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/ide-project/NetBeans/nbproject/build-impl.xml (original)
+++ sis/branches/JDK7/ide-project/NetBeans/nbproject/build-impl.xml Wed Jan 11 18:28:20 2017
@@ -128,6 +128,7 @@ is divided into following sections:
<available file="${test.geotiff.dir}"/>
<available file="${test.netcdf.dir}"/>
<available file="${test.shapefile.dir}"/>
+ <available file="${test.xmlstore.dir}"/>
<available file="${test.storage.dir}"/>
<available file="${test.feature.dir}"/>
<available file="${test.referencing.dir}"/>
@@ -145,6 +146,7 @@ is divided into following sections:
<available file="${src.geotiff.dir}"/>
<available file="${src.netcdf.dir}"/>
<available file="${src.shapefile.dir}"/>
+ <available file="${src.xmlstore.dir}"/>
<available file="${src.storage.dir}"/>
<available file="${src.feature.dir}"/>
<available file="${src.referencing.dir}"/>
@@ -260,6 +262,7 @@ is divided into following sections:
<fail unless="src.geotiff.dir">Must set src.geotiff.dir</fail>
<fail unless="src.netcdf.dir">Must set src.netcdf.dir</fail>
<fail unless="src.shapefile.dir">Must set src.shapefile.dir</fail>
+ <fail unless="src.xmlstore.dir">Must set src.xmlstore.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>
@@ -272,6 +275,7 @@ is divided into following sections:
<fail unless="test.geotiff.dir">Must set test.geotiff.dir</fail>
<fail unless="test.netcdf.dir">Must set test.netcdf.dir</fail>
<fail unless="test.shapefile.dir">Must set test.shapefile.dir</fail>
+ <fail unless="test.xmlstore.dir">Must set test.xmlstore.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>
@@ -298,7 +302,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.earth-obs.dir}:${src.geotiff.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.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.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"/>
@@ -339,7 +343,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.earth-obs.dir}:${src.geotiff.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.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.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"/>
@@ -372,7 +376,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.earth-obs.dir}:${src.geotiff.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.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.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>
@@ -477,6 +481,9 @@ is divided into following sections:
<fileset dir="${test.shapefile.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
+ <fileset dir="${test.xmlstore.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
+ <filename name="@{testincludes}"/>
+ </fileset>
<fileset dir="${test.storage.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
@@ -542,6 +549,9 @@ is divided into following sections:
<fileset dir="${test.shapefile.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
+ <fileset dir="${test.xmlstore.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>
@@ -687,6 +697,9 @@ is divided into following sections:
<fileset dir="${test.shapefile.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
+ <fileset dir="${test.xmlstore.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
+ <filename name="@{testincludes}"/>
+ </fileset>
<fileset dir="${test.storage.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
@@ -1077,7 +1090,7 @@ is divided into following sections:
<include name="*"/>
</dirset>
</pathconvert>
- <j2seproject3:depend srcdir="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.earth-obs.dir}:${src.geotiff.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.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.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}"/>
@@ -1089,6 +1102,7 @@ is divided into following sections:
<fileset dir="${src.geotiff.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.netcdf.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.shapefile.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.xmlstore.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}"/>
@@ -1115,7 +1129,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.earth-obs.dir}:${src.geotiff.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.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.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. -->
@@ -1402,6 +1416,9 @@ is divided into following sections:
<fileset dir="${src.shapefile.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
<filename name="**/*.java"/>
</fileset>
+ <fileset dir="${src.xmlstore.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
+ <filename name="**/*.java"/>
+ </fileset>
<fileset dir="${src.storage.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
<filename name="**/*.java"/>
</fileset>
@@ -1448,6 +1465,9 @@ is divided into following sections:
<fileset dir="${src.shapefile.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/doc-files/**"/>
</fileset>
+ <fileset dir="${src.xmlstore.dir}" excludes="${excludes}" includes="${includes}">
+ <filename name="**/doc-files/**"/>
+ </fileset>
<fileset dir="${src.storage.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/doc-files/**"/>
</fileset>
@@ -1488,10 +1508,10 @@ 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.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.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.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.xmlstore.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.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.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.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.xmlstore.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.webapp.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.console.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
@@ -1499,6 +1519,7 @@ is divided into following sections:
<fileset dir="${test.geotiff.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.netcdf.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.shapefile.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${test.xmlstore.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}"/>
@@ -1519,7 +1540,7 @@ 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.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.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.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.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}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}" srcdir="${test.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.xmlstore.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.webapp.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.console.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
@@ -1527,6 +1548,7 @@ is divided into following sections:
<fileset dir="${test.geotiff.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.netcdf.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.shapefile.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${test.xmlstore.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}"/>
Modified: sis/branches/JDK7/ide-project/NetBeans/nbproject/genfiles.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/ide-project/NetBeans/nbproject/genfiles.properties?rev=1778333&r1=1778332&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/ide-project/NetBeans/nbproject/genfiles.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/ide-project/NetBeans/nbproject/genfiles.properties [ISO-8859-1] Wed Jan 11 18:28:20 2017
@@ -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=0807ea7a
-nbproject/build-impl.xml.script.CRC32=33578922
+nbproject/build-impl.xml.data.CRC32=5ca8f670
+nbproject/build-impl.xml.script.CRC32=52d7cdf7
nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
Modified: sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties?rev=1778333&r1=1778332&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] Wed Jan 11 18:28:20 2017
@@ -58,6 +58,8 @@ src.netcdf.dir = ${project.root}/s
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.xmlstore.dir = ${project.root}/storage/sis-xmlstore/src/main/java
+test.xmlstore.dir = ${project.root}/storage/sis-xmlstore/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
Modified: sis/branches/JDK7/ide-project/NetBeans/nbproject/project.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/ide-project/NetBeans/nbproject/project.xml?rev=1778333&r1=1778332&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/ide-project/NetBeans/nbproject/project.xml (original)
+++ sis/branches/JDK7/ide-project/NetBeans/nbproject/project.xml Wed Jan 11 18:28:20 2017
@@ -30,6 +30,7 @@
<root id="src.geotiff.dir" name="GeoTIFF"/>
<root id="src.netcdf.dir" name="NetCDF"/>
<root id="src.shapefile.dir" name="Shapefile"/>
+ <root id="src.xmlstore.dir" name="XMLStore"/>
<root id="src.storage.dir" name="Storage"/>
<root id="src.feature.dir" name="Feature"/>
<root id="src.referencing.dir" name="Referencing"/>
@@ -44,6 +45,7 @@
<root id="test.geotiff.dir" name="Test GeoTIFF"/>
<root id="test.netcdf.dir" name="Test NetCDF"/>
<root id="test.shapefile.dir" name="Test Shapefile"/>
+ <root id="test.xmlstore.dir" name="Test XMLStore"/>
<root id="test.storage.dir" name="Test Storage"/>
<root id="test.feature.dir" name="Test Feature"/>
<root id="test.referencing.dir" name="Test Referencing"/>
Modified: sis/branches/JDK7/storage/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/pom.xml?rev=1778333&r1=1778332&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/storage/pom.xml (original)
+++ sis/branches/JDK7/storage/pom.xml Wed Jan 11 18:28:20 2017
@@ -162,6 +162,7 @@
<module>sis-shapefile</module>
<module>sis-netcdf</module>
<module>sis-geotiff</module>
+ <module>sis-xmlstore</module>
<module>sis-earth-observation</module>
</modules>
Modified: sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java?rev=1778333&r1=1778332&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java [UTF-8] Wed Jan 11 18:28:20 2017
@@ -549,7 +549,7 @@ public final class Store extends Feature
/**
* Implementation of the iterator returned by {@link #getFeatures()}.
*/
- private final class Iter extends Spliterator<Feature> {
+ private final class Iter implements Spliterator<Feature> {
/**
* Converters from string representations to the values to store in the {@link #values} array.
*/
Modified: sis/branches/JDK7/storage/sis-xmlstore/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-xmlstore/pom.xml?rev=1778333&r1=1778247&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-xmlstore/pom.xml (original)
+++ sis/branches/JDK7/storage/sis-xmlstore/pom.xml Wed Jan 11 18:28:20 2017
@@ -28,7 +28,7 @@
<parent>
<groupId>org.apache.sis</groupId>
<artifactId>storage</artifactId>
- <version>0.8-jdk8-SNAPSHOT</version>
+ <version>0.8-jdk7-SNAPSHOT</version>
</parent>
Modified: sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Copyright.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Copyright.java?rev=1778333&r1=1778247&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Copyright.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Copyright.java [UTF-8] Wed Jan 11 18:28:20 2017
@@ -509,7 +509,8 @@ resp: for (final Responsibility r : c.
*/
@Override
public Collection<OnlineResource> getOnlineResources() {
- return (license != null) ? Collections.singleton(new Link(license)) : Collections.emptySet();
+ return (license != null) ? Collections.<OnlineResource>singleton(new Link(license))
+ : Collections.<OnlineResource>emptySet();
}
/**
@@ -517,7 +518,8 @@ resp: for (final Responsibility r : c.
* or an empty set if the given condition is {@code false}.
*/
private Collection<Copyright> thisOrEmpty(final boolean condition) {
- return condition ? Collections.singleton(this) : Collections.emptySet();
+ return condition ? Collections.<Copyright>singleton(this)
+ : Collections.<Copyright>emptySet();
}
/**
Modified: sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Metadata.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Metadata.java?rev=1778333&r1=1778247&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Metadata.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Metadata.java [UTF-8] Wed Jan 11 18:28:20 2017
@@ -50,6 +50,9 @@ import org.apache.sis.metadata.iso.exten
import org.apache.sis.util.iso.SimpleInternationalString;
import org.apache.sis.util.iso.Types;
+// Branch-dependent imports
+import org.apache.sis.internal.jdk8.Instant;
+
/**
* Information about the GPX file, author, and copyright restrictions.
@@ -296,7 +299,7 @@ public final class Metadata extends Simp
@Override
public Collection<Keywords> getDescriptiveKeywords() {
if (keywords != null) {
- return Collections.singleton(new DefaultKeywords(keywords.toArray(new String[keywords.size()])));
+ return Collections.<Keywords>singleton(new DefaultKeywords(keywords.toArray(new String[keywords.size()])));
}
return super.getDescriptiveKeywords();
}
@@ -312,9 +315,9 @@ public final class Metadata extends Simp
if (creator != null) {
final Person p = new Person(creator);
return (author != null) ? UnmodifiableArrayList.wrap(new Responsibility[] {p, author})
- : Collections.singletonList(author);
+ : Collections.<Responsibility>singletonList(author);
}
- return (author != null) ? Collections.singletonList(author) : super.getPointOfContacts();
+ return (author != null) ? Collections.<Responsibility>singletonList(author) : super.getPointOfContacts();
}
/**
@@ -325,7 +328,7 @@ public final class Metadata extends Simp
*/
@Override
public Collection<Constraints> getResourceConstraints() {
- return (copyright != null) ? Collections.singleton(copyright) : super.getResourceConstraints();
+ return (copyright != null) ? Collections.<Constraints>singleton(copyright) : super.getResourceConstraints();
}
/**
@@ -336,7 +339,7 @@ public final class Metadata extends Simp
*/
@Override
public Collection<Extent> getExtents() {
- return (bounds != null) ? Collections.singleton(bounds) : super.getExtents();
+ return (bounds != null) ? Collections.<Extent>singleton(bounds) : super.getExtents();
}
/**
@@ -348,7 +351,7 @@ public final class Metadata extends Simp
@Override
public Collection<CitationDate> getDates() {
if (time != null) {
- return Collections.singleton(new DefaultCitationDate(time, DateType.CREATION));
+ return Collections.<CitationDate>singleton(new DefaultCitationDate(time, DateType.CREATION));
}
return super.getDates();
}
@@ -361,7 +364,7 @@ public final class Metadata extends Simp
*/
@Override
public Collection<OnlineResource> getOnlineResources() {
- return (links != null) ? Collections.unmodifiableList(links) : super.getOnlineResources();
+ return (links != null) ? Collections.<OnlineResource>unmodifiableList(links) : super.getOnlineResources();
}
/**
@@ -447,7 +450,7 @@ public final class Metadata extends Simp
append(table, "Author", author);
append(table, "Copyright", copyright);
append(table, "Link(s)", links, System.lineSeparator());
- append(table, "Time", (time != null) ? time.toInstant() : null);
+ append(table, "Time", Instant.create(time));
append(table, "Keywords", keywords, " ");
append(table, "Bounds", bounds);
table.appendHorizontalSeparator();
Modified: sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Person.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Person.java?rev=1778333&r1=1778247&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Person.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Person.java [UTF-8] Wed Jan 11 18:28:20 2017
@@ -253,7 +253,8 @@ public final class Person implements Res
*/
@Override
public Collection<OnlineResource> getOnlineResources() {
- return (link != null) ? Collections.singleton(link) : Collections.emptySet();
+ return (link != null) ? Collections.<OnlineResource>singleton(link)
+ : Collections.<OnlineResource>emptySet();
}
/**
@@ -358,7 +359,8 @@ public final class Person implements Res
*/
@Override
public Collection<String> getElectronicMailAddresses() {
- return (email != null) ? Collections.singleton(email) : Collections.emptySet();
+ return (email != null) ? Collections.<String>singleton(email)
+ : Collections.<String>emptySet();
}
/**
@@ -366,7 +368,8 @@ public final class Person implements Res
* or an empty set if the given condition is {@code false}.
*/
private Collection<Person> thisOrEmpty(final boolean condition) {
- return condition ? Collections.singleton(this) : Collections.emptySet();
+ return condition ? Collections.<Person>singleton(this)
+ : Collections.<Person>emptySet();
}
/**
Modified: sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Reader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Reader.java?rev=1778333&r1=1778247&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Reader.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Reader.java [UTF-8] Wed Jan 11 18:28:20 2017
@@ -35,8 +35,9 @@ import org.apache.sis.util.resources.Err
import org.apache.sis.util.Version;
// Branch-dependent imports
-import java.util.function.Consumer;
-import java.time.format.DateTimeParseException;
+import org.apache.sis.internal.jdk8.Consumer;
+import org.apache.sis.internal.jdk8.Predicate;
+import java.text.ParseException;
import org.opengis.feature.Feature;
@@ -142,17 +143,21 @@ final class Reader extends StaxStreamRea
* @throws JAXBException if an error occurred while parsing GPX 1.1 metadata.
* @throws ClassCastException if an object unmarshalled by JAXB was not of the expected type.
* @throws URISyntaxException if an error occurred while parsing URI in GPX 1.0 metadata.
- * @throws DateTimeParseException if a text can not be parsed as a date.
+ * @throws ParseException if a text can not be parsed as a date.
* @throws EOFException if the file seems to be truncated.
*/
public Version initialize(final boolean readMetadata) throws DataStoreException,
- XMLStreamException, JAXBException, URISyntaxException, EOFException
+ XMLStreamException, JAXBException, URISyntaxException, ParseException, EOFException
{
/*
* Skip comments, characters, entity declarations, etc. until we find the root element.
* If that root is anything other than <gpx>, we consider that this is not a GPX file.
*/
- moveToRootElement(Reader::isGPX, Tags.GPX);
+ moveToRootElement(new Predicate<String>() {
+ @Override public boolean test(String value) {
+ return isGPX(value);
+ }
+ }, Tags.GPX);
/*
* If a version attribute is found on the <gpx> element, use that value for detecting the GPX version.
* If a version is specified, we require major.minor version 1.0 or 1.1 but accept any bug-fix versions
@@ -356,7 +361,7 @@ parse: while (reader.hasNext()) {
* @throws JAXBException if an error occurred while parsing GPX 1.1 link.
* @throws ClassCastException if an object unmarshalled by JAXB was not of the expected type.
* @throws NumberFormatException if a text can not be parsed as an integer or a floating point number.
- * @throws DateTimeParseException if a text can not be parsed as a date.
+ * @throws ParseException if a text can not be parsed as a date.
* @throws EOFException if the file seems to be truncated.
*/
@SuppressWarnings("fallthrough")
Modified: sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Store.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Store.java?rev=1778333&r1=1778247&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Store.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Store.java [UTF-8] Wed Jan 11 18:28:20 2017
@@ -32,9 +32,9 @@ import org.apache.sis.metadata.sql.Metad
import org.apache.sis.metadata.sql.MetadataStoreException;
// Branch-dependent imports
-import java.util.stream.Stream;
-import java.util.stream.StreamSupport;
-import java.io.UncheckedIOException;
+import org.apache.sis.internal.jdk8.Stream;
+import org.apache.sis.internal.jdk8.StreamSupport;
+import org.apache.sis.internal.jdk8.UncheckedIOException;
import org.opengis.feature.Feature;
import org.opengis.feature.FeatureType;
Modified: sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java?rev=1778333&r1=1778247&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java [UTF-8] Wed Jan 11 18:28:20 2017
@@ -40,7 +40,7 @@ import org.apache.sis.util.iso.DefaultNa
import org.apache.sis.util.Static;
// Branch-dependent imports
-import java.time.temporal.Temporal;
+import org.apache.sis.internal.jdk8.Temporal;
import org.apache.sis.storage.IllegalNameException;
import org.opengis.feature.FeatureType;
Modified: sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamReader.java?rev=1778333&r1=1778247&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamReader.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamReader.java [UTF-8] Wed Jan 11 18:28:20 2017
@@ -20,7 +20,6 @@ import java.util.Date;
import java.util.Map;
import java.util.List;
import java.util.Arrays;
-import java.util.function.Predicate;
import java.util.NoSuchElementException;
import java.net.URI;
import java.io.IOException;
@@ -44,10 +43,12 @@ import org.apache.sis.util.collection.Ba
import org.apache.sis.util.resources.Errors;
// Branch-dependent imports
-import java.util.Spliterator;
-import java.util.function.Consumer;
-import java.time.temporal.Temporal;
-import java.time.format.DateTimeParseException;
+import org.apache.sis.internal.jdk8.Spliterator;
+import org.apache.sis.internal.jdk8.Consumer;
+import org.apache.sis.internal.jdk8.Predicate;
+import org.apache.sis.internal.jdk8.Temporal;
+import org.apache.sis.internal.jdk8.Instant;
+import java.text.ParseException;
import org.opengis.feature.Feature;
@@ -128,6 +129,11 @@ public abstract class StaxStreamReader e
private Unmarshaller unmarshaller;
/**
+ * Object to use for parsing dates. Created when first needed.
+ */
+ private transient StandardDateFormat dateFormat;
+
+ /**
* Creates a new XML reader for the given data store.
*
* @param owner the data store for which this reader is created.
@@ -378,11 +384,17 @@ public abstract class StaxStreamReader e
*
* @return the current text element as a date, or {@code null} if empty.
* @throws XMLStreamException if a text element can not be returned.
- * @throws DateTimeParseException if the text can not be parsed as a date.
+ * @throws ParseException if the text can not be parsed as a date.
*/
- protected final Date getElementAsDate() throws XMLStreamException {
+ protected final Date getElementAsDate() throws XMLStreamException, ParseException {
final String text = getElementText();
- return (text != null) ? StandardDateFormat.toDate(StandardDateFormat.FORMAT.parse(text)) : null;
+ if (text != null) {
+ if (dateFormat == null) {
+ dateFormat = new StandardDateFormat();
+ }
+ return dateFormat.parse(text);
+ }
+ return null;
}
/**
@@ -391,10 +403,10 @@ public abstract class StaxStreamReader e
*
* @return the current text element as a temporal object, or {@code null} if empty.
* @throws XMLStreamException if a text element can not be returned.
- * @throws DateTimeParseException if the text can not be parsed as a date.
+ * @throws ParseException if the text can not be parsed as a date.
*/
- protected final Temporal getElementAsTemporal() throws XMLStreamException {
- return StandardDateFormat.parseBest(getElementText());
+ protected final Temporal getElementAsTemporal() throws XMLStreamException, ParseException {
+ return Instant.create(getElementAsDate());
}
/**
Modified: sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamWriter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamWriter.java?rev=1778333&r1=1778247&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamWriter.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamWriter.java [UTF-8] Wed Jan 11 18:28:20 2017
@@ -32,8 +32,9 @@ import org.apache.sis.util.collection.Ba
import org.apache.sis.util.resources.Errors;
// Branch-dependent imports
-import java.io.UncheckedIOException;
-import java.util.function.Consumer;
+import org.apache.sis.internal.jdk8.UncheckedIOException;
+import org.apache.sis.internal.jdk8.Consumer;
+import org.apache.sis.internal.jdk8.Instant;
import org.opengis.feature.Feature;
@@ -227,7 +228,7 @@ public abstract class StaxStreamWriter e
*/
protected final void writeSingle(final String localName, final Date value) throws XMLStreamException {
if (value != null) {
- writeSingleValue(localName, value.toInstant());
+ writeSingleValue(localName, Instant.create(value));
}
}
Modified: sis/branches/JDK7/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/ReaderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/ReaderTest.java?rev=1778333&r1=1778247&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/ReaderTest.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/ReaderTest.java [UTF-8] Wed Jan 11 18:28:20 2017
@@ -19,7 +19,6 @@ package org.apache.sis.internal.storage.
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
-import java.time.Instant;
import com.esri.core.geometry.Point;
import com.esri.core.geometry.Polyline;
import org.opengis.geometry.Envelope;
@@ -39,7 +38,8 @@ import static org.apache.sis.test.TestUt
import static org.apache.sis.test.TestUtilities.getSingleton;
// Branch-dependent imports
-import java.util.stream.Stream;
+import org.apache.sis.internal.jdk8.Stream;
+import org.apache.sis.internal.jdk8.Instant;
import org.opengis.feature.Feature;
import org.opengis.metadata.content.FeatureTypeInfo;
Modified: sis/branches/JDK7/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/WriterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/WriterTest.java?rev=1778333&r1=1778247&r2=1778333&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/WriterTest.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/WriterTest.java [UTF-8] Wed Jan 11 18:28:20 2017
@@ -38,7 +38,8 @@ import org.junit.Test;
import static org.apache.sis.test.Assert.*;
// Branch-dependent imports
-import java.time.Instant;
+import org.apache.sis.internal.jdk8.Instant;
+import org.apache.sis.internal.jdk8.Stream;
import org.opengis.feature.Feature;
@@ -351,7 +352,7 @@ public final strictfp class WriterTest e
final Metadata metadata = new Metadata();
metadata.bounds = bounds;
metadata.creator = "DataProducer";
- store.write(metadata, features.stream());
+ store.write(metadata, Stream.create(features));
}
/**