Author: desruisseaux
Date: Sat Feb 24 10:27:06 2018
New Revision: 1825206
URL: http://svn.apache.org/viewvc?rev=1825206&view=rev
Log:
Documentation and minor cleanup (import order, etc.).
Modified:
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStores.java
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/ReadOnlyStorageException.java
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/WritableFeatureSet.java
Modified:
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java?rev=1825206&r1=1825205&r2=1825206&view=diff
==============================================================================
---
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java
[UTF-8] (original)
+++
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java
[UTF-8] Sat Feb 24 10:27:06 2018
@@ -21,8 +21,9 @@ import java.util.Locale;
import java.util.Map;
import java.util.IdentityHashMap;
import java.util.NoSuchElementException;
-import org.apache.sis.internal.metadata.NameToIdentifier;
import org.opengis.metadata.Metadata;
+import org.opengis.metadata.Identifier;
+import org.opengis.metadata.citation.Citation;
import org.opengis.metadata.identification.Identification;
import org.opengis.parameter.ParameterValueGroup;
import org.apache.sis.util.Localized;
@@ -30,9 +31,8 @@ import org.apache.sis.util.ArgumentCheck
import org.apache.sis.util.logging.WarningListener;
import org.apache.sis.util.logging.WarningListeners;
import org.apache.sis.internal.storage.Resources;
-import static org.apache.sis.internal.util.Citations.titleMatches;
-import org.opengis.metadata.Identifier;
-import org.opengis.metadata.citation.Citation;
+import org.apache.sis.internal.metadata.NameToIdentifier;
+import org.apache.sis.internal.util.Citations;
/**
@@ -51,7 +51,7 @@ import org.opengis.metadata.citation.Cit
*
* @author Johann Sorel (Geomatys)
* @author Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
*
* @see DataStores#open(Object)
*
@@ -349,7 +349,7 @@ public abstract class DataStore implemen
if (citation != null && identifier != null) {
final Collection<? extends Identifier> identifiers =
citation.getIdentifiers();
if (identifiers == null || identifiers.isEmpty()) {
- return titleMatches(citation, identifier);
+ return Citations.titleMatches(citation, identifier);
} else {
return
NameToIdentifier.isHeuristicMatchForIdentifier(identifiers, identifier);
}
Modified:
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java?rev=1825206&r1=1825205&r2=1825206&view=diff
==============================================================================
---
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java
[UTF-8] (original)
+++
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java
[UTF-8] Sat Feb 24 10:27:06 2018
@@ -18,7 +18,7 @@ package org.apache.sis.storage;
import java.util.List;
import java.util.LinkedList;
-import java.util.Collection;
+import java.util.Set;
import java.util.Iterator;
import java.util.ServiceLoader;
import org.apache.sis.internal.storage.Resources;
@@ -41,7 +41,7 @@ import org.apache.sis.util.ArgumentCheck
* on the part of the caller.
*
* @author Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
* @since 0.4
* @module
*/
@@ -80,7 +80,7 @@ final class DataStoreRegistry {
*
* @since 0.8
*/
- public Collection<DataStoreProvider> providers() {
+ public Set<DataStoreProvider> providers() {
synchronized (loader) {
final Iterator<DataStoreProvider> providers = loader.iterator();
return new LazySet<>(new Iterator<DataStoreProvider>() {
Modified:
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStores.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStores.java?rev=1825206&r1=1825205&r2=1825206&view=diff
==============================================================================
---
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStores.java
[UTF-8] (original)
+++
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStores.java
[UTF-8] Sat Feb 24 10:27:06 2018
@@ -82,7 +82,7 @@ public final class DataStores extends St
}
/**
- * Returns the list of data store providers available at this method
invocation time.
+ * Returns the set of data store providers available at this method
invocation time.
* More providers may be added later in a running JVM if new modules are
added on the classpath.
*
* @return descriptions of available data stores.
@@ -102,8 +102,15 @@ public final class DataStores extends St
* @return descriptions of compatible data stores.
*
* @since 1.0
+ *
+ * @deprecated this method force initialization and probing of all data
stores, while maybe only
+ * the first instance is needed. We could lazily probe the
content during the first
+ * iteration, but this would require an {@link AutoCloseable}
iterator for closing
+ * the {@link StorageConnector}. We could return a {@link
java.util.stream.Stream}
+ * for resolving that issue, but that would be at odd with the
{@link #providers()} API.
*/
- public static Collection<DataStoreProvider> providers(Object input) {
+ @Deprecated
+ public static Collection<DataStoreProvider> providers(final Object input) {
final StorageConnector connector = (input instanceof StorageConnector)
?
(StorageConnector) input : new StorageConnector(input);
@@ -117,6 +124,9 @@ public final class DataStores extends St
} catch (DataStoreException ex) {
// could be caused for multiple reasons, we assume it does not
// support the given input.
+ // TODO: should we? DataStoreException in probeContent are
usually caused by IOException,
+ // in which state the stream is probably in an invalid state
and likely to cause failure
+ // in next providers too.
}
}
return providers;
Modified:
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/ReadOnlyStorageException.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/ReadOnlyStorageException.java?rev=1825206&r1=1825205&r2=1825206&view=diff
==============================================================================
---
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/ReadOnlyStorageException.java
[UTF-8] (original)
+++
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/ReadOnlyStorageException.java
[UTF-8] Sat Feb 24 10:27:06 2018
@@ -16,17 +16,15 @@
*/
package org.apache.sis.storage;
-import org.apache.sis.util.Localized;
-
/**
* Thrown when a {@code DataStore} can not perform a write operations.
- * This exception may occur either because:
- *
- * <ul>
- * <li>the data store does not support write operations, or</li>
- * <li>write operations are supported but the channel is read-only.</li>
- * </ul>
+ * If a data store does not support any write operation, then it should not
implement
+ * {@link WritableAggregate} or {@link WritableFeatureSet} interface.
+ * But in some situations, a data store may implement a {@code Writable*}
interface
+ * and nevertheless be unable to perform a write operation, for example
because the
+ * underlying {@link java.nio.channels.Channel} is read-only or part of the
file is
+ * locked by another process.
*
* @author Johann Sorel (Geomatys)
* @version 0.8
@@ -74,15 +72,4 @@ public class ReadOnlyStorageException ex
public ReadOnlyStorageException(final String message, final Throwable
cause) {
super(message, cause);
}
-
- /**
- * Creates a new exception which will format a localized message in the
resource locale.
- *
- * @param originator the instance throwing this exception, or {@code
null} if unknown.
- * @param key one of {@link
org.apache.sis.internal.storage.Resources.Keys} constants.
- * @param parameters parameters to use for formatting the messages.
- */
- ReadOnlyStorageException(final Resource originator, final short key, final
Object... parameters) {
- super((originator instanceof Localized) ? ((Localized)
originator).getLocale() : null, key, parameters);
- }
}
Modified:
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/WritableFeatureSet.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/WritableFeatureSet.java?rev=1825206&r1=1825205&r2=1825206&view=diff
==============================================================================
---
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/WritableFeatureSet.java
[UTF-8] (original)
+++
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/WritableFeatureSet.java
[UTF-8] Sat Feb 24 10:27:06 2018
@@ -17,6 +17,7 @@
package org.apache.sis.storage;
import java.util.Iterator;
+import java.util.stream.Stream;
import java.util.function.Predicate;
import java.util.function.UnaryOperator;
@@ -55,10 +56,10 @@ public interface WritableFeatureSet exte
* Any feature already present in the {@link FeatureSet} will remain
unmodified.
*
* <div class="note"><b>API note:</b>
- * this method expects an {@link Iterator} rather then a {@link
java.util.stream.Stream} for easing
+ * this method expects an {@link Iterator} rather then a {@link Stream}
for easing
* inter-operability with various API. Implementing a custom {@link
Iterator} requires less effort
- * than implementing a {@link java.util.stream.Stream}. On the other side
if the user has a {@link java.util.stream.Stream},
- * obtaining an {@link java.util.Iterator} can be done by a call to {@link
java.util.stream.Stream#iterator()}.</div>
+ * than implementing a {@link Stream}. On the other side if the user has a
{@link Stream},
+ * obtaining an {@link Iterator} can be done by a call to {@link
Stream#iterator()}.</div>
*
* <p>The {@link Capability#WRITABLE} flag if presents in the {@link
#getCapabilities()} set
* indicates that this method should be implemented.</p>