コード例 #1
0
 /// <exception cref="System.IO.IOException"/>
 private void InitWebHdfs(Configuration conf)
 {
     if (WebHdfsFileSystem.IsEnabled(conf, HttpServer2.Log))
     {
         // set user pattern based on configuration file
         UserParam.SetUserPattern(conf.Get(DFSConfigKeys.DfsWebhdfsUserPatternKey, DFSConfigKeys
                                           .DfsWebhdfsUserPatternDefault));
         // add authentication filter for webhdfs
         string className = conf.Get(DFSConfigKeys.DfsWebhdfsAuthenticationFilterKey, DFSConfigKeys
                                     .DfsWebhdfsAuthenticationFilterDefault);
         string name     = className;
         string pathSpec = WebHdfsFileSystem.PathPrefix + "/*";
         IDictionary <string, string> @params = GetAuthFilterParams(conf);
         HttpServer2.DefineFilter(httpServer.GetWebAppContext(), name, className, @params,
                                  new string[] { pathSpec });
         HttpServer2.Log.Info("Added filter '" + name + "' (class=" + className + ")");
         // add webhdfs packages
         httpServer.AddJerseyResourcePackage(typeof(NamenodeWebHdfsMethods).Assembly.GetName
                                                 () + ";" + typeof(Param).Assembly.GetName(), pathSpec);
     }
 }