Package org.apache.metamodel.util
Class HdfsResource
- java.lang.Object
-
- org.apache.metamodel.util.AbstractResource
-
- org.apache.metamodel.util.HdfsResource
-
- All Implemented Interfaces:
Serializable,org.apache.metamodel.util.HasName,org.apache.metamodel.util.Resource
public class HdfsResource extends org.apache.metamodel.util.AbstractResource implements Serializable
AResourceimplementation that connects to Apache Hadoop's HDFS distributed file system.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringSCHEME_EMRFSstatic StringSCHEME_FTPstatic StringSCHEME_HDFSstatic StringSCHEME_MAPRFSstatic StringSCHEME_S3static StringSCHEME_SWIFTstatic StringSYSTEM_PROPERTY_HADOOP_CONF_DIR_ENABLED
-
Constructor Summary
Constructors Constructor Description HdfsResource(String url)Creates aHdfsResourceHdfsResource(String hostname, int port, String filepath)Creates aHdfsResourceusing the "hdfs" schemeHdfsResource(String url, String hadoopConfDir)Creates aHdfsResourceHdfsResource(String scheme, String hostname, int port, String filepath, String hadoopConfDir)Creates aHdfsResource
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OutputStreamappend()booleanequals(Object obj)StringgetFilepath()StringgetHadoopConfDir()org.apache.hadoop.conf.ConfigurationgetHadoopConfiguration()org.apache.hadoop.fs.FileSystemgetHadoopFileSystem()org.apache.hadoop.fs.PathgetHadoopPath()StringgetHostname()longgetLastModified()StringgetName()intgetPort()StringgetQualifiedPath()StringgetScheme()longgetSize()inthashCode()booleanisExists()booleanisReadOnly()InputStreamread()OutputStreamwrite()
-
-
-
Field Detail
-
SYSTEM_PROPERTY_HADOOP_CONF_DIR_ENABLED
public static final String SYSTEM_PROPERTY_HADOOP_CONF_DIR_ENABLED
- See Also:
- Constant Field Values
-
SCHEME_HDFS
public static final String SCHEME_HDFS
- See Also:
- Constant Field Values
-
SCHEME_SWIFT
public static final String SCHEME_SWIFT
- See Also:
- Constant Field Values
-
SCHEME_EMRFS
public static final String SCHEME_EMRFS
- See Also:
- Constant Field Values
-
SCHEME_MAPRFS
public static final String SCHEME_MAPRFS
- See Also:
- Constant Field Values
-
SCHEME_S3
public static final String SCHEME_S3
- See Also:
- Constant Field Values
-
SCHEME_FTP
public static final String SCHEME_FTP
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HdfsResource
public HdfsResource(String url)
Creates aHdfsResource- Parameters:
url- a URL of the form: scheme://hostname:port/path/to/file
-
HdfsResource
public HdfsResource(String url, String hadoopConfDir)
Creates aHdfsResource- Parameters:
url- a URL of the form: scheme://hostname:port/path/to/filehadoopConfDir- the path of a directory containing the Hadoop and HDFS configuration file(s).
-
HdfsResource
public HdfsResource(String hostname, int port, String filepath)
Creates aHdfsResourceusing the "hdfs" scheme- Parameters:
hostname- the HDFS (namenode) hostnameport- the HDFS (namenode) port numberfilepath- the path on HDFS to the file, starting with slash ('/')
-
HdfsResource
public HdfsResource(String scheme, String hostname, int port, String filepath, String hadoopConfDir)
Creates aHdfsResource- Parameters:
scheme- the scheme to use (consider usingSCHEME_HDFSor 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).
-
-
Method Detail
-
getScheme
public String getScheme()
-
getFilepath
public String getFilepath()
-
getHostname
public String getHostname()
-
getPort
public int getPort()
-
getHadoopConfDir
public String getHadoopConfDir()
-
getName
public String getName()
- Specified by:
getNamein interfaceorg.apache.metamodel.util.HasName- Specified by:
getNamein interfaceorg.apache.metamodel.util.Resource
-
getQualifiedPath
public String getQualifiedPath()
- Specified by:
getQualifiedPathin interfaceorg.apache.metamodel.util.Resource
-
isReadOnly
public boolean isReadOnly()
- Specified by:
isReadOnlyin interfaceorg.apache.metamodel.util.Resource
-
isExists
public boolean isExists()
- Specified by:
isExistsin interfaceorg.apache.metamodel.util.Resource
-
getSize
public long getSize()
- Specified by:
getSizein interfaceorg.apache.metamodel.util.Resource
-
getLastModified
public long getLastModified()
- Specified by:
getLastModifiedin interfaceorg.apache.metamodel.util.Resource
-
write
public OutputStream write() throws org.apache.metamodel.util.ResourceException
- Specified by:
writein interfaceorg.apache.metamodel.util.Resource- Throws:
org.apache.metamodel.util.ResourceException
-
append
public OutputStream append() throws org.apache.metamodel.util.ResourceException
- Specified by:
appendin interfaceorg.apache.metamodel.util.Resource- Throws:
org.apache.metamodel.util.ResourceException
-
read
public InputStream read() throws org.apache.metamodel.util.ResourceException
- Specified by:
readin interfaceorg.apache.metamodel.util.Resource- Throws:
org.apache.metamodel.util.ResourceException
-
getHadoopConfiguration
public org.apache.hadoop.conf.Configuration getHadoopConfiguration()
-
getHadoopFileSystem
public org.apache.hadoop.fs.FileSystem getHadoopFileSystem()
-
getHadoopPath
public org.apache.hadoop.fs.Path getHadoopPath()
-
-