FilesCollectorpublic class FilesCollector extends Object implements Collector
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.Data | capture()
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 void | log(java.util.logging.Level level, java.lang.String message)
logger.log(level, message);
|
|