Skip to content

Commit 7cc04b9

Browse files
committed
Remove S3 handling
1 parent 70a35d7 commit 7cc04b9

11 files changed

Lines changed: 9 additions & 1389 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.vscode
12
.DS_Store
23
target
34
.idea

pom.xml

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -87,51 +87,6 @@
8787
</ciManagement>
8888

8989
<dependencies>
90-
<dependency>
91-
<groupId>io.minio</groupId>
92-
<artifactId>minio</artifactId>
93-
<version>5.0.2</version>
94-
<exclusions>
95-
<exclusion>
96-
<groupId>commons-codec</groupId>
97-
<artifactId>commons-codec</artifactId>
98-
</exclusion>
99-
<exclusion>
100-
<groupId>commons-logging</groupId>
101-
<artifactId>commons-logging</artifactId>
102-
</exclusion>
103-
<exclusion>
104-
<groupId>com.google.code.findbugs</groupId>
105-
<artifactId>annotations</artifactId>
106-
</exclusion>
107-
<exclusion>
108-
<groupId>com.google.code.findbugs</groupId>
109-
<artifactId>jsr305</artifactId>
110-
</exclusion>
111-
<exclusion>
112-
<groupId>com.fasterxml.jackson.core</groupId>
113-
<artifactId>jackson-databind</artifactId>
114-
</exclusion>
115-
<exclusion>
116-
<groupId>com.fasterxml.jackson.core</groupId>
117-
<artifactId>jackson-core</artifactId>
118-
</exclusion>
119-
<exclusion>
120-
<groupId>com.fasterxml.jackson.core</groupId>
121-
<artifactId>jackson-annotations</artifactId>
122-
</exclusion>
123-
</exclusions>
124-
</dependency>
125-
<dependency>
126-
<groupId>com.fasterxml.jackson.core</groupId>
127-
<artifactId>jackson-databind</artifactId>
128-
<version>2.14.2</version>
129-
</dependency>
130-
<dependency>
131-
<groupId>com.fasterxml.jackson.core</groupId>
132-
<artifactId>jackson-annotations</artifactId>
133-
<version>2.14.2</version>
134-
</dependency>
13590
<dependency>
13691
<groupId>com.esotericsoftware</groupId>
13792
<artifactId>kryo</artifactId>

src/main/java/loci/common/Location.java

Lines changed: 7 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,8 @@ public Location(String parent, String child) {
203203
pathname = child;
204204
uri = new URI(mapped);
205205
isURL = true;
206-
if (S3Handle.canHandleScheme(uri.toString())) {
207-
urlType = UrlType.S3;
208-
url = null;
209-
}
210-
else {
211-
urlType = UrlType.GENERIC;
212-
url = uri.toURL();
213-
}
206+
urlType = UrlType.GENERIC;
207+
url = uri.toURL();
214208
}
215209
catch (URISyntaxException | MalformedURLException e) {
216210
// Readers such as FilePatternReader may pass invalid URI paths
@@ -486,23 +480,8 @@ public static IRandomAccess getHandle(String id, boolean writable,
486480
LOGGER.trace("no handle was mapped for this ID");
487481
String mapId = getMappedId(id);
488482

489-
if (S3Handle.canHandleScheme(id)) {
490-
StreamHandle.Settings ss = new StreamHandle.Settings();
491-
if (ss.getRemoteCacheRootDir() != null) {
492-
String cachedFile = S3Handle.cacheObject(mapId, ss);
493-
if (bufferSize > 0) {
494-
handle = new NIOFileHandle(
495-
new File(cachedFile), "r", bufferSize);
496-
}
497-
else {
498-
handle = new NIOFileHandle(cachedFile, "r");
499-
}
500-
}
501-
else {
502-
handle = new S3Handle(mapId);
503-
}
504-
}
505-
else if (id.startsWith("http://") || id.startsWith("https://")) {
483+
if (id.startsWith("http://") || id.startsWith("https://")
484+
|| id.startsWith("s3://")) {
506485
handle = new URLHandle(mapId);
507486
}
508487
else if (allowArchiveHandles && ZipHandle.isZipFile(mapId)) {
@@ -918,32 +897,9 @@ public boolean isAbsolute() {
918897
public boolean isDirectory() {
919898
LOGGER.trace("isDirectory()");
920899
if (isURL) {
921-
if (urlType == UrlType.S3) {
922-
// TODO: This is complicated
923-
//
924-
// S3 doesn't have directories, but keys can contain / which we
925-
// can pretend is a file path. However this "directory" doesn't
926-
// actually exist, only the "contents" of the directory exist.
927-
//
928-
// Minio.listObjects() lists all objects in a bucket that
929-
// match an optional prefix so this could be an option for checking
930-
// whether to trest this as a directory.
931-
//
932-
// S3 buckets are the closest thing to a proper directory
933-
// so for now
934-
try {
935-
S3Handle h = new S3Handle(uri.toString());
936-
boolean isBucket = h.isBucket();
937-
h.close();
938-
return isBucket;
939-
} catch (IOException e) {
940-
throw new UncheckedIOException(e);
941-
}
942-
} else {
943-
// TODO: this should be removed as well.
944-
String[] list = list();
945-
return list != null;
946-
}
900+
// TODO: this should be removed as well.
901+
String[] list = list();
902+
return list != null;
947903
}
948904
return file.isDirectory();
949905
}

0 commit comments

Comments
 (0)