FileDocCategorySizeDatePackage
FilesCollector.javaAPI DocGlassfish v2 API3959Fri May 04 22:34:44 BST 2007com.sun.enterprise.diagnostics.collect

FilesCollector

public class FilesCollector extends Object implements Collector
author
mu125243

Fields Summary
private String
repositoryDir
private String
reportDir
private List
files
private String
dataType
private static Logger
logger
Constructors Summary
public FilesCollector(String repositoryDir, String reportDir, List files, String dataType)
Creates a new instance of FilesCollector

           
         
                
        this.repositoryDir = repositoryDir;
        this.reportDir = reportDir;
        this.files = files;
        this.dataType = dataType;
    
Methods Summary
public com.sun.enterprise.diagnostics.Datacapture()

        WritableDataImpl writableData = null;
        if (files != null && repositoryDir != null && reportDir != null) {
            writableData = new WritableDataImpl(dataType);
            for(String fileName : files) {
                String srcFile = repositoryDir + File.separator + fileName;
                if(new File(srcFile).exists()) {
                    String destFile = reportDir + File.separator + fileName;
                    try {
                        FileUtils.copyFile(srcFile, destFile);
                        writableData.addChild(new FileData(fileName, dataType));
                    } catch(IOException io) {
                        log(Level.WARNING, "Error occurred during copy of file" + srcFile);
                    }
                    
                }
            }
        }
        return writableData;
    
private voidlog(java.util.logging.Level level, java.lang.String message)

        logger.log(level, message);