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