Author: desruisseaux
Date: Thu Sep 7 15:47:24 2017
New Revision: 1807624
URL: http://svn.apache.org/viewvc?rev=1807624&view=rev
Log:
Merge from JDK8 branch.
Added:
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractDataSet.java
- copied unchanged from r1807623,
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractDataSet.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/URIDataStore.java
- copied unchanged from r1807623,
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/URIDataStore.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/storage/IllegalOpenParameterException.java
- copied unchanged from r1807623,
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/IllegalOpenParameterException.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/storage/ReadOnlyStorageException.java
- copied unchanged from r1807623,
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/ReadOnlyStorageException.java
sis/branches/JDK9/storage/sis-storage/src/test/resources/
- copied from r1807623,
sis/branches/JDK8/storage/sis-storage/src/test/resources/
Removed:
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/FeatureAccess.java
sis/branches/JDK9/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/FeatureAccess.java
Modified:
sis/branches/JDK9/ (props changed)
sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/Merger.java
sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataCopier.java
sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/MergerTest.java
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ObliqueStereographic.java
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/CodeListUID.java
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/NilReason.java
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java
sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java
sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java
sis/branches/JDK9/ide-project/NetBeans/build.xml
sis/branches/JDK9/pom.xml
sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java
sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java
sis/branches/JDK9/storage/sis-gdal/src/main/resources/native/linux/libproj-binding.so
sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java
sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java
sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractFeatureSet.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractResource.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/DocumentedStoreProvider.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.properties
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources_fr.properties
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/StoreProvider.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelData.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelDataInput.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelDataOutput.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelFactory.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelImageInputStream.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/IOUtilities.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/InputStreamAdapter.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/Markable.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/FirstKeywordPeek.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/AbstractProvider.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/MimeTypeDetector.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/StoreProvider.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/storage/Aggregate.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/storage/DataSet.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreProvider.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSet.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/storage/ForwardOnlyStorageException.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/storage/Resource.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/storage/StorageConnector.java
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedStorageException.java
sis/branches/JDK9/storage/sis-storage/src/test/java/org/apache/sis/storage/DataStoreMock.java
sis/branches/JDK9/storage/sis-storage/src/test/java/org/apache/sis/storage/StorageConnectorTest.java
sis/branches/JDK9/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Link.java
sis/branches/JDK9/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Store.java
sis/branches/JDK9/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java
sis/branches/JDK9/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamReader.java
sis/branches/JDK9/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/ReaderTest.java
Propchange: sis/branches/JDK9/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Sep 7 15:47:24 2017
@@ -1,4 +1,4 @@
/sis/branches/Android:1430670-1480699
/sis/branches/JDK6:1394913-1508480
-/sis/branches/JDK8:1773327-1805589
+/sis/branches/JDK8:1773327-1807623
/sis/trunk:1394364-1508466,1519089-1519674
Modified:
sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/Merger.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/Merger.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/Merger.java
[UTF-8] (original)
+++
sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/Merger.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -44,19 +44,19 @@ import org.apache.sis.util.Classes;
* <li>Otherwise if the target value is a collection, then:
* <ul>
* <li>For each element of the source collection, a corresponding
element of the target collection is searched.
- * A pair of source and target elements is established if the pair
meet all of the following conditions:
+ * A pair of source and target elements is established if the pair
meets all of the following conditions:
* <ul>
* <li>The {@linkplain MetadataStandard#getInterface(Class) standard
type} of the source element
* is assignable to the type of the target element.</li>
- * <li>There is no conflict, i.e. no property value that are not
collection and not equal
- * (note: this condition is disabled if {@link #avoidConflicts}
is {@code false}).</li>
+ * <li>There is no conflict, i.e. no property value that are not
collection and not equal.
+ * This condition can be modified by overriding {@link
#resolve(Object, ModifiableMetadata)}.</li>
* </ul>
* If such pair is found, then the merge operation if performed
recursively
* for that pair of source and target elements.</li>
* <li>All other source elements will be added as new elements in the
target collection.</li>
* </ul>
* </li>
- * <li>Otherwise the {@link #unmerged unmerged(…)} method is invoked.</li>
+ * <li>Otherwise the {@link #copy(Object, ModifiableMetadata) copy(…)}
method is invoked.</li>
* </ul>
*
* @author Johann Sorel (Geomatys)
@@ -79,14 +79,6 @@ public class Merger {
protected final Locale locale;
/**
- * {@code true} for performing a greater effort of avoiding merge
conflicts.
- * The default value is {@code false}, which may cause {@link #unmerged
unmerged(…)} to be invoked in
- * situation where it could have been avoided. Setting this value to
{@code true} increase the chances
- * of merge success at the expense of more computations.
- */
- public boolean avoidConflicts;
-
- /**
* Creates a new merger.
*
* @param locale the locale to use for formatting error messages, or
{@code null} for the default locale.
@@ -122,15 +114,15 @@ public class Merger {
* for example because the source class is a more specialized type
than the target class.
* @throws IllegalArgumentException if this method detects a
cross-reference between source and target metadata.
*/
- public final void merge(final Object source, final ModifiableMetadata
target) {
- if (!merge(source, target, false)) {
+ public final void copy(final Object source, final ModifiableMetadata
target) {
+ if (!copy(source, target, false)) {
throw new
InvalidMetadataException(errors().getString(Errors.Keys.IllegalArgumentClass_3,
"target",
target.getStandard().getInterface(source.getClass()),
Classes.getClass(target)));
}
}
/**
- * Implementation of {@link #merge(Object, ModifiableMetadata)} method,
+ * Implementation of {@link #copy(Object, ModifiableMetadata)} method,
* to be invoked recursively for all child properties to merge.
*
* @param dryRun {@code true} for executing the merge operation in "dry
run" mode instead than performing the
@@ -139,7 +131,8 @@ public class Merger {
* @return {@code true} if the merge operation is valid, or {@code false}
if the given arguments are valid
* metadata but the merge operation can nevertheless not be
executed because it could cause data lost.
*/
- private boolean merge(final Object source, final ModifiableMetadata
target, final boolean dryRun) {
+ @SuppressWarnings("fallthrough")
+ private boolean copy(final Object source, final ModifiableMetadata target,
final boolean dryRun) {
/*
* Verify if the given source can be merged with the target. If this
is not the case, action
* taken will depend on the caller: it may either skips the value or
throws an exception.
@@ -191,7 +184,7 @@ public class Merger {
:
targetMap.putIfAbsent(propertyName, sourceValue);
if (targetValue != null) {
if (targetValue instanceof ModifiableMetadata) {
- success = merge(sourceValue, (ModifiableMetadata)
targetValue, dryRun);
+ success = copy(sourceValue, (ModifiableMetadata)
targetValue, dryRun);
if (!success) {
/*
* This exception may happen if the source is a
subclass of the target. This is the converse
@@ -223,17 +216,22 @@ public class Merger {
for (final Object element : targetList) {
if (element instanceof ModifiableMetadata) {
final Iterator<?> it = sourceList.iterator();
- while (it.hasNext()) {
+distribute: while (it.hasNext()) {
final Object value = it.next();
- if (!avoidConflicts || merge(value,
(ModifiableMetadata) element, true)) {
- /*
- * If enabled, above 'merge' call verified
that the merge can be done, including
- * by recursive checks in all children.
The intend is to have a "all or nothing"
- * behavior, before the 'merge' call below
starts to modify the values.
- */
- if (merge(value, (ModifiableMetadata)
element, false)) {
+ switch (resolve(value, (ModifiableMetadata)
element)) {
+ // case SEPARATE: do nothing.
+ case MERGE: {
+ /*
+ * If enabled, copy(…, true) call
verified that the merge can be done, including
+ * by recursive checks in all
children. The intend is to have a "all or nothing"
+ * behavior, before the copy(…, false)
call below starts to modify the values.
+ */
+ if (!copy(value, (ModifiableMetadata)
element, false)) break;
+ // Fall through
+ }
+ case IGNORE: {
it.remove();
- break; // Merge at most one
source element to each target element.
+ break distribute; // Merge at most
one source element to each target element.
}
}
}
@@ -263,7 +261,8 @@ public class Merger {
success = targetValue.equals(sourceValue);
if (!success) {
if (dryRun) break;
- unmerged(target, propertyName, sourceValue,
targetValue);
+ merge(target, propertyName, sourceValue, targetValue);
+ success = true; // If no exception has been thrown by
'merged', assume the conflict solved.
}
}
}
@@ -277,19 +276,74 @@ public class Merger {
}
/**
- * Invoked when a metadata value can not be merged.
+ * The action to perform when a <var>source</var> metadata element is
about to be written in an existing
+ * <var>target</var> element. Many metadata elements defined by ISO 19115
allows multi-occurrence, i.e.
+ * are stored in {@link Collection}. When a value <var>A</var> is about to
be added in an existing collection
+ * which already contains values <var>B</var> and <var>C</var>, then
different scenarios are possible.
+ *
+ * <p>For <var>A</var> ⟶ {<var>B</var>, <var>C</var>}:</p>
+ * <ul>
+ * <li>Value <var>A</var> may overwrite some values of <var>B</var>.
This action is executed if
+ * <code>{@linkplain Merger#resolve Merger.resolve}(A, B)</code>
returns {@link #MERGE}.</li>
+ * <li>Value <var>A</var> may overwrite some values of <var>C</var>.
This action is executed if
+ * <code>{@linkplain Merger#resolve Merger.resolve}(A, B)</code>
returns {@link #SEPARATE},
+ * then {@code Merger.resolve(A, C)} returns {@link #MERGE}.</li>
+ * <li>Value <var>A</var> may be added as a new value after <var>B</var>
and <var>C</var>.
+ * This action is executed if <code>{@linkplain Merger#resolve
Merger.resolve}(A, B)</code>
+ * <strong>and</strong> {@code Merger.resolve(A, C)} return {@link
#SEPARATE}.</li>
+ * <li>Value <var>A</var> may be discarded. This action is executed if
+ * <code>{@linkplain Merger#resolve Merger.resolve}(A, B)</code>
+ * <strong>or</strong> {@code Merger.resolve(A, C)} return {@link
#IGNORE}.</li>
+ * </ul>
+ *
+ * @see Merger#resolve(Object, ModifiableMetadata)
+ */
+ public enum Resolution {
+ /**
+ * Indicates that <var>source</var> values should be written in
<var>target</var> attributes of existing
+ * metadata element. No new metadata object is created. If a value
already exists in the target metadata,
+ * then the {@link Merger#merge(ModifiableMetadata, String, Object,
Object) merge(…)} method will be invoked.
+ */
+ MERGE,
+
+ /**
+ * Indicates that <var>source</var> values should be written in
another metadata element.
+ */
+ SEPARATE,
+
+ /**
+ * Indicates that <var>source</var> values should be discarded.
+ */
+ IGNORE
+ }
+
+ /**
+ * Invoked when a source metadata element is about to be written in an
existing target element.
+ * The default implementation returns {@link Resolution#MERGE} if writing
in the given target
+ * would only fill holes, without overwriting any existing value.
Otherwise this method returns
+ * {@code Resolution#SEPARATE}.
+ *
+ * @param source the source metadata to copy.
+ * @param target where the source metadata would be copied if this
method returns {@link Resolution#MERGE}.
+ * @return {@link Resolution#MERGE} for writing {@code source} into {@code
target}, or
+ * {@link Resolution#SEPARATE} for writing {@code source} in a
separated metadata element, or
+ * {@link Resolution#IGNORE} for discarding {@code source}.
+ */
+ protected Resolution resolve(Object source, ModifiableMetadata target) {
+ return copy(source, target, true) ? Resolution.MERGE :
Resolution.SEPARATE;
+ }
+
+ /**
+ * Invoked when {@code Merger} can not merge a metadata value by itself.
* The default implementation throws an {@link InvalidMetadataException}.
* Subclasses can override this method if they want to perform a different
processing.
*
- * <p><b>Tip:</b> to reduce the risks that this method is invoked,
consider setting the
- * {@link #avoidConflicts} flag to {@code true} before invoking {@link
#merge merge(…)}.</p>
- *
* @param target the metadata instance in which the value should
have been written.
* @param propertyName the name of the property to write.
* @param sourceValue the value to write.
* @param targetValue the value that already exist in the target
metadata.
*/
- protected void unmerged(ModifiableMetadata target, String propertyName,
Object sourceValue, Object targetValue) {
+ protected void merge(ModifiableMetadata target, String propertyName,
Object sourceValue, Object targetValue) {
throw new
InvalidMetadataException(errors().getString(Errors.Keys.ValueAlreadyDefined_1,
name(target, propertyName)));
}
}
Modified:
sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataCopier.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataCopier.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataCopier.java
[UTF-8] (original)
+++
sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataCopier.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -47,8 +47,8 @@ import org.apache.sis.util.collection.Co
* <p>This class is not thread-safe.
* In multi-threads environment, each thread should use its own {@code
MetadataCopier} instance.</p>
*
- * <div class="section">Recommended alternative</div>
- * Deep metadata copies are sometime useful when using an existing metadata as
a template.
+ * <div class="note"><b>Recommended alternative:</b>
+ * deep metadata copies are sometime useful when using an existing metadata as
a template.
* But the {@link ModifiableMetadata#unmodifiable()} method may provide a
better way to use a metadata as a template,
* as it returns a snapshot and allows the caller to continue to modify the
original metadata object and create new
* snapshots. Example:
@@ -77,6 +77,7 @@ import org.apache.sis.util.collection.Co
* result of a call to {@link
org.apache.sis.metadata.sql.MetadataSource#lookup(Class, String)}) into
instances of the
* public {@link AbstractMetadata} subclasses. But note that shallow copies as
provided by the {@code castOrCopy(…)}
* static methods in each {@code AbstractMetadata} subclass are sometime
sufficient.</p>
+ * </div>
*
* @author Martin Desruisseaux (Geomatys)
* @version 0.8
Modified:
sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/MergerTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/MergerTest.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/MergerTest.java
[UTF-8] (original)
+++
sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/MergerTest.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -100,8 +100,7 @@ public final strictfp class MergerTest e
final DefaultMetadata source = createSample1();
final DefaultMetadata target = createSample2();
final Merger merger = new Merger(null);
- merger.avoidConflicts = true;
- merger.merge(source, target);
+ merger.copy(source, target);
assertSetEquals(Arrays.asList(Locale.JAPANESE, Locale.FRENCH),
target.getLanguages());
assertSetEquals(Collections.singleton(StandardCharsets.UTF_16),
target.getCharacterSets());
Modified:
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
[UTF-8] (original)
+++
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -473,7 +473,7 @@ public class DefaultParameterValue<T> ex
* {@link URI}, {@link URL}, {@link Path}, {@link File}.
*
* @return the reference to a file containing parameter values.
- * @throws InvalidParameterTypeException if the value is not a reference
to a file or an URI.
+ * @throws InvalidParameterTypeException if the value is not a reference
to a file or a URI.
* @throws IllegalStateException if the value is not defined and there is
no default value.
*
* @see #getValue()
Modified:
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
[UTF-8] (original)
+++
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -86,7 +86,7 @@ import static org.apache.sis.util.Argume
* recommended to provide also {@linkplain #getIdentifiers() identifiers}
(e.g. “EPSG:9804” in the above example)
* since names can sometime be ambiguous or be spelled in different ways.
*
- * <div class="note"><b>Departure from the ISO 19111 standard</b><br>
+ * <div class="section">Departure from the ISO 19111 standard</div>
* The following properties are mandatory according ISO 19111,
* but may be missing under some conditions in Apache SIS:
* <ul>
@@ -95,7 +95,7 @@ import static org.apache.sis.util.Argume
* can not be {@linkplain #DefaultOperationMethod(MathTransform) inferred
from the given math transform}.</li>
* <li>The {@linkplain #getParameters() parameters} if the {@link
#DefaultOperationMethod(MathTransform)}
* constructor can not infer them.</li>
- * </ul></div>
+ * </ul>
*
* <div class="section">Relationship with other classes or interfaces</div>
* {@code OperationMethod} describes parameters without providing any value
(except sometime default values).
Modified:
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ObliqueStereographic.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ObliqueStereographic.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ObliqueStereographic.java
[UTF-8] (original)
+++
sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ObliqueStereographic.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -263,11 +263,14 @@ public class ObliqueStereographic extend
/*
* Convert the geodetic coordinates (φ,λ) to conformal coordinates
(χ,Λ) before to apply the
* actual stereographic projection. The geodetic and conformal
coordinates will be the same
- * if the ellipsoid is already a sphere.
+ * if the ellipsoid is already a sphere. The original formulas were:
+ *
+ * χ = asin((w - 1) / (w + 1))
+ *
+ * But since the projection needs only sin(χ) and cos(χ), we avoid the
costly asin(…) function.
*/
- final double χ = asin((w - 1) / (w + 1));
- final double cosχ = cos(χ);
- final double sinχ = sin(χ);
+ final double sinχ = (w - 1) / (w + 1);
+ final double cosχ = sqrt(1 - sinχ*sinχ);
/*
* The conformal longitude is Λ = n⋅(λ - λ₀) + Λ₀ where λ is the
geodetic longitude.
* But in Apache SIS implementation, the multiplication by n has
been merged in the
Modified:
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java
[UTF-8] (original)
+++
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -66,7 +66,7 @@ public class UnitAdapter extends XmlAdap
}
/**
- * A variant of {@link UnitAdapter} which marshal units as an URN for
Coordinate System (CS) axes.
+ * A variant of {@link UnitAdapter} which marshal units as a URN for
Coordinate System (CS) axes.
* Example: {@code "urn:ogc:def:uom:EPSG::9001"}.
*
* The difference between coordinate system axis and other uses (prime
meridian, etc.) is in the choice of EPSG
Modified:
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/CodeListUID.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/CodeListUID.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/CodeListUID.java
[UTF-8] (original)
+++
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/CodeListUID.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -32,7 +32,7 @@ import org.apache.sis.util.iso.Types;
*/
public final class CodeListUID {
/**
- * The code space of the {@link #value} as an URI, or {@code null}.
+ * The code space of the {@link #value} as a URI, or {@code null}.
*/
@XmlAttribute
String codeSpace;
Modified:
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
[UTF-8] (original)
+++
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -557,7 +557,7 @@ loop: for (int p=0; ; p++) {
/**
* Returns a string representation of this URI. If the URI were originally
a GML's URL, then this method formats
- * the URI in the {@code "http://www.opengis.net/gml/srs/"} namespace.
Otherwise the URI were originally an URL,
+ * the URI in the {@code "http://www.opengis.net/gml/srs/"} namespace.
Otherwise the URI were originally a URL,
* then this method formats the URI in the {@code
"http://www.opengis.net/"} namespace.
* Otherwise this method formats the URI as a URN.
*
Modified:
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/NilReason.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/NilReason.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/NilReason.java
[UTF-8] (original)
+++
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/NilReason.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -145,7 +145,7 @@ public final class NilReason implements
/**
* Either the XML value as a {@code String} (including the explanation if
the prefix
- * is "{@code other}", or an {@link URI}.
+ * is "{@code other}", or a {@link URI}.
*/
private final Object reason;
Modified:
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java
[UTF-8] (original)
+++
sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -112,7 +112,7 @@ public class ReferenceResolver {
* The default implementation performs the following lookups:
*
* <ul>
- * <li>If the {@link XLink#getHRef() xlink:href} attribute is an
{@linkplain URI#getFragment() URI fragment}
+ * <li>If the {@link XLink#getHRef() xlink:href} attribute is a
{@linkplain URI#getFragment() URI fragment}
* of the form {@code "#foo"} and if an object of class {@code type}
with the {@code gml:id="foo"} attribute
* has previously been seen in the same XML document, then that
object is returned.</li>
* <li>Otherwise returns {@code null}.</li>
Modified:
sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java
[UTF-8] (original)
+++
sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -322,11 +322,11 @@ public final strictfp class RangeFormatT
String text = it.toString();
findYears(it, RangeFormat.Field.MIN_VALUE, minPos);
findYears(it, RangeFormat.Field.MAX_VALUE, maxPos);
- assertEquals("[16/01/70 18:00 … 16/01/90 09:00]", text);
+ assertEquals("[16/01/1970 18:00 … 16/01/1990 09:00]", text);
assertEquals( 7, minPos.getBeginIndex());
- assertEquals( 9, minPos.getEndIndex());
- assertEquals(24, maxPos.getBeginIndex());
- assertEquals(26, maxPos.getEndIndex());
+ assertEquals(11, minPos.getEndIndex());
+ assertEquals(26, maxPos.getBeginIndex());
+ assertEquals(30, maxPos.getEndIndex());
assertEquals(range, parse(text));
/*
* Try again with the infinity symbol in one endpoint.
@@ -335,18 +335,18 @@ public final strictfp class RangeFormatT
it = format.formatToCharacterIterator(range);
text = it.toString();
findYears(it, RangeFormat.Field.MAX_VALUE, maxPos);
- assertEquals("(−∞ … 01/01/90 00:00]", text);
+ assertEquals("(−∞ … 01/01/1990 00:00]", text);
assertEquals(12, maxPos.getBeginIndex());
- assertEquals(14, maxPos.getEndIndex());
+ assertEquals(16, maxPos.getEndIndex());
assertEquals(range, parse(text));
range = new Range<>(Date.class, new Date(20*YEAR), true, (Date) null,
true);
it = format.formatToCharacterIterator(range);
text = it.toString();
findYears(it, RangeFormat.Field.MIN_VALUE, minPos);
- assertEquals("[01/01/90 00:00 … ∞)", text);
- assertEquals(7, minPos.getBeginIndex());
- assertEquals(9, minPos.getEndIndex());
+ assertEquals("[01/01/1990 00:00 … ∞)", text);
+ assertEquals( 7, minPos.getBeginIndex());
+ assertEquals(11, minPos.getEndIndex());
assertEquals(range, parse(text));
}
Modified:
sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java
[UTF-8] (original)
+++
sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -384,6 +384,7 @@ public strictfp class Assert extends org
* @return the deserialized object.
*/
public static <T> T assertSerializedEquals(final T object) {
+ Objects.requireNonNull(object);
final Object deserialized;
try {
final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
@@ -402,7 +403,10 @@ public strictfp class Assert extends org
} catch (IOException e) {
throw new AssertionError(e.toString(), e);
}
- // Compares with the original object and returns it.
+ assertNotNull("Deserialized object shall not be null.", deserialized);
+ /*
+ * Compare with the original object and return it.
+ */
@SuppressWarnings("unchecked")
final Class<? extends T> type = (Class<? extends T>) object.getClass();
assertEquals("Deserialized object not equal to the original one.",
object, deserialized);
Modified: sis/branches/JDK9/ide-project/NetBeans/build.xml
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/ide-project/NetBeans/build.xml?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
--- sis/branches/JDK9/ide-project/NetBeans/build.xml (original)
+++ sis/branches/JDK9/ide-project/NetBeans/build.xml Thu Sep 7 15:47:24 2017
@@ -226,6 +226,9 @@
<include name="**/*.laa"/>
<include name="**/*.loa"/>
</fileset>
+ <fileset dir="${project.root}/storage/sis-storage/src/test/resources">
+ <include name="**/*.txt"/>
+ </fileset>
<fileset dir="${project.root}/storage/sis-xmlstore/src/test/resources">
<include name="**/*.gpx"/>
<include name="**/*.xml"/>
Modified: sis/branches/JDK9/pom.xml
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/pom.xml?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
--- sis/branches/JDK9/pom.xml (original)
+++ sis/branches/JDK9/pom.xml Thu Sep 7 15:47:24 2017
@@ -755,7 +755,7 @@ Apache SIS is a free software, Java lang
<!-- JavaDoc configuration. -->
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
- <version>2.10.4</version>
+ <version>3.0.0-M1</version>
<configuration>
<source>${maven.compile.source}</source> <!-- Enables
javadoc to handle language constructs present in target JDK. -->
<encoding>${project.build.sourceEncoding}</encoding> <!-- Encoding
of Java source file. -->
Modified:
sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java
[UTF-8] (original)
+++
sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -20,15 +20,17 @@ import java.io.Reader;
import java.io.BufferedReader;
import java.io.LineNumberReader;
import java.io.IOException;
+import java.net.URI;
import org.opengis.metadata.Metadata;
import org.opengis.util.FactoryException;
+import org.opengis.parameter.ParameterValueGroup;
import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.DataStoreException;
import org.apache.sis.storage.DataStoreReferencingException;
import org.apache.sis.storage.UnsupportedStorageException;
import org.apache.sis.storage.StorageConnector;
+import org.apache.sis.internal.storage.URIDataStore;
import org.apache.sis.setup.OptionKey;
-import org.apache.sis.storage.Resource;
import org.apache.sis.util.Debug;
@@ -72,6 +74,11 @@ public class LandsatStore extends DataSt
private Reader source;
/**
+ * The {@link LandsatStoreProvider#LOCATION} parameter value, or {@code
null} if none.
+ */
+ private final URI location;
+
+ /**
* The object returned by {@link #getMetadata()}, created when first
needed and cached.
*/
private Metadata metadata;
@@ -87,10 +94,11 @@ public class LandsatStore extends DataSt
*/
public LandsatStore(final LandsatStoreProvider provider, final
StorageConnector connector) throws DataStoreException {
super(provider, connector);
+ location = connector.getStorageAs(URI.class);
source = connector.getStorageAs(Reader.class);
connector.closeAllExcept(source);
if (source == null) {
- throw new UnsupportedStorageException(super.getLocale(), "Landsat",
+ throw new UnsupportedStorageException(super.getLocale(),
LandsatStoreProvider.NAME,
connector.getStorage(),
connector.getOption(OptionKey.OPEN_OPTIONS));
}
}
@@ -121,15 +129,19 @@ public class LandsatStore extends DataSt
}
/**
- * Current implementation does not provide any resource yet.
- * Future versions may return an aggregate of all raster data in the
GeoTIFF files associated with this metadata.
+ * Returns the parameters used to open this Landsat data store.
+ * If non-null, the parameters are described by {@link
LandsatStoreProvider#getOpenParameters()}
+ * and contains at least a parameter named {@value
LandsatStoreProvider#LOCATION} with a {@link URI} value.
+ * This method may return {@code null} if the storage input can not be
described by a URI
+ * (for example a Landsat file reading directly from a {@link
java.nio.channels.ReadableByteChannel}).
*
- * @return the starting point of all resources in this data store.
- * @throws DataStoreException if an error occurred while reading the data.
+ * @return parameters used for opening this data store, or {@code null} if
not available.
+ *
+ * @since 0.8
*/
@Override
- public Resource getRootResource() throws DataStoreException {
- return null;
+ public ParameterValueGroup getOpenParameters() {
+ return URIDataStore.parameters(provider, location);
}
/**
Modified:
sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java
[UTF-8] (original)
+++
sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -16,6 +16,7 @@
*/
package org.apache.sis.storage.earthobservation;
+import org.opengis.parameter.ParameterDescriptorGroup;
import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.DataStoreProvider;
import org.apache.sis.storage.DataStoreException;
@@ -23,6 +24,7 @@ import org.apache.sis.storage.StorageCon
import org.apache.sis.storage.ProbeResult;
import org.apache.sis.internal.storage.Capability;
import org.apache.sis.internal.storage.Capabilities;
+import org.apache.sis.internal.storage.URIDataStore;
import org.apache.sis.internal.storage.wkt.FirstKeywordPeek;
@@ -42,6 +44,16 @@ import org.apache.sis.internal.storage.w
@Capabilities(Capability.READ)
public class LandsatStoreProvider extends DataStoreProvider {
/**
+ * The format name.
+ */
+ static final String NAME = "Landsat";
+
+ /**
+ * The parameter descriptor to be returned by {@link #getOpenParameters()}.
+ */
+ private static final ParameterDescriptorGroup OPEN_DESCRIPTOR =
URIDataStore.Provider.descriptor(NAME);
+
+ /**
* The object to use for verifying if the first keyword is the expected
one.
*/
private static final class Peek extends FirstKeywordPeek {
@@ -132,7 +144,19 @@ public class LandsatStoreProvider extend
*/
@Override
public String getShortName() {
- return "Landsat";
+ return NAME;
+ }
+
+ /**
+ * Returns a description of all parameters accepted by this provider for
opening a Landsat file.
+ *
+ * @return description of available parameters for opening a Landsat file.
+ *
+ * @since 0.8
+ */
+ @Override
+ public ParameterDescriptorGroup getOpenParameters() {
+ return OPEN_DESCRIPTOR;
}
/**
Modified:
sis/branches/JDK9/storage/sis-gdal/src/main/resources/native/linux/libproj-binding.so
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-gdal/src/main/resources/native/linux/libproj-binding.so?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
Binary files - no diff available.
Modified:
sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
[UTF-8] (original)
+++
sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -18,6 +18,7 @@ package org.apache.sis.storage.geotiff;
import java.util.Locale;
import java.io.IOException;
+import java.net.URI;
import java.nio.charset.Charset;
import java.util.logging.LogRecord;
import java.nio.charset.StandardCharsets;
@@ -25,6 +26,7 @@ import java.nio.file.StandardOpenOption;
import org.opengis.util.FactoryException;
import org.opengis.metadata.Metadata;
import org.opengis.metadata.maintenance.ScopeCode;
+import org.opengis.parameter.ParameterValueGroup;
import org.apache.sis.setup.OptionKey;
import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.StorageConnector;
@@ -33,10 +35,10 @@ import org.apache.sis.storage.DataStoreC
import org.apache.sis.storage.UnsupportedStorageException;
import org.apache.sis.internal.storage.io.ChannelDataInput;
import org.apache.sis.internal.storage.MetadataBuilder;
+import org.apache.sis.internal.storage.URIDataStore;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.metadata.sql.MetadataStoreException;
import org.apache.sis.storage.DataStoreClosedException;
-import org.apache.sis.storage.Resource;
import org.apache.sis.util.resources.Errors;
@@ -63,6 +65,11 @@ public class GeoTiffStore extends DataSt
private Reader reader;
/**
+ * The {@link GeoTiffStoreProvider#LOCATION} parameter value, or {@code
null} if none.
+ */
+ private final URI location;
+
+ /**
* The metadata, or {@code null} if not yet created.
*
* @see #getMetadata()
@@ -84,9 +91,10 @@ public class GeoTiffStore extends DataSt
this.encoding = (encoding != null) ? encoding :
StandardCharsets.US_ASCII;
final ChannelDataInput input =
connector.getStorageAs(ChannelDataInput.class);
if (input == null) {
- throw new UnsupportedStorageException(super.getLocale(), "TIFF",
+ throw new UnsupportedStorageException(super.getLocale(),
Constants.GEOTIFF,
connector.getStorage(),
connector.getOption(OptionKey.OPEN_OPTIONS));
}
+ location = connector.getStorageAs(URI.class);
connector.closeAllExcept(input);
try {
reader = new Reader(this, input);
@@ -126,22 +134,26 @@ public class GeoTiffStore extends DataSt
} catch (IOException e) {
throw new
DataStoreException(errors().getString(Errors.Keys.CanNotRead_1,
reader.input.filename), e);
} catch (FactoryException | ArithmeticException e) {
- throw new DataStoreContentException(getLocale(), "TIFF",
reader.input.filename, null).initCause(e);
+ throw new DataStoreContentException(getLocale(),
Constants.GEOTIFF, reader.input.filename, null).initCause(e);
}
}
return metadata;
}
/**
- * Current implementation does not provide any resource yet.
- * A future version will return the raster data in a coverage resource.
+ * Returns the parameters used to open this GeoTIFF data store.
+ * If non-null, the parameters are described by {@link
GeoTiffStoreProvider#getOpenParameters()}
+ * and contains at least a parameter named {@value
GeoTiffStoreProvider#LOCATION} with a {@link URI} value.
+ * This method may return {@code null} if the storage input can not be
described by a URI
+ * (for example a GeoTIFF file reading directly from a {@link
java.nio.channels.ReadableByteChannel}).
*
- * @return the starting point of all resources in this data store.
- * @throws DataStoreException if an error occurred while reading the data.
+ * @return parameters used for opening this data store, or {@code null} if
not available.
+ *
+ * @since 0.8
*/
@Override
- public Resource getRootResource() throws DataStoreException {
- return null;
+ public ParameterValueGroup getOpenParameters() {
+ return URIDataStore.parameters(provider, location);
}
/**
Modified:
sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java
[UTF-8] (original)
+++
sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -18,6 +18,7 @@ package org.apache.sis.storage.geotiff;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
+import org.opengis.parameter.ParameterDescriptorGroup;
import org.apache.sis.util.Version;
import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.DataStoreException;
@@ -26,6 +27,7 @@ import org.apache.sis.storage.ProbeResul
import org.apache.sis.storage.StorageConnector;
import org.apache.sis.internal.storage.Capabilities;
import org.apache.sis.internal.storage.Capability;
+import org.apache.sis.internal.storage.URIDataStore;
import org.apache.sis.internal.util.Constants;
@@ -58,6 +60,11 @@ public class GeoTiffStoreProvider extend
private static final Version VERSION = new Version("6.0");
/**
+ * The parameter descriptor to be returned by {@link #getOpenParameters()}.
+ */
+ private static final ParameterDescriptorGroup OPEN_DESCRIPTOR =
URIDataStore.Provider.descriptor(Constants.GEOTIFF);
+
+ /**
* Creates a new provider.
*/
public GeoTiffStoreProvider() {
@@ -74,6 +81,18 @@ public class GeoTiffStoreProvider extend
}
/**
+ * Returns a description of all parameters accepted by this provider for
opening a GeoTIFF file.
+ *
+ * @return description of available parameters for opening a GeoTIFF file.
+ *
+ * @since 0.8
+ */
+ @Override
+ public ParameterDescriptorGroup getOpenParameters() {
+ return OPEN_DESCRIPTOR;
+ }
+
+ /**
* Returns {@link ProbeResult#SUPPORTED} if the given storage appears to
be supported by {@link GeoTiffStore}.
* Returning {@code SUPPORTED} from this method does not guarantee that
reading or writing will succeed,
* only that there appears to be a reasonable chance of success based on a
brief inspection of the
Modified:
sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java
[UTF-8] (original)
+++
sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -17,16 +17,18 @@
package org.apache.sis.storage.netcdf;
import java.io.IOException;
+import java.net.URI;
import org.opengis.metadata.Metadata;
+import org.opengis.parameter.ParameterValueGroup;
import org.apache.sis.util.Debug;
import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.DataStoreException;
import org.apache.sis.storage.UnsupportedStorageException;
import org.apache.sis.storage.StorageConnector;
import org.apache.sis.internal.netcdf.Decoder;
+import org.apache.sis.internal.storage.URIDataStore;
import org.apache.sis.metadata.ModifiableMetadata;
import org.apache.sis.setup.OptionKey;
-import org.apache.sis.storage.Resource;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.Version;
import ucar.nc2.constants.CDM;
@@ -52,6 +54,11 @@ public class NetcdfStore extends DataSto
private final Decoder decoder;
/**
+ * The {@link NetcdfStoreProvider#LOCATION} parameter value, or {@code
null} if none.
+ */
+ private final URI location;
+
+ /**
* The object returned by {@link #getMetadata()}, created when first
needed and cached.
*/
private Metadata metadata;
@@ -84,13 +91,14 @@ public class NetcdfStore extends DataSto
*/
public NetcdfStore(final NetcdfStoreProvider provider, final
StorageConnector connector) throws DataStoreException {
super(provider, connector);
+ location = connector.getStorageAs(URI.class);
try {
decoder = NetcdfStoreProvider.decoder(listeners, connector);
} catch (IOException e) {
throw new DataStoreException(e);
}
if (decoder == null) {
- throw new UnsupportedStorageException(super.getLocale(), "NetCDF",
+ throw new UnsupportedStorageException(super.getLocale(),
NetcdfStoreProvider.NAME,
connector.getStorage(),
connector.getOption(OptionKey.OPEN_OPTIONS));
}
}
@@ -118,14 +126,19 @@ public class NetcdfStore extends DataSto
}
/**
- * This implementation does not provide any resource yet.
+ * Returns the parameters used to open this netCDF data store.
+ * If non-null, the parameters are described by {@link
NetcdfStoreProvider#getOpenParameters()}
+ * and contains at least a parameter named {@value
NetcdfStoreProvider#LOCATION} with a {@link URI} value.
+ * This method may return {@code null} if the storage input can not be
described by a URI
+ * (for example a netCDF file reading directly from a {@link
java.nio.channels.ReadableByteChannel}).
*
- * @return currently {@code null} (will be implemented in future Apache
SIS version).
- * @throws DataStoreException if an error occurred while reading the data.
+ * @return parameters used for opening this data store, or {@code null} if
not available.
+ *
+ * @since 0.8
*/
@Override
- public Resource getRootResource() throws DataStoreException {
- return null;
+ public ParameterValueGroup getOpenParameters() {
+ return URIDataStore.parameters(provider, location);
}
/**
Modified:
sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java
[UTF-8] (original)
+++
sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -26,6 +26,7 @@ import java.lang.reflect.Method;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.UndeclaredThrowableException;
+import org.opengis.parameter.ParameterDescriptorGroup;
import org.apache.sis.internal.netcdf.Decoder;
import org.apache.sis.internal.netcdf.Resources;
import org.apache.sis.internal.netcdf.impl.ChannelDecoder;
@@ -33,6 +34,7 @@ import org.apache.sis.internal.netcdf.uc
import org.apache.sis.internal.storage.io.ChannelDataInput;
import org.apache.sis.internal.storage.Capabilities;
import org.apache.sis.internal.storage.Capability;
+import org.apache.sis.internal.storage.URIDataStore;
import org.apache.sis.internal.system.SystemListener;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.storage.DataStore;
@@ -67,11 +69,21 @@ import org.apache.sis.util.Version;
@Capabilities(Capability.READ)
public class NetcdfStoreProvider extends DataStoreProvider {
/**
+ * The format name.
+ */
+ static final String NAME = "NetCDF";
+
+ /**
* The MIME type for NetCDF files.
*/
static final String MIME_TYPE = "application/x-netcdf";
/**
+ * The parameter descriptor to be returned by {@link #getOpenParameters()}.
+ */
+ private static final ParameterDescriptorGroup OPEN_DESCRIPTOR =
URIDataStore.Provider.descriptor(NAME);
+
+ /**
* The name of the {@link ucar.nc2.NetcdfFile} class, which is {@value}.
*/
private static final String UCAR_CLASSNAME = "ucar.nc2.NetcdfFile";
@@ -126,7 +138,19 @@ public class NetcdfStoreProvider extends
*/
@Override
public String getShortName() {
- return "NetCDF";
+ return NAME;
+ }
+
+ /**
+ * Returns a description of all parameters accepted by this provider for
opening a netCDF file.
+ *
+ * @return description of available parameters for opening a netCDF file.
+ *
+ * @since 0.8
+ */
+ @Override
+ public ParameterDescriptorGroup getOpenParameters() {
+ return OPEN_DESCRIPTOR;
}
/**
Modified:
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractFeatureSet.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractFeatureSet.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractFeatureSet.java
[UTF-8] (original)
+++
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractFeatureSet.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -28,10 +28,8 @@ import org.apache.sis.util.logging.Warni
* @version 0.8
* @since 0.8
* @module
- *
- * @todo this class may be removed if we refactor {@link FeatureSet} as an
abstract class.
*/
-public abstract class AbstractFeatureSet extends AbstractResource implements
FeatureSet {
+public abstract class AbstractFeatureSet extends AbstractDataSet implements
FeatureSet {
/**
* Creates a new resource.
*
Modified:
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractResource.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractResource.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractResource.java
[UTF-8] (original)
+++
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractResource.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -16,16 +16,8 @@
*/
package org.apache.sis.internal.storage;
-import org.opengis.geometry.Envelope;
-import org.opengis.metadata.Metadata;
-import org.opengis.metadata.extent.Extent;
-import org.opengis.metadata.extent.GeographicExtent;
-import org.opengis.metadata.extent.GeographicBoundingBox;
-import org.opengis.metadata.identification.Identification;
import org.apache.sis.storage.Resource;
import org.apache.sis.storage.DataStore;
-import org.apache.sis.storage.DataStoreException;
-import org.apache.sis.geometry.GeneralEnvelope;
import org.apache.sis.util.logging.WarningListeners;
@@ -36,8 +28,6 @@ import org.apache.sis.util.logging.Warni
* @version 0.8
* @since 0.8
* @module
- *
- * @todo this class may be removed if we refactor {@link Resource} as an
abstract class.
*/
public abstract class AbstractResource implements Resource {
/**
@@ -65,42 +55,6 @@ public abstract class AbstractResource i
}
/**
- * Returns the spatio-temporal envelope of this resource.
- * The default implementation computes the union of all {@link
GeographicBoundingBox} in the resource metadata,
- * assuming the {@linkplain
org.apache.sis.referencing.CommonCRS#defaultGeographic() default geographic CRS}
- * (usually WGS 84).
- *
- * @return the spatio-temporal resource extent.
- * @throws DataStoreException if an error occurred while reading or
computing the envelope.
- */
- @Override
- public Envelope getEnvelope() throws DataStoreException {
- final Metadata metadata = getMetadata();
- GeneralEnvelope bounds = null;
- if (metadata != null) {
- for (final Identification identification :
metadata.getIdentificationInfo()) {
- if (identification != null) {
// Paranoiac check.
- for (final Extent extent : identification.getExtents()) {
- if (extent != null) {
// Paranoiac check.
- for (final GeographicExtent ge :
extent.getGeographicElements()) {
- if (ge instanceof GeographicBoundingBox) {
- final GeneralEnvelope env = new
GeneralEnvelope((GeographicBoundingBox) ge);
- if (bounds == null) {
- bounds = env;
- } else {
- bounds.add(env);
- }
- }
- }
- }
- }
- }
- }
- }
- return bounds;
- }
-
- /**
* The set of registered warning listeners for the data store.
*
* @return the registered warning listeners for the data store.
Modified:
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/DocumentedStoreProvider.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/DocumentedStoreProvider.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/DocumentedStoreProvider.java
[UTF-8] (original)
+++
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/DocumentedStoreProvider.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -21,7 +21,6 @@ import org.opengis.metadata.distribution
import org.apache.sis.metadata.sql.MetadataSource;
import org.apache.sis.metadata.sql.MetadataStoreException;
import org.apache.sis.storage.DataStore;
-import org.apache.sis.storage.DataStoreProvider;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.logging.WarningListeners;
import org.apache.sis.internal.system.Modules;
@@ -36,7 +35,7 @@ import org.apache.sis.internal.system.Mo
* @since 0.8
* @module
*/
-public abstract class DocumentedStoreProvider extends DataStoreProvider {
+public abstract class DocumentedStoreProvider extends URIDataStore.Provider {
/**
* The primary key to use for searching in the {@code MD_Format} table, or
{@code null} if none.
* This primary name is also the value returned by {@link #getShortName()}
default implementation.
Modified:
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.java
[UTF-8] (original)
+++
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -164,11 +164,26 @@ public final class Resources extends Ind
public static final short ShallBeDeclaredBefore_2 = 22;
/**
+ * Write operations are not supported.
+ */
+ public static final short StoreIsReadOnly = 28;
+
+ /**
* Can not move backward in the “{0}” stream.
*/
public static final short StreamIsForwardOnly_1 = 13;
/**
+ * Stream “{0}” is not readable.
+ */
+ public static final short StreamIsNotReadable_1 = 25;
+
+ /**
+ * Stream “{0}” is not writable.
+ */
+ public static final short StreamIsNotWritable_1 = 26;
+
+ /**
* The “{0}” data store can be read only once.
*/
public static final short StreamIsReadOnce_1 = 18;
@@ -179,6 +194,11 @@ public final class Resources extends Ind
public static final short StreamIsWriteOnce_1 = 21;
/**
+ * Can not open {0} data store without “{1}” parameter.
+ */
+ public static final short UndefinedParameter_2 = 27;
+
+ /**
* Format of “{0}” is not recognized.
*/
public static final short UnknownFormatFor_1 = 14;
Modified:
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.properties
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.properties?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.properties
[ISO-8859-1] (original)
+++
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.properties
[ISO-8859-1] Thu Sep 7 15:47:24 2017
@@ -39,7 +39,11 @@ ProcessingExecutedOn_1 = Proc
ResourceIdentifierCollision_2 = More than one resource have the
\u201c{1}\u201d identifier in the \u201c{0}\u201d data store.
ResourceNotFound_2 = No resource found for the \u201c{1}\u201d
identifier in the \u201c{0}\u201d data store.
ShallBeDeclaredBefore_2 = The \u201c{1}\u201d element must be
declared before \u201c{0}\u201d.
+StoreIsReadOnly = Write operations are not supported.
StreamIsForwardOnly_1 = Can not move backward in the
\u201c{0}\u201d stream.
+StreamIsNotReadable_1 = Stream \u201c{0}\u201d is not readable.
+StreamIsNotWritable_1 = Stream \u201c{0}\u201d is not writable.
StreamIsReadOnce_1 = The \u201c{0}\u201d data store can be read
only once.
StreamIsWriteOnce_1 = Can not modify previously written data in
\u201c{0}\u201d.
+UndefinedParameter_2 = Can not open {0} data store without
\u201c{1}\u201d parameter.
UnknownFormatFor_1 = Format of \u201c{0}\u201d is not
recognized.
Modified:
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources_fr.properties
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources_fr.properties?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources_fr.properties
[ISO-8859-1] (original)
+++
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources_fr.properties
[ISO-8859-1] Thu Sep 7 15:47:24 2017
@@ -44,7 +44,11 @@ ProcessingExecutedOn_1 = Trai
ResourceIdentifierCollision_2 = Plusieurs ressources utilisent
l\u2019identifiant \u00ab\u202f{1}\u202f\u00bb dans les donn\u00e9es de
\u00ab\u202f{0}\u202f\u00bb.
ResourceNotFound_2 = Aucune ressource n\u2019a \u00e9t\u00e9
trouv\u00e9e pour l\u2019identifiant \u00ab\u202f{1}\u202f\u00bb dans les
donn\u00e9es de \u00ab\u202f{0}\u202f\u00bb.
ShallBeDeclaredBefore_2 = L\u2019\u00e9l\u00e9ment
\u00ab\u202f{1}\u202f\u00bb doit \u00eatre d\u00e9clar\u00e9 avant
\u00ab\u202f{0}\u202f\u00bb.
+StoreIsReadOnly = Les op\u00e9rations d\u2019\u00e9criture
ne sont pas support\u00e9es.
StreamIsForwardOnly_1 = Ne peut pas reculer dans le flux de
donn\u00e9es \u00ab\u202f{0}\u202f\u00bb.
+StreamIsNotReadable_1 = Les donn\u00e9es de
\u00ab\u202f{0}\u202f\u00bb ne sont pas accessibles en lecture.
+StreamIsNotWritable_1 = Le flux de donn\u00e9es
\u00ab\u202f{0}\u202f\u00bb ne g\u00e8re pas les \u00e9critures.
StreamIsReadOnce_1 = Les donn\u00e9es de
\u00ab\u202f{0}\u202f\u00bb ne peuvent \u00eatre lues qu\u2019une seule fois.
StreamIsWriteOnce_1 = Ne peut pas revenir sur les donn\u00e9es
d\u00e9j\u00e0 \u00e9crites dans \u00ab\u202f{0}\u202f\u00bb.
+UndefinedParameter_2 = Ne peut pas ouvrir une source de
donn\u00e9es {0} sans le param\u00e8tre \u00ab\u202f{1}\u202f\u00bb.
UnknownFormatFor_1 = Le format de \u00ab\u202f{0}\u202f\u00bb
n\u2019est pas reconnu.
Modified:
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java
[UTF-8] (original)
+++
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -31,8 +31,9 @@ import java.net.URI;
import java.nio.charset.Charset;
import javax.measure.Unit;
import javax.measure.quantity.Time;
-import org.opengis.metadata.Metadata;
import org.opengis.util.FactoryException;
+import org.opengis.geometry.Envelope;
+import org.opengis.metadata.Metadata;
import org.opengis.metadata.maintenance.ScopeCode;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.crs.TemporalCRS;
@@ -48,15 +49,17 @@ import org.apache.sis.internal.storage.i
import org.apache.sis.internal.feature.Geometries;
import org.apache.sis.internal.feature.MovingFeature;
import org.apache.sis.internal.storage.Resources;
+import org.apache.sis.internal.storage.URIDataStore;
import org.apache.sis.geometry.GeneralEnvelope;
+import org.apache.sis.geometry.ImmutableEnvelope;
import org.apache.sis.metadata.iso.DefaultMetadata;
import org.apache.sis.metadata.sql.MetadataStoreException;
-import org.apache.sis.storage.Resource;
-import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.DataStoreException;
import org.apache.sis.storage.DataStoreContentException;
import org.apache.sis.storage.DataStoreReferencingException;
+import org.apache.sis.storage.UnsupportedStorageException;
import org.apache.sis.storage.StorageConnector;
+import org.apache.sis.storage.FeatureSet;
import org.apache.sis.setup.OptionKey;
import org.apache.sis.util.ArraysExt;
import org.apache.sis.util.CharSequences;
@@ -83,7 +86,7 @@ import org.opengis.feature.AttributeType
* @since 0.7
* @module
*/
-public final class Store extends DataStore {
+public final class Store extends URIDataStore implements FeatureSet {
/**
* The character at the beginning of lines to ignore in the header.
* Note that this is not part of OGC Moving Feature Specification.
@@ -153,8 +156,9 @@ public final class Store extends DataSto
* and a temporal component if the CSV file contains a start time and end
time.
*
* @see #parseEnvelope(List)
+ * @see #getEnvelope()
*/
- private final GeneralEnvelope envelope;
+ private final ImmutableEnvelope envelope;
/**
* Description of the columns found in the CSV file.
@@ -231,7 +235,8 @@ public final class Store extends DataSto
final Reader r = connector.getStorageAs(Reader.class);
connector.closeAllExcept(r);
if (r == null) {
- throw new
DataStoreException(Errors.format(Errors.Keys.CanNotOpen_1,
super.getDisplayName()));
+ throw new UnsupportedStorageException(super.getLocale(),
StoreProvider.NAME,
+ connector.getStorage(),
connector.getOption(OptionKey.OPEN_OPTIONS));
}
source = (r instanceof BufferedReader) ? (BufferedReader) r : new
LineNumberReader(r);
geometries =
Geometries.implementation(connector.getOption(OptionKey.GEOMETRY_LIBRARY));
@@ -298,7 +303,7 @@ public final class Store extends DataSto
throw new DataStoreContentException(getLocale(),
StoreProvider.NAME, super.getDisplayName(), source).initCause(e);
}
this.encoding = connector.getOption(OptionKey.ENCODING);
- this.envelope = envelope;
+ this.envelope = new ImmutableEnvelope(envelope);
this.featureType = featureType;
this.foliation = foliation;
this.dissociate |= (timeEncoding == null);
@@ -619,13 +624,29 @@ public final class Store extends DataSto
}
/**
- * Returns the {@code FeatureSet} from which all features in this data
store can be accessed.
+ * Returns the spatio-temporal extent of CSV data in coordinate reference
system of the CSV file.
+ */
+ @Override
+ public Envelope getEnvelope() throws DataStoreException {
+ return envelope;
+ }
+
+ /**
+ * Returns the type of features in the CSV file. The feature type name
will be the value
+ * specified at the following path (only one such value exists for a CSV
data store):
*
- * @return the starting point of all features in this data store.
+ * <blockquote>
+ * {@link #getMetadata()} /
+ * {@link org.apache.sis.metadata.iso.DefaultMetadata#getContentInfo()
contentInfo} /
+ * {@link
org.apache.sis.metadata.iso.content.DefaultFeatureCatalogueDescription#getFeatureTypeInfo()
featureTypes} /
+ * {@link
org.apache.sis.metadata.iso.content.DefaultFeatureTypeInfo#getFeatureTypeName()
featureTypeName}
+ * </blockquote>
+ *
+ * @return type of features in the CSV file.
*/
@Override
- public Resource getRootResource() {
- return new FeatureAccess(this, listeners);
+ public FeatureType getType() {
+ return featureType;
}
/**
@@ -638,7 +659,8 @@ public final class Store extends DataSto
* @todo Needs to reset the position when doing another pass on the
features.
* @todo If sequential order, publish Feature as soon as identifier
changed.
*/
- final synchronized Stream<Feature> features(final boolean parallel) throws
DataStoreException {
+ @Override
+ public final synchronized Stream<Feature> features(final boolean parallel)
throws DataStoreException {
/*
* If the user asks for one feature instance per line, then we can
return a FeatureIter instance directly.
* Since each feature is fully constructed from a single line and each
line are read atomically, we can
Modified:
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/StoreProvider.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/StoreProvider.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/StoreProvider.java
[UTF-8] (original)
+++
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/StoreProvider.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -18,11 +18,11 @@ package org.apache.sis.internal.storage.
import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.DataStoreException;
-import org.apache.sis.storage.DataStoreProvider;
import org.apache.sis.storage.ProbeResult;
import org.apache.sis.storage.StorageConnector;
import org.apache.sis.internal.storage.Capability;
import org.apache.sis.internal.storage.Capabilities;
+import org.apache.sis.internal.storage.URIDataStore;
import org.apache.sis.internal.storage.wkt.FirstKeywordPeek;
@@ -40,7 +40,7 @@ import org.apache.sis.internal.storage.w
* @module
*/
@Capabilities(Capability.READ)
-public final class StoreProvider extends DataStoreProvider {
+public final class StoreProvider extends URIDataStore.Provider {
/**
* The format names for static features and moving features.
*/
Modified:
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelData.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelData.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelData.java
[UTF-8] (original)
+++
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelData.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -62,8 +62,11 @@ public abstract class ChannelData implem
* The position of the channel when this {@code ChannelData} has been
created.
* This is almost always 0, but we allow other values in case the data to
read
* or write are part of a bigger file.
+ *
+ * <p>This value is added to the argument given to the {@link #seek(long)}
method. Users can ignore
+ * this field, unless they want to invoke {@link
SeekableByteChannel#position(long)} directly.</p>
*/
- final long channelOffset;
+ public final long channelOffset;
/**
* The channel position where is located the {@link #buffer} value at
index 0.
@@ -272,13 +275,11 @@ public abstract class ChannelData implem
* An {@code IOException} may be be thrown if the previous marked position
lies in the
* discarded portion of the stream.
*
- * <p>This method differs from the {@link
javax.imageio.stream.ImageInputStream} contract in two aspects:</p>
- * <ul>
- * <li>This method may, under some conditions, be able to perform its
work even if the marked
- * position is before the flushed position.</li>
- * <li>If there is no mark, this method throws an {@link
InvalidMarkException} rather than
- * doing nothing. Doing nothing is considered a too high risk of
error.</li>
- * </ul>
+ * <div class="section">Departure from Image I/O specification</div>
+ * The {@link javax.imageio.stream.ImageInputStream#reset()} contract
specifies that if there is no matching mark,
+ * then this method shall do nothing. This method throws {@link
InvalidMarkException} instead; silently ignoring
+ * the mismatch is considered too dangerous. However we may revisit this
policy in the future if it appears to be
+ * a compatibility problem. Consequently, no code shall rely on {@code
InvalidMarkException} to be thrown.
*
* @throws IOException if an I/O error occurs.
*/
Modified:
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelDataInput.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelDataInput.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelDataInput.java
[UTF-8] (original)
+++
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelDataInput.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -841,7 +841,7 @@ public class ChannelDataInput extends Ch
*/
@Override
public final void seek(final long position) throws IOException {
- long p = position - bufferOffset;
+ long p = Math.subtractExact(position, bufferOffset);
if (p >= 0 && p <= buffer.limit()) {
/*
* Requested position is inside the current limits of the buffer.
@@ -854,7 +854,7 @@ public class ChannelDataInput extends Ch
* that StorageConnector.rewind() needs the buffer content to be
* valid as a result of this seek, so we reload it immediately.
*/
- ((SeekableByteChannel) channel).position(channelOffset + position);
+ ((SeekableByteChannel)
channel).position(Math.addExact(channelOffset, position));
bufferOffset = position;
buffer.clear().limit(0);
} else if (p >= 0) {
Modified:
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelDataOutput.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelDataOutput.java?rev=1807624&r1=1807623&r2=1807624&view=diff
==============================================================================
---
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelDataOutput.java
[UTF-8] (original)
+++
sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelDataOutput.java
[UTF-8] Thu Sep 7 15:47:24 2017
@@ -607,7 +607,7 @@ public class ChannelDataOutput extends C
*/
@Override
public final void seek(final long position) throws IOException {
- long p = position - bufferOffset;
+ long p = Math.subtractExact(position, bufferOffset);
if (p >= 0 && p <= buffer.limit()) {
/*
* Requested position is inside the current limits of the buffer.
@@ -620,7 +620,7 @@ public class ChannelDataOutput extends C
* but we can set the new position directly in the channel.
*/
flush();
- ((SeekableByteChannel) channel).position(channelOffset + position);
+ ((SeekableByteChannel)
channel).position(Math.addExact(channelOffset, position));
bufferOffset = position;
} else if (p >= 0) {
/*