diff --git a/pom.xml b/pom.xml
index e6044cd..f1a4c3e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -112,11 +112,11 @@
sign,deploy-to-scijava
3.2.0
- 4.1.2
+ 4.2.0
2.2.0
7.0.0
4.1.0
- 1.3.1
+ 1.3.4
1.0.0-preview.20191208
1.4.1
diff --git a/src/main/java/org/janelia/saalfeldlab/n5/universe/N5Factory.java b/src/main/java/org/janelia/saalfeldlab/n5/universe/N5Factory.java
index 43d7015..a808a95 100644
--- a/src/main/java/org/janelia/saalfeldlab/n5/universe/N5Factory.java
+++ b/src/main/java/org/janelia/saalfeldlab/n5/universe/N5Factory.java
@@ -26,13 +26,19 @@
*/
package org.janelia.saalfeldlab.n5.universe;
-import com.amazonaws.auth.AWSCredentials;
-import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
-import com.amazonaws.services.s3.AmazonS3;
-import com.google.cloud.storage.Storage;
-import com.google.gson.GsonBuilder;
-import net.imglib2.util.Pair;
-import net.imglib2.util.ValuePair;
+import java.io.File;
+import java.io.Serializable;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.file.FileSystems;
+import java.nio.file.Paths;
+import java.util.function.BiFunction;
+import java.util.function.Predicate;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.annotation.Nullable;
+
import org.apache.commons.lang3.function.TriFunction;
import org.janelia.saalfeldlab.googlecloud.GoogleCloudStorageURI;
import org.janelia.saalfeldlab.googlecloud.GoogleCloudUtils;
@@ -55,17 +61,15 @@
import org.janelia.saalfeldlab.n5.zarr.ZarrKeyValueReader;
import org.janelia.saalfeldlab.n5.zarr.ZarrKeyValueWriter;
-import javax.annotation.Nullable;
-import java.io.File;
-import java.io.Serializable;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.nio.file.FileSystems;
-import java.nio.file.Paths;
-import java.util.function.BiFunction;
-import java.util.function.Predicate;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+import com.amazonaws.ClientConfiguration;
+import com.amazonaws.auth.AWSCredentials;
+import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
+import com.amazonaws.services.s3.AmazonS3;
+import com.google.cloud.storage.Storage;
+import com.google.gson.GsonBuilder;
+
+import net.imglib2.util.Pair;
+import net.imglib2.util.ValuePair;
/**
* Factory for various N5 readers and writers. Implementation specific
@@ -94,6 +98,7 @@ public class N5Factory implements Serializable {
private String googleCloudProjectId = null;
private String s3Region = null;
private AWSCredentials s3Credentials = null;
+ private ClientConfiguration s3ClientConfiguration = null;
private boolean s3Anonymous = true;
private String s3Endpoint;
@@ -182,6 +187,12 @@ public N5Factory s3UseCredentials(final AWSCredentials credentials) {
return this;
}
+ public N5Factory s3ClientConfiguration(final ClientConfiguration clientConfiguration) {
+
+ this.s3ClientConfiguration = clientConfiguration;
+ return this;
+ }
+
@Deprecated
public N5Factory s3RetryWithCredentials() {
@@ -203,7 +214,7 @@ public N5Factory s3Region(final String s3Region) {
AmazonS3 createS3(final String uri) {
try {
- return AmazonS3Utils.createS3(uri, s3Endpoint, AmazonS3Utils.getS3Credentials(s3Credentials, s3Anonymous), s3Region);
+ return AmazonS3Utils.createS3(uri, s3Endpoint, AmazonS3Utils.getS3Credentials(s3Credentials, s3Anonymous), s3ClientConfiguration, s3Region);
} catch (final Throwable e) {
throw new N5Exception("Could not create s3 client from uri: " + uri, e);
}
@@ -228,7 +239,7 @@ KeyValueAccess getKeyValueAccess(final URI uri) {
* backend take into account reasonable defaults when possible.
* Here we test from most to least restrictive.
* See the Javadoc for more details. */
- for (KeyValueAccessBackend backend : KeyValueAccessBackend.values()) {
+ for (final KeyValueAccessBackend backend : KeyValueAccessBackend.values()) {
final KeyValueAccess kva = backend.apply(uri, this);
if (kva != null)
return kva;
@@ -352,10 +363,10 @@ public N5Reader openReader(final String uri) {
private N5Reader openReader(@Nullable final StorageFormat storage, @Nullable final KeyValueAccess access, String containerPath) {
if (storage == null) {
- for (StorageFormat format : StorageFormat.values()) {
+ for (final StorageFormat format : StorageFormat.values()) {
try {
return openReader(format, access, containerPath);
- } catch (Throwable e) {
+ } catch (final Throwable e) {
}
}
throw new N5Exception("Unable to open " + containerPath + " as N5Reader");
@@ -480,10 +491,10 @@ public N5Writer openWriter(final String uri) {
private N5Writer openWriter(@Nullable final StorageFormat storage, @Nullable final KeyValueAccess access, final String containerPath) {
if (storage == null) {
- for (StorageFormat format : StorageFormat.values()) {
+ for (final StorageFormat format : StorageFormat.values()) {
try {
return openWriter(format, access, containerPath);
- } catch (Throwable ignored) {
+ } catch (final Throwable ignored) {
}
}
throw new N5Exception("Unable to open " + containerPath + " as N5Writer");
@@ -511,7 +522,7 @@ private T openN5ContainerWithStorageFormat(
try {
final URI asUri = StorageFormat.parseUri(uri).getB();
return openWithFormat.apply(format, asUri);
- } catch (URISyntaxException e) {
+ } catch (final URISyntaxException e) {
throw new N5Exception("Cannot create N5 Container (" + format + ") at " + uri, e);
}
}
@@ -547,7 +558,7 @@ private T openN5Container(
final Pair storageAndUri;
try {
storageAndUri = StorageFormat.parseUri(containerUri);
- } catch (URISyntaxException e) {
+ } catch (final URISyntaxException e) {
throw new N5Exception("Unable to open " + containerUri + " as N5 Container", e);
}
final StorageFormat format = storageAndUri.getA();
@@ -631,7 +642,7 @@ public enum StorageFormat {
public static StorageFormat guessStorageFromUri(URI uri) {
- for (StorageFormat format : StorageFormat.values()) {
+ for (final StorageFormat format : StorageFormat.values()) {
if (format.uriTest.test(uri))
return format;
}
@@ -656,7 +667,7 @@ public static Pair getStorageFromNestedScheme(String uri)
final String storageFormatScheme = storageSchemeMatcher.group(STORAGE_SCHEME_GROUP);
final String uriGroup = storageSchemeMatcher.group(URI_GROUP);
if (storageFormatScheme != null) {
- for (StorageFormat format : StorageFormat.values()) {
+ for (final StorageFormat format : StorageFormat.values()) {
if (format.schemePattern.asPredicate().test(storageFormatScheme))
return new ValuePair<>(format, uriGroup);
}
@@ -690,15 +701,15 @@ public static N5Reader createReader(String containerUri) {
private static URI parseUriFromString(String uri) {
try {
return URI.create(uri);
- } catch (Throwable ignore) {}
+ } catch (final Throwable ignore) {}
try {
return Paths.get(uri).toUri();
- } catch (Throwable ignore) {}
+ } catch (final Throwable ignore) {}
try {
return N5URI.encodeAsUri(uri);
- } catch (URISyntaxException e) {
+ } catch (final URISyntaxException e) {
throw new N5Exception(e);
}
}
diff --git a/src/main/java/org/janelia/saalfeldlab/n5/universe/N5TreeNode.java b/src/main/java/org/janelia/saalfeldlab/n5/universe/N5TreeNode.java
index 3315b45..7df577b 100644
--- a/src/main/java/org/janelia/saalfeldlab/n5/universe/N5TreeNode.java
+++ b/src/main/java/org/janelia/saalfeldlab/n5/universe/N5TreeNode.java
@@ -149,8 +149,8 @@ public N5TreeNode addPath( final String path, Function const
// get the appropriate child along the path if it exists, otherwise add it
N5TreeNode child = null;
- Stream cs = children.stream().filter( n -> n.getNodeName().equals(childName));
- Optional copt = cs.findFirst();
+ final Stream cs = children.stream().filter( n -> n.getNodeName().equals(childName));
+ final Optional copt = cs.findFirst();
if( copt.isPresent() )
child = copt.get();
else {
@@ -199,8 +199,8 @@ public boolean structureEquals( N5TreeNode other )
return false;
boolean childrenEqual = true;
- for( N5TreeNode c : childrenList()) {
- Optional otherChildOpt = other.childrenList().stream()
+ for( final N5TreeNode c : childrenList()) {
+ final Optional otherChildOpt = other.childrenList().stream()
.filter( x -> x.getNodeName().equals( c.getNodeName()))
.findFirst();
@@ -221,9 +221,9 @@ public String printRecursive() {
private static String printRecursiveHelper(N5TreeNode node, String prefix) {
- StringBuffer out = new StringBuffer();
+ final StringBuffer out = new StringBuffer();
out.append(prefix + node.path + "\n");
- for (N5TreeNode c : node.childrenList()) {
+ for (final N5TreeNode c : node.childrenList()) {
System.out.println(c.path);
out.append(printRecursiveHelper(c, prefix + " "));
}