no message

This commit is contained in:
2024-10-14 12:54:52 +03:00
parent e1627badd3
commit e64a4f4c47
45 changed files with 211 additions and 200 deletions

46
.idea/workspace.xml generated
View File

@@ -7,7 +7,51 @@
</component>
<component name="ChangeListManager">
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Common/MainModule_.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/MainModule_.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Common/Utils/Loggable.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Utils/Loggable.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Common/Utils/Utils_.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Utils/Utils_.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Global.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Global.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Tasks/RunTask/RunTask.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Tasks/RunTask/RunTask.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Tasks/Supervisor/Local/Linux/LinuxLocalCompilationSupervisor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Tasks/Supervisor/Local/Linux/LinuxLocalCompilationSupervisor.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Tasks/Supervisor/Local/Linux/LinuxLocalTaskSupervisor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Tasks/Supervisor/Local/Linux/LinuxLocalTaskSupervisor.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Tasks/Supervisor/Local/LocalTaskSupervisor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Tasks/Supervisor/Local/LocalTaskSupervisor.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Tasks/Supervisor/Local/Windows/WindowsLocalCompilationSupervisor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Tasks/Supervisor/Local/Windows/WindowsLocalCompilationSupervisor.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Tasks/Supervisor/TaskSupervisor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Tasks/Supervisor/TaskSupervisor.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Tasks/Task.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Tasks/Task.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/BuildComponent.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/BuildComponent.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/Compile.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/Compile.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DeleteDebugResults.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DeleteDebugResults.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DeleteDownloadedBugReports.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DeleteDownloadedBugReports.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DeleteFile.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DeleteFile.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DeleteSelectedCompilationTasks.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DeleteSelectedCompilationTasks.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DeleteSelectedFiles.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DeleteSelectedFiles.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DeleteSelectedRunTasks.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DeleteSelectedRunTasks.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DeleteVersion.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DeleteVersion.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DownloadBugReport.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DownloadBugReport.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DownloadDVMPackages.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DownloadDVMPackages.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DownloadSapforPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DownloadSapforPackage.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DownloadTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DownloadTest.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/GCOV.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/GCOV.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/LocalInitaliseUser.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/LocalInitaliseUser.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/Run.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/Run.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_ParseFilesWithOrder.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_ParseFilesWithOrder.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SynchronizeBugReports.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SynchronizeBugReports.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SynchronizeTests.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SynchronizeTests.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/UnzipFolderPass.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/UnzipFolderPass.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/Testing/DeleteTestingPackages.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/Testing/DeleteTestingPackages.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/Project/db_project_info.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/Project/db_project_info.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Repository/Component/Component.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Repository/Component/Component.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Repository/Component/Sapfor/Sapfor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Repository/Component/Sapfor/Sapfor.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Repository/Server/ComponentsServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Repository/Server/ComponentsServer.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/MachineProcess/MachineProcess.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/MachineProcess/MachineProcess.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingServer.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestsDatabase.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestsDatabase.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/RemoteDVMTestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/RemoteDVMTestingPlanner.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/PerformSapforTask.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/PerformSapforTask.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/SapforPackage/SapforPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/SapforPackage/SapforPackage.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/SapforTestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/SapforTestingPlanner.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Utils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Utils.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -106,11 +150,11 @@
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\files" />
</key>
<key name="MoveMembersDialog.RECENTS_KEY">
<recent name="Common.Utils.Utils_" />
<recent name="Common.Visual.CommonUI" />
<recent name="CommomUI" />
<recent name="_VisualDVM.Global" />
<recent name="Common.CurrentAnchestor" />
<recent name="Common.Utils.CommonUtils" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\Common\Visual\Windows" />

View File

@@ -13,7 +13,7 @@ import java.util.LinkedHashMap;
import java.util.Vector;
//Основной объект визуализатора.
public abstract class MainModule_<D extends VisualiserDatabase> {
public static MainModule_ object = null; //текущий экземпляр
public static MainModule_ object = null; //текущий экземпляр. всегда один.
//--
D db;
Class<D> db_class;

View File

@@ -1,6 +1,5 @@
package Common.Utils;
import Common.Visual.UI_;
import _VisualDVM.Utils;
import java.io.File;
import java.io.FileWriter;
@@ -16,7 +15,7 @@ public interface Loggable {
}
default void ClearLog() {
try {
Utils.forceDeleteWithCheck(getLogFile());
Utils_.forceDeleteWithCheck(getLogFile());
} catch (Exception ignored) {
}
}

View File

@@ -1,6 +1,6 @@
package Common.Utils;
import Common.CommonConstants;
import Common.Database.VisualiserDatabase;
import Common.Passes.PassException;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.apache.commons.io.FileUtils;
@@ -396,6 +396,52 @@ public class Utils_ {
os.write(bytes);
os.close();
}
public static void CheckDirectory(File dir) {
if (!dir.exists()) {
try {
FileUtils.forceMkdir(dir);
} catch (Exception e) {
MainLog.PrintException(e);
}
}
}
public static void CheckAndCleanDirectory(File dir) {
if (dir.exists()) {
File[] files = dir.listFiles();
if (files != null)
for (File f : files) {
try {
forceDeleteWithCheck(f);
} catch (Exception e) {
MainLog.PrintException(e);
}
}
} else {
try {
FileUtils.forceMkdir(dir);
} catch (Exception e) {
MainLog.PrintException(e);
}
}
}
public static void forceDeleteWithCheck(File file) throws Exception {
int attempts = 0;
while (attempts < 10) {
if (file.exists()) {
try {
FileUtils.forceDelete(file);
} catch (Exception ex) {
ex.printStackTrace();
}
} else return;
if (file.exists()) {
attempts++;
System.out.println("неудачная попытка удаления: файл " + Brackets(file.getAbsolutePath()) + " занят");
sleep(2000);
} else return;
}
throw new PassException("Не удалось удалить файл " + Brackets(file.getAbsolutePath()) + " за " + attempts + " попыток");
}
//Иконки
public static ImageIcon getIcon(String path) {
URL imageUrl = Utils_.class.getResource(path);

View File

@@ -83,45 +83,45 @@ public class Global {
}
}
public static void CheckVisualiserDirectories() {
Utils.CheckDirectory(ComponentsDirectory = new File(Utils_.getHomeDirectory(), Constants.ComponentsDirectoryName));
Utils.CheckAndCleanDirectory(TempDirectory = new File(Utils_.getHomeDirectory(), Constants.TempDirectoryName));
Utils.CheckDirectory(DataDirectory = new File(Utils_.getHomeDirectory(), Constants.DataDirectoryName));
Utils_.CheckDirectory(ComponentsDirectory = new File(Utils_.getHomeDirectory(), Constants.ComponentsDirectoryName));
Utils_.CheckAndCleanDirectory(TempDirectory = new File(Utils_.getHomeDirectory(), Constants.TempDirectoryName));
Utils_.CheckDirectory(DataDirectory = new File(Utils_.getHomeDirectory(), Constants.DataDirectoryName));
//-
Utils.CheckDirectory(RepoDirectory = new File(Utils_.getHomeDirectory(), Constants.RepoDirectoryName));
Utils.CheckDirectory(BugReportsDirectory = new File(Utils_.getHomeDirectory(), Constants.BugsDirectoryName));
Utils.CheckDirectory(BackUpsDirectory = new File(Utils_.getHomeDirectory(), Constants.BackUpsDirectoryName));
Utils.CheckDirectory(ProjectsDirectory = new File(Utils_.getHomeDirectory(), Constants.ProjectsDirectoryName));
Utils.CheckDirectory(CompilationTasksDirectory = new File(Utils_.getHomeDirectory(), Constants.CompilationTasksDirectoryName));
Utils.CheckDirectory(RunTasksDirectory = new File(Utils_.getHomeDirectory(), Constants.RunTasksDirectoryName));
Utils.CheckDirectory(StsDirectory = new File(Utils_.getHomeDirectory(), Constants.StsDirectoryName));
Utils.CheckDirectory(TestsDirectory = new File(Utils_.getHomeDirectory(), Constants.TestsDirectoryName));
Utils.CheckDirectory(PerformanceAnalyzerDirectory = new File(Utils_.getHomeDirectory(), Constants.PerformanceAnalyzerDirectoryName));
Utils.CheckDirectory(DVMPackagesDirectory = new File(Utils_.getHomeDirectory(), Constants.DVMPackagesDirectoryName));
Utils_.CheckDirectory(RepoDirectory = new File(Utils_.getHomeDirectory(), Constants.RepoDirectoryName));
Utils_.CheckDirectory(BugReportsDirectory = new File(Utils_.getHomeDirectory(), Constants.BugsDirectoryName));
Utils_.CheckDirectory(BackUpsDirectory = new File(Utils_.getHomeDirectory(), Constants.BackUpsDirectoryName));
Utils_.CheckDirectory(ProjectsDirectory = new File(Utils_.getHomeDirectory(), Constants.ProjectsDirectoryName));
Utils_.CheckDirectory(CompilationTasksDirectory = new File(Utils_.getHomeDirectory(), Constants.CompilationTasksDirectoryName));
Utils_.CheckDirectory(RunTasksDirectory = new File(Utils_.getHomeDirectory(), Constants.RunTasksDirectoryName));
Utils_.CheckDirectory(StsDirectory = new File(Utils_.getHomeDirectory(), Constants.StsDirectoryName));
Utils_.CheckDirectory(TestsDirectory = new File(Utils_.getHomeDirectory(), Constants.TestsDirectoryName));
Utils_.CheckDirectory(PerformanceAnalyzerDirectory = new File(Utils_.getHomeDirectory(), Constants.PerformanceAnalyzerDirectoryName));
Utils_.CheckDirectory(DVMPackagesDirectory = new File(Utils_.getHomeDirectory(), Constants.DVMPackagesDirectoryName));
//через пару версий заменить на clean.
Utils.CheckDirectory(SapforPackagesDirectory = new File(Utils_.getHomeDirectory(), "SapforPackages"));
Utils.CheckDirectory(MachinesDirectory = new File(Utils_.getHomeDirectory(), "Machines"));
Utils_.CheckDirectory(SapforPackagesDirectory = new File(Utils_.getHomeDirectory(), "SapforPackages"));
Utils_.CheckDirectory(MachinesDirectory = new File(Utils_.getHomeDirectory(), "Machines"));
}
public static void CheckServerDirectories() {
Utils.CheckDirectory(ComponentsDirectory = new File(Utils_.getHomeDirectory(), Constants.ComponentsDirectoryName));
Utils.CheckAndCleanDirectory(TempDirectory = new File(Utils_.getHomeDirectory(), Constants.TempDirectoryName));
Utils.CheckDirectory(DataDirectory = new File(Utils_.getHomeDirectory(), Constants.DataDirectoryName));
Utils_.CheckDirectory(ComponentsDirectory = new File(Utils_.getHomeDirectory(), Constants.ComponentsDirectoryName));
Utils_.CheckAndCleanDirectory(TempDirectory = new File(Utils_.getHomeDirectory(), Constants.TempDirectoryName));
Utils_.CheckDirectory(DataDirectory = new File(Utils_.getHomeDirectory(), Constants.DataDirectoryName));
//-
Utils.CheckDirectory(BugReportsDirectory = new File(Utils_.getHomeDirectory(), Constants.BugsDirectoryName));
Utils.CheckDirectory(DataBackUpsDirectory = new File(Utils_.getHomeDirectory(), Constants.DataBackUpsDirectoryName));
Utils.CheckDirectory(MachinesDirectory = new File(Utils_.getHomeDirectory(), "Machines"));
Utils_.CheckDirectory(BugReportsDirectory = new File(Utils_.getHomeDirectory(), Constants.BugsDirectoryName));
Utils_.CheckDirectory(DataBackUpsDirectory = new File(Utils_.getHomeDirectory(), Constants.DataBackUpsDirectoryName));
Utils_.CheckDirectory(MachinesDirectory = new File(Utils_.getHomeDirectory(), "Machines"));
}
public static void CheckTestingSystemDirectories() {
Utils.CheckDirectory(ComponentsDirectory = new File(Utils_.getHomeDirectory(), Constants.ComponentsDirectoryName));
Utils.CheckAndCleanDirectory(TempDirectory = new File(Utils_.getHomeDirectory(), Constants.TempDirectoryName));
Utils.CheckDirectory(DataDirectory = new File(Utils_.getHomeDirectory(), Constants.DataDirectoryName));
Utils_.CheckDirectory(ComponentsDirectory = new File(Utils_.getHomeDirectory(), Constants.ComponentsDirectoryName));
Utils_.CheckAndCleanDirectory(TempDirectory = new File(Utils_.getHomeDirectory(), Constants.TempDirectoryName));
Utils_.CheckDirectory(DataDirectory = new File(Utils_.getHomeDirectory(), Constants.DataDirectoryName));
//-
Utils.CheckDirectory(TestsDirectory = new File(Utils_.getHomeDirectory(), Constants.TestsDirectoryName));
Utils.CheckDirectory(RepoDirectory = new File(Utils_.getHomeDirectory(), Constants.RepoDirectoryName));
Utils.CheckDirectory(DVMPackagesDirectory = new File(Utils_.getHomeDirectory(), Constants.DVMPackagesDirectoryName));
Utils.CheckDirectory(SapforsDirectory = new File(Utils_.getHomeDirectory(), "Sapfors"));
Utils.CheckDirectory(SapforPackagesDirectory = new File(Utils_.getHomeDirectory(), "SapforPackages"));
Utils_.CheckDirectory(TestsDirectory = new File(Utils_.getHomeDirectory(), Constants.TestsDirectoryName));
Utils_.CheckDirectory(RepoDirectory = new File(Utils_.getHomeDirectory(), Constants.RepoDirectoryName));
Utils_.CheckDirectory(DVMPackagesDirectory = new File(Utils_.getHomeDirectory(), Constants.DVMPackagesDirectoryName));
Utils_.CheckDirectory(SapforsDirectory = new File(Utils_.getHomeDirectory(), "Sapfors"));
Utils_.CheckDirectory(SapforPackagesDirectory = new File(Utils_.getHomeDirectory(), "SapforPackages"));
//CheclAndClean через неделю
Utils.CheckDirectory(MachinesDirectory = new File(Utils_.getHomeDirectory(), "Machines"));
Utils_.CheckDirectory(MachinesDirectory = new File(Utils_.getHomeDirectory(), "Machines"));
}
public static void CreateLogAtComponentsPath() {
Utils_.MainLog = new Loggable() {

View File

@@ -1,9 +1,7 @@
package _VisualDVM.GlobalData.Tasks.RunTask;
import Common.CommonConstants;
import Common.Current_;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import _VisualDVM.GlobalData.GlobalDatabase;
import _VisualDVM.Global;
import Common.Utils.StringTemplate;
import _VisualDVM.Utils;
@@ -37,7 +35,7 @@ public class RunTask extends Task {
@Override
public void DropResults() throws Exception {
super.DropResults();
Utils.forceDeleteWithCheck(getLocalStsFile());
Utils_.forceDeleteWithCheck(getLocalStsFile());
CleanTime = 0;
Global.mainModule.getDb().Update(this);
}

View File

@@ -1,6 +1,5 @@
package _VisualDVM.GlobalData.Tasks.Supervisor.Local.Linux;
import Common.Utils.Utils_;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.Makefile.Makefile;
import _VisualDVM.GlobalData.Tasks.CompilationTask.CompilationTask;
import _VisualDVM.GlobalData.Tasks.TaskState;
@@ -15,7 +14,7 @@ public class LinuxLocalCompilationSupervisor extends LinuxLocalTaskSupervisor<Co
protected void PrepareWorkspace() throws Exception {
//возможно тут сделать отличие. не удалять все, а тоже сверять по дате и именам..
super.PrepareWorkspace();
Utils.CheckAndCleanDirectory(getProjectCopy());
Utils_.CheckAndCleanDirectory(getProjectCopy());
//скопировать проект в папку. без бд.
project.Clone(getProjectCopy(), false);
//-удалить старый бинарник если есть? бессмысленно если папка и так полностью пересоздается при каждой компиляции.

View File

@@ -71,9 +71,9 @@ public abstract class LinuxLocalTaskSupervisor<T extends Task> extends LocalTask
@Override
protected void PrepareWorkspace() throws Exception {
super.PrepareWorkspace();
Utils.forceDeleteWithCheck(getDONE_file());
Utils.forceDeleteWithCheck(getTIMEOUT_file());
Utils.forceDeleteWithCheck(getProjectTime());
Utils_.forceDeleteWithCheck(getDONE_file());
Utils_.forceDeleteWithCheck(getTIMEOUT_file());
Utils_.forceDeleteWithCheck(getProjectTime());
}
@Override
protected void CalculatePerformanceTime() throws Exception {

View File

@@ -55,8 +55,8 @@ public abstract class LocalTaskSupervisor<T extends Task> extends TaskSupervisor
@Override
protected void PrepareWorkspace() throws Exception {
super.PrepareWorkspace(); //локальная подготовка
Utils.forceDeleteWithCheck(getProjectOutput());
Utils.forceDeleteWithCheck(getProjectErrors());
Utils_.forceDeleteWithCheck(getProjectOutput());
Utils_.forceDeleteWithCheck(getProjectErrors());
}
@Override
protected void AchieveResults() throws Exception {

View File

@@ -1,8 +1,6 @@
package _VisualDVM.GlobalData.Tasks.Supervisor.Local.Windows;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.GlobalDatabase;
import _VisualDVM.GlobalData.Makefile.Makefile;
import _VisualDVM.GlobalData.Settings.SettingName;
import _VisualDVM.GlobalData.Tasks.CompilationTask.CompilationTask;
@@ -27,7 +25,7 @@ public class WindowsLocalCompilationSupervisor extends WindowsLocalTaskSuperviso
protected void PrepareWorkspace() throws Exception {
//возможно тут сделать отличие. не удалять все, а тоже сверять по дате и именам..
super.PrepareWorkspace();
Utils.CheckAndCleanDirectory(getProjectCopy());
Utils_.CheckAndCleanDirectory(getProjectCopy());
//скопировать проект в папку. без бд.
project.Clone(getProjectCopy(), false);
//-удалить старый бинарник если есть? бессмысленно если папка и так полностью пересоздается при каждой компиляции.

View File

@@ -1,7 +1,6 @@
package _VisualDVM.GlobalData.Tasks.Supervisor;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.Tasks.Task;
import _VisualDVM.GlobalData.Tasks.TaskState;
import _VisualDVM.ProjectData.Project.db_project_info;
@@ -30,7 +29,7 @@ public abstract class TaskSupervisor<T extends Task, P extends Pass> {
}
}
protected void PrepareWorkspace() throws Exception {
Utils.CheckAndCleanDirectory(task.getLocalWorkspace());
Utils_.CheckAndCleanDirectory(task.getLocalWorkspace());
}
protected abstract void StartTask() throws Exception;
protected boolean isTaskActive() {

View File

@@ -38,8 +38,8 @@ public abstract class Task extends iDBObject {
return this.project_path.equalsIgnoreCase(project.Home.getAbsolutePath());
}
public void DropResults() throws Exception {
Utils.forceDeleteWithCheck(getOutputFile());
Utils.forceDeleteWithCheck(getErrorsFile());
Utils_.forceDeleteWithCheck(getOutputFile());
Utils_.forceDeleteWithCheck(getErrorsFile());
//-
StartDate = 0;
EndDate = 0;

View File

@@ -1,6 +1,6 @@
package _VisualDVM.Passes.All;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.Utils;
import _VisualDVM.Repository.Component.Component;
import _VisualDVM.Passes.PassCode;
import Common.Passes.PassException;
@@ -24,7 +24,7 @@ public class BuildComponent extends ProcessPass<Component> {
}
@Override
protected void performPreparation() throws Exception {
Utils.forceDeleteWithCheck(target.getAssemblyFile());
Utils_.forceDeleteWithCheck(target.getAssemblyFile());
}
@Override
protected void body() throws Exception {

View File

@@ -3,7 +3,6 @@ import Common.Utils.Utils_;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.Visual.UI;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.Tasks.CompilationTask.CompilationTask;
import _VisualDVM.GlobalData.Tasks.TaskState;
import _VisualDVM.GlobalData.User.UserState;
@@ -54,7 +53,7 @@ public class Compile extends Pass<db_project_info> {
compilationTask.CompleteSummary(target.compilation_maxtime);
compilationTask.state = TaskState.Inactive;
Global.mainModule.getDb().Insert(compilationTask);
Utils.forceDeleteWithCheck(compilationTask.getLocalWorkspace());
Utils_.forceDeleteWithCheck(compilationTask.getLocalWorkspace());
}
@Override
protected void showPreparation() throws Exception {

View File

@@ -1,6 +1,6 @@
package _VisualDVM.Passes.All;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.Tasks.Task;
import _VisualDVM.Passes.Project.CurrentProjectPass;
@@ -17,7 +17,7 @@ public class DeleteDebugResults extends CurrentProjectPass {
Vector<Task> toDelete = Global.mainModule.getDb().compilationTasks.Data.values().stream().filter(task -> task.belongsToProject(target)).collect(Collectors.toCollection(Vector::new));
Global.mainModule.getDb().runTasks.Data.values().stream().filter(task -> task.belongsToProject(target)).forEach(toDelete::add);
for (Task task : toDelete) {
Utils.forceDeleteWithCheck(task.getLocalWorkspace());
Utils_.forceDeleteWithCheck(task.getLocalWorkspace());
Global.mainModule.getDb().Delete(task);
}
}

View File

@@ -1,7 +1,7 @@
package _VisualDVM.Passes.All;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import Common.Visual.Windows.Dialog.Dialog;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.FileObject.DirInfo;
import _VisualDVM.GlobalData.FileObject.DirInfosDataSet;
import _VisualDVM.GlobalData.FileObject.DirInfosFields;
@@ -62,7 +62,7 @@ public class DeleteDownloadedBugReports extends Pass<DirInfosDataSet> {
protected void body() throws Exception {
for (DirInfo dir : target.Data.values()) {
ShowMessage1(dir.getPK().toString());
Utils.forceDeleteWithCheck(dir.getFile());
Utils_.forceDeleteWithCheck(dir.getFile());
}
}
}

View File

@@ -4,7 +4,6 @@ import Common.Visual.UI_;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.Visual.UI;
import _VisualDVM.Utils;
import _VisualDVM.ProjectData.Files.DBProjectFile;
import _VisualDVM.Passes.Project.ChangeFilePass;
import _VisualDVM.Passes.PassCode;
@@ -29,7 +28,7 @@ public class DeleteFile extends ChangeFilePass<DBProjectFile> {
protected void body() throws Exception {
UI.getMainWindow().getProjectWindow().getFilesTreeForm().getTree().RemoveNode(target.node);
project.db.Delete(target);
Utils.forceDeleteWithCheck(target.file);
Utils_.forceDeleteWithCheck(target.file);
}
@Override
protected void performDone() throws Exception {

View File

@@ -1,6 +1,6 @@
package _VisualDVM.Passes.All;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.Tasks.CompilationTask.CompilationTask;
import _VisualDVM.GlobalData.Tasks.RunTask.RunTask;
import Common.Passes.Pass;
@@ -33,10 +33,10 @@ public class DeleteSelectedCompilationTasks extends Pass<Vector<CompilationTask>
for (CompilationTask task : target) {
for (RunTask runTask : task.getRunTasks().values()) {
Global.mainModule.getDb().Delete(runTask);
Utils.forceDeleteWithCheck(runTask.getLocalWorkspace());
Utils_.forceDeleteWithCheck(runTask.getLocalWorkspace());
}
Global.mainModule.getDb().Delete(task);
Utils.forceDeleteWithCheck(task.getLocalWorkspace());
Utils_.forceDeleteWithCheck(task.getLocalWorkspace());
}
}
@Override

View File

@@ -1,9 +1,9 @@
package _VisualDVM.Passes.All;
import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.Visual.UI;
import _VisualDVM.Utils;
import _VisualDVM.ProjectData.Files.DBProjectFile;
import _VisualDVM.Passes.PassCode;
import Common.Passes.Pass;
@@ -49,7 +49,7 @@ public class DeleteSelectedFiles extends Pass {
ShowMessage1(file.name);
UI.getMainWindow().getProjectWindow().getFilesTreeForm().getTree().RemoveNode(file.node);
Global.mainModule.getProject().db.Delete(file);
Utils.forceDeleteWithCheck(file.file);
Utils_.forceDeleteWithCheck(file.file);
}
}
}

View File

@@ -1,6 +1,6 @@
package _VisualDVM.Passes.All;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.Tasks.RunTask.RunTask;
import Common.Passes.Pass;
@@ -31,7 +31,7 @@ public class DeleteSelectedRunTasks extends Pass<Vector<RunTask>> {
protected void body() throws Exception {
for (RunTask task : target) {
Global.mainModule.getDb().Delete(task);
Utils.forceDeleteWithCheck(task.getLocalWorkspace());
Utils_.forceDeleteWithCheck(task.getLocalWorkspace());
}
}
@Override

View File

@@ -4,7 +4,6 @@ import Common.Visual.UI_;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.Visual.UI;
import _VisualDVM.Utils;
import _VisualDVM.ProjectData.Project.db_project_info;
import _VisualDVM.Passes.PassCode;
import Common.Passes.Pass;
@@ -46,7 +45,7 @@ public class DeleteVersion extends Pass<db_project_info> {
}
@Override
protected void body() throws Exception {
Utils.forceDeleteWithCheck(target.Home);
Utils_.forceDeleteWithCheck(target.Home);
}
@Override
protected void performDone() throws Exception {

View File

@@ -1,7 +1,6 @@
package _VisualDVM.Passes.All;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.Utils;
import _VisualDVM.Repository.BugReport.BugReport;
import _VisualDVM.Repository.BugReport.BugReportInterface;
import _VisualDVM.Repository.Server.ServerCode;
@@ -17,7 +16,7 @@ public class DownloadBugReport extends ComponentsRepositoryPass<BugReport> {
}
@Override
protected void performPreparation() throws Exception {
Utils.CheckDirectory(Global.BugReportsDirectory);
Utils_.CheckDirectory(Global.BugReportsDirectory);
}
@Override
protected void ServerAction() throws Exception {

View File

@@ -2,7 +2,6 @@ package _VisualDVM.Passes.All;
import Common.Utils.Utils_;
import _VisualDVM.Constants;
import _VisualDVM.Global;
import _VisualDVM.Utils;
import _VisualDVM.Repository.Server.ServerCode;
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
import _VisualDVM.TestingSystem.DVM.DVMPackage.DVMPackage;
@@ -61,7 +60,7 @@ public class DownloadDVMPackages extends Pass<Vector<Integer>> {
DVMPackage dvmPackage = Global.testingServer.db.dvmPackages.get(p.getKey());
ShowMessage2(String.valueOf(dvmPackage.id));
File workspace = dvmPackage.getLocalWorkspace();
Utils.CheckAndCleanDirectory(workspace);
Utils_.CheckAndCleanDirectory(workspace);
File results_zip = new File(workspace, "results.zip");
File results = new File(workspace, "results");
File loaded = new File(workspace, Constants.LOADED);

View File

@@ -48,7 +48,7 @@ public class DownloadSapforPackage extends Pass<SapforPackage> {
@Override
protected void body() throws Exception {
File workspace = target.getLocalWorkspace();
Utils.forceDeleteWithCheck(workspace);
Utils_.forceDeleteWithCheck(workspace);
File archive = Utils.getTempFileName(String.valueOf(target.id));
Utils_.bytesToFile(packed,archive);
Global.mainModule.getPass(PassCode.UnzipFolderPass).Do(archive.getAbsolutePath(), Global.SapforPackagesDirectory.getAbsolutePath());

View File

@@ -3,7 +3,6 @@ import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.Utils;
import _VisualDVM.Repository.Server.ServerCode;
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
import _VisualDVM.TestingSystem.Common.Test.Test;
@@ -30,8 +29,8 @@ public class DownloadTest extends TestingSystemPass<Test> {
protected void performPreparation() throws Exception {
Global.mainModule.getPass(PassCode.CloseCurrentProject).Do();
Global.mainModule.set(Current.Root, null); //чтобы гарантированно не существовало корня.
Utils.forceDeleteWithCheck(target.getArchive());
Utils.forceDeleteWithCheck(target.getHomePath());
Utils_.forceDeleteWithCheck(target.getArchive());
Utils_.forceDeleteWithCheck(target.getHomePath());
}
@Override
protected void ServerAction() throws Exception {

View File

@@ -1,7 +1,6 @@
package _VisualDVM.Passes.All;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.Module.Module;
import _VisualDVM.ProjectData.Files.DBProjectFile;
import _VisualDVM.ProjectData.LanguageName;
@@ -79,7 +78,7 @@ public class GCOV extends Precompilation {
String uname = file.last_assembly_name.substring(0, file.last_assembly_name.length() - 2);
String gcno = uname + ".gcno";
File gcov = Paths.get(workspace.getAbsolutePath(), file.file.getName() + ".gcov").toFile();
Utils.forceDeleteWithCheck(gcov);
Utils_.forceDeleteWithCheck(gcov);
name_to_kill = "gcov.exe";
StartProcess("gcov -b " +
Utils_.DQuotes(

View File

@@ -18,7 +18,7 @@ public class LocalInitaliseUser extends ProcessPass<User> {
protected void body() throws Exception {
File workspace = new File(Utils_.getHomeDirectory(), "User");
target.workspace = workspace.getAbsolutePath();
Utils.CheckAndCleanDirectory(workspace);
Utils_.CheckAndCleanDirectory(workspace);
FileUtils.forceMkdir(target.getLocalProjectsDir());
FileUtils.forceMkdir(target.getLocalModulesDir());
//-

View File

@@ -3,7 +3,6 @@ import Common.Utils.Utils_;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.Visual.UI;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.Machine.MachineType;
import _VisualDVM.GlobalData.Tasks.RunTask.RunTask;
import _VisualDVM.GlobalData.Tasks.TaskState;
@@ -29,7 +28,7 @@ public class Run extends Pass<db_project_info> {
runTasks = Global.mainModule.getRunConfiguration().generateRunTasks(target, Global.mainModule.getCompilationTask());
for (RunTask runTask : runTasks) {
Global.mainModule.getDb().Insert(runTask);
Utils.forceDeleteWithCheck(runTask.getLocalWorkspace());
Utils_.forceDeleteWithCheck(runTask.getLocalWorkspace());
}
}
@Override
@@ -93,7 +92,7 @@ public class Run extends Pass<db_project_info> {
case DoneWithErrors:
task_completed = true;
if (task.hasDvmSts) {
Utils.CheckAndCleanDirectory(Global.mainModule.getProject().getStatisticDirectory());
Utils_.CheckAndCleanDirectory(Global.mainModule.getProject().getStatisticDirectory());
Global.mainModule.getPass(PassCode.SPF_StatisticAnalyzer).Do(task);
}
break;

View File

@@ -3,7 +3,6 @@ import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.Global;
import _VisualDVM.Visual.UI;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.Settings.SettingName;
import _VisualDVM.ProjectData.Files.DBProjectFile;
import _VisualDVM.ProjectData.Files.FileState;
@@ -196,6 +195,6 @@ public class SPF_ParseFilesWithOrder extends SapforAnalysis {
@Override
protected void performFail() throws Exception {
super.performFail();
Utils.forceDeleteWithCheck(target.getProjFile());
Utils_.forceDeleteWithCheck(target.getProjFile());
}
}

View File

@@ -1,4 +1,5 @@
package _VisualDVM.Passes.All;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.Visual.UI;
import _VisualDVM.Utils;
@@ -38,7 +39,7 @@ public class SynchronizeBugReports extends ComponentsRepositoryPass<Object> {
protected void performDone() throws Exception {
super.performDone();
server.db.Disconnect();
Utils.forceDeleteWithCheck(server.db.getFile());
Utils_.forceDeleteWithCheck(server.db.getFile());
FileUtils.moveFile(new_db_file, server.db.getFile());
server.db.Connect();
server.db.prepareTablesStatements();

View File

@@ -1,4 +1,5 @@
package _VisualDVM.Passes.All;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.Visual.Controls.PassButton;
import _VisualDVM.Visual.UI;
@@ -52,7 +53,7 @@ public class SynchronizeTests extends TestingSystemPass<Object> {
protected void performDone() throws Exception {
super.performDone();
server.db.Disconnect();
Utils.forceDeleteWithCheck(server.db.getFile());
Utils_.forceDeleteWithCheck(server.db.getFile());
FileUtils.moveFile(new_db_file, server.db.getFile());
server.db.Connect();
server.db.prepareTablesStatements();

View File

@@ -1,5 +1,5 @@
package _VisualDVM.Passes.All;
import _VisualDVM.Utils;
import Common.Utils.Utils_;
import Common.Passes.Pass;
import java.io.File;
@@ -27,7 +27,7 @@ public class UnzipFolderPass<T> extends Pass<T> {
@Override
protected void performPreparation() throws Exception {
if (clean_dst)
Utils.forceDeleteWithCheck(new File(dst));
Utils_.forceDeleteWithCheck(new File(dst));
}
@Override
protected void body() throws Exception {

View File

@@ -1,7 +1,7 @@
package _VisualDVM.Passes.Testing;
import Common.CommonConstants;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.Utils;
import _VisualDVM.TestingSystem.Common.TestingPackage.TestingPackage;
import _VisualDVM.TestingSystem.Common.TestingServer;
import _VisualDVM.Passes.Server.DeleteServerObjects;
@@ -66,7 +66,7 @@ public abstract class DeleteTestingPackages<P extends TestingPackage> extends De
for (Object object : target) {
int id = (int) object;
File workspace = new File(getPackagesHome(), String.valueOf(id));
Utils.forceDeleteWithCheck(workspace);
Utils_.forceDeleteWithCheck(workspace);
}
}
}

View File

@@ -373,12 +373,12 @@ public class db_project_info extends DBObject {
return res;
}
public void CreateParserOptionsDirs() throws Exception {
Utils.forceDeleteWithCheck(getOptionsDirectory());
Utils_.forceDeleteWithCheck(getOptionsDirectory());
FileUtils.forceMkdir(getOptionsDirectory());
CopySubdirectories(getOptionsDirectory());
}
public void CreateGCOVDirs() throws Exception {
Utils.forceDeleteWithCheck(getGCOVDirectory());
Utils_.forceDeleteWithCheck(getGCOVDirectory());
FileUtils.forceMkdir(getGCOVDirectory());
CopySubdirectories(getGCOVDirectory());
}
@@ -439,7 +439,7 @@ public class db_project_info extends DBObject {
public void CleanVersions() throws Exception {
node.removeAllChildren();
for (db_project_info v : versions.values())
Utils.forceDeleteWithCheck(v.Home);
Utils_.forceDeleteWithCheck(v.Home);
versions.clear();
dropLastModification();
}
@@ -688,7 +688,7 @@ public class db_project_info extends DBObject {
}
public void CleanInterruptFile() throws Exception {
File file = getInterruptFile();
Utils.forceDeleteWithCheck(file);
Utils_.forceDeleteWithCheck(file);
}
public void CreateInterruptFile() throws Exception {
FileUtils.write(getInterruptFile(), Global.mode.toString());
@@ -799,12 +799,12 @@ public class db_project_info extends DBObject {
}
//----------------------------------------------------
private void CheckVisualiserDirectories() {
Utils.CheckDirectory(getDataDirectory());
Utils.CheckDirectory(getOptionsDirectory());
Utils.CheckDirectory(getStatisticDirectory());
Utils.CheckDirectory(getAttachmentsDirectory());
Utils.CheckDirectory(getGCOVDirectory());
Utils.CheckDirectory(getAnalyzerDirectory());
Utils_.CheckDirectory(getDataDirectory());
Utils_.CheckDirectory(getOptionsDirectory());
Utils_.CheckDirectory(getStatisticDirectory());
Utils_.CheckDirectory(getAttachmentsDirectory());
Utils_.CheckDirectory(getGCOVDirectory());
Utils_.CheckDirectory(getAnalyzerDirectory());
}
//загрузка инфы из бд проекта.
private void ExtractStoredInfo(db_project_info to_restore) {
@@ -890,7 +890,7 @@ public class db_project_info extends DBObject {
}
public void DeleteCrushedVersionIfNeed() throws Exception {
if (!VersionBuilding.equals("")) {
Utils.forceDeleteWithCheck(Paths.get(Home.getAbsolutePath(), VersionBuilding).toFile());
Utils_.forceDeleteWithCheck(Paths.get(Home.getAbsolutePath(), VersionBuilding).toFile());
SaveVersionToBuild("");
}
}
@@ -989,9 +989,9 @@ public class db_project_info extends DBObject {
return res;
}
public void cleanDepAndGCOVR() throws Exception {
Utils.forceDeleteWithCheck(getOptionsDirectory());
Utils.forceDeleteWithCheck(getGCOVDirectory());
Utils.forceDeleteWithCheck(getStatisticDirectory());
Utils_.forceDeleteWithCheck(getOptionsDirectory());
Utils_.forceDeleteWithCheck(getGCOVDirectory());
Utils_.forceDeleteWithCheck(getStatisticDirectory());
for (db_project_info version : versions.values())
version.cleanDepAndGCOVR();
}
@@ -1070,12 +1070,12 @@ public class db_project_info extends DBObject {
Global.mainModule.set(Current.Version, null);
//---
UI.getVersionsWindow().getVersionsForm().getTree().RemoveNode(last_version.node);
Utils.forceDeleteWithCheck(last_version.Home);
Utils_.forceDeleteWithCheck(last_version.Home);
versions.remove(last_version.name);
last_version = null;
//---
if (last_modification != null) {
Utils.forceDeleteWithCheck(last_modification.Home);
Utils_.forceDeleteWithCheck(last_modification.Home);
UI.getVersionsWindow().getVersionsForm().getTree().RemoveNode(last_modification.node);
versions.remove(last_modification.name);
last_modification = null;

View File

@@ -66,11 +66,11 @@ public abstract class Component extends DBObject implements Loggable {
minimal_version = Long.parseLong(v_string);
}
public void ReplaceOldFile() throws Exception {
Utils.delete_with_check(getFile());
Utils_.forceDeleteWithCheck(getFile());
//-скопировать файл
Files.move(getNewFile().toPath(), getFile().toPath(), StandardCopyOption.REPLACE_EXISTING);
//удалить новый файл.
Utils.delete_with_check(getNewFile());
Utils_.forceDeleteWithCheck(getNewFile());
}
public void Update() throws Exception {
if (!getNewFile().setExecutable(true)) throw new PassException("Не удалось разрешить файл\n" +

View File

@@ -449,11 +449,11 @@ public abstract class Sapfor extends OSDComponent {
int exit_code = CommonConstants.Nan;
//---
File data_workspace = new File(workspace, Constants.data);
Utils.CheckDirectory(data_workspace);
Utils_.CheckDirectory(data_workspace);
File outputFile = new File(data_workspace, outName);
File errorsFile = new File(data_workspace, errName);
Utils.delete_with_check(outputFile);
Utils.delete_with_check(errorsFile);
Utils_.forceDeleteWithCheck(outputFile);
Utils_.forceDeleteWithCheck(errorsFile);
//---
File file = new File(data_workspace, name + (Utils_.isWindows() ? ".bat" : ".sh"));
FileUtils.write(file,

View File

@@ -56,7 +56,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
if (object instanceof BugReport) {
BugReport bugReport = (BugReport) object;
if (!bugReport.project_version.isEmpty())
Utils.delete_with_check(BugReportInterface.getArchiveFile(bugReport));
Utils_.forceDeleteWithCheck(BugReportInterface.getArchiveFile(bugReport));
}
}
@Override
@@ -191,12 +191,12 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
if (versionFile.exists())
versionText = Utils.ReadAllText(versionFile);
//---->>
Utils.CheckDirectory(backupsFolder);
Utils_.CheckDirectory(backupsFolder);
Utils.keepNewFiles(backupsFolder, Global.properties.ComponentsBackUpsCount);
//-->>
File backupFile = new File(backupsFolder, sComponentType + "_" + versionText);
if (backupFile.exists())
Utils.delete_with_check(backupFile);
Utils_.forceDeleteWithCheck(backupFile);
FileUtils.moveFile(componentFile, backupFile);
}
//1 распаковка компонента
@@ -396,7 +396,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
//-
zip.Do("Bugs", bugsArchives.getAbsolutePath());
zip.Do(todayBackUp.getAbsolutePath(), todayBackUpArchive.getAbsolutePath());
Utils.forceDeleteWithCheck(todayBackUp);
Utils_.forceDeleteWithCheck(todayBackUp);
//-
for (Pair<Machine, User> cred : storages) {
backupSession.Do(cred.getKey(), cred.getValue(),

View File

@@ -94,7 +94,7 @@ public class MachineProcess extends DBObject {
public void Start() {
try {
File workspace = getWorkspace();
Utils.CheckAndCleanDirectory(workspace);
Utils_.CheckAndCleanDirectory(workspace);
//копирование визуализатора
File src = new File(Utils_.getHomeDirectory(), "TestingSystem.jar");
File supervisor = new File(workspace, "VisualSapfor.jar");

View File

@@ -61,7 +61,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
} else if (object instanceof DVMPackage) {
DVMPackage dvmPackage = (DVMPackage) object;
//--
Utils.CheckAndCleanDirectory(dvmPackage.getLocalWorkspace());
Utils_.CheckAndCleanDirectory(dvmPackage.getLocalWorkspace());
//--
dvmPackage.saveJson();
dvmPackage.package_json = null; // объект больше не нужен.
@@ -74,8 +74,8 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
public void afterDeleteAction(DBObject object) throws Exception {
if (object instanceof Test) {
Test test = (Test) object;
Utils.forceDeleteWithCheck(test.getArchive());
Utils.forceDeleteWithCheck(test.getServerPath());
Utils_.forceDeleteWithCheck(test.getArchive());
Utils_.forceDeleteWithCheck(test.getServerPath());
} else if (object instanceof Group) {
Group group = (Group) object;
Vector<Test> tests = new Vector<>();
@@ -85,11 +85,11 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
}
for (Test group_test : tests) {
db.Delete(group_test);
Utils.forceDeleteWithCheck(group_test.getArchive());
Utils.forceDeleteWithCheck(group_test.getServerPath());
Utils_.forceDeleteWithCheck(group_test.getArchive());
Utils_.forceDeleteWithCheck(group_test.getServerPath());
}
} else if (object instanceof ServerSapfor) {
Utils.forceDeleteWithCheck(
Utils_.forceDeleteWithCheck(
new File(
((ServerSapfor) object).home_path
)
@@ -97,11 +97,11 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
} else if (object instanceof DVMPackage) {
DVMPackage dvmPackage = (DVMPackage) object;
File workspace = dvmPackage.getLocalWorkspace();
Utils.forceDeleteWithCheck(workspace);
Utils_.forceDeleteWithCheck(workspace);
} else if (object instanceof SapforPackage) {
SapforPackage sapforPackage = (SapforPackage) object;
File workspace = sapforPackage.getLocalWorkspace();
Utils.forceDeleteWithCheck(workspace);
Utils_.forceDeleteWithCheck(workspace);
} else if (object instanceof SapforSettings) {
SapforSettings sapforSettings = (SapforSettings) object;
Vector<SapforSettingsCommand> commands = new Vector<>();

View File

@@ -173,7 +173,7 @@ public class TestsDatabase extends SQLiteDatabase {
//--
public void SaveTestFromSingleFile(ServerSapfor sapfor, Group group, Test test, File file) throws Exception {
File testDirectory = new File(Global.TestsDirectory, String.valueOf(test.id));
Utils.CheckAndCleanDirectory(testDirectory);
Utils_.CheckAndCleanDirectory(testDirectory);
File testFile = Paths.get(testDirectory.getAbsolutePath(), file.getName()).toFile();
FileUtils.copyFile(file, testFile);
//----

View File

@@ -231,7 +231,7 @@ public class RemoteDVMTestingPlanner extends DVMTestingPlanner {
}
@Override
protected void DownloadResults() throws Exception {
Utils.CheckDirectory(packageLocalWorkspace);
Utils_.CheckDirectory(packageLocalWorkspace);
RemoteFile remote_results_archive = new RemoteFile(packageRemoteWorkspace, "results.zip");
File results_archive = new File(packageLocalWorkspace, "results.zip");
user.connection.performScript(packageRemoteWorkspace, "zip -r " + Utils_.DQuotes("results.zip") + " " + Utils_.DQuotes("results"));

View File

@@ -61,7 +61,7 @@ public class PerformSapforTask extends Pass<SapforTask> {
//слегка изменить подход.
protected boolean transformation(PassCode code) throws Exception {
task = new File(parentTask, "v1");
Utils.CheckAndCleanDirectory(task); //папка для преобразования.
Utils_.CheckAndCleanDirectory(task); //папка для преобразования.
//если версия пустая, это тоже результат тестирования. Поэтому должна учитываться в древе.
target.versions.add(version_json = new SapforVersion_json(
root.getAbsolutePath(),

View File

@@ -1,12 +1,11 @@
package _VisualDVM.TestingSystem.SAPFOR.SapforPackage;
import Common.CommonConstants;
import _VisualDVM.Current;
import Common.Utils.Utils_;
import Common.Database.Objects.DBObject;
import _VisualDVM.Global;
import _VisualDVM.ServerObjectsCache.ConfigurationCache;
import _VisualDVM.ServerObjectsCache.VisualCaches;
import Common.Utils.TextLog;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.Account.Account;
import _VisualDVM.GlobalData.Tasks.TaskState;
import _VisualDVM.TestingSystem.Common.TasksPackageState;
@@ -46,7 +45,7 @@ public class SapforPackage extends TestingPackage<SapforPackage_json> {
public void init() throws Exception {
for (SapforTask task : package_json.tasks)
task.sapfortaskspackage_id = id;
Utils.CheckAndCleanDirectory(getLocalWorkspace());
Utils_.CheckAndCleanDirectory(getLocalWorkspace());
saveJson();
package_json = null; // объект больше не нужен.
}

View File

@@ -81,7 +81,7 @@ public class SapforTestingPlanner extends TestingPlanner<SapforPackage> {
//--->>>
for (SapforTest_json test_json : set_json.tests) {
File test_root = new File(configurationWorkspace, test_json.description);
Utils.CheckAndCleanDirectory(test_root);
Utils_.CheckAndCleanDirectory(test_root);
FileUtils.copyDirectory(new File(Global.TestsDirectory, String.valueOf(test_json.id)), test_root);
}
}

View File

@@ -4,7 +4,6 @@ import Common.Utils.Index;
import Common.Utils.StringTemplate;
import Common.Utils.TextLog;
import Common.Visual.UI_;
import _VisualDVM.GlobalData.GlobalDatabase;
import Common.Visual.Windows.Dialog.VFileChooser_;
import _VisualDVM.GlobalData.Settings.SettingName;
import _VisualDVM.GlobalData.Tasks.TaskState;
@@ -39,34 +38,6 @@ public class Utils {
public static String MFVar(Object o) {
return "$(" + o.toString() + ")";
}
public static void CheckDirectory(File dir) {
if (!dir.exists()) {
try {
FileUtils.forceMkdir(dir);
} catch (Exception e) {
Utils_.MainLog.PrintException(e);
}
}
}
public static void CheckAndCleanDirectory(File dir) {
if (dir.exists()) {
File[] files = dir.listFiles();
if (files != null)
for (File f : files) {
try {
forceDeleteWithCheck(f);
} catch (Exception e) {
Utils_.MainLog.PrintException(e);
}
}
} else {
try {
FileUtils.forceMkdir(dir);
} catch (Exception e) {
Utils_.MainLog.PrintException(e);
}
}
}
public static String ReadAllText(File file) {
try {
return new String(Files.readAllBytes(file.toPath()));
@@ -81,7 +52,7 @@ public class Utils {
if (files != null) {
for (File f : files) {
try {
forceDeleteWithCheck(f);
Utils_.forceDeleteWithCheck(f);
} catch (Exception e) {
Utils_.MainLog.PrintException(e);
}
@@ -194,24 +165,6 @@ public class Utils {
//нужно проверить корень на наличие хоть одной программы.
return Log.isEmpty();
}
public static void delete_with_check(File file) throws Exception {
int attempts = 0;
while (attempts < 10) {
if (file.exists()) {
try {
FileUtils.forceDelete(file);
} catch (Exception ex) {
// ex.printStackTrace();
}
} else return;
if (file.exists()) {
attempts++;
System.out.println("файл " + Utils_.Brackets(file.getAbsolutePath()) + " занят");
Thread.sleep(2000);
} else return;
}
throw new PassException("Не удалось удалить файл " + Utils_.Brackets(file.getAbsolutePath()) + " за " + attempts + " попыток");
}
public static void GetVertices(float R, float r, float x0, float y0, int n, float phi) {
boolean inner = false;
for (int i = 0; i < 2 * n; i++) {
@@ -253,23 +206,6 @@ public class Utils {
}
}
}
public static void forceDeleteWithCheck(File file) throws Exception {
int attempts = 0;
while (attempts < 10) {
if (file.exists()) {
try {
FileUtils.forceDelete(file);
} catch (Exception ignore) {
}
} else return;
if (file.exists()) {
attempts++;
Utils_.MainLog.Print("неудачная попытка удаления: файл " + Utils_.Brackets(file.getAbsolutePath()) + " занят");
Thread.sleep(2000);
} else return;
}
throw new PassException("Не удалось удалить файл " + Utils_.Brackets(file.getAbsolutePath()) + " за " + attempts + " попыток");
}
public static Socket createClientSocket(InetAddress address, int port, int timeout) throws Exception {
Socket socket = new Socket();
socket.setSoTimeout(timeout);
@@ -303,7 +239,7 @@ public class Utils {
Vector<File> res = new Vector<>();
Utils.getFilesByExtensions_r(dir, res, extensions);
for (File src : res)
Utils.forceDeleteWithCheck(src);
Utils_.forceDeleteWithCheck(src);
}
//----->>
//--процессы-------------------------------------------------->>>>>