You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by am...@apache.org on 2021/03/24 13:13:03 UTC
[sis] 01/02: chore(Storage): mirror Storage connector API in strict
version
This is an automated email from the ASF dual-hosted git repository.
amanin pushed a commit to branch refactor/strict_storage_connector
in repository https://gitbox.apache.org/repos/asf/sis.git
commit eb8954b9960c1515fd9965fc8498a636e0690bda
Author: Alexis Manin <al...@geomatys.com>
AuthorDate: Wed Mar 24 13:27:40 2021 +0100
chore(Storage): mirror Storage connector API in strict version
---
.../apache/sis/storage/StrictStorageConnector.java | 42 ++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/storage/StrictStorageConnector.java b/storage/sis-storage/src/main/java/org/apache/sis/storage/StrictStorageConnector.java
index 22754c7..23934cc 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/storage/StrictStorageConnector.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/StrictStorageConnector.java
@@ -267,7 +267,44 @@ public class StrictStorageConnector implements AutoCloseable {
return storage.getOption(key);
}
+ public <T> void setOption(final OptionKey<T> key, final T value) {
+ storage.setOption(key, value);
+ }
+
+ public String getStorageName() {
+ return storage.getStorageName();
+ }
+
+ public String getFileExtension() {
+ return storage.getFileExtension();
+ }
+
/**
+ * Please use a safe alternative instead, like {@link #useAs(Class, StorageOperatingFunction)}.
+ * Only call this if safe methods do not support the storage type you require.
+ *
+ * @return A connector that does not provides control over resource usage. It does not automatically rewind
+ * automatically used resources. That means that resource lifecycle becomes <em>entirely</em> caller responsability.
+ */
+ public <T> T getStorageAs(final Class<T> type) throws IllegalArgumentException, DataStoreException {
+ return storage.getStorageAs(type);
+ }
+
+ /**
+ * Please use a safe alternative instead, like {@link #useAs(Class, StorageOperatingFunction)}.
+ * Only call this if safe methods do not support the storage type you require.
+ *
+ * @return A connector that does not provides control over resource usage. It does not automatically rewind
+ * automatically used resources. That means that resource lifecycle becomes <em>entirely</em> caller responsability.
+ */
+ @Deprecated
+ public Object getStorage() throws DataStoreException {
+ return storage.getStorage();
+ }
+
+ /**
+ * Please try to use {@link #useAs(Class, StorageOperatingFunction)} instead. Only call this if safe methods do not
+ * support the storage type you require.
*
* @return A connector that does not provides control over resource usage. It does not automatically rewind
* automatically used resources. That means that resource lifecycle becomes <em>entirely</em> caller responsability.
@@ -276,6 +313,11 @@ public class StrictStorageConnector implements AutoCloseable {
return storage;
}
+ @Override
+ public String toString() {
+ return storage.toString();
+ }
+
private interface StorageCallable<V> extends Callable<V> {
@Override
V call() throws IOException, DataStoreException;