org.apache.hadoop.fs
Class AbstractFileSystem

java.lang.Object
  extended by org.apache.hadoop.fs.AbstractFileSystem
Direct Known Subclasses:
ViewFs

@InterfaceAudience.Public
@InterfaceStability.Evolving
public abstract class AbstractFileSystem
extends Object

This class provides an interface for implementors of a Hadoop file system (analogous to the VFS of Unix). Applications do not access this class; instead they access files across all file systems using FileContext. Pathnames passed to AbstractFileSystem can be fully qualified URI that matches the "this" file system (ie same scheme and authority) or a Slash-relative name that is assumed to be relative to the root of the "this" file system .


Field Summary
protected  org.apache.hadoop.fs.FileSystem.Statistics statistics
          The statistics for this file system.
 
Constructor Summary
AbstractFileSystem(URI uri, String supportedScheme, boolean authorityNeeded, int defaultPort)
          Constructor to be called by subclasses.
 
Method Summary
 void checkPath(Path path)
          Check that a Path belongs to this FileSystem.
 void checkScheme(URI uri, String supportedScheme)
          Check that the Uri's scheme matches
static void clearStatistics()
           
 FSDataOutputStream create(Path f, EnumSet<CreateFlag> createFlag, org.apache.hadoop.fs.Options.CreateOpts... opts)
          The specification of this method matches that of FileContext.create(Path, EnumSet, Options.CreateOpts...) except that the Path f must be fully qualified and the permission is absolute (i.e.
static AbstractFileSystem createFileSystem(URI uri, Configuration conf)
          Create a file system instance for the specified uri using the conf.
abstract  FSDataOutputStream createInternal(Path f, EnumSet<CreateFlag> flag, FsPermission absolutePermission, int bufferSize, short replication, long blockSize, Progressable progress, org.apache.hadoop.fs.Options.ChecksumOpt checksumOpt, boolean createParent)
          The specification of this method matches that of create(Path, EnumSet, Options.CreateOpts...) except that the opts have been declared explicitly.
 void createSymlink(Path target, Path link, boolean createParent)
          The specification of this method matches that of FileContext.createSymlink(Path, Path, boolean);
abstract  boolean delete(Path f, boolean recursive)
          The specification of this method matches that of FileContext.delete(Path, boolean) except that Path f must be for this file system.
 boolean equals(Object other)
           
static AbstractFileSystem get(URI uri, Configuration conf)
          The main factory method for creating a file system.
 AclStatus getAclStatus(Path path)
          Gets the ACLs of files and directories.
protected static Map<URI,org.apache.hadoop.fs.FileSystem.Statistics> getAllStatistics()
           
 String getCanonicalServiceName()
          Get a canonical name for this file system.
abstract  BlockLocation[] getFileBlockLocations(Path f, long start, long len)
          The specification of this method matches that of FileContext.getFileBlockLocations(Path, long, long) except that Path f must be for this file system.
abstract  FileChecksum getFileChecksum(Path f)
          The specification of this method matches that of FileContext.getFileChecksum(Path) except that Path f must be for this file system.
 FileStatus getFileLinkStatus(Path f)
          The specification of this method matches that of FileContext.getFileLinkStatus(Path) except that an UnresolvedLinkException may be thrown if a symlink is encountered in the path leading up to the final path component.
abstract  FileStatus getFileStatus(Path f)
          The specification of this method matches that of FileContext.getFileStatus(Path) except that an UnresolvedLinkException may be thrown if a symlink is encountered in the path.
abstract  FsStatus getFsStatus()
          The specification of this method matches that of FileContext.getFsStatus(Path).
 FsStatus getFsStatus(Path f)
          The specification of this method matches that of FileContext.getFsStatus(Path) except that Path f must be for this file system.
 Path getHomeDirectory()
          Return the current user's home directory in this file system.
 Path getInitialWorkingDirectory()
          Some file systems like LocalFileSystem have an initial workingDir that is used as the starting workingDir.
 Path getLinkTarget(Path f)
          Partially resolves the path.
abstract  FsServerDefaults getServerDefaults()
          Return a set of server default configuration values.
 org.apache.hadoop.fs.FileSystem.Statistics getStatistics()
           
protected static org.apache.hadoop.fs.FileSystem.Statistics getStatistics(URI uri)
          Get the statistics for a particular file system.
 URI getUri()
          Returns a URI whose scheme and authority identify this FileSystem.
abstract  int getUriDefaultPort()
          The default port of this file system.
 String getUriPath(Path p)
          Get the path-part of a pathname.
 byte[] getXAttr(Path path, String name)
          Get an xattr for a file or directory.
 Map<String,byte[]> getXAttrs(Path path)
          Get all of the xattrs for a file or directory.
 Map<String,byte[]> getXAttrs(Path path, List<String> names)
          Get all of the xattrs for a file or directory.
 int hashCode()
           
 boolean isValidName(String src)
          Returns true if the specified string is considered valid in the path part of a URI by this file system.
 org.apache.hadoop.fs.RemoteIterator<Path> listCorruptFileBlocks(Path path)
           
 org.apache.hadoop.fs.RemoteIterator<LocatedFileStatus> listLocatedStatus(Path f)
          The specification of this method matches that of FileContext.listLocatedStatus(Path) except that Path f must be for this file system.
abstract  FileStatus[] listStatus(Path f)
          The specification of this method matches that of FileContext.Util.listStatus(Path) except that Path f must be for this file system.
 org.apache.hadoop.fs.RemoteIterator<FileStatus> listStatusIterator(Path f)
          The specification of this method matches that of FileContext.listStatus(Path) except that Path f must be for this file system.
 List<String> listXAttrs(Path path)
          Get all of the xattr names for a file or directory.
 Path makeQualified(Path path)
          Make the path fully qualified to this file system
abstract  void mkdir(Path dir, FsPermission permission, boolean createParent)
          The specification of this method matches that of FileContext.mkdir(Path, FsPermission, boolean) except that the Path f must be fully qualified and the permission is absolute (i.e.
 void modifyAclEntries(Path path, List<AclEntry> aclSpec)
          Modifies ACL entries of files and directories.
 FSDataInputStream open(Path f)
          The specification of this method matches that of FileContext.open(Path) except that Path f must be for this file system.
abstract  FSDataInputStream open(Path f, int bufferSize)
          The specification of this method matches that of FileContext.open(Path, int) except that Path f must be for this file system.
static void printStatistics()
          Prints statistics for all file systems.
 void removeAcl(Path path)
          Removes all but the base ACL entries of files and directories.
 void removeAclEntries(Path path, List<AclEntry> aclSpec)
          Removes ACL entries from files and directories.
 void removeDefaultAcl(Path path)
          Removes all default ACL entries from files and directories.
 void removeXAttr(Path path, String name)
          Remove an xattr of a file or directory.
 void rename(Path src, Path dst, org.apache.hadoop.fs.Options.Rename... options)
          The specification of this method matches that of FileContext.rename(Path, Path, Options.Rename...) except that Path f must be for this file system.
abstract  void renameInternal(Path src, Path dst)
          The specification of this method matches that of FileContext.rename(Path, Path, Options.Rename...) except that Path f must be for this file system and NO OVERWRITE is performed.
 void renameInternal(Path src, Path dst, boolean overwrite)
          The specification of this method matches that of FileContext.rename(Path, Path, Options.Rename...) except that Path f must be for this file system.
 Path resolvePath(Path p)
          Return the fully-qualified path of path f resolving the path through any internal symlinks or mount point
 void setAcl(Path path, List<AclEntry> aclSpec)
          Fully replaces ACL of files and directories, discarding all existing entries.
abstract  void setOwner(Path f, String username, String groupname)
          The specification of this method matches that of FileContext.setOwner(Path, String, String) except that Path f must be for this file system.
abstract  void setPermission(Path f, FsPermission permission)
          The specification of this method matches that of FileContext.setPermission(Path, FsPermission) except that Path f must be for this file system.
abstract  boolean setReplication(Path f, short replication)
          The specification of this method matches that of FileContext.setReplication(Path, short) except that Path f must be for this file system.
abstract  void setTimes(Path f, long mtime, long atime)
          The specification of this method matches that of FileContext.setTimes(Path, long, long) except that Path f must be for this file system.
abstract  void setVerifyChecksum(boolean verifyChecksum)
          The specification of this method matches that of FileContext.setVerifyChecksum(boolean, Path) except that Path f must be for this file system.
 void setXAttr(Path path, String name, byte[] value)
          Set an xattr of a file or directory.
 void setXAttr(Path path, String name, byte[] value, EnumSet<XAttrSetFlag> flag)
          Set an xattr of a file or directory.
 boolean supportsSymlinks()
          Returns true if the file system supports symlinks, false otherwise.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

statistics

protected org.apache.hadoop.fs.FileSystem.Statistics statistics
The statistics for this file system.

Constructor Detail

AbstractFileSystem

public AbstractFileSystem(URI uri,
                          String supportedScheme,
                          boolean authorityNeeded,
                          int defaultPort)
                   throws URISyntaxException
Constructor to be called by subclasses.

Parameters:
uri - for this file system.
supportedScheme - the scheme supported by the implementor
authorityNeeded - if true then theURI must have authority, if false then the URI must have null authority.
Throws:
URISyntaxException - uri has syntax error
Method Detail

getStatistics

public org.apache.hadoop.fs.FileSystem.Statistics getStatistics()

isValidName

public boolean isValidName(String src)
Returns true if the specified string is considered valid in the path part of a URI by this file system. The default implementation enforces the rules of HDFS, but subclasses may override this method to implement specific validation rules for specific file systems.

Parameters:
src - String source filename to check, path part of the URI
Returns:
boolean true if the specified string is considered valid

createFileSystem

public static AbstractFileSystem createFileSystem(URI uri,
                                                  Configuration conf)
                                           throws UnsupportedFileSystemException
Create a file system instance for the specified uri using the conf. The conf is used to find the class name that implements the file system. The conf is also passed to the file system for its configuration.

Parameters:
uri - URI of the file system
conf - Configuration for the file system
Returns:
Returns the file system for the given URI
Throws:
UnsupportedFileSystemException - file system for uri is not found

getStatistics

protected static org.apache.hadoop.fs.FileSystem.Statistics getStatistics(URI uri)
Get the statistics for a particular file system.

Parameters:
uri - used as key to lookup STATISTICS_TABLE. Only scheme and authority part of the uri are used.
Returns:
a statistics object

clearStatistics

public static void clearStatistics()

printStatistics

public static void printStatistics()
Prints statistics for all file systems.


getAllStatistics

protected static Map<URI,org.apache.hadoop.fs.FileSystem.Statistics> getAllStatistics()

get

public static AbstractFileSystem get(URI uri,
                                     Configuration conf)
                              throws UnsupportedFileSystemException
The main factory method for creating a file system. Get a file system for the URI's scheme and authority. The scheme of the uri determines a configuration property name, fs.AbstractFileSystem.scheme.impl whose value names the AbstractFileSystem class. The entire URI and conf is passed to the AbstractFileSystem factory method.

Parameters:
uri - for the file system to be created.
conf - which is passed to the file system impl.
Returns:
file system for the given URI.
Throws:
UnsupportedFileSystemException - if the file system for uri is not supported.

checkScheme

public void checkScheme(URI uri,
                        String supportedScheme)
Check that the Uri's scheme matches

Parameters:
uri -
supportedScheme -

getUriDefaultPort

public abstract int getUriDefaultPort()
The default port of this file system.

Returns:
default port of this file system's Uri scheme A uri with a port of -1 => default port;

getUri

public URI getUri()
Returns a URI whose scheme and authority identify this FileSystem.

Returns:
the uri of this file system.

checkPath

public void checkPath(Path path)
Check that a Path belongs to this FileSystem. If the path is fully qualified URI, then its scheme and authority matches that of this file system. Otherwise the path must be slash-relative name.

Throws:
InvalidPathException - if the path is invalid

getUriPath

public String getUriPath(Path p)
Get the path-part of a pathname. Checks that URI matches this file system and that the path-part is a valid name.

Parameters:
p - path
Returns:
path-part of the Path p

makeQualified

public Path makeQualified(Path path)
Make the path fully qualified to this file system

Parameters:
path -
Returns:
the qualified path

getInitialWorkingDirectory

public Path getInitialWorkingDirectory()
Some file systems like LocalFileSystem have an initial workingDir that is used as the starting workingDir. For other file systems like HDFS there is no built in notion of an initial workingDir.

Returns:
the initial workingDir if the file system has such a notion otherwise return a null.

getHomeDirectory

public Path getHomeDirectory()
Return the current user's home directory in this file system. The default implementation returns "/user/$USER/".

Returns:
current user's home directory.

getServerDefaults

public abstract FsServerDefaults getServerDefaults()
                                            throws IOException
Return a set of server default configuration values.

Returns:
server default configuration values
Throws:
IOException - an I/O error occurred

resolvePath

public Path resolvePath(Path p)
                 throws FileNotFoundException,
                        org.apache.hadoop.fs.UnresolvedLinkException,
                        org.apache.hadoop.security.AccessControlException,
                        IOException
Return the fully-qualified path of path f resolving the path through any internal symlinks or mount point

Parameters:
p - path to be resolved
Returns:
fully qualified path
Throws:
FileNotFoundException, - AccessControlException, IOException UnresolvedLinkException if symbolic link on path cannot be resolved internally
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
org.apache.hadoop.security.AccessControlException
IOException

create

public final FSDataOutputStream create(Path f,
                                       EnumSet<CreateFlag> createFlag,
                                       org.apache.hadoop.fs.Options.CreateOpts... opts)
                                throws org.apache.hadoop.security.AccessControlException,
                                       FileAlreadyExistsException,
                                       FileNotFoundException,
                                       ParentNotDirectoryException,
                                       UnsupportedFileSystemException,
                                       org.apache.hadoop.fs.UnresolvedLinkException,
                                       IOException
The specification of this method matches that of FileContext.create(Path, EnumSet, Options.CreateOpts...) except that the Path f must be fully qualified and the permission is absolute (i.e. umask has been applied).

Throws:
org.apache.hadoop.security.AccessControlException
FileAlreadyExistsException
FileNotFoundException
ParentNotDirectoryException
UnsupportedFileSystemException
org.apache.hadoop.fs.UnresolvedLinkException
IOException

createInternal

public abstract FSDataOutputStream createInternal(Path f,
                                                  EnumSet<CreateFlag> flag,
                                                  FsPermission absolutePermission,
                                                  int bufferSize,
                                                  short replication,
                                                  long blockSize,
                                                  Progressable progress,
                                                  org.apache.hadoop.fs.Options.ChecksumOpt checksumOpt,
                                                  boolean createParent)
                                           throws org.apache.hadoop.security.AccessControlException,
                                                  FileAlreadyExistsException,
                                                  FileNotFoundException,
                                                  ParentNotDirectoryException,
                                                  UnsupportedFileSystemException,
                                                  org.apache.hadoop.fs.UnresolvedLinkException,
                                                  IOException
The specification of this method matches that of create(Path, EnumSet, Options.CreateOpts...) except that the opts have been declared explicitly.

Throws:
org.apache.hadoop.security.AccessControlException
FileAlreadyExistsException
FileNotFoundException
ParentNotDirectoryException
UnsupportedFileSystemException
org.apache.hadoop.fs.UnresolvedLinkException
IOException

mkdir

public abstract void mkdir(Path dir,
                           FsPermission permission,
                           boolean createParent)
                    throws org.apache.hadoop.security.AccessControlException,
                           FileAlreadyExistsException,
                           FileNotFoundException,
                           org.apache.hadoop.fs.UnresolvedLinkException,
                           IOException
The specification of this method matches that of FileContext.mkdir(Path, FsPermission, boolean) except that the Path f must be fully qualified and the permission is absolute (i.e. umask has been applied).

Throws:
org.apache.hadoop.security.AccessControlException
FileAlreadyExistsException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException

delete

public abstract boolean delete(Path f,
                               boolean recursive)
                        throws org.apache.hadoop.security.AccessControlException,
                               FileNotFoundException,
                               org.apache.hadoop.fs.UnresolvedLinkException,
                               IOException
The specification of this method matches that of FileContext.delete(Path, boolean) except that Path f must be for this file system.

Throws:
org.apache.hadoop.security.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException

open

public FSDataInputStream open(Path f)
                       throws org.apache.hadoop.security.AccessControlException,
                              FileNotFoundException,
                              org.apache.hadoop.fs.UnresolvedLinkException,
                              IOException
The specification of this method matches that of FileContext.open(Path) except that Path f must be for this file system.

Throws:
org.apache.hadoop.security.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException

open

public abstract FSDataInputStream open(Path f,
                                       int bufferSize)
                                throws org.apache.hadoop.security.AccessControlException,
                                       FileNotFoundException,
                                       org.apache.hadoop.fs.UnresolvedLinkException,
                                       IOException
The specification of this method matches that of FileContext.open(Path, int) except that Path f must be for this file system.

Throws:
org.apache.hadoop.security.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException

setReplication

public abstract boolean setReplication(Path f,
                                       short replication)
                                throws org.apache.hadoop.security.AccessControlException,
                                       FileNotFoundException,
                                       org.apache.hadoop.fs.UnresolvedLinkException,
                                       IOException
The specification of this method matches that of FileContext.setReplication(Path, short) except that Path f must be for this file system.

Throws:
org.apache.hadoop.security.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException

rename

public final void rename(Path src,
                         Path dst,
                         org.apache.hadoop.fs.Options.Rename... options)
                  throws org.apache.hadoop.security.AccessControlException,
                         FileAlreadyExistsException,
                         FileNotFoundException,
                         ParentNotDirectoryException,
                         org.apache.hadoop.fs.UnresolvedLinkException,
                         IOException
The specification of this method matches that of FileContext.rename(Path, Path, Options.Rename...) except that Path f must be for this file system.

Throws:
org.apache.hadoop.security.AccessControlException
FileAlreadyExistsException
FileNotFoundException
ParentNotDirectoryException
org.apache.hadoop.fs.UnresolvedLinkException
IOException

renameInternal

public abstract void renameInternal(Path src,
                                    Path dst)
                             throws org.apache.hadoop.security.AccessControlException,
                                    FileAlreadyExistsException,
                                    FileNotFoundException,
                                    ParentNotDirectoryException,
                                    org.apache.hadoop.fs.UnresolvedLinkException,
                                    IOException
The specification of this method matches that of FileContext.rename(Path, Path, Options.Rename...) except that Path f must be for this file system and NO OVERWRITE is performed. File systems that do not have a built in overwrite need implement only this method and can take advantage of the default impl of the other renameInternal(Path, Path, boolean)

Throws:
org.apache.hadoop.security.AccessControlException
FileAlreadyExistsException
FileNotFoundException
ParentNotDirectoryException
org.apache.hadoop.fs.UnresolvedLinkException
IOException

renameInternal

public void renameInternal(Path src,
                           Path dst,
                           boolean overwrite)
                    throws org.apache.hadoop.security.AccessControlException,
                           FileAlreadyExistsException,
                           FileNotFoundException,
                           ParentNotDirectoryException,
                           org.apache.hadoop.fs.UnresolvedLinkException,
                           IOException
The specification of this method matches that of FileContext.rename(Path, Path, Options.Rename...) except that Path f must be for this file system.

Throws:
org.apache.hadoop.security.AccessControlException
FileAlreadyExistsException
FileNotFoundException
ParentNotDirectoryException
org.apache.hadoop.fs.UnresolvedLinkException
IOException

supportsSymlinks

public boolean supportsSymlinks()
Returns true if the file system supports symlinks, false otherwise.

Returns:
true if filesystem supports symlinks

createSymlink

public void createSymlink(Path target,
                          Path link,
                          boolean createParent)
                   throws IOException,
                          org.apache.hadoop.fs.UnresolvedLinkException
The specification of this method matches that of FileContext.createSymlink(Path, Path, boolean);

Throws:
IOException
org.apache.hadoop.fs.UnresolvedLinkException

getLinkTarget

public Path getLinkTarget(Path f)
                   throws IOException
Partially resolves the path. This is used during symlink resolution in FSLinkResolver, and differs from the similarly named method FileContext.getLinkTarget(Path).

Throws:
IOException - subclass implementations may throw IOException

setPermission

public abstract void setPermission(Path f,
                                   FsPermission permission)
                            throws org.apache.hadoop.security.AccessControlException,
                                   FileNotFoundException,
                                   org.apache.hadoop.fs.UnresolvedLinkException,
                                   IOException
The specification of this method matches that of FileContext.setPermission(Path, FsPermission) except that Path f must be for this file system.

Throws:
org.apache.hadoop.security.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException

setOwner

public abstract void setOwner(Path f,
                              String username,
                              String groupname)
                       throws org.apache.hadoop.security.AccessControlException,
                              FileNotFoundException,
                              org.apache.hadoop.fs.UnresolvedLinkException,
                              IOException
The specification of this method matches that of FileContext.setOwner(Path, String, String) except that Path f must be for this file system.

Throws:
org.apache.hadoop.security.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException

setTimes

public abstract void setTimes(Path f,
                              long mtime,
                              long atime)
                       throws org.apache.hadoop.security.AccessControlException,
                              FileNotFoundException,
                              org.apache.hadoop.fs.UnresolvedLinkException,
                              IOException
The specification of this method matches that of FileContext.setTimes(Path, long, long) except that Path f must be for this file system.

Throws:
org.apache.hadoop.security.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException

getFileChecksum

public abstract FileChecksum getFileChecksum(Path f)
                                      throws org.apache.hadoop.security.AccessControlException,
                                             FileNotFoundException,
                                             org.apache.hadoop.fs.UnresolvedLinkException,
                                             IOException
The specification of this method matches that of FileContext.getFileChecksum(Path) except that Path f must be for this file system.

Throws:
org.apache.hadoop.security.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException

getFileStatus

public abstract FileStatus getFileStatus(Path f)
                                  throws org.apache.hadoop.security.AccessControlException,
                                         FileNotFoundException,
                                         org.apache.hadoop.fs.UnresolvedLinkException,
                                         IOException
The specification of this method matches that of FileContext.getFileStatus(Path) except that an UnresolvedLinkException may be thrown if a symlink is encountered in the path.

Throws:
org.apache.hadoop.security.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException

getFileLinkStatus

public FileStatus getFileLinkStatus(Path f)
                             throws org.apache.hadoop.security.AccessControlException,
                                    FileNotFoundException,
                                    UnsupportedFileSystemException,
                                    IOException
The specification of this method matches that of FileContext.getFileLinkStatus(Path) except that an UnresolvedLinkException may be thrown if a symlink is encountered in the path leading up to the final path component. If the file system does not support symlinks then the behavior is equivalent to getFileStatus(Path).

Throws:
org.apache.hadoop.security.AccessControlException
FileNotFoundException
UnsupportedFileSystemException
IOException

getFileBlockLocations

public abstract BlockLocation[] getFileBlockLocations(Path f,
                                                      long start,
                                                      long len)
                                               throws org.apache.hadoop.security.AccessControlException,
                                                      FileNotFoundException,
                                                      org.apache.hadoop.fs.UnresolvedLinkException,
                                                      IOException
The specification of this method matches that of FileContext.getFileBlockLocations(Path, long, long) except that Path f must be for this file system.

Throws:
org.apache.hadoop.security.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException

getFsStatus

public FsStatus getFsStatus(Path f)
                     throws org.apache.hadoop.security.AccessControlException,
                            FileNotFoundException,
                            org.apache.hadoop.fs.UnresolvedLinkException,
                            IOException
The specification of this method matches that of FileContext.getFsStatus(Path) except that Path f must be for this file system.

Throws:
org.apache.hadoop.security.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException

getFsStatus

public abstract FsStatus getFsStatus()
                              throws org.apache.hadoop.security.AccessControlException,
                                     FileNotFoundException,
                                     IOException
The specification of this method matches that of FileContext.getFsStatus(Path).

Throws:
org.apache.hadoop.security.AccessControlException
FileNotFoundException
IOException

listStatusIterator

public org.apache.hadoop.fs.RemoteIterator<FileStatus> listStatusIterator(Path f)
                                                                   throws org.apache.hadoop.security.AccessControlException,
                                                                          FileNotFoundException,
                                                                          org.apache.hadoop.fs.UnresolvedLinkException,
                                                                          IOException
The specification of this method matches that of FileContext.listStatus(Path) except that Path f must be for this file system.

Throws:
org.apache.hadoop.security.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException

listLocatedStatus

public org.apache.hadoop.fs.RemoteIterator<LocatedFileStatus> listLocatedStatus(Path f)
                                                                         throws org.apache.hadoop.security.AccessControlException,
                                                                                FileNotFoundException,
                                                                                org.apache.hadoop.fs.UnresolvedLinkException,
                                                                                IOException
The specification of this method matches that of FileContext.listLocatedStatus(Path) except that Path f must be for this file system.

Throws:
org.apache.hadoop.security.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException

listStatus

public abstract FileStatus[] listStatus(Path f)
                                 throws org.apache.hadoop.security.AccessControlException,
                                        FileNotFoundException,
                                        org.apache.hadoop.fs.UnresolvedLinkException,
                                        IOException
The specification of this method matches that of FileContext.Util.listStatus(Path) except that Path f must be for this file system.

Throws:
org.apache.hadoop.security.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException

listCorruptFileBlocks

public org.apache.hadoop.fs.RemoteIterator<Path> listCorruptFileBlocks(Path path)
                                                                throws IOException
Returns:
an iterator over the corrupt files under the given path (may contain duplicates if a file has more than one corrupt block)
Throws:
IOException

setVerifyChecksum

public abstract void setVerifyChecksum(boolean verifyChecksum)
                                throws org.apache.hadoop.security.AccessControlException,
                                       IOException
The specification of this method matches that of FileContext.setVerifyChecksum(boolean, Path) except that Path f must be for this file system.

Throws:
org.apache.hadoop.security.AccessControlException
IOException

getCanonicalServiceName

public String getCanonicalServiceName()
Get a canonical name for this file system.

Returns:
a URI string that uniquely identifies this file system

modifyAclEntries

public void modifyAclEntries(Path path,
                             List<AclEntry> aclSpec)
                      throws IOException
Modifies ACL entries of files and directories. This method can add new ACL entries or modify the permissions on existing ACL entries. All existing ACL entries that are not specified in this call are retained without changes. (Modifications are merged into the current ACL.)

Parameters:
path - Path to modify
aclSpec - List describing modifications
Throws:
IOException - if an ACL could not be modified

removeAclEntries

public void removeAclEntries(Path path,
                             List<AclEntry> aclSpec)
                      throws IOException
Removes ACL entries from files and directories. Other ACL entries are retained.

Parameters:
path - Path to modify
aclSpec - List describing entries to remove
Throws:
IOException - if an ACL could not be modified

removeDefaultAcl

public void removeDefaultAcl(Path path)
                      throws IOException
Removes all default ACL entries from files and directories.

Parameters:
path - Path to modify
Throws:
IOException - if an ACL could not be modified

removeAcl

public void removeAcl(Path path)
               throws IOException
Removes all but the base ACL entries of files and directories. The entries for user, group, and others are retained for compatibility with permission bits.

Parameters:
path - Path to modify
Throws:
IOException - if an ACL could not be removed

setAcl

public void setAcl(Path path,
                   List<AclEntry> aclSpec)
            throws IOException
Fully replaces ACL of files and directories, discarding all existing entries.

Parameters:
path - Path to modify
aclSpec - List describing modifications, must include entries for user, group, and others for compatibility with permission bits.
Throws:
IOException - if an ACL could not be modified

getAclStatus

public AclStatus getAclStatus(Path path)
                       throws IOException
Gets the ACLs of files and directories.

Parameters:
path - Path to get
Returns:
RemoteIterator which returns each AclStatus
Throws:
IOException - if an ACL could not be read

setXAttr

public void setXAttr(Path path,
                     String name,
                     byte[] value)
              throws IOException
Set an xattr of a file or directory. The name must be prefixed with user/trusted/security/system and followed by ".". For example, "user.attr".

A regular user can only set an xattr for the "user" namespace. The super user can set an xattr of either the "user" or "trusted" namespaces. The xattrs of the "security" and "system" namespaces are only used/exposed internally by/to the FS impl.

The access permissions of an xattr in the "user" namespace are defined by the file and directory permission bits. An xattr can only be set when the logged-in user has the correct permissions. If the xattr exists, it will be replaced.

Parameters:
path - Path to modify
name - xattr name.
value - xattr value.
Throws:
IOException
See Also:
http://en.wikipedia.org/wiki/Extended_file_attributes

setXAttr

public void setXAttr(Path path,
                     String name,
                     byte[] value,
                     EnumSet<XAttrSetFlag> flag)
              throws IOException
Set an xattr of a file or directory. The name must be prefixed with user/trusted/security/system and followed by ".". For example, "user.attr".

A regular user can only set an xattr for the "user" namespace. The super user can set an xattr of either the "user" or "trusted" namespaces. The xattrs of the "security" and "system" namespaces are only used/exposed internally by/to the FS impl.

The access permissions of an xattr in the "user" namespace are defined by the file and directory permission bits. An xattr can only be set when the logged-in user has the correct permissions. If the xattr exists, it will be replaced.

Parameters:
path - Path to modify
name - xattr name.
value - xattr value.
flag - xattr set flag
Throws:
IOException
See Also:
http://en.wikipedia.org/wiki/Extended_file_attributes

getXAttr

public byte[] getXAttr(Path path,
                       String name)
                throws IOException
Get an xattr for a file or directory. The name must be prefixed with user/trusted/security/system and followed by ".". For example, "user.attr".

A regular user can only get an xattr for the "user" namespace. The super user can get an xattr of either the "user" or "trusted" namespaces. The xattrs of the "security" and "system" namespaces are only used/exposed internally by/to the FS impl.

An xattr will only be returned when the logged-in user has the correct permissions.

Parameters:
path - Path to get extended attribute
name - xattr name.
Returns:
byte[] xattr value.
Throws:
IOException
See Also:
http://en.wikipedia.org/wiki/Extended_file_attributes

getXAttrs

public Map<String,byte[]> getXAttrs(Path path)
                             throws IOException
Get all of the xattrs for a file or directory. Only those xattrs for which the logged-in user has permissions to view are returned.

A regular user can only get xattrs for the "user" namespace. The super user can only get xattrs for "user" and "trusted" namespaces. The xattr of "security" and "system" namespaces are only used/exposed internally by/to the FS impl.

Parameters:
path - Path to get extended attributes
Returns:
Map describing the XAttrs of the file or directory
Throws:
IOException
See Also:
http://en.wikipedia.org/wiki/Extended_file_attributes

getXAttrs

public Map<String,byte[]> getXAttrs(Path path,
                                    List<String> names)
                             throws IOException
Get all of the xattrs for a file or directory. Only those xattrs for which the logged-in user has permissions to view are returned.

A regular user can only get xattrs for the "user" namespace. The super user can only get xattrs for "user" and "trusted" namespaces. The xattr of "security" and "system" namespaces are only used/exposed internally by/to the FS impl.

Parameters:
path - Path to get extended attributes
names - XAttr names.
Returns:
Map describing the XAttrs of the file or directory
Throws:
IOException
See Also:
http://en.wikipedia.org/wiki/Extended_file_attributes

listXAttrs

public List<String> listXAttrs(Path path)
                        throws IOException
Get all of the xattr names for a file or directory. Only the xattr names for which the logged-in user has permissions to view are returned.

A regular user can only get xattr names for the "user" namespace. The super user can only get xattr names for the "user" and "trusted" namespaces. The xattr names in the "security" and "system" namespaces are only used/exposed internally by/to the FS impl.

Parameters:
path - Path to get extended attributes
Returns:
Map describing the XAttrs of the file or directory
Throws:
IOException
See Also:
http://en.wikipedia.org/wiki/Extended_file_attributes

removeXAttr

public void removeXAttr(Path path,
                        String name)
                 throws IOException
Remove an xattr of a file or directory. The name must be prefixed with user/trusted/security/system and followed by ".". For example, "user.attr".

A regular user can only remove an xattr for the "user" namespace. The super user can remove an xattr of either the "user" or "trusted" namespaces. The xattrs of the "security" and "system" namespaces are only used/exposed internally by/to the FS impl.

The access permissions of an xattr in the "user" namespace are defined by the file and directory permission bits. An xattr can only be set when the logged-in user has the correct permissions. If the xattr exists, it will be replaced.

Parameters:
path - Path to remove extended attribute
name - xattr name
Throws:
IOException
See Also:
http://en.wikipedia.org/wiki/Extended_file_attributes

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object other)
Overrides:
equals in class Object


Copyright © 2014 Apache Software Foundation. All Rights Reserved.