1 23 24 25 30 31 package com.sun.enterprise.config.backup; 32 33 import com.sun.enterprise.config.backup.util.FileUtils; 34 import java.io.*; 35 36 45 public class ListManager extends BackupRestoreManager 46 { 47 48 55 public ListManager(BackupRequest req) throws BackupException, BackupWarningException 56 { 57 super(req); 58 } 59 60 67 public String list() throws BackupException 68 { 69 StringBuffer sb = new StringBuffer (); 70 71 findZips(); 72 73 for(int i = 0; i < zips.length; i++) 75 { 76 Status status = new Status(); 77 sb.append(status.read(zips[i], request.terse)); 78 sb.append("\n"); 79 80 if(request.terse == false) 81 sb.append("\n"); 82 } 83 84 return sb.toString(); 85 } 86 87 88 97 void init() throws BackupException, BackupWarningException 98 { 99 super.init(); 100 101 if(!FileUtils.safeIsDirectory(request.domainDir)) 102 throw new BackupException("backup-res.NoDomainDir", request.domainDir); 103 104 request.backupDir = new File(request.domainDir, Constants.BACKUP_DIR); 105 106 if(!FileUtils.safeIsDirectory(request.backupDir)) 108 throw new BackupWarningException("backup-res.NoBackupDir", request.backupDir); 109 } 110 111 113 117 void findZips() throws BackupWarningException 118 { 119 zips = request.backupDir.listFiles(new ZipFilenameFilter()); 120 121 if(zips == null || zips.length <= 0) 122 throw new BackupWarningException("backup-res.NoBackupFiles", request.backupDir); 123 } 124 125 127 File[] zips; 128 } 129 | Popular Tags |