/** * Create a FileContext for specified default URI using the specified config. * * @param defaultFsUri * @param aConf * @return new FileContext for specified uri * @throws UnsupportedFileSystemException If the file system with specified is * not supported * @throws RuntimeException If the file system specified is supported but * could not be instantiated, or if login fails. */ public static FileContext getFileContext(final URI defaultFsUri, final Configuration aConf) throws UnsupportedFileSystemException { UserGroupInformation currentUser = null; AbstractFileSystem defaultAfs = null; if (defaultFsUri.getScheme() == null) { return getFileContext(aConf); } try { currentUser = UserGroupInformation.getCurrentUser(); defaultAfs = getAbstractFileSystem(currentUser, defaultFsUri, aConf); } catch (UnsupportedFileSystemException ex) { throw ex; } catch (IOException ex) { LOG.error(ex.toString()); throw new RuntimeException(ex); } return getFileContext(defaultAfs, aConf); }
/** * Get the file system of supplied path. * * @param absOrFqPath - absolute or fully qualified path * @return the file system of the path * * @throws UnsupportedFileSystemException If the file system for * <code>absOrFqPath</code> is not supported. * @throws IOException If the file system for <code>absOrFqPath</code> could * not be instantiated. */ protected AbstractFileSystem getFSofPath(final Path absOrFqPath) throws UnsupportedFileSystemException, IOException { absOrFqPath.checkNotSchemeWithRelative(); absOrFqPath.checkNotRelative(); try { // Is it the default FS for this FileContext? defaultFS.checkPath(absOrFqPath); return defaultFS; } catch (Exception e) { // it is different FileSystem return getAbstractFileSystem(ugi, absOrFqPath.toUri(), conf); } }
/** * Create a FileContext for specified default URI using the specified config. * * @param defaultFsUri * @param aConf * @return new FileContext for specified uri * @throws UnsupportedFileSystemException If the file system with specified is * not supported * @throws RuntimeException If the file system specified is supported but * could not be instantiated, or if login fails. */ public static FileContext getFileContext(final URI defaultFsUri, final Configuration aConf) throws UnsupportedFileSystemException { UserGroupInformation currentUser = null; AbstractFileSystem defaultAfs = null; if (defaultFsUri.getScheme() == null) { return getFileContext(aConf); } try { currentUser = UserGroupInformation.getCurrentUser(); defaultAfs = getAbstractFileSystem(currentUser, defaultFsUri, aConf); } catch (UnsupportedFileSystemException ex) { throw ex; } catch (IOException ex) { LOG.error(ex); throw new RuntimeException(ex); } return getFileContext(defaultAfs, aConf); }
/** * Create a FileContext for specified default URI using the specified config. * * @param defaultFsUri * @param aConf * @return new FileContext for specified uri * @throws UnsupportedFileSystemException If the file system with specified is * not supported * @throws RuntimeException If the file system specified is supported but * could not be instantiated, or if login fails. */ public static FileContext getFileContext(final URI defaultFsUri, final Configuration aConf) throws UnsupportedFileSystemException { UserGroupInformation currentUser = null; AbstractFileSystem defaultAfs = null; if (defaultFsUri.getScheme() == null) { return getFileContext(aConf); } try { currentUser = UserGroupInformation.getCurrentUser(); defaultAfs = getAbstractFileSystem(currentUser, defaultFsUri, aConf); } catch (UnsupportedFileSystemException ex) { throw ex; } catch (IOException ex) { LOG.error(ex); throw new RuntimeException(ex); } return getFileContext(defaultAfs, aConf); }
/** * Create a FileContext for specified default URI using the specified config. * * @param defaultFsUri * @param aConf * @return new FileContext for specified uri * @throws UnsupportedFileSystemException If the file system with specified is * not supported * @throws RuntimeException If the file system specified is supported but * could not be instantiated, or if login fails. */ public static FileContext getFileContext(final URI defaultFsUri, final Configuration aConf) throws UnsupportedFileSystemException { UserGroupInformation currentUser = null; AbstractFileSystem defaultAfs = null; if (defaultFsUri.getScheme() == null) { return getFileContext(aConf); } try { currentUser = UserGroupInformation.getCurrentUser(); defaultAfs = getAbstractFileSystem(currentUser, defaultFsUri, aConf); } catch (UnsupportedFileSystemException ex) { throw ex; } catch (IOException ex) { LOG.error(ex); throw new RuntimeException(ex); } return getFileContext(defaultAfs, aConf); }
/** * Create a FileContext for specified default URI using the specified config. * * @param defaultFsUri * @param aConf * @return new FileContext for specified uri * @throws UnsupportedFileSystemException If the file system with specified is * not supported * @throws RuntimeException If the file system specified is supported but * could not be instantiated, or if login fails. */ public static FileContext getFileContext(final URI defaultFsUri, final Configuration aConf) throws UnsupportedFileSystemException { UserGroupInformation currentUser = null; AbstractFileSystem defaultAfs = null; if (defaultFsUri.getScheme() == null) { return getFileContext(aConf); } try { currentUser = UserGroupInformation.getCurrentUser(); defaultAfs = getAbstractFileSystem(currentUser, defaultFsUri, aConf); } catch (UnsupportedFileSystemException ex) { throw ex; } catch (IOException ex) { LOG.error(ex); throw new RuntimeException(ex); } return getFileContext(defaultAfs, aConf); }
/** * Get the file system of supplied path. * * @param absOrFqPath - absolute or fully qualified path * @return the file system of the path * * @throws UnsupportedFileSystemException If the file system for * <code>absOrFqPath</code> is not supported. * @throws IOExcepton If the file system for <code>absOrFqPath</code> could * not be instantiated. */ protected AbstractFileSystem getFSofPath(final Path absOrFqPath) throws UnsupportedFileSystemException, IOException { absOrFqPath.checkNotSchemeWithRelative(); absOrFqPath.checkNotRelative(); try { // Is it the default FS for this FileContext? defaultFS.checkPath(absOrFqPath); return defaultFS; } catch (Exception e) { // it is different FileSystem return getAbstractFileSystem(ugi, absOrFqPath.toUri(), conf); } }
/** * Get the file system of supplied path. * * @param absOrFqPath - absolute or fully qualified path * @return the file system of the path * * @throws UnsupportedFileSystemException If the file system for * <code>absOrFqPath</code> is not supported. * @throws IOExcepton If the file system for <code>absOrFqPath</code> could * not be instantiated. */ protected AbstractFileSystem getFSofPath(final Path absOrFqPath) throws UnsupportedFileSystemException, IOException { absOrFqPath.checkNotSchemeWithRelative(); absOrFqPath.checkNotRelative(); try { // Is it the default FS for this FileContext? defaultFS.checkPath(absOrFqPath); return defaultFS; } catch (Exception e) { // it is different FileSystem return getAbstractFileSystem(ugi, absOrFqPath.toUri(), conf); } }
/** * Get the file system of supplied path. * * @param absOrFqPath - absolute or fully qualified path * @return the file system of the path * * @throws UnsupportedFileSystemException If the file system for * <code>absOrFqPath</code> is not supported. * @throws IOExcepton If the file system for <code>absOrFqPath</code> could * not be instantiated. */ protected AbstractFileSystem getFSofPath(final Path absOrFqPath) throws UnsupportedFileSystemException, IOException { absOrFqPath.checkNotSchemeWithRelative(); absOrFqPath.checkNotRelative(); try { // Is it the default FS for this FileContext? defaultFS.checkPath(absOrFqPath); return defaultFS; } catch (Exception e) { // it is different FileSystem return getAbstractFileSystem(ugi, absOrFqPath.toUri(), conf); } }
/** * Get the file system of supplied path. * * @param absOrFqPath - absolute or fully qualified path * @return the file system of the path * * @throws UnsupportedFileSystemException If the file system for * <code>absOrFqPath</code> is not supported. * @throws IOException If the file system for <code>absOrFqPath</code> could * not be instantiated. */ protected AbstractFileSystem getFSofPath(final Path absOrFqPath) throws UnsupportedFileSystemException, IOException { absOrFqPath.checkNotSchemeWithRelative(); absOrFqPath.checkNotRelative(); try { // Is it the default FS for this FileContext? defaultFS.checkPath(absOrFqPath); return defaultFS; } catch (Exception e) { // it is different FileSystem return getAbstractFileSystem(ugi, absOrFqPath.toUri(), conf); } }