@@ -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