org.apache.hadoop.hdfs.web
Class WebHdfsFileSystem

java.lang.Object
  extended by org.apache.hadoop.conf.Configured
      extended by org.apache.hadoop.fs.FileSystem
          extended by org.apache.hadoop.hdfs.web.WebHdfsFileSystem
All Implemented Interfaces:
Closeable, org.apache.hadoop.conf.Configurable, org.apache.hadoop.fs.DelegationTokenRenewer.Renewable

public class WebHdfsFileSystem
extends org.apache.hadoop.fs.FileSystem
implements org.apache.hadoop.fs.DelegationTokenRenewer.Renewable

A FileSystem for HDFS over the web.


Nested Class Summary
static class WebHdfsFileSystem.DtRenewer
          Delegation token renewer.
 
Nested classes/interfaces inherited from class org.apache.hadoop.fs.FileSystem
org.apache.hadoop.fs.FileSystem.Statistics
 
Field Summary
static org.apache.hadoop.hdfs.web.WebHdfsFileSystem.WebHdfsDelegationTokenSelector DT_SELECTOR
          Token selector
static org.apache.commons.logging.Log LOG
           
static String PATH_PREFIX
          Http URI: http://namenode:port/{PATH_PREFIX}/path/to/file
static String SCHEME
          File System URI: {SCHEME}://namenode:port/path/to/file
static org.apache.hadoop.io.Text TOKEN_KIND
          Delegation token kind
static int VERSION
          WebHdfs version.
 
Fields inherited from class org.apache.hadoop.fs.FileSystem
DEFAULT_FS, FS_DEFAULT_NAME_KEY, SHUTDOWN_HOOK_PRIORITY, statistics
 
Constructor Summary
WebHdfsFileSystem()
           
 
Method Summary
protected  void addRenewAction(WebHdfsFileSystem webhdfs)
           
 org.apache.hadoop.fs.FSDataOutputStream append(org.apache.hadoop.fs.Path f, int bufferSize, org.apache.hadoop.util.Progressable progress)
           
protected  URI canonicalizeUri(URI uri)
           
 void close()
           
 void concat(org.apache.hadoop.fs.Path trg, org.apache.hadoop.fs.Path[] srcs)
           
 org.apache.hadoop.fs.FSDataOutputStream create(org.apache.hadoop.fs.Path f, org.apache.hadoop.fs.permission.FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, org.apache.hadoop.util.Progressable progress)
           
 void createSymlink(org.apache.hadoop.fs.Path destination, org.apache.hadoop.fs.Path f, boolean createParent)
          Create a symlink pointing to the destination path.
 boolean delete(org.apache.hadoop.fs.Path f)
           
 boolean delete(org.apache.hadoop.fs.Path f, boolean recursive)
           
 org.apache.hadoop.fs.ContentSummary getContentSummary(org.apache.hadoop.fs.Path p)
           
 long getDefaultBlockSize()
           
protected  int getDefaultPort()
           
 short getDefaultReplication()
           
protected  org.apache.hadoop.security.token.Token<?> getDelegationToken()
           
 org.apache.hadoop.security.token.Token<org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier> getDelegationToken(String renewer)
           
 org.apache.hadoop.fs.BlockLocation[] getFileBlockLocations(org.apache.hadoop.fs.FileStatus status, long offset, long length)
           
 org.apache.hadoop.fs.BlockLocation[] getFileBlockLocations(org.apache.hadoop.fs.Path p, long offset, long length)
           
 org.apache.hadoop.fs.MD5MD5CRC32FileChecksum getFileChecksum(org.apache.hadoop.fs.Path p)
           
 org.apache.hadoop.fs.FileStatus getFileStatus(org.apache.hadoop.fs.Path f)
           
 org.apache.hadoop.fs.Path getHomeDirectory()
           
static String getHomeDirectoryString(org.apache.hadoop.security.UserGroupInformation ugi)
           
 org.apache.hadoop.security.token.Token<?> getRenewToken()
           
 String getScheme()
          Return the protocol scheme for the FileSystem.
 URI getUri()
           
 org.apache.hadoop.fs.Path getWorkingDirectory()
           
protected  void initDelegationToken()
           
 void initialize(URI uri, org.apache.hadoop.conf.Configuration conf)
           
static boolean isEnabled(org.apache.hadoop.conf.Configuration conf, org.apache.commons.logging.Log log)
          Is WebHDFS enabled in conf?
 org.apache.hadoop.fs.FileStatus[] listStatus(org.apache.hadoop.fs.Path f)
           
 boolean mkdirs(org.apache.hadoop.fs.Path f, org.apache.hadoop.fs.permission.FsPermission permission)
           
 org.apache.hadoop.fs.FSDataInputStream open(org.apache.hadoop.fs.Path f, int buffersize)
           
 boolean rename(org.apache.hadoop.fs.Path src, org.apache.hadoop.fs.Path dst)
           
 void rename(org.apache.hadoop.fs.Path src, org.apache.hadoop.fs.Path dst, org.apache.hadoop.fs.Options.Rename... options)
           
protected  org.apache.hadoop.security.token.Token<org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier> selectDelegationToken(org.apache.hadoop.security.UserGroupInformation ugi)
           
<T extends org.apache.hadoop.security.token.TokenIdentifier>
void
setDelegationToken(org.apache.hadoop.security.token.Token<T> token)
           
 void setOwner(org.apache.hadoop.fs.Path p, String owner, String group)
           
 void setPermission(org.apache.hadoop.fs.Path p, org.apache.hadoop.fs.permission.FsPermission permission)
           
 boolean setReplication(org.apache.hadoop.fs.Path p, short replication)
           
 void setTimes(org.apache.hadoop.fs.Path p, long mtime, long atime)
           
 void setWorkingDirectory(org.apache.hadoop.fs.Path dir)
           
 
Methods inherited from class org.apache.hadoop.fs.FileSystem
append, append, cancelDeleteOnExit, checkPath, clearStatistics, closeAll, closeAllForUGI, completeLocalOutput, copyFromLocalFile, copyFromLocalFile, copyFromLocalFile, copyFromLocalFile, copyToLocalFile, copyToLocalFile, copyToLocalFile, create, create, create, create, create, create, create, create, create, create, create, create, createNewFile, createNonRecursive, createNonRecursive, createNonRecursive, createSnapshot, createSnapshot, deleteOnExit, deleteSnapshot, exists, fixRelativePart, get, get, get, getAllStatistics, getBlockSize, getCanonicalUri, getDefaultBlockSize, getDefaultReplication, getDefaultUri, getFileLinkStatus, getFileSystemClass, getFSofPath, getInitialWorkingDirectory, getLength, getLinkTarget, getLocal, getName, getNamed, getReplication, getServerDefaults, getServerDefaults, getStatistics, getStatistics, getStatus, getStatus, getUsed, globStatus, globStatus, isDirectory, isFile, listCorruptFileBlocks, listFiles, listLocatedStatus, listLocatedStatus, listStatus, listStatus, listStatus, makeQualified, mkdirs, mkdirs, moveFromLocalFile, moveFromLocalFile, moveToLocalFile, newInstance, newInstance, newInstance, newInstanceLocal, open, primitiveCreate, primitiveMkdir, primitiveMkdir, printStatistics, processDeleteOnExit, renameSnapshot, resolveLink, resolvePath, setDefaultUri, setDefaultUri, setVerifyChecksum, setWriteChecksum, startLocalOutput, supportsSymlinks
 
Methods inherited from class org.apache.hadoop.conf.Configured
getConf, setConf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG

SCHEME

public static final String SCHEME
File System URI: {SCHEME}://namenode:port/path/to/file

See Also:
Constant Field Values

VERSION

public static final int VERSION
WebHdfs version.

See Also:
Constant Field Values

PATH_PREFIX

public static final String PATH_PREFIX
Http URI: http://namenode:port/{PATH_PREFIX}/path/to/file

See Also:
Constant Field Values

TOKEN_KIND

public static final org.apache.hadoop.io.Text TOKEN_KIND
Delegation token kind


DT_SELECTOR

public static final org.apache.hadoop.hdfs.web.WebHdfsFileSystem.WebHdfsDelegationTokenSelector DT_SELECTOR
Token selector

Constructor Detail

WebHdfsFileSystem

public WebHdfsFileSystem()
Method Detail

addRenewAction

protected void addRenewAction(WebHdfsFileSystem webhdfs)

isEnabled

public static boolean isEnabled(org.apache.hadoop.conf.Configuration conf,
                                org.apache.commons.logging.Log log)
Is WebHDFS enabled in conf?


getScheme

public String getScheme()
Return the protocol scheme for the FileSystem.

Overrides:
getScheme in class org.apache.hadoop.fs.FileSystem
Returns:
webhdfs

initialize

public void initialize(URI uri,
                       org.apache.hadoop.conf.Configuration conf)
                throws IOException
Overrides:
initialize in class org.apache.hadoop.fs.FileSystem
Throws:
IOException

initDelegationToken

protected void initDelegationToken()
                            throws IOException
Throws:
IOException

getDelegationToken

protected org.apache.hadoop.security.token.Token<?> getDelegationToken()
                                                                throws IOException
Throws:
IOException

selectDelegationToken

protected org.apache.hadoop.security.token.Token<org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier> selectDelegationToken(org.apache.hadoop.security.UserGroupInformation ugi)

getDefaultPort

protected int getDefaultPort()
Overrides:
getDefaultPort in class org.apache.hadoop.fs.FileSystem

getUri

public URI getUri()
Specified by:
getUri in class org.apache.hadoop.fs.FileSystem

canonicalizeUri

protected URI canonicalizeUri(URI uri)
Overrides:
canonicalizeUri in class org.apache.hadoop.fs.FileSystem

getHomeDirectoryString

public static String getHomeDirectoryString(org.apache.hadoop.security.UserGroupInformation ugi)
Returns:
the home directory.

getHomeDirectory

public org.apache.hadoop.fs.Path getHomeDirectory()
Overrides:
getHomeDirectory in class org.apache.hadoop.fs.FileSystem

getWorkingDirectory

public org.apache.hadoop.fs.Path getWorkingDirectory()
Specified by:
getWorkingDirectory in class org.apache.hadoop.fs.FileSystem

setWorkingDirectory

public void setWorkingDirectory(org.apache.hadoop.fs.Path dir)
Specified by:
setWorkingDirectory in class org.apache.hadoop.fs.FileSystem

getFileStatus

public org.apache.hadoop.fs.FileStatus getFileStatus(org.apache.hadoop.fs.Path f)
                                              throws IOException
Specified by:
getFileStatus in class org.apache.hadoop.fs.FileSystem
Throws:
IOException

mkdirs

public boolean mkdirs(org.apache.hadoop.fs.Path f,
                      org.apache.hadoop.fs.permission.FsPermission permission)
               throws IOException
Specified by:
mkdirs in class org.apache.hadoop.fs.FileSystem
Throws:
IOException

createSymlink

public void createSymlink(org.apache.hadoop.fs.Path destination,
                          org.apache.hadoop.fs.Path f,
                          boolean createParent)
                   throws IOException
Create a symlink pointing to the destination path.

Overrides:
createSymlink in class org.apache.hadoop.fs.FileSystem
Throws:
IOException
See Also:
Hdfs.createSymlink(Path, Path, boolean)

rename

public boolean rename(org.apache.hadoop.fs.Path src,
                      org.apache.hadoop.fs.Path dst)
               throws IOException
Specified by:
rename in class org.apache.hadoop.fs.FileSystem
Throws:
IOException

rename

public void rename(org.apache.hadoop.fs.Path src,
                   org.apache.hadoop.fs.Path dst,
                   org.apache.hadoop.fs.Options.Rename... options)
            throws IOException
Overrides:
rename in class org.apache.hadoop.fs.FileSystem
Throws:
IOException

setOwner

public void setOwner(org.apache.hadoop.fs.Path p,
                     String owner,
                     String group)
              throws IOException
Overrides:
setOwner in class org.apache.hadoop.fs.FileSystem
Throws:
IOException

setPermission

public void setPermission(org.apache.hadoop.fs.Path p,
                          org.apache.hadoop.fs.permission.FsPermission permission)
                   throws IOException
Overrides:
setPermission in class org.apache.hadoop.fs.FileSystem
Throws:
IOException

setReplication

public boolean setReplication(org.apache.hadoop.fs.Path p,
                              short replication)
                       throws IOException
Overrides:
setReplication in class org.apache.hadoop.fs.FileSystem
Throws:
IOException

setTimes

public void setTimes(org.apache.hadoop.fs.Path p,
                     long mtime,
                     long atime)
              throws IOException
Overrides:
setTimes in class org.apache.hadoop.fs.FileSystem
Throws:
IOException

getDefaultBlockSize

public long getDefaultBlockSize()
Overrides:
getDefaultBlockSize in class org.apache.hadoop.fs.FileSystem

getDefaultReplication

public short getDefaultReplication()
Overrides:
getDefaultReplication in class org.apache.hadoop.fs.FileSystem

concat

public void concat(org.apache.hadoop.fs.Path trg,
                   org.apache.hadoop.fs.Path[] srcs)
            throws IOException
Overrides:
concat in class org.apache.hadoop.fs.FileSystem
Throws:
IOException

create

public org.apache.hadoop.fs.FSDataOutputStream create(org.apache.hadoop.fs.Path f,
                                                      org.apache.hadoop.fs.permission.FsPermission permission,
                                                      boolean overwrite,
                                                      int bufferSize,
                                                      short replication,
                                                      long blockSize,
                                                      org.apache.hadoop.util.Progressable progress)
                                               throws IOException
Specified by:
create in class org.apache.hadoop.fs.FileSystem
Throws:
IOException

append

public org.apache.hadoop.fs.FSDataOutputStream append(org.apache.hadoop.fs.Path f,
                                                      int bufferSize,
                                                      org.apache.hadoop.util.Progressable progress)
                                               throws IOException
Specified by:
append in class org.apache.hadoop.fs.FileSystem
Throws:
IOException

delete

public boolean delete(org.apache.hadoop.fs.Path f)
               throws IOException
Overrides:
delete in class org.apache.hadoop.fs.FileSystem
Throws:
IOException

delete

public boolean delete(org.apache.hadoop.fs.Path f,
                      boolean recursive)
               throws IOException
Specified by:
delete in class org.apache.hadoop.fs.FileSystem
Throws:
IOException

open

public org.apache.hadoop.fs.FSDataInputStream open(org.apache.hadoop.fs.Path f,
                                                   int buffersize)
                                            throws IOException
Specified by:
open in class org.apache.hadoop.fs.FileSystem
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class org.apache.hadoop.fs.FileSystem
Throws:
IOException

listStatus

public org.apache.hadoop.fs.FileStatus[] listStatus(org.apache.hadoop.fs.Path f)
                                             throws IOException
Specified by:
listStatus in class org.apache.hadoop.fs.FileSystem
Throws:
IOException

getDelegationToken

public org.apache.hadoop.security.token.Token<org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier> getDelegationToken(String renewer)
                                                                                                                                      throws IOException
Overrides:
getDelegationToken in class org.apache.hadoop.fs.FileSystem
Throws:
IOException

getRenewToken

public org.apache.hadoop.security.token.Token<?> getRenewToken()
Specified by:
getRenewToken in interface org.apache.hadoop.fs.DelegationTokenRenewer.Renewable

setDelegationToken

public <T extends org.apache.hadoop.security.token.TokenIdentifier> void setDelegationToken(org.apache.hadoop.security.token.Token<T> token)
Specified by:
setDelegationToken in interface org.apache.hadoop.fs.DelegationTokenRenewer.Renewable

getFileBlockLocations

public org.apache.hadoop.fs.BlockLocation[] getFileBlockLocations(org.apache.hadoop.fs.FileStatus status,
                                                                  long offset,
                                                                  long length)
                                                           throws IOException
Overrides:
getFileBlockLocations in class org.apache.hadoop.fs.FileSystem
Throws:
IOException

getFileBlockLocations

public org.apache.hadoop.fs.BlockLocation[] getFileBlockLocations(org.apache.hadoop.fs.Path p,
                                                                  long offset,
                                                                  long length)
                                                           throws IOException
Overrides:
getFileBlockLocations in class org.apache.hadoop.fs.FileSystem
Throws:
IOException

getContentSummary

public org.apache.hadoop.fs.ContentSummary getContentSummary(org.apache.hadoop.fs.Path p)
                                                      throws IOException
Overrides:
getContentSummary in class org.apache.hadoop.fs.FileSystem
Throws:
IOException

getFileChecksum

public org.apache.hadoop.fs.MD5MD5CRC32FileChecksum getFileChecksum(org.apache.hadoop.fs.Path p)
                                                             throws IOException
Overrides:
getFileChecksum in class org.apache.hadoop.fs.FileSystem
Throws:
IOException


Copyright © 2013 Apache Software Foundation. All Rights Reserved.