Java Code Examples for org.apache.hadoop.hdfs.protocol.HdfsConstants#HDFS_URI_SCHEME

The following examples show how to use org.apache.hadoop.hdfs.protocol.HdfsConstants#HDFS_URI_SCHEME . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Hdfs.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * This constructor has the signature needed by
 * {@link AbstractFileSystem#createFileSystem(URI, Configuration)}
 * 
 * @param theUri which must be that of Hdfs
 * @param conf configuration
 * @throws IOException
 */
Hdfs(final URI theUri, final Configuration conf) throws IOException, URISyntaxException {
  super(theUri, HdfsConstants.HDFS_URI_SCHEME, true, NameNode.DEFAULT_PORT);

  if (!theUri.getScheme().equalsIgnoreCase(HdfsConstants.HDFS_URI_SCHEME)) {
    throw new IllegalArgumentException("Passed URI's scheme is not for Hdfs");
  }
  String host = theUri.getHost();
  if (host == null) {
    throw new IOException("Incomplete HDFS URI, no host: " + theUri);
  }

  this.dfs = new DFSClient(theUri, conf, getStatistics());
}
 
Example 2
Source File: Hdfs.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * This constructor has the signature needed by
 * {@link AbstractFileSystem#createFileSystem(URI, Configuration)}
 * 
 * @param theUri which must be that of Hdfs
 * @param conf configuration
 * @throws IOException
 */
Hdfs(final URI theUri, final Configuration conf) throws IOException, URISyntaxException {
  super(theUri, HdfsConstants.HDFS_URI_SCHEME, true, NameNode.DEFAULT_PORT);

  if (!theUri.getScheme().equalsIgnoreCase(HdfsConstants.HDFS_URI_SCHEME)) {
    throw new IllegalArgumentException("Passed URI's scheme is not for Hdfs");
  }
  String host = theUri.getHost();
  if (host == null) {
    throw new IOException("Incomplete HDFS URI, no host: " + theUri);
  }

  this.dfs = new DFSClient(theUri, conf, getStatistics());
}
 
Example 3
Source File: HATestUtil.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public static URI getLogicalUri(MiniDFSCluster cluster)
    throws URISyntaxException {
  return new URI(HdfsConstants.HDFS_URI_SCHEME + "://" +
      getLogicalHostname(cluster));
}
 
Example 4
Source File: HATestUtil.java    From big-c with Apache License 2.0 4 votes vote down vote up
public static URI getLogicalUri(MiniDFSCluster cluster)
    throws URISyntaxException {
  return new URI(HdfsConstants.HDFS_URI_SCHEME + "://" +
      getLogicalHostname(cluster));
}
 
Example 5
Source File: DistributedFileSystem.java    From hadoop with Apache License 2.0 2 votes vote down vote up
/**
 * Return the protocol scheme for the FileSystem.
 * <p/>
 *
 * @return <code>hdfs</code>
 */
@Override
public String getScheme() {
  return HdfsConstants.HDFS_URI_SCHEME;
}
 
Example 6
Source File: DistributedFileSystem.java    From big-c with Apache License 2.0 2 votes vote down vote up
/**
 * Return the protocol scheme for the FileSystem.
 * <p/>
 *
 * @return <code>hdfs</code>
 */
@Override
public String getScheme() {
  return HdfsConstants.HDFS_URI_SCHEME;
}