Class 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
    A Resource implementation that connects to Apache Hadoop's HDFS distributed file system.
    See Also:
    Serialized Form
    • Constructor Detail

      • HdfsResource

        public HdfsResource​(String url)
        Creates a HdfsResource
        Parameters:
        url - a URL of the form: scheme://hostname:port/path/to/file
      • HdfsResource

        public HdfsResource​(String url,
                            String hadoopConfDir)
        Creates a HdfsResource
        Parameters:
        url - a URL of the form: scheme://hostname:port/path/to/file
        hadoopConfDir - the path of a directory containing the Hadoop and HDFS configuration file(s).
      • HdfsResource

        public HdfsResource​(String hostname,
                            int port,
                            String filepath)
        Creates a HdfsResource using the "hdfs" scheme
        Parameters:
        hostname - the HDFS (namenode) hostname
        port - the HDFS (namenode) port number
        filepath - the path on HDFS to the file, starting with slash ('/')
      • HdfsResource

        public HdfsResource​(String scheme,
                            String hostname,
                            int port,
                            String filepath,
                            String hadoopConfDir)
        Creates a HdfsResource
        Parameters:
        scheme - the scheme to use (consider using SCHEME_HDFS or any of the other "SCHEME_" constants).
        hostname - the HDFS (namenode) hostname
        port - the HDFS (namenode) port number
        filepath - 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:
        getName in interface org.apache.metamodel.util.HasName
        Specified by:
        getName in interface org.apache.metamodel.util.Resource
      • getQualifiedPath

        public String getQualifiedPath()
        Specified by:
        getQualifiedPath in interface org.apache.metamodel.util.Resource
      • isReadOnly

        public boolean isReadOnly()
        Specified by:
        isReadOnly in interface org.apache.metamodel.util.Resource
      • isExists

        public boolean isExists()
        Specified by:
        isExists in interface org.apache.metamodel.util.Resource
      • getSize

        public long getSize()
        Specified by:
        getSize in interface org.apache.metamodel.util.Resource
      • getLastModified

        public long getLastModified()
        Specified by:
        getLastModified in interface org.apache.metamodel.util.Resource
      • write

        public OutputStream write()
                           throws org.apache.metamodel.util.ResourceException
        Specified by:
        write in interface org.apache.metamodel.util.Resource
        Throws:
        org.apache.metamodel.util.ResourceException
      • append

        public OutputStream append()
                            throws org.apache.metamodel.util.ResourceException
        Specified by:
        append in interface org.apache.metamodel.util.Resource
        Throws:
        org.apache.metamodel.util.ResourceException
      • read

        public InputStream read()
                         throws org.apache.metamodel.util.ResourceException
        Specified by:
        read in interface org.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()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object