1 23 package com.sun.enterprise.diagnostics; 24 25 import java.io.File ; 26 import java.io.IOException ; 27 import java.util.logging.Logger ; 28 import com.sun.logging.LogDomains; 29 import com.sun.enterprise.diagnostics.util.FileUtils; 30 import com.sun.enterprise.diagnostics.util.UniqueNameGenerator; 31 32 36 public class Archiver { 37 38 39 private static Logger logger = 40 LogDomains.getLogger(LogDomains.ADMIN_LOGGER); 41 42 public Archiver() { 43 } 44 45 52 public java.util.jar.JarFile archive(ReportTarget target, String file) 53 throws DiagnosticException { 54 try { 55 if (file == null) { 56 file = File.separator + target.getDefaultReportDir() + 58 File.separator + 59 UniqueNameGenerator.getName(target.getName()); 60 } 61 String dirTobeArchived = target.getArchiveDir(); 62 63 FileUtils.jarDirectory(new File (file),dirTobeArchived); 65 66 FileUtils.deleteFile(dirTobeArchived); 68 69 return new java.util.jar.JarFile (file); 70 71 } catch (IOException ioe) { 72 throw new DiagnosticException(ioe.getMessage()); 73 } 74 } 75 } 76 | Popular Tags |