@Test @Ignore public void testHdfsScheme() throws IOException { FilesArchiver archiver = FilesArchiverFactory.createFromURI( "hdfs: assertEquals("hdfs: archiver.getClass(), HdfsArchiver.class); }
public static FilesArchiver createFromURI(String uri) throws IOException { try { URI outputURI = new URI(uri); String scheme = outputURI.getScheme(); logger.info("Got scheme " + scheme + " for URI " + uri); if (scheme == null || scheme.equalsIgnoreCase(EMPTY_STRING)) { return makeDirectoryArchiver(new File(uri)); } if (scheme.equalsIgnoreCase(FILE_SCHEME)) { return makeDirectoryArchiver(new File(outputURI)); } if (scheme.equalsIgnoreCase(HDFS_SCHEME)) { return makeHdfsArchiver(uri); } if (scheme.equalsIgnoreCase(S3_SCHEME)) { return makeS3Archiver(outputURI); } throw new IllegalArgumentException("Unsupported scheme " + scheme); } catch (URISyntaxException e) { throw new IllegalArgumentException( "Unable to parse the URI " + uri, e); } }
FilesArchiverFactory { public static FilesArchiver createFromURI(String uri) throws IOException { try { URI outputURI = new URI(uri); String scheme = outputURI.getScheme(); logger.info("Got scheme " + scheme + " for URI " + uri); if (scheme == null || scheme.equalsIgnoreCase(EMPTY_STRING)) { return makeDirectoryArchiver(new File(uri)); } if (scheme.equalsIgnoreCase(FILE_SCHEME)) { return makeDirectoryArchiver(new File(outputURI)); } if (scheme.equalsIgnoreCase(HDFS_SCHEME)) { return makeHdfsArchiver(uri); } if (scheme.equalsIgnoreCase(S3_SCHEME)) { return makeS3Archiver(outputURI); } throw new IllegalArgumentException("Unsupported scheme " + scheme); } catch (URISyntaxException e) { throw new IllegalArgumentException( "Unable to parse the URI " + uri, e); } } }
FilesArchiverFactory { public static FilesArchiver createFromURI(String uri) throws IOException { try { URI outputURI = new URI(uri); String scheme = outputURI.getScheme(); logger.info("Got scheme " + scheme + " for URI " + uri); if (scheme == null || scheme.equalsIgnoreCase(EMPTY_STRING)) { return makeDirectoryArchiver(new File(uri)); } if (scheme.equalsIgnoreCase(FILE_SCHEME)) { return makeDirectoryArchiver(new File(outputURI)); } if (scheme.equalsIgnoreCase(HDFS_SCHEME)) { return makeHdfsArchiver(uri); } if (scheme.equalsIgnoreCase(S3_SCHEME)) { return makeS3Archiver(outputURI); } throw new IllegalArgumentException("Unsupported scheme " + scheme); } catch (URISyntaxException e) { throw new IllegalArgumentException( "Unable to parse the URI " + uri, e); } }  }
FilesArchiverFactory { public static FilesArchiver createFromURI(String uri) throws IOException { try { URI outputURI = new URI(uri); String scheme = outputURI.getScheme(); logger.info("Got scheme " + scheme + " for URI " + uri); if (scheme == null || scheme.equalsIgnoreCase(EMPTY_STRING)) { return makeDirectoryArchiver(new File(uri)); } if (scheme.equalsIgnoreCase(FILE_SCHEME)) { return makeDirectoryArchiver(new File(outputURI)); } if (scheme.equalsIgnoreCase(HDFS_SCHEME)) { return makeHdfsArchiver(uri); } if (scheme.equalsIgnoreCase(S3_SCHEME)) { return makeS3Archiver(outputURI); } throw new IllegalArgumentException("Unsupported scheme " + scheme); } catch (URISyntaxException e) { throw new IllegalArgumentException( "Unable to parse the URI " + uri, e); } }  static FilesArchiver createFromURI(String uri); }
FilesArchiverFactory { public static FilesArchiver createFromURI(String uri) throws IOException { try { URI outputURI = new URI(uri); String scheme = outputURI.getScheme(); logger.info("Got scheme " + scheme + " for URI " + uri); if (scheme == null || scheme.equalsIgnoreCase(EMPTY_STRING)) { return makeDirectoryArchiver(new File(uri)); } if (scheme.equalsIgnoreCase(FILE_SCHEME)) { return makeDirectoryArchiver(new File(outputURI)); } if (scheme.equalsIgnoreCase(HDFS_SCHEME)) { return makeHdfsArchiver(uri); } if (scheme.equalsIgnoreCase(S3_SCHEME)) { return makeS3Archiver(outputURI); } throw new IllegalArgumentException("Unsupported scheme " + scheme); } catch (URISyntaxException e) { throw new IllegalArgumentException( "Unable to parse the URI " + uri, e); } }  static FilesArchiver createFromURI(String uri);  }