public class HdfsResource extends AbstractResource implements Serializable
Resource implementation that connects to Apache Hadoop's HDFS
distributed file system.| Modifier and Type | Field and Description |
|---|---|
static String |
SCHEME_EMRFS |
static String |
SCHEME_FTP |
static String |
SCHEME_HDFS |
static String |
SCHEME_MAPRFS |
static String |
SCHEME_S3 |
static String |
SCHEME_SWIFT |
static String |
SYSTEM_PROPERTY_HADOOP_CONF_DIR_ENABLED |
| Constructor and Description |
|---|
HdfsResource(String url)
Creates a
HdfsResource |
HdfsResource(String hostname,
int port,
String filepath)
Creates a
HdfsResource using the "hdfs" scheme |
HdfsResource(String url,
String hadoopConfDir)
Creates a
HdfsResource |
HdfsResource(String scheme,
String hostname,
int port,
String filepath,
String hadoopConfDir)
Creates a
HdfsResource |
| Modifier and Type | Method and Description |
|---|---|
OutputStream |
append() |
boolean |
equals(Object obj) |
String |
getFilepath() |
String |
getHadoopConfDir() |
org.apache.hadoop.conf.Configuration |
getHadoopConfiguration() |
org.apache.hadoop.fs.FileSystem |
getHadoopFileSystem() |
org.apache.hadoop.fs.Path |
getHadoopPath() |
String |
getHostname() |
long |
getLastModified() |
String |
getName() |
int |
getPort() |
String |
getQualifiedPath() |
String |
getScheme() |
long |
getSize() |
int |
hashCode() |
boolean |
isExists() |
boolean |
isReadOnly() |
InputStream |
read() |
OutputStream |
write() |
public static final String SYSTEM_PROPERTY_HADOOP_CONF_DIR_ENABLED
public static final String SCHEME_HDFS
public static final String SCHEME_SWIFT
public static final String SCHEME_EMRFS
public static final String SCHEME_MAPRFS
public static final String SCHEME_S3
public static final String SCHEME_FTP
public HdfsResource(String url)
HdfsResourceurl - a URL of the form: scheme://hostname:port/path/to/filepublic HdfsResource(String url, String hadoopConfDir)
HdfsResourceurl - a URL of the form: scheme://hostname:port/path/to/filehadoopConfDir - the path of a directory containing the Hadoop and HDFS
configuration file(s).public HdfsResource(String hostname, int port, String filepath)
HdfsResource using the "hdfs" schemehostname - the HDFS (namenode) hostnameport - the HDFS (namenode) port numberfilepath - the path on HDFS to the file, starting with slash ('/')public HdfsResource(String scheme, String hostname, int port, String filepath, String hadoopConfDir)
HdfsResourcescheme - the scheme to use (consider using SCHEME_HDFS or any
of the other "SCHEME_" constants).hostname - the HDFS (namenode) hostnameport - the HDFS (namenode) port numberfilepath - the path on HDFS to the file, starting with slash ('/')hadoopConfDir - the path of a directory containing the Hadoop and HDFS
configuration file(s).public String getScheme()
public String getFilepath()
public String getHostname()
public int getPort()
public String getHadoopConfDir()
public String getName()
public String getQualifiedPath()
getQualifiedPath in interface Resourcepublic boolean isReadOnly()
isReadOnly in interface Resourcepublic long getLastModified()
getLastModified in interface Resourcepublic OutputStream write() throws ResourceException
write in interface ResourceResourceExceptionpublic OutputStream append() throws ResourceException
append in interface ResourceResourceExceptionpublic InputStream read() throws ResourceException
read in interface ResourceResourceExceptionpublic org.apache.hadoop.conf.Configuration getHadoopConfiguration()
public org.apache.hadoop.fs.FileSystem getHadoopFileSystem()
public org.apache.hadoop.fs.Path getHadoopPath()
Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.