| 45 | } |
| 46 | |
| 47 | public void loadBackupRoot() throws SQLException |
| 48 | { |
| 49 | logger.info("loadBackupRoot"); |
| 50 | ResultSet ret=mysqlHelper.querySql("select * from tb_backuproot"); |
| 51 | while(ret!=null&&ret.next()) |
| 52 | { |
| 53 | Backuproot backuproot=new Backuproot(); |
| 54 | backuproot.setId(ret.getInt("id")); |
| 55 | backuproot.setRootpath(ret.getString("rootpath")); |
| 56 | File checkfile=new File(backuproot.getRootpath()); |
| 57 | if(!checkfile.exists()) |
| 58 | { |
| 59 | logger.error("No found backup source :"+backuproot.getRootpath()); |
| 60 | } |
| 61 | else { |
| 62 | BackupRootList.add(backuproot); |
| 63 | } |
| 64 | } |
| 65 | ret=mysqlHelper.querySql("select * from tb_backuptargetroot"); |
| 66 | while(ret!=null&&ret.next()) |
| 67 | { |
| 68 | Backuptargetroot backuptargetroot=new Backuptargetroot(); |
| 69 | backuptargetroot.setId(ret.getInt("id")); |
| 70 | backuptargetroot.setTagetrootpath(ret.getString("tagetrootpath")); |
| 71 | backuptargetroot.setTargetrootdir(targetBkDirName); |
| 72 | File file=new File(backuptargetroot.getTagetrootpath()); |
| 73 | if(!file.exists()) { |
| 74 | file.mkdir(); |
| 75 | } |
| 76 | File checkfile=new File(backuptargetroot.getTagetrootpath()); |
| 77 | //if(false&&!checkfile.exists())//removed after debug |
| 78 | if(!checkfile.exists()) |
| 79 | { |
| 80 | logger.error("No found backup target :"+backuptargetroot.getTagetrootpath()); |
| 81 | } |
| 82 | else { |
| 83 | backuptargetroot.setSpaceRemain(file.getFreeSpace()); |
| 84 | BackupTargetRootList.add(backuptargetroot); |
| 85 | } |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | private static void loadAllFiles(File file,List<String> fileList) |
| 90 | { |