示例#1
0
        public UserFile fetchFile(string username, string filename)
        {
            logger.Debug("Fetching file for user and file name : " + username + " " + filename);

            try {
                string        lastcheckpointfilepath    = CheckpointLogic.pathprefix + CheckpointLogic.lastcheckpointfilename;
                List <string> lastcheckpointfilecontent = FileUtils.ReadLinesFromFile(lastcheckpointfilepath);
                logger.Debug("Last check point time stamp read :" + lastcheckpointfilecontent [0].Trim());
                DateTime lastcheckpointtime = DateUtils.getDatefromString(lastcheckpointfilecontent [0].Trim());

                logger.Debug("Read last checkpoint time as :" + lastcheckpointtime);

                if (lastcheckpointfilecontent.Count < 2)
                {
                    throw new DiskuserMetaDataCorrupt("Something wrong with the last check point file path, check!!");
                }

                string latestcheckpointfolderpath = lastcheckpointfilecontent [1];
                logger.Debug("Last check point path read as :" + latestcheckpointfolderpath);
                latestcheckpointfolderpath = latestcheckpointfolderpath.Trim();
                string userpath = latestcheckpointfolderpath + username;

                logger.Debug("User path constructed is :" + userpath);
                UserFile file = new CheckpointLogic().RestoreUserFile(
                    userpath, FileUtils.getDiskPathFromMemoryPath(filename), true);

                logger.Debug("File read of disk is : " + file.ToString());
                return(file);
            } catch (Exception e) {
                //logger.Warn ("Exception occured while restoring the file system : " + e);
                throw e;
            }
        }
        public UserFile fetchFile(string username, string filename)
        {
            logger.Debug ("Fetching file for user and file name : " + username + " " + filename);

            try {
                string lastcheckpointfilepath = CheckpointLogic.pathprefix + CheckpointLogic.lastcheckpointfilename;
                List<string> lastcheckpointfilecontent = FileUtils.ReadLinesFromFile (lastcheckpointfilepath);
                logger.Debug ("Last check point time stamp read :" + lastcheckpointfilecontent [0].Trim ());
                DateTime lastcheckpointtime = DateUtils.getDatefromString (lastcheckpointfilecontent [0].Trim ());

                logger.Debug ("Read last checkpoint time as :" + lastcheckpointtime);

                if (lastcheckpointfilecontent.Count < 2)
                    throw new DiskuserMetaDataCorrupt ("Something wrong with the last check point file path, check!!");

                string latestcheckpointfolderpath = lastcheckpointfilecontent [1];
                logger.Debug ("Last check point path read as :" + latestcheckpointfolderpath);
                latestcheckpointfolderpath = latestcheckpointfolderpath.Trim ();
                string userpath = latestcheckpointfolderpath + username;

                logger.Debug ("User path constructed is :" + userpath);
                UserFile file = new CheckpointLogic ().RestoreUserFile (
                    userpath, FileUtils.getDiskPathFromMemoryPath (filename), true);

                logger.Debug ("File read of disk is : " + file.ToString ());
                return file;

            } catch (Exception e) {
                //logger.Warn ("Exception occured while restoring the file system : " + e);
                throw e;
            }
        }
 public object Get(RestoreCheckPoint request)
 {
     try{
         logger.Debug("API call for restoring the check point");
         CheckPointObject obj = new CheckpointLogic().RestoreFileSystem();
         return(obj);
     } catch (Exception e) {
         throw e;
     }
 }