1 6 7 package com.sun.enterprise.config.backup.appserver; 8 9 import com.sun.enterprise.config.backup.*; 10 import com.sun.enterprise.config.backup.utils.*; 11 import com.sun.enterprise.config.backup.status.*; 12 13 17 public class BackupManager 18 { 19 public BackupManager() 20 { 21 } 22 23 public void execute(BackupRequest request) 24 { 25 request.verify(); 26 String [] dirs = request.getDirsToBackup(); 27 String allDirs = dirs[0]; 28 29 for(int i = 1; i < dirs.length; i++) 30 allDirs += ',' + dirs[i]; 31 32 SystemPropsHelper.setProperty(EnvironmentConstants.DIRS_TO_BACKUP, allDirs); 33 SystemPropsHelper.setProperty(EnvironmentConstants.DIR_TO_STORE_BACKUP_FILES, request.getDirToStoreBackupFiles()); 34 SystemPropsHelper.setProperty(EnvironmentConstants.BACKUP_STORAGE_TYPE, request.getBackupStorageType()); 35 BackupCommand cmd = request.getCommand(); 36 37 BackupRestore bri = Util.getBackupRestore(); 38 Status[] statuses = new Status[1]; 39 BackupHistory bh = null; 40 try 41 { 42 if(cmd == BackupCommand.backup) 43 { 44 statuses[0] = bri.backup(request.getUserInfo()); 45 } 46 else if(cmd == BackupCommand.restore) 47 { 48 statuses[0] = bri.restore(); 49 } 50 else if(cmd == BackupCommand.undorestore) 51 { 52 statuses[0] = bri.undoRestore(); 53 } 54 else if(cmd == BackupCommand.listbackups) 55 { 56 statuses = bri.listBackups(); 57 } 58 else if(cmd == BackupCommand.listhistory) 59 { 60 statuses = null; 62 bh = bri.getBackupHistory(6); 63 } 64 } 65 catch(BackupAbortException bae) 66 { 67 throw bae; 68 } 69 catch(BackupException be) 70 { 71 throw new BackupAbortException("qqqqq", "wwwww", be); 73 } 74 catch(Exception e) 75 { 76 throw new BackupAbortException("xxx", "yyy", e); 77 } 78 79 if(bh != null) 80 { 81 System.out.println(bh.toString()); 82 } 83 if(statuses != null) 84 { 85 for(int i = 0; i < statuses.length; i++) 86 { 87 System.out.println(statuses[i]); 88 } 89 } 90 } 91 } 92 93 94 95 134 135 | Popular Tags |