FileDocCategorySizeDatePackage
Archiver.javaAPI DocGlassfish v2 API3686Fri May 04 22:34:40 BST 2007com.sun.enterprise.diagnostics

Archiver

public class Archiver extends Object
Generates a zip file containing diagnostic data
author
Manisha Umbarje

Fields Summary
private static Logger
logger
Constructors Summary
public Archiver()
Creates a new instance of Archiver

           
      
    
Methods Summary
public java.util.jar.JarFilearchive(ReportTarget target, java.lang.String file)
generates zip file containing diagnostic report

param
file name of archived file
param
target target at which report generation is invoked
throws
com.sun.enterprise.diagnostics.DiagnosticException
return
zip file containing diagnostic report.

        try {
            if (file == null) {
                // Generate uniqu name
                file = File.separator + target.getDefaultReportDir() + 
                        File.separator + 
                        UniqueNameGenerator.getName(target.getName());              
            }
            String dirTobeArchived = target.getArchiveDir();
            
            // Generate the jar file
            FileUtils.jarDirectory(new File(file),dirTobeArchived);
            
            //Delete report folder
            FileUtils.deleteFile(dirTobeArchived);

            return new java.util.jar.JarFile(file);
            
        } catch (IOException ioe) {
            throw new DiagnosticException(ioe.getMessage());
        }