Files
VisualSapfor/src/_VisualDVM/Passes/All/DownloadBugReport.java

28 lines
1018 B
Java
Raw Normal View History

2024-10-14 12:14:01 +03:00
package _VisualDVM.Passes.All;
2024-10-11 00:00:30 +03:00
import Common.Utils.Utils_;
import _VisualDVM.Global;
2024-10-14 15:19:13 +03:00
import _VisualDVM.Passes.Server.ComponentsRepositoryPass;
2024-10-09 22:21:57 +03:00
import _VisualDVM.Repository.BugReport.BugReport;
import _VisualDVM.Repository.Server.ServerCode;
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
2023-09-17 22:13:42 +03:00
public class DownloadBugReport extends ComponentsRepositoryPass<BugReport> {
@Override
protected boolean canStart(Object... args) {
target = (BugReport) args[0];
2024-10-22 13:36:57 +03:00
return !target.getArchiveFile().exists();
2023-09-17 22:13:42 +03:00
}
@Override
protected void performPreparation() throws Exception {
2024-10-14 12:54:52 +03:00
Utils_.CheckDirectory(Global.BugReportsDirectory);
2023-09-17 22:13:42 +03:00
}
@Override
protected void ServerAction() throws Exception {
Command(new ServerExchangeUnit_2021(ServerCode.ReceiveBugReport, target.id));
2024-10-22 13:36:57 +03:00
Utils_.bytesToFile((byte[]) response.object, target.getArchiveFile());
2023-09-17 22:13:42 +03:00
}
@Override
protected boolean validate() {
2024-10-22 13:36:57 +03:00
return target.getArchiveFile().exists();
2023-09-17 22:13:42 +03:00
}
}