@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, supportsSymlinks
getConf, setConf
public 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()
FileSystem
getDefaultPort
in class FileSystem
protected InetSocketAddress getNamenodeAddr(URI uri)
uri
- public String getCanonicalServiceName()
getCanonicalServiceName
in class FileSystem
SecurityUtil.buildDTServiceName(URI, int)
protected URI canonicalizeUri(URI uri)
FileSystem
canonicalizeUri
in class FileSystem
NetUtils.getCanonicalUri(URI, int)
public String getScheme()
getScheme
in class FileSystem
hftp
public void initialize(URI name, Configuration conf) throws IOException
FileSystem
initialize
in class FileSystem
name
- a uri whose authority section names the host, port, etc.
for this FileSystemconf
- the configurationIOException
protected void initDelegationToken() throws IOException
IOException
protected Token<DelegationTokenIdentifier> selectDelegationToken(UserGroupInformation ugi)
public Token<?> getRenewToken()
getRenewToken
in interface DelegationTokenRenewer.Renewable
protected String getUnderlyingProtocol()
public <T extends TokenIdentifier> void setDelegationToken(Token<T> token)
DelegationTokenRenewer.Renewable
setDelegationToken
in interface DelegationTokenRenewer.Renewable
public Token<?> getDelegationToken(String renewer) throws IOException
FileSystem
FileSystem.addDelegationTokens(String, Credentials)
getDelegationToken
in class FileSystem
renewer
- the account name that is allowed to renew the token.IOException
public URI getUri()
FileSystem
getUri
in class FileSystem
protected 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 URLIOException
protected String addDelegationTokenParam(String query) throws IOException
IOException
public FSDataInputStream open(Path f, int buffersize) throws IOException
FileSystem
open
in class FileSystem
f
- the file name to openbuffersize
- the size of the buffer to be used.IOException
public void close() throws IOException
FileSystem
close
in interface Closeable
close
in interface AutoCloseable
close
in class FileSystem
IOException
public FileStatus[] listStatus(Path f) throws IOException
FileSystem
listStatus
in class FileSystem
f
- given pathFileNotFoundException
- when the path does not exist;
IOException see specific implementationIOException
public FileStatus getFileStatus(Path f) throws IOException
FileSystem
getFileStatus
in class FileSystem
f
- The path we want information fromFileNotFoundException
- when the path does not exist;
IOException see specific implementationIOException
public FileChecksum getFileChecksum(Path f) throws IOException
FileSystem
getFileChecksum
in class FileSystem
f
- The file pathIOException
public Path getWorkingDirectory()
FileSystem
getWorkingDirectory
in class FileSystem
public void setWorkingDirectory(Path f)
FileSystem
setWorkingDirectory
in class FileSystem
public FSDataOutputStream append(Path f, int bufferSize, Progressable progress) throws IOException
append
in class FileSystem
f
- the existing file to be appended.bufferSize
- the size of the buffer to be used.progress
- for reporting progress if it is not null.IOException
public FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException
FileSystem
create
in class FileSystem
f
- 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.IOException
FileSystem.setPermission(Path, FsPermission)
public boolean rename(Path src, Path dst) throws IOException
FileSystem
rename
in class FileSystem
src
- path to be renameddst
- new path after renameIOException
- on failurepublic boolean delete(Path f, boolean recursive) throws IOException
FileSystem
delete
in class FileSystem
f
- 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.IOException
public boolean mkdirs(Path f, FsPermission permission) throws IOException
FileSystem
mkdirs
in class FileSystem
f
- path to createpermission
- to apply to fIOException
public ContentSummary getContentSummary(Path f) throws IOException
FileSystem
ContentSummary
of a given Path
.getContentSummary
in class FileSystem
f
- path to useIOException
Copyright © 2013 Apache Software Foundation. All rights reserved.