1 6 7 package com.sun.enterprise.config.backup.pluggable.impl; 8 9 import java.io.IOException ; 10 import java.io.File ; 11 import com.sun.enterprise.config.backup.BackupException; 12 import com.sun.enterprise.config.backup.BackupAbortException; 13 import com.sun.enterprise.config.backup.status.Status; 14 import com.sun.enterprise.config.backup.utils.FactoryHelper; 15 import com.sun.enterprise.config.backup.utils.LoggerHelper; 16 import com.sun.enterprise.util.io.FileUtils; 17 import com.sun.enterprise.util.zip.ZipWriter; 18 import com.sun.enterprise.util.zip.ZipFileException; 19 import com.sun.enterprise.util.StringUtils; 20 21 import com.sun.enterprise.config.backup.pluggable.BackupStorage; 22 26 public class ZipStorage extends GenericStorage 27 { 28 32 long copyFiles(File fromDir, File toDir) throws BackupException 33 { 34 File zip = new File (toDir.getAbsolutePath() + ".zip"); 35 LoggerHelper.fine("Writing " + zip.getPath()); 36 37 try 38 { 39 ZipWriter writer = new ZipWriter(zip.getPath(), fromDir.getPath()); 40 writer.safeWrite(); 41 return zip.length(); 42 } 43 catch(ZipFileException zfe) 44 { 45 throw new BackupException("Zip Backup Error", "Got a ZipFileException", zfe); 46 } 47 } 48 } 49 | Popular Tags |