Example #1
0
        public string[] isCorrupt(string[] files)
        {
            get_namenode getnamenode = new get_namenode();
            int          count       = 0;
            int          count_file  = 0;



            string[] namenode = getnamenode.getnamenode();//get the namenode ip address

            while (namenode[count] != null)
            {
                while (files[count_file] != null)
                {
                    string filestatus = "http://" + namenode[count] + "/webhdfs/v1" + files[count_file] + "?op=GETFILESTATUS";//json command

                    string json_input = get(filestatus).Content;

                    if (json_input.Contains("FileNotFoundException"))
                    {
                        count_file++;
                    }
                    else
                    {
                        files_new[count_file] = files[count_file];
                        count_file++;
                    }
                }
                count++;
            }



            return(files_new);
        }
Example #2
0
        public Boolean isfileCorrupt(string file)
        {
            get_namenode getnamenode = new get_namenode();
            int          count       = 0;



            string[] namenode = getnamenode.getnamenode();//get the namenode ip address

            while (namenode[count] != null)
            {
                string filestatus = "http://" + namenode[count] + "/webhdfs/v1/" + file + "?op=GET_BLOCK_LOCATIONS";    //json command

                string json_input = get(filestatus).Content;

                if (json_input.Contains("\"isCorrupt\":true"))
                {
                    response = true;
                }



                count++;
            }
            return(response);
        }
Example #3
0
        public Boolean checkfile(string directory)
        {
            get_namenode getnamenode = new get_namenode();
            int          count       = 0;
            Boolean      result      = true;

            string[] namenode = getnamenode.getnamenode();//get the namenode ip address

            while (namenode[count] != null)
            {
                string filestatus = "http://" + namenode[count] + "/webhdfs/v1/" + directory + "?op=GETFILESTATUS";//json command

                string json_input = get(filestatus).Content;

                if (json_input.Contains("FileNotFoundException"))
                {
                    result = false;
                }

                count++;
            }

            //dynamic json = Newtonsoft.Json.JsonConvert.DeserializeObject(json_input);


            //if (json.RemoteException.exception == null)
            //{
            //    return true;

            //}
            //else
            //    return false;
            //string json_response = json.RemoteException.exception;//need to fix



            //if (json_response == "FileNotFoundException")//returns false if the file is not found
            //    return false;
            //else
            //    return true;



            return(result);
        }