1 23 24 29 30 package com.sun.enterprise.config.backup; 31 32 import com.sun.enterprise.config.backup.util.FileListerRelative; 33 import com.sun.enterprise.config.backup.util.FileUtils; 34 import com.sun.enterprise.config.backup.util.ZipFileException; 35 import com.sun.enterprise.config.backup.util.ZipWriter; 36 import java.io.*; 37 38 42 class ZipStorage 43 { 44 48 ZipStorage(BackupRequest req) throws BackupException 49 { 50 if(req == null) 51 throw new BackupException("backup-res.NoBackupRequest", getClass().getName() + ".ctor"); 52 53 request = req; 54 } 55 56 60 void store() throws BackupException 61 { 62 String zipName = FileUtils.safeGetCanonicalPath(request.backupFile); 63 String domainDirName = FileUtils.safeGetCanonicalPath(request.domainDir); 64 65 FileListerRelative lister = new FileListerRelative(request.domainDir); 66 lister.keepEmptyDirectories(); String [] files = lister.getFiles(); 68 69 LoggerHelper.fine("Writing " + zipName); 70 71 try 72 { 73 ZipWriter writer = new ZipWriter(zipName, domainDirName, files); 74 75 if(request.excludeDirs != null && request.excludeDirs.length > 0) 76 writer.excludeDirs(request.excludeDirs); 77 78 writer.safeWrite(); 79 } 80 catch(ZipFileException zfe) 81 { 82 throw new BackupException("backup-res.ZipBackupError", zfe, zipName); 83 } 84 } 85 86 88 void write() throws BackupException 89 { 90 91 } 92 93 95 private BackupRequest request; 96 } 97 | Popular Tags |