001/**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019package org.apache.hadoop.fs;
020
021import org.apache.hadoop.classification.InterfaceAudience;
022import org.apache.hadoop.classification.InterfaceStability;
023import org.apache.hadoop.conf.Configuration;
024import org.apache.hadoop.hdfs.web.WebHdfsFileSystem;
025
026import java.io.IOException;
027import java.net.URI;
028import java.net.URISyntaxException;
029
030/**
031 * AbstractFileSystem implementation for HDFS over the web.
032 */
033@InterfaceAudience.Public
034@InterfaceStability.Evolving
035public class WebHdfs extends DelegateToFileSystem {
036
037  public static final String SCHEME = "webhdfs";
038
039  /**
040   * This constructor has the signature needed by
041   * {@link AbstractFileSystem#createFileSystem(URI, Configuration)}
042   *
043   * @param theUri which must be that of webhdfs
044   * @param conf   configuration
045   * @throws IOException
046   */
047  WebHdfs(URI theUri, Configuration conf)
048      throws IOException, URISyntaxException {
049    super(theUri, createWebHdfsFileSystem(conf), conf, SCHEME, false);
050  }
051
052  /**
053   * Returns a new {@link WebHdfsFileSystem}, with the given configuration.
054   *
055   * @param conf configuration
056   * @return new WebHdfsFileSystem
057   */
058  private static WebHdfsFileSystem createWebHdfsFileSystem(Configuration conf) {
059    WebHdfsFileSystem fs = new WebHdfsFileSystem();
060    fs.setConf(conf);
061    return fs;
062  }
063}