@InterfaceAudience.Private @InterfaceStability.Evolving public class HftpFileSystem extends FileSystem implements DelegationTokenRenewer.Renewable
ListPathsServlet,
FileDataServlet| Modifier and Type | Class and Description |
|---|---|
static class |
HftpFileSystem.TokenManager |
FileSystem.Statistics| Modifier and Type | Field and Description |
|---|---|
protected static ThreadLocal<SimpleDateFormat> |
df |
static String |
HFTP_DATE_FORMAT |
static String |
HFTP_TIMEZONE |
protected URI |
nnUri |
static Text |
TOKEN_KIND |
protected UserGroupInformation |
ugi |
DEFAULT_FS, FS_DEFAULT_NAME_KEY, LOG, SHUTDOWN_HOOK_PRIORITY, statistics| Constructor and Description |
|---|
HftpFileSystem() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
addDelegationTokenParam(String query) |
FSDataOutputStream |
append(Path f,
int bufferSize,
Progressable progress)
This optional operation is not yet supported.
|
protected URI |
canonicalizeUri(URI uri)
Canonicalize the given URI.
|
void |
close()
No more filesystem operations are needed.
|
FSDataOutputStream |
create(Path f,
FsPermission permission,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
Progressable progress)
Create an FSDataOutputStream at the indicated Path with write-progress
reporting.
|
boolean |
delete(Path f,
boolean recursive)
Delete a file.
|
String |
getCanonicalServiceName()
See the documentation of for the logic
behind selecting the canonical service name.
|
ContentSummary |
getContentSummary(Path f)
Return the
ContentSummary of a given Path. |
static SimpleDateFormat |
getDateFormat() |
protected int |
getDefaultPort()
Get the default port for this file system.
|
Token<?> |
getDelegationToken(String renewer)
Get a new delegation token for this file system.
|
FileChecksum |
getFileChecksum(Path f)
Get the checksum of a file.
|
FileStatus |
getFileStatus(Path f)
Return a file status object that represents the path.
|
protected InetSocketAddress |
getNamenodeAddr(URI uri)
We generate the address with one of the following ports, in
order of preference.
|
protected URI |
getNamenodeUri(URI uri) |
protected URL |
getNamenodeURL(String path,
String query)
Return a URL pointing to given path on the namenode.
|
Token<?> |
getRenewToken() |
String |
getScheme()
Return the protocol scheme for the FileSystem.
|
protected String |
getUnderlyingProtocol()
Return the underlying protocol that is used to talk to the namenode.
|
URI |
getUri()
Returns a URI whose scheme and authority identify this FileSystem.
|
Path |
getWorkingDirectory()
Get the current working directory for the given file system
|
protected void |
initDelegationToken() |
void |
initialize(URI name,
Configuration conf)
Called after a new FileSystem instance is constructed.
|
FileStatus[] |
listStatus(Path f)
List the statuses of the files/directories in the given path if the path is
a directory.
|
boolean |
mkdirs(Path f,
FsPermission permission)
Make the given file and all non-existent parents into
directories.
|
FSDataInputStream |
open(Path f,
int buffersize)
Opens an FSDataInputStream at the indicated Path.
|
protected HttpURLConnection |
openConnection(String path,
String query)
Open an HTTP connection to the namenode to read file data and metadata.
|
boolean |
rename(Path src,
Path dst)
Renames Path src to Path dst.
|
protected Token<DelegationTokenIdentifier> |
selectDelegationToken(UserGroupInformation ugi) |
<T extends TokenIdentifier> |
setDelegationToken(Token<T> token)
Set delegation token.
|
void |
setWorkingDirectory(Path f)
Set the current working directory for the given file system.
|
addDelegationTokens, append, append, cancelDeleteOnExit, checkPath, clearStatistics, closeAll, closeAllForUGI, completeLocalOutput, concat, 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, createSymlink, delete, deleteOnExit, deleteSnapshot, enableSymlinks, exists, fixRelativePart, get, get, get, getAllStatistics, getBlockSize, getCanonicalUri, getChildFileSystems, getDefaultBlockSize, getDefaultBlockSize, getDefaultReplication, getDefaultReplication, getDefaultUri, getFileBlockLocations, getFileBlockLocations, getFileLinkStatus, getFileSystemClass, getFSofPath, getHomeDirectory, getInitialWorkingDirectory, getLength, getLinkTarget, getLocal, getName, getNamed, getReplication, getServerDefaults, getServerDefaults, getStatistics, getStatistics, getStatus, getStatus, getUsed, globStatus, globStatus, isDirectory, isFile, isSymlinksEnabled, listCorruptFileBlocks, listFiles, listLocatedStatus, listLocatedStatus, listStatus, listStatus, listStatus, makeQualified, mkdirs, mkdirs, moveFromLocalFile, moveFromLocalFile, moveToLocalFile, newInstance, newInstance, newInstance, newInstanceLocal, open, primitiveCreate, primitiveMkdir, primitiveMkdir, printStatistics, processDeleteOnExit, rename, renameSnapshot, resolveLink, resolvePath, setDefaultUri, setDefaultUri, setOwner, setPermission, setReplication, setTimes, setVerifyChecksum, setWriteChecksum, startLocalOutput, supportsSymlinksgetConf, setConfpublic static final Text TOKEN_KIND
protected UserGroupInformation ugi
protected URI nnUri
public static final String HFTP_TIMEZONE
public static final String HFTP_DATE_FORMAT
protected static final ThreadLocal<SimpleDateFormat> df
public static final SimpleDateFormat getDateFormat()
protected int getDefaultPort()
FileSystemgetDefaultPort in class FileSystemprotected InetSocketAddress getNamenodeAddr(URI uri)
uri - public String getCanonicalServiceName()
getCanonicalServiceName in class FileSystemSecurityUtil.buildDTServiceName(URI, int)protected URI canonicalizeUri(URI uri)
FileSystemcanonicalizeUri in class FileSystemNetUtils.getCanonicalUri(URI, int)public String getScheme()
getScheme in class FileSystemhftppublic void initialize(URI name, Configuration conf) throws IOException
FileSysteminitialize in class FileSystemname - a uri whose authority section names the host, port, etc.
for this FileSystemconf - the configurationIOExceptionprotected void initDelegationToken()
throws IOException
IOExceptionprotected Token<DelegationTokenIdentifier> selectDelegationToken(UserGroupInformation ugi)
public Token<?> getRenewToken()
getRenewToken in interface DelegationTokenRenewer.Renewableprotected String getUnderlyingProtocol()
public <T extends TokenIdentifier> void setDelegationToken(Token<T> token)
DelegationTokenRenewer.RenewablesetDelegationToken in interface DelegationTokenRenewer.Renewablepublic Token<?> getDelegationToken(String renewer) throws IOException
FileSystemFileSystem.addDelegationTokens(String, Credentials)getDelegationToken in class FileSystemrenewer - the account name that is allowed to renew the token.IOExceptionpublic URI getUri()
FileSystemgetUri in class FileSystemprotected URL getNamenodeURL(String path, String query) throws IOException
path - to obtain the URL forquery - string to append to the pathIOException - on error constructing the URLprotected HttpURLConnection openConnection(String path, String query) throws IOException
path - The path component of the URLquery - The query component of the URLIOExceptionprotected String addDelegationTokenParam(String query) throws IOException
IOExceptionpublic FSDataInputStream open(Path f, int buffersize) throws IOException
FileSystemopen in class FileSystemf - the file name to openbuffersize - the size of the buffer to be used.IOExceptionpublic void close()
throws IOException
FileSystemclose in interface Closeableclose in interface AutoCloseableclose in class FileSystemIOExceptionpublic FileStatus[] listStatus(Path f) throws IOException
FileSystemlistStatus in class FileSystemf - given pathFileNotFoundException - when the path does not exist;
IOException see specific implementationIOExceptionpublic FileStatus getFileStatus(Path f) throws IOException
FileSystemgetFileStatus in class FileSystemf - The path we want information fromFileNotFoundException - when the path does not exist;
IOException see specific implementationIOExceptionpublic FileChecksum getFileChecksum(Path f) throws IOException
FileSystemgetFileChecksum in class FileSystemf - The file pathIOExceptionpublic Path getWorkingDirectory()
FileSystemgetWorkingDirectory in class FileSystempublic void setWorkingDirectory(Path f)
FileSystemsetWorkingDirectory in class FileSystempublic FSDataOutputStream append(Path f, int bufferSize, Progressable progress) throws IOException
append in class FileSystemf - the existing file to be appended.bufferSize - the size of the buffer to be used.progress - for reporting progress if it is not null.IOExceptionpublic FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException
FileSystemcreate in class FileSystemf - the file name to openoverwrite - if a file with this name already exists, then if true,
the file will be overwritten, and if false an error will be thrown.bufferSize - the size of the buffer to be used.replication - required block replication for the file.IOExceptionFileSystem.setPermission(Path, FsPermission)public boolean rename(Path src, Path dst) throws IOException
FileSystemrename in class FileSystemsrc - path to be renameddst - new path after renameIOException - on failurepublic boolean delete(Path f, boolean recursive) throws IOException
FileSystemdelete in class FileSystemf - the path to delete.recursive - if path is a directory and set to
true, the directory is deleted else throws an exception. In
case of a file the recursive can be set to either true or false.IOExceptionpublic boolean mkdirs(Path f, FsPermission permission) throws IOException
FileSystemmkdirs in class FileSystemf - path to createpermission - to apply to fIOExceptionpublic ContentSummary getContentSummary(Path f) throws IOException
FileSystemContentSummary of a given Path.getContentSummary in class FileSystemf - path to useIOExceptionCopyright © 2013 Apache Software Foundation. All rights reserved.