no message
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
package _VisualDVM.Repository.BugReport;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Current;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Objects.rDBObject;
|
||||
import _VisualDVM.GlobalData.GlobalDatabase;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Repository.Component.ComponentType;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
@@ -31,6 +28,24 @@ public class BugReport extends rDBObject {
|
||||
public File owner = null;
|
||||
public BugReport() {
|
||||
}
|
||||
public BugReport(BugReport src) {
|
||||
this.SynchronizeFields(src);
|
||||
}
|
||||
public BugReport(String sender_name_in, String sender_address_in, String description_in, String version_in) {
|
||||
genName();
|
||||
sender_name = sender_name_in;
|
||||
sender_address = sender_address_in;
|
||||
project_version = version_in;
|
||||
visualiser_version = Global.visualiser.version;
|
||||
sapfor_version = Global.Components.get(ComponentType.Sapfor_F).version;
|
||||
sapfor_settings = (Global.mainModule.getDb()).settings.getSapforSettingsText();
|
||||
percentage = 0;
|
||||
description = description_in;
|
||||
date = new Date().getTime();
|
||||
change_date = new Date().getTime();
|
||||
state = BugReportState.draft;
|
||||
owner = Global.mainModule.getProject().Home;
|
||||
}
|
||||
@Override
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
super.SynchronizeFields(src);
|
||||
@@ -53,25 +68,6 @@ public class BugReport extends rDBObject {
|
||||
commentAdditionDraft = b.commentAdditionDraft;
|
||||
owner = b.owner;
|
||||
}
|
||||
public BugReport(BugReport src) {
|
||||
this.SynchronizeFields(src);
|
||||
}
|
||||
|
||||
public BugReport(String sender_name_in, String sender_address_in, String description_in, String version_in) {
|
||||
genName();
|
||||
sender_name = sender_name_in;
|
||||
sender_address = sender_address_in;
|
||||
project_version = version_in;
|
||||
visualiser_version = Global.visualiser.version;
|
||||
sapfor_version = Global.Components.get(ComponentType.Sapfor_F).version;
|
||||
sapfor_settings = (Global.mainModule.getDb()).settings.getSapforSettingsText();
|
||||
percentage = 0;
|
||||
description = description_in;
|
||||
date = new Date().getTime();
|
||||
change_date = new Date().getTime();
|
||||
state = BugReportState.draft;
|
||||
owner = Global.mainModule.getProject().Home;
|
||||
}
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return BugReportInterface.isVisible(this);
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package _VisualDVM.Repository.BugReport;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Utils.TextLog;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Repository.RepositoryServer;
|
||||
import _VisualDVM.Repository.Subscribes.Subscriber;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.Repository.BugReport;
|
||||
import Common.Visual.StatusEnum;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.StatusEnum;
|
||||
|
||||
import java.io.Serializable;
|
||||
public enum BugReportState implements Serializable, StatusEnum {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package _VisualDVM.Repository.BugReport;
|
||||
import _VisualDVM.Current;
|
||||
import Common.Database.Tables.DBTable;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Visual.UI;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package _VisualDVM.Repository;
|
||||
import Common.Database.SQLITE.SQLiteDatabase;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Repository.BugReport.BugReport;
|
||||
import _VisualDVM.Repository.BugReport.BugReportsDBTable;
|
||||
import _VisualDVM.Repository.SubscriberWorkspace.SubscriberWorkspaceDBTable;
|
||||
import _VisualDVM.Repository.Subscribes.SubsribersDBTable;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Vector;
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package _VisualDVM.Repository.Component;
|
||||
import Common.CommonConstants;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Constants;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Visual.Windows.Dialog.VFileChooser;
|
||||
import Common.Utils.TextLog;
|
||||
import _VisualDVM.Utils;
|
||||
import Common.Passes.PassException;
|
||||
import Common.Utils.Loggable;
|
||||
import Common.Utils.TextLog;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Windows.Dialog.VFileChooser;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
@@ -23,9 +22,9 @@ public abstract class Component extends DBObject implements Loggable {
|
||||
public String code = "";
|
||||
public String actual_code = "";
|
||||
public boolean needs_update_minimal_version = false;
|
||||
VFileChooser fileChooser = null; ///для ручной установки.
|
||||
private ComponentState state;
|
||||
public abstract ComponentType getComponentType();
|
||||
VFileChooser fileChooser = null; ///для ручной установки.
|
||||
public VFileChooser getFileChooser() {
|
||||
return (fileChooser == null) ? (fileChooser = new VFileChooser("выбор файла для компонента " +
|
||||
Utils_.Brackets(getComponentType().getDescription()), Utils_.getExtension(getFile())))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.Repository.Component;
|
||||
import Common.Visual.StatusEnum;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.StatusEnum;
|
||||
public enum ComponentState implements StatusEnum {
|
||||
Undefined,
|
||||
Actual,
|
||||
|
||||
@@ -2,8 +2,8 @@ package _VisualDVM.Repository.Component;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.Menus.DataMenuBar;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Visual.Menus.VisualiserMenu;
|
||||
public class ComponentsMenuBar extends DataMenuBar {
|
||||
public ComponentsMenuBar() {
|
||||
@@ -13,17 +13,15 @@ public class ComponentsMenuBar extends DataMenuBar {
|
||||
"Восстановление предыдущей версии компонента", "/icons/Resurrect.png") {
|
||||
{
|
||||
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
add( Global.mainModule.getPass(PassCode.ResurrectComponent).createMenuItem());
|
||||
add( Global.mainModule.getPass(PassCode.ResurrectComponentFromServer).createMenuItem());
|
||||
add(Global.mainModule.getPass(PassCode.ResurrectComponent).createMenuItem());
|
||||
add(Global.mainModule.getPass(PassCode.ResurrectComponentFromServer).createMenuItem());
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
addPasses(PassCode.InstallComponentFromFolder,
|
||||
PassCode.UpdateSelectedComponents,
|
||||
PassCode.PublishComponent,
|
||||
PassCode.ShowComponentChangesLog);
|
||||
|
||||
Global.mainModule.getPass(PassCode.PublishComponent).setControlsVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package _VisualDVM.Repository.Component;
|
||||
import _VisualDVM.Current;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import _VisualDVM.Current;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public class Instruction extends Component {
|
||||
}
|
||||
@Override
|
||||
public void unpackMinimalVersion(String v_string) {
|
||||
//--
|
||||
//--
|
||||
}
|
||||
@Override
|
||||
public void GetVersionInfo() {
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package _VisualDVM.Repository.Component.PerformanceAnalyzer;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import analyzer.common.MessageJtoJ;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.Repository.Component.Component;
|
||||
import _VisualDVM.Repository.Component.ComponentType;
|
||||
import _VisualDVM.Utils;
|
||||
import analyzer.common.MessageJtoJ;
|
||||
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
@@ -103,7 +102,7 @@ public class PerformanceAnalyzer extends Component {
|
||||
return null;
|
||||
});
|
||||
Utils.startScript(Global.TempDirectory, Global.ComponentsDirectory, "analyzer",
|
||||
"java -jar -Dprism.order=sw "+ Utils_.DQuotes(Global.performanceAnalyzer.getFile()) + " --port "+ getPort()+ " --version" );
|
||||
"java -jar -Dprism.order=sw " + Utils_.DQuotes(Global.performanceAnalyzer.getFile()) + " --port " + getPort() + " --version");
|
||||
//-
|
||||
server_thread.join();
|
||||
} catch (Exception ex) {
|
||||
@@ -120,12 +119,11 @@ public class PerformanceAnalyzer extends Component {
|
||||
Global.mainModule.HasProject() ? Global.mainModule.getProject().getAnalyzerDirectory().getAbsolutePath() : Global.PerformanceAnalyzerDirectory.getAbsolutePath(), "StatDirPath"));
|
||||
while (true) ConvertStatistic();
|
||||
});
|
||||
// UI.Info(String.valueOf(getPort()));
|
||||
// UI.Info(String.valueOf(getPort()));
|
||||
process_thread = new Thread(() -> {
|
||||
try {
|
||||
|
||||
Utils.startScript(Global.TempDirectory, Global.ComponentsDirectory, "analyzer",
|
||||
"java -jar -Dprism.order=sw "+ Utils_.DQuotes(Global.performanceAnalyzer.getFile()) + " --port "+ getPort());
|
||||
"java -jar -Dprism.order=sw " + Utils_.DQuotes(Global.performanceAnalyzer.getFile()) + " --port " + getPort());
|
||||
//-
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package _VisualDVM.Repository.Component.Sapfor;
|
||||
import Common.MainModule_;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
@@ -30,8 +28,8 @@ public class MessagesServer {
|
||||
InputStreamReader(client.getInputStream()));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
if (MainModule_.object.HasPassForm())
|
||||
MainModule_.object.getPassForm().Result.ShowSapforMessage(line);
|
||||
if (MainModule_.object.passForm != null)
|
||||
MainModule_.object.passForm.Result.ShowSapforMessage(line);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
// UI.Print(DebugPrintLevel.MessagesServer, "соединение сброшено!");
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
package _VisualDVM.Repository.Component.Sapfor;
|
||||
import Common.CommonConstants;
|
||||
import Common.Passes.PassException;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Passes.Sapfor.SapforAnalysis;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.GlobalData.Settings.SettingName;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Passes.Sapfor.SapforAnalysis;
|
||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
import _VisualDVM.ProjectData.Files.LanguageStyle;
|
||||
import _VisualDVM.Repository.Component.OSDComponent;
|
||||
import _VisualDVM.Repository.Component.Visualizer_2;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Test;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.PassException;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
@@ -27,17 +27,18 @@ public abstract class Sapfor extends OSDComponent {
|
||||
public static final int empty_code = -100;
|
||||
public static final int canceled_code = -99;
|
||||
public static final int invalid_proj_code = -2;
|
||||
public static File temp_copy = null;
|
||||
public Vector<String> Intrinsics = new Vector<>();
|
||||
public LinkedHashMap<String, String> ModifiedFiles = new LinkedHashMap<>();
|
||||
public LinkedHashMap<String, String> OldFiles = new LinkedHashMap<>();
|
||||
int size;
|
||||
int[] sizes;
|
||||
String PID = "";
|
||||
private int errorCode;
|
||||
private String result;
|
||||
private String output;
|
||||
private String outputMessage;
|
||||
private String predictorStats;
|
||||
String PID = "";
|
||||
//-
|
||||
public static String pack(String... params) {
|
||||
StringBuilder res = new StringBuilder();
|
||||
@@ -45,16 +46,6 @@ public abstract class Sapfor extends OSDComponent {
|
||||
res.append(param.length()).append(" ").append(param);
|
||||
return res.toString();
|
||||
}
|
||||
public void refreshPid() {
|
||||
try {
|
||||
// UI.Info("Calling SPF_GetCurrentPID...");
|
||||
RunAnalysis("SPF_GetCurrentPID", -1, "", "");
|
||||
PID = getResult();
|
||||
// UI.Info("PID = " + Utils.Brackets(PID));
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static PassCode[] getAnalysesCodes() {
|
||||
return new PassCode[]{
|
||||
PassCode.SPF_ParseFilesWithOrder,
|
||||
@@ -131,6 +122,219 @@ public abstract class Sapfor extends OSDComponent {
|
||||
PassCode.SPF_InsertImplicitNone
|
||||
};
|
||||
}
|
||||
//----------
|
||||
public static Vector<PassCode> getScenariosCodes() {
|
||||
Vector<PassCode> res = new Vector<>();
|
||||
res.add(PassCode.SPF_InitDeclsWithZero);//+
|
||||
res.add(PassCode.SPF_ConvertStructures);//+
|
||||
res.add(PassCode.SPF_ExpressionSubstitution);//+
|
||||
//--
|
||||
res.add(PassCode.SPF_CreateCheckpoints); //+
|
||||
res.add(PassCode.SPF_CreateIntervalsTree);//+
|
||||
res.add(PassCode.SPF_RemoveDvmIntervals);//+
|
||||
//--
|
||||
res.add(PassCode.SPF_RemoveDvmDirectives); //+
|
||||
res.add(PassCode.SPF_RemoveDvmDirectivesToComments); //+
|
||||
res.add(PassCode.SPF_RemoveOmpDirectives);//+
|
||||
res.add(PassCode.SPF_RemoveComments);//+
|
||||
res.add(PassCode.SPF_RemoveDeadCode);//+
|
||||
res.add(PassCode.SPF_RenameIncludes);
|
||||
res.add(PassCode.SPF_InsertIncludesPass);//+
|
||||
//--
|
||||
res.add(PassCode.SPF_LoopEndDoConverterPass); //+
|
||||
res.add(PassCode.SPF_LoopUnion);//+
|
||||
res.add(PassCode.SPF_LoopFission);//+
|
||||
//--
|
||||
res.add(PassCode.SPF_PrivateShrinking);//+
|
||||
res.add(PassCode.SPF_PrivateExpansion);//+
|
||||
res.add(PassCode.SPF_PrivateRemoving);//+
|
||||
//--
|
||||
res.add(PassCode.SPF_RemoveUnusedFunctions);//+
|
||||
res.add(PassCode.SPF_DuplicateFunctionChains);//+
|
||||
//--
|
||||
res.add(PassCode.SPF_ResolveParallelRegionConflicts);//+
|
||||
res.add(PassCode.SPF_ResolveCommonBlockConflicts);//+
|
||||
//-
|
||||
res.add(PassCode.SPF_InsertDvmhRegions);//+
|
||||
res.add(PassCode.SPF_SharedMemoryParallelization);//+
|
||||
res.add(PassCode.SPF_InsertImplicitNone);//+
|
||||
res.add(PassCode.CreateParallelVariants); //?
|
||||
return res;
|
||||
}
|
||||
public static boolean checkLines(Vector<String> lines) {
|
||||
for (String line : lines) {
|
||||
if (line.toLowerCase().contains("internal error")) {
|
||||
return false;
|
||||
}
|
||||
if (line.toLowerCase().contains("exception")) {
|
||||
return false;
|
||||
}
|
||||
if (line.contains("[ERROR]")) {
|
||||
return false;
|
||||
}
|
||||
if (line.toLowerCase().contains("segmentation fault")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//--
|
||||
public static boolean performScript(String name, //имя скрипта
|
||||
File sapfor_drv, //путь к сапфору
|
||||
File workspace, //проект
|
||||
String command, //проход
|
||||
String flags, //флаги
|
||||
String outName,
|
||||
String errName,
|
||||
Vector<String> resultLines
|
||||
) throws Exception {
|
||||
Process process = null;
|
||||
int exit_code = CommonConstants.Nan;
|
||||
//---
|
||||
File data_workspace = new File(workspace, Constants.data);
|
||||
Utils_.CheckDirectory(data_workspace);
|
||||
File outputFile = new File(data_workspace, outName);
|
||||
File errorsFile = new File(data_workspace, errName);
|
||||
Utils_.forceDeleteWithCheck(outputFile);
|
||||
Utils_.forceDeleteWithCheck(errorsFile);
|
||||
//---
|
||||
File file = new File(data_workspace, name + (Utils_.isWindows() ? ".bat" : ".sh"));
|
||||
FileUtils.write(file,
|
||||
Utils_.DQuotes(sapfor_drv)
|
||||
+ (flags.isEmpty() ? "" : (" " + flags))
|
||||
+ " -noLogo"
|
||||
+ " " + command +
|
||||
" 1>" +
|
||||
Utils_.DQuotes(outputFile.getAbsolutePath()) +
|
||||
" 2>" +
|
||||
Utils_.DQuotes(errorsFile.getAbsolutePath()),
|
||||
Charset.defaultCharset());
|
||||
if (!file.setExecutable(true))
|
||||
throw new Exception("Не удалось сделать файл скрипта " + name + " исполняемым!");
|
||||
//--
|
||||
boolean flag = false;
|
||||
do {
|
||||
try {
|
||||
ProcessBuilder procBuilder = new ProcessBuilder(file.getAbsolutePath());
|
||||
procBuilder.directory(workspace);
|
||||
process = procBuilder.start();
|
||||
exit_code = process.waitFor();
|
||||
flag = true;
|
||||
} catch (Exception ex) {
|
||||
Utils_.MainLog.PrintException(ex);
|
||||
Utils_.sleep(1000);
|
||||
}
|
||||
}
|
||||
while (!flag);
|
||||
process = null;
|
||||
//---
|
||||
Vector<String> outputLines = new Vector<>(FileUtils.readLines(outputFile));
|
||||
Vector<String> errorsLines = new Vector<>(FileUtils.readLines(errorsFile));
|
||||
if (resultLines != null) {
|
||||
resultLines.addAll(outputLines);
|
||||
}
|
||||
return (exit_code == 0) &&
|
||||
checkLines(outputLines) &&
|
||||
checkLines(errorsLines);
|
||||
}
|
||||
public static boolean performScript(String name, //имя скрипта
|
||||
File sapfor_drv, //путь к сапфору
|
||||
File workspace, //проект
|
||||
String command, //проход
|
||||
String flags, //флаги
|
||||
String outName,
|
||||
String errName
|
||||
) throws Exception {
|
||||
return performScript(name, sapfor_drv, workspace, command, flags, outName, errName, null);
|
||||
}
|
||||
public static boolean parse(File sapfor_drv, File workspace, String flags) throws Exception {
|
||||
return performScript(
|
||||
"parse",
|
||||
sapfor_drv,
|
||||
workspace,
|
||||
"-parse -spf *.f* *.F*", // "-parse -spf *.f *.for *.fdv *.f90 *.f77",
|
||||
flags,
|
||||
Constants.parse_out_file,
|
||||
Constants.parse_err_file)
|
||||
&& (new File(workspace, "dvm.proj")).exists();
|
||||
}
|
||||
public static boolean analysis(File sapfor_drv, File workspace, PassCode code, String flags, Vector<String> result_lines) throws Exception {
|
||||
return performScript("analysis",
|
||||
sapfor_drv,
|
||||
workspace,
|
||||
code.getTestingCommand(),
|
||||
flags,
|
||||
Constants.out_file,
|
||||
Constants.err_file,
|
||||
result_lines
|
||||
);
|
||||
}
|
||||
public static File getTempCopy(File src) throws Exception {
|
||||
if (temp_copy == null || !temp_copy.exists()) {
|
||||
temp_copy = Utils.getTempFileName("SAPFOR" + (Utils_.isWindows() ? ".exe" : ""));
|
||||
FileUtils.copyFile(src, temp_copy);
|
||||
temp_copy.setExecutable(true);
|
||||
}
|
||||
return temp_copy;
|
||||
}
|
||||
//--
|
||||
public static boolean getMinMaxDim(File sapfor_drv, File workspace, Test test) throws Exception {
|
||||
File sapfor = Sapfor.getTempCopy(sapfor_drv);
|
||||
String flags = "-noLogo";
|
||||
if (Sapfor.parse(sapfor, workspace, flags)
|
||||
) {
|
||||
Vector<String> outputLines = new Vector<>();
|
||||
if (Sapfor.analysis(sapfor, workspace, PassCode.SPF_GetMaxMinBlockDistribution, flags, outputLines)) {
|
||||
//---
|
||||
for (String line : outputLines) {
|
||||
String prefix = "GET_MIN_MAX_BLOCK_DIST: ";
|
||||
if (line.startsWith(prefix)) {
|
||||
String s = line.substring(prefix.length());
|
||||
String[] data = s.split(" ");
|
||||
test.min_dim = Math.max(Integer.parseInt(data[0]), 0);
|
||||
test.max_dim = Math.max(Integer.parseInt(data[1]), 0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static int readVersionFromCode(File versionFile) {
|
||||
int res = CommonConstants.Nan;
|
||||
if (versionFile.exists()) {
|
||||
try {
|
||||
List<String> data = FileUtils.readLines(versionFile);
|
||||
for (String s : data) {
|
||||
if (s.startsWith("#define VERSION_SPF ")) {
|
||||
String[] version_data = s.split("\"");
|
||||
if (version_data.length > 0) {
|
||||
String version_s = version_data[1];
|
||||
//-
|
||||
try {
|
||||
res = Integer.parseInt(version_s);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public void refreshPid() {
|
||||
try {
|
||||
// UI.Info("Calling SPF_GetCurrentPID...");
|
||||
RunAnalysis("SPF_GetCurrentPID", -1, "", "");
|
||||
PID = getResult();
|
||||
// UI.Info("PID = " + Utils.Brackets(PID));
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
//<editor-fold desc="компонент">
|
||||
@Override
|
||||
public void GetVersionInfo() {
|
||||
@@ -342,14 +546,14 @@ public abstract class Sapfor extends OSDComponent {
|
||||
//</editor-fold>
|
||||
public SapforAnalysis getAnalysisByPhase(String phase) {
|
||||
for (PassCode analysis_code : getAnalysesCodes()) {
|
||||
SapforAnalysis analysis = (SapforAnalysis) Global.mainModule.getPass(analysis_code);
|
||||
SapforAnalysis analysis = (SapforAnalysis) Global.mainModule.getPass(analysis_code);
|
||||
if (analysis.phase().equals(phase)) return analysis;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public void ResetAllAnalyses() {
|
||||
for (PassCode code : getAnalysesCodes())
|
||||
( Global.mainModule.getPass(code)).Reset();
|
||||
(Global.mainModule.getPass(code)).Reset();
|
||||
//------------------------------------------------------------------------------------------>>>> пакетный режим.
|
||||
if (UI_.isActive()) {
|
||||
Global.mainModule.getPass(PassCode.Precompilation).Reset();
|
||||
@@ -366,46 +570,6 @@ public abstract class Sapfor extends OSDComponent {
|
||||
public LanguageStyle getStyle() throws Exception {
|
||||
return (Global.mainModule.getDb()).settings.get(SettingName.FREE_FORM).toBoolean() ? LanguageStyle.free : LanguageStyle.fixed;
|
||||
}
|
||||
//----------
|
||||
public static Vector<PassCode> getScenariosCodes() {
|
||||
Vector<PassCode> res = new Vector<>();
|
||||
res.add(PassCode.SPF_InitDeclsWithZero);//+
|
||||
res.add(PassCode.SPF_ConvertStructures);//+
|
||||
res.add(PassCode.SPF_ExpressionSubstitution);//+
|
||||
//--
|
||||
res.add(PassCode.SPF_CreateCheckpoints); //+
|
||||
res.add(PassCode.SPF_CreateIntervalsTree);//+
|
||||
res.add(PassCode.SPF_RemoveDvmIntervals);//+
|
||||
//--
|
||||
res.add(PassCode.SPF_RemoveDvmDirectives); //+
|
||||
res.add(PassCode.SPF_RemoveDvmDirectivesToComments); //+
|
||||
|
||||
res.add(PassCode.SPF_RemoveOmpDirectives);//+
|
||||
res.add(PassCode.SPF_RemoveComments);//+
|
||||
res.add(PassCode.SPF_RemoveDeadCode);//+
|
||||
res.add(PassCode.SPF_RenameIncludes);
|
||||
res.add(PassCode.SPF_InsertIncludesPass);//+
|
||||
//--
|
||||
res.add(PassCode.SPF_LoopEndDoConverterPass); //+
|
||||
res.add(PassCode.SPF_LoopUnion);//+
|
||||
res.add(PassCode.SPF_LoopFission);//+
|
||||
//--
|
||||
res.add(PassCode.SPF_PrivateShrinking);//+
|
||||
res.add(PassCode.SPF_PrivateExpansion);//+
|
||||
res.add(PassCode.SPF_PrivateRemoving);//+
|
||||
//--
|
||||
res.add(PassCode.SPF_RemoveUnusedFunctions);//+
|
||||
res.add(PassCode.SPF_DuplicateFunctionChains);//+
|
||||
//--
|
||||
res.add(PassCode.SPF_ResolveParallelRegionConflicts);//+
|
||||
res.add(PassCode.SPF_ResolveCommonBlockConflicts);//+
|
||||
//-
|
||||
res.add(PassCode.SPF_InsertDvmhRegions);//+
|
||||
res.add(PassCode.SPF_SharedMemoryParallelization);//+
|
||||
res.add(PassCode.SPF_InsertImplicitNone);//+
|
||||
res.add(PassCode.CreateParallelVariants); //?
|
||||
return res;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
public String getConsoleFlags() throws Exception {
|
||||
Vector<String> res = new Vector<>();
|
||||
@@ -418,169 +582,4 @@ public abstract class Sapfor extends OSDComponent {
|
||||
res.add("-keepSPF");
|
||||
return String.join(" ", res);
|
||||
}
|
||||
public static boolean checkLines(Vector<String> lines) {
|
||||
for (String line : lines) {
|
||||
if (line.toLowerCase().contains("internal error")) {
|
||||
return false;
|
||||
}
|
||||
if (line.toLowerCase().contains("exception")) {
|
||||
return false;
|
||||
}
|
||||
if (line.contains("[ERROR]")) {
|
||||
return false;
|
||||
}
|
||||
if (line.toLowerCase().contains("segmentation fault")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//--
|
||||
public static boolean performScript(String name, //имя скрипта
|
||||
File sapfor_drv, //путь к сапфору
|
||||
File workspace, //проект
|
||||
String command, //проход
|
||||
String flags, //флаги
|
||||
String outName,
|
||||
String errName,
|
||||
Vector<String> resultLines
|
||||
) throws Exception {
|
||||
Process process = null;
|
||||
int exit_code = CommonConstants.Nan;
|
||||
//---
|
||||
File data_workspace = new File(workspace, Constants.data);
|
||||
Utils_.CheckDirectory(data_workspace);
|
||||
File outputFile = new File(data_workspace, outName);
|
||||
File errorsFile = new File(data_workspace, errName);
|
||||
Utils_.forceDeleteWithCheck(outputFile);
|
||||
Utils_.forceDeleteWithCheck(errorsFile);
|
||||
//---
|
||||
File file = new File(data_workspace, name + (Utils_.isWindows() ? ".bat" : ".sh"));
|
||||
FileUtils.write(file,
|
||||
Utils_.DQuotes(sapfor_drv)
|
||||
+ (flags.isEmpty() ? "" : (" " + flags))
|
||||
+ " -noLogo"
|
||||
+ " " + command +
|
||||
" 1>" +
|
||||
Utils_.DQuotes(outputFile.getAbsolutePath()) +
|
||||
" 2>" +
|
||||
Utils_.DQuotes(errorsFile.getAbsolutePath()),
|
||||
Charset.defaultCharset());
|
||||
if (!file.setExecutable(true))
|
||||
throw new Exception("Не удалось сделать файл скрипта " + name + " исполняемым!");
|
||||
//--
|
||||
boolean flag = false;
|
||||
do {
|
||||
try {
|
||||
ProcessBuilder procBuilder = new ProcessBuilder(file.getAbsolutePath());
|
||||
procBuilder.directory(workspace);
|
||||
process = procBuilder.start();
|
||||
exit_code = process.waitFor();
|
||||
flag = true;
|
||||
} catch (Exception ex) {
|
||||
Utils_.MainLog.PrintException(ex);
|
||||
Utils_.sleep(1000);
|
||||
}
|
||||
}
|
||||
while (!flag);
|
||||
process = null;
|
||||
//---
|
||||
Vector<String> outputLines = new Vector<>(FileUtils.readLines(outputFile));
|
||||
Vector<String> errorsLines = new Vector<>(FileUtils.readLines(errorsFile));
|
||||
if (resultLines != null) {
|
||||
resultLines.addAll(outputLines);
|
||||
}
|
||||
return (exit_code == 0) &&
|
||||
checkLines(outputLines) &&
|
||||
checkLines(errorsLines);
|
||||
}
|
||||
public static boolean performScript(String name, //имя скрипта
|
||||
File sapfor_drv, //путь к сапфору
|
||||
File workspace, //проект
|
||||
String command, //проход
|
||||
String flags, //флаги
|
||||
String outName,
|
||||
String errName
|
||||
) throws Exception {
|
||||
return performScript(name, sapfor_drv, workspace, command, flags, outName, errName, null);
|
||||
}
|
||||
public static boolean parse(File sapfor_drv, File workspace, String flags) throws Exception {
|
||||
return performScript(
|
||||
"parse",
|
||||
sapfor_drv,
|
||||
workspace,
|
||||
"-parse -spf *.f* *.F*", // "-parse -spf *.f *.for *.fdv *.f90 *.f77",
|
||||
flags,
|
||||
Constants.parse_out_file,
|
||||
Constants.parse_err_file)
|
||||
&& (new File(workspace, "dvm.proj")).exists();
|
||||
}
|
||||
public static boolean analysis(File sapfor_drv, File workspace, PassCode code, String flags, Vector<String> result_lines) throws Exception {
|
||||
return performScript("analysis",
|
||||
sapfor_drv,
|
||||
workspace,
|
||||
code.getTestingCommand(),
|
||||
flags,
|
||||
Constants.out_file,
|
||||
Constants.err_file,
|
||||
result_lines
|
||||
);
|
||||
}
|
||||
public static File temp_copy = null;
|
||||
public static File getTempCopy(File src) throws Exception {
|
||||
if (temp_copy == null || !temp_copy.exists()) {
|
||||
temp_copy = Utils.getTempFileName("SAPFOR" + (Utils_.isWindows() ? ".exe" : ""));
|
||||
FileUtils.copyFile(src, temp_copy);
|
||||
temp_copy.setExecutable(true);
|
||||
}
|
||||
return temp_copy;
|
||||
}
|
||||
//--
|
||||
public static boolean getMinMaxDim(File sapfor_drv, File workspace, Test test) throws Exception {
|
||||
File sapfor = Sapfor.getTempCopy(sapfor_drv);
|
||||
String flags = "-noLogo";
|
||||
if (Sapfor.parse(sapfor, workspace, flags)
|
||||
) {
|
||||
Vector<String> outputLines = new Vector<>();
|
||||
if (Sapfor.analysis(sapfor, workspace, PassCode.SPF_GetMaxMinBlockDistribution, flags, outputLines)) {
|
||||
//---
|
||||
for (String line : outputLines) {
|
||||
String prefix = "GET_MIN_MAX_BLOCK_DIST: ";
|
||||
if (line.startsWith(prefix)) {
|
||||
String s = line.substring(prefix.length());
|
||||
String[] data = s.split(" ");
|
||||
test.min_dim = Math.max(Integer.parseInt(data[0]), 0);
|
||||
test.max_dim = Math.max(Integer.parseInt(data[1]), 0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static int readVersionFromCode(File versionFile) {
|
||||
int res = CommonConstants.Nan;
|
||||
if (versionFile.exists()) {
|
||||
try {
|
||||
List<String> data = FileUtils.readLines(versionFile);
|
||||
for (String s : data) {
|
||||
if (s.startsWith("#define VERSION_SPF ")) {
|
||||
String[] version_data = s.split("\"");
|
||||
if (version_data.length > 0) {
|
||||
String version_s = version_data[1];
|
||||
//-
|
||||
try {
|
||||
res = Integer.parseInt(version_s);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.Repository.Component.UI;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
import _VisualDVM.Global;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.Repository.Component.UI;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Visual.Windows.Dialog.Dialog;
|
||||
import _VisualDVM.Global;
|
||||
|
||||
import java.awt.*;
|
||||
public class ComponentsForm extends Dialog<Object, ComponentsFields> {
|
||||
@@ -26,7 +26,6 @@ public class ComponentsForm extends Dialog<Object, ComponentsFields> {
|
||||
public void Init(Object... params) {
|
||||
Global.Components.ShowUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void LoadSize() {
|
||||
setMinimumSize(new Dimension(650, 250));
|
||||
@@ -37,8 +36,8 @@ public class ComponentsForm extends Dialog<Object, ComponentsFields> {
|
||||
@Override
|
||||
public void onClose() {
|
||||
super.onClose();
|
||||
Global.properties.ComponentsWindowWidth=getWidth();
|
||||
Global.properties.ComponentsWindowHeight=getHeight();
|
||||
Global.properties.ComponentsWindowWidth = getWidth();
|
||||
Global.properties.ComponentsWindowHeight = getHeight();
|
||||
Global.properties.Update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.Repository.Component.UI;
|
||||
import _VisualDVM.Visual.Editor.BaseEditor;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
import _VisualDVM.Visual.Editor.BaseEditor;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -31,5 +31,4 @@ public class PublishFields implements DialogFields {
|
||||
public Component getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,5 +12,4 @@ public class PublishForm extends Dialog<String, PublishFields> {
|
||||
public void ProcessResult() {
|
||||
Result = fields.cbNeedsBroadcast.isSelected() ? fields.taBroadcast.getText() : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package _VisualDVM.Repository.Component;
|
||||
import Common.Passes.PassException;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Utils;
|
||||
import Common.Passes.PassException;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
@@ -13,11 +13,11 @@ import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
import java.nio.file.Paths;
|
||||
public class Visualizer_2 extends OSDComponent {
|
||||
public String PID = "";
|
||||
//</editor-fold>
|
||||
//-
|
||||
//<editor-fold desc="функционал">
|
||||
int port;
|
||||
public String PID = "";
|
||||
Socket client = null;
|
||||
PrintWriter out = null;
|
||||
BufferedReader in = null;
|
||||
@@ -51,12 +51,12 @@ public class Visualizer_2 extends OSDComponent {
|
||||
Utils_.MainLog.PrintException(e);
|
||||
}
|
||||
}
|
||||
public void refreshPid(){
|
||||
public void refreshPid() {
|
||||
try {
|
||||
// UI.Info("Getting Server PID...");
|
||||
// UI.Info("Getting Server PID...");
|
||||
Command("get_pid: ");
|
||||
PID = response;
|
||||
// UI.Info("SERVER PID = "+Utils.Brackets(PID));
|
||||
// UI.Info("SERVER PID = "+Utils.Brackets(PID));
|
||||
} catch (Exception e) {
|
||||
Utils_.MainLog.PrintException(e);
|
||||
}
|
||||
@@ -92,7 +92,7 @@ public class Visualizer_2 extends OSDComponent {
|
||||
in = new BufferedReader(new InputStreamReader(client.getInputStream())); //то что нам приходит от сервера
|
||||
out = new PrintWriter(client.getOutputStream(), true); //то что мы пишем серверу.
|
||||
}
|
||||
public void Interrupt(){
|
||||
public void Interrupt() {
|
||||
Utils.Kill(PID, false);
|
||||
}
|
||||
public void Shutdown() throws Exception {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package _VisualDVM.Repository;
|
||||
import Common.Passes.PassException;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Passes.Server.TestingSystemPass;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
||||
import Common.Passes.PassException;
|
||||
import _VisualDVM.Passes.Server.TestingSystemPass;
|
||||
|
||||
import java.io.FileWriter;
|
||||
import java.io.Serializable;
|
||||
@@ -59,12 +59,12 @@ public abstract class RepositoryClient {
|
||||
return ServerCommand(code_in, "", null);
|
||||
}
|
||||
protected void ServerConnectionError(ServerCode code_in, String logText) throws Exception {
|
||||
throw new PassException(Utils_.Brackets(new Date().toString())+" Ошибка взаимодействия с сервером " + code_in);
|
||||
throw new PassException(Utils_.Brackets(new Date().toString()) + " Ошибка взаимодействия с сервером " + code_in);
|
||||
}
|
||||
public abstract void perform() throws Exception;
|
||||
public void Perform(){
|
||||
public void Perform() {
|
||||
try {
|
||||
perform();
|
||||
perform();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package _VisualDVM.Repository;
|
||||
public class RepositoryRefuseException extends Exception{
|
||||
public class RepositoryRefuseException extends Exception {
|
||||
//исключение для "штатных" отказов. например отсутствие объекта с заданным ключом.
|
||||
public RepositoryRefuseException(String message_in){
|
||||
public RepositoryRefuseException(String message_in) {
|
||||
super(message_in);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package _VisualDVM.Repository;
|
||||
import Common.Database.Database;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Utils.InterruptThread;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Constants;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Database;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Utils.InterruptThread;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.Repository.Server.DiagnosticSignalHandler;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
||||
import _VisualDVM.Utils;
|
||||
import javafx.util.Pair;
|
||||
import sun.misc.SignalHandler;
|
||||
|
||||
@@ -28,48 +28,32 @@ import java.util.LinkedHashMap;
|
||||
import java.util.Properties;
|
||||
import java.util.Vector;
|
||||
public abstract class RepositoryServer<D extends Database> {
|
||||
Class<D> d_class;
|
||||
public final static String separator = "----------------------------------";
|
||||
protected static FileWriter Log;
|
||||
protected static boolean printOn = false;
|
||||
//-
|
||||
public D db;
|
||||
protected Socket clientSocket; //сокет для общения
|
||||
protected ServerSocket server; // серверсокет
|
||||
protected ObjectInputStream in; // поток чтения из сокета
|
||||
protected ObjectOutputStream out; // поток записи в сокет
|
||||
//-
|
||||
public D db;
|
||||
protected static FileWriter Log;
|
||||
protected ServerExchangeUnit_2021 request;
|
||||
protected ServerExchangeUnit_2021 response;
|
||||
//-
|
||||
protected ServerCode code;
|
||||
protected long count = 0; //для отладки.
|
||||
protected static boolean printOn = false;
|
||||
//-----------
|
||||
SignalHandler signalHandler = signal -> {
|
||||
};
|
||||
//------------
|
||||
public abstract int getPort();
|
||||
protected abstract void Session() throws Exception;
|
||||
protected void startAdditionalThreads() {
|
||||
}
|
||||
public final static String separator = "----------------------------------";
|
||||
public RepositoryServer(Class<D> d_class_in) {
|
||||
d_class = d_class_in;
|
||||
}
|
||||
public void ActivateDB() {
|
||||
try {
|
||||
db = d_class.newInstance();
|
||||
db.Connect();
|
||||
db.CreateAllTables();
|
||||
db.prepareTablesStatements();
|
||||
db.Synchronize();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
protected Thread interruptThread = new InterruptThread(10000,
|
||||
() -> {
|
||||
System.exit(0);
|
||||
return null;
|
||||
});
|
||||
Class<D> d_class;
|
||||
//-----------
|
||||
SignalHandler signalHandler = signal -> {
|
||||
};
|
||||
public RepositoryServer(Class<D> d_class_in) {
|
||||
d_class = d_class_in;
|
||||
}
|
||||
protected static void Print(String message) {
|
||||
if (printOn) {
|
||||
try {
|
||||
@@ -83,6 +67,22 @@ public abstract class RepositoryServer<D extends Database> {
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------
|
||||
public abstract int getPort();
|
||||
protected abstract void Session() throws Exception;
|
||||
protected void startAdditionalThreads() {
|
||||
}
|
||||
public void ActivateDB() {
|
||||
try {
|
||||
db = d_class.newInstance();
|
||||
db.Connect();
|
||||
db.CreateAllTables();
|
||||
db.prepareTablesStatements();
|
||||
db.Synchronize();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
protected void checkTargets(EmailMessage message_in) {
|
||||
}
|
||||
public void Email(EmailMessage message_in, File... directAttachements) throws Exception {
|
||||
@@ -117,7 +117,6 @@ public abstract class RepositoryServer<D extends Database> {
|
||||
Constants.MailPassword);
|
||||
}
|
||||
});
|
||||
|
||||
for (String target : targets_) {
|
||||
boolean done = false;
|
||||
int attempts = 5;
|
||||
|
||||
@@ -2,12 +2,14 @@ package _VisualDVM.Repository.Server;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.GlobalData.Account.Account;
|
||||
import _VisualDVM.GlobalData.Machine.Machine;
|
||||
import _VisualDVM.GlobalData.Machine.MachineType;
|
||||
import _VisualDVM.GlobalData.RemoteFile.RemoteFile;
|
||||
import _VisualDVM.GlobalData.User.User;
|
||||
import _VisualDVM.Passes.All.ArchivesBackupPass;
|
||||
import _VisualDVM.Passes.All.UnzipFolderPass;
|
||||
import _VisualDVM.Passes.All.ZipFolderPass;
|
||||
import _VisualDVM.ProjectData.LanguageName;
|
||||
import _VisualDVM.Repository.BugReport.BugReport;
|
||||
import _VisualDVM.Repository.BugReport.BugReportInterface;
|
||||
@@ -17,9 +19,7 @@ import _VisualDVM.Repository.EmailMessage;
|
||||
import _VisualDVM.Repository.RepositoryRefuseException;
|
||||
import _VisualDVM.Repository.RepositoryServer;
|
||||
import _VisualDVM.Repository.Subscribes.Subscriber;
|
||||
import _VisualDVM.Passes.All.ArchivesBackupPass;
|
||||
import _VisualDVM.Passes.All.UnzipFolderPass;
|
||||
import _VisualDVM.Passes.All.ZipFolderPass;
|
||||
import _VisualDVM.Utils;
|
||||
import javafx.util.Pair;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
@@ -31,6 +31,75 @@ import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
public static final String server_dvm_drv = "/home/DVM/dvm_current/dvm_sys/bin/dvm_drv";
|
||||
public static ZipFolderPass zip = new ZipFolderPass();
|
||||
public static UnzipFolderPass unzip = new UnzipFolderPass();
|
||||
public static ArchivesBackupPass backupSession = new ArchivesBackupPass();
|
||||
//-
|
||||
public static Vector<Pair<Machine, User>> storages =
|
||||
new Vector<>(Arrays.asList(
|
||||
new Pair<>(
|
||||
new Machine("titan", "dvmh.keldysh.ru", 22, MachineType.Server),
|
||||
new User("dvmuser1", "mprit_2011"))
|
||||
/*
|
||||
new Pair<>(
|
||||
new Machine("k100", "k100.kiam.ru", 22, MachineType.Server),
|
||||
new User("dvmuser1", "mprit_2011"))
|
||||
*/
|
||||
)
|
||||
);
|
||||
//-
|
||||
protected Thread backUp = new Thread(() -> {
|
||||
while (true) {
|
||||
try {
|
||||
//-------------------------------------
|
||||
Calendar rightNow = Calendar.getInstance();
|
||||
int year = rightNow.get(Calendar.YEAR);
|
||||
int month = rightNow.get(Calendar.MONTH);
|
||||
int day = rightNow.get(Calendar.DAY_OF_MONTH);
|
||||
int hour = rightNow.get(Calendar.HOUR_OF_DAY);
|
||||
int minute = rightNow.get(Calendar.MINUTE);
|
||||
if ((hour == Global.properties.BackupHour) && (minute == Global.properties.BackupMinute)) {
|
||||
//определить имя папки с багом.
|
||||
String backUpName = year + "_" + (month + 1) + "_" + (day);
|
||||
File todayBackUp = Paths.get(Global.DataBackUpsDirectory.getAbsolutePath(), backUpName).toFile();
|
||||
File todayBackUpArchive = Paths.get(Global.DataBackUpsDirectory.getAbsolutePath(), backUpName + ".zip").toFile();
|
||||
//-
|
||||
File bugsDBBackUp = Paths.get(todayBackUp.getAbsolutePath(), db.getFile().getName()).toFile();
|
||||
File bugsArchives = Paths.get(todayBackUp.getAbsolutePath(), "Bugs.zip").toFile();
|
||||
//-
|
||||
// Чистка старых бекапов на самом сервере.
|
||||
Utils.keepNewFiles(todayBackUp.getParentFile(), 2);
|
||||
if (!todayBackUpArchive.exists()) {
|
||||
FileUtils.forceMkdir(todayBackUp);
|
||||
Files.copy(db.getFile().toPath(), bugsDBBackUp.toPath());
|
||||
//-
|
||||
zip.Do("Bugs", bugsArchives.getAbsolutePath());
|
||||
zip.Do(todayBackUp.getAbsolutePath(), todayBackUpArchive.getAbsolutePath());
|
||||
Utils_.forceDeleteWithCheck(todayBackUp);
|
||||
//-
|
||||
for (Pair<Machine, User> cred : storages) {
|
||||
backupSession.Do(cred.getKey(), cred.getValue(),
|
||||
todayBackUpArchive
|
||||
);
|
||||
}
|
||||
//bonus backup
|
||||
if (rightNow.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY) {
|
||||
EmailMessage message = new EmailMessage(
|
||||
"db backup",
|
||||
"копия баз данных журнала ошибок",
|
||||
new Vector<>()
|
||||
);
|
||||
Email(message, db.getFile());
|
||||
}
|
||||
}
|
||||
}
|
||||
//-------------------------------------
|
||||
Thread.sleep(60000);
|
||||
} catch (Exception ex) {
|
||||
Utils_.MainLog.PrintException(ex);
|
||||
}
|
||||
}
|
||||
});
|
||||
public ComponentsServer() {
|
||||
super(BugReportsDatabase.class);
|
||||
}
|
||||
@@ -41,13 +110,13 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
@Override
|
||||
protected void checkTargets(EmailMessage message_in) {
|
||||
Vector<String> checkedTargets = new Vector<>();
|
||||
for (String email: message_in.targets){
|
||||
if (db.subscribers.containsKey(email)){
|
||||
for (String email : message_in.targets) {
|
||||
if (db.subscribers.containsKey(email)) {
|
||||
Subscriber subscriber = db.subscribers.get(email);
|
||||
if (subscriber.mailOn>0){
|
||||
if (subscriber.mailOn > 0) {
|
||||
checkedTargets.add(email);
|
||||
}
|
||||
}else checkedTargets.add(email); //если почта не зарегана значит это мейл с регистрацией.
|
||||
} else checkedTargets.add(email); //если почта не зарегана значит это мейл с регистрацией.
|
||||
}
|
||||
message_in.targets = checkedTargets;
|
||||
}
|
||||
@@ -352,73 +421,4 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
protected void startAdditionalThreads() {
|
||||
backUp.start();
|
||||
}
|
||||
public static ZipFolderPass zip = new ZipFolderPass();
|
||||
public static UnzipFolderPass unzip = new UnzipFolderPass();
|
||||
public static ArchivesBackupPass backupSession = new ArchivesBackupPass();
|
||||
//-
|
||||
public static Vector<Pair<Machine, User>> storages =
|
||||
new Vector<>(Arrays.asList(
|
||||
new Pair<>(
|
||||
new Machine("titan", "dvmh.keldysh.ru", 22, MachineType.Server),
|
||||
new User("dvmuser1", "mprit_2011"))
|
||||
/*
|
||||
new Pair<>(
|
||||
new Machine("k100", "k100.kiam.ru", 22, MachineType.Server),
|
||||
new User("dvmuser1", "mprit_2011"))
|
||||
*/
|
||||
)
|
||||
);
|
||||
//-
|
||||
protected Thread backUp = new Thread(() -> {
|
||||
while (true) {
|
||||
try {
|
||||
//-------------------------------------
|
||||
Calendar rightNow = Calendar.getInstance();
|
||||
int year = rightNow.get(Calendar.YEAR);
|
||||
int month = rightNow.get(Calendar.MONTH);
|
||||
int day = rightNow.get(Calendar.DAY_OF_MONTH);
|
||||
int hour = rightNow.get(Calendar.HOUR_OF_DAY);
|
||||
int minute = rightNow.get(Calendar.MINUTE);
|
||||
if ((hour == Global.properties.BackupHour) && (minute == Global.properties.BackupMinute)) {
|
||||
//определить имя папки с багом.
|
||||
String backUpName = year + "_" + (month + 1) + "_" + (day);
|
||||
File todayBackUp = Paths.get(Global.DataBackUpsDirectory.getAbsolutePath(), backUpName).toFile();
|
||||
File todayBackUpArchive = Paths.get(Global.DataBackUpsDirectory.getAbsolutePath(), backUpName + ".zip").toFile();
|
||||
//-
|
||||
File bugsDBBackUp = Paths.get(todayBackUp.getAbsolutePath(), db.getFile().getName()).toFile();
|
||||
File bugsArchives = Paths.get(todayBackUp.getAbsolutePath(), "Bugs.zip").toFile();
|
||||
//-
|
||||
// Чистка старых бекапов на самом сервере.
|
||||
Utils.keepNewFiles(todayBackUp.getParentFile(), 2);
|
||||
if (!todayBackUpArchive.exists()) {
|
||||
FileUtils.forceMkdir(todayBackUp);
|
||||
Files.copy(db.getFile().toPath(), bugsDBBackUp.toPath());
|
||||
//-
|
||||
zip.Do("Bugs", bugsArchives.getAbsolutePath());
|
||||
zip.Do(todayBackUp.getAbsolutePath(), todayBackUpArchive.getAbsolutePath());
|
||||
Utils_.forceDeleteWithCheck(todayBackUp);
|
||||
//-
|
||||
for (Pair<Machine, User> cred : storages) {
|
||||
backupSession.Do(cred.getKey(), cred.getValue(),
|
||||
todayBackUpArchive
|
||||
);
|
||||
}
|
||||
//bonus backup
|
||||
if (rightNow.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY) {
|
||||
EmailMessage message = new EmailMessage(
|
||||
"db backup",
|
||||
"копия баз данных журнала ошибок",
|
||||
new Vector<>()
|
||||
);
|
||||
Email(message, db.getFile());
|
||||
}
|
||||
}
|
||||
}
|
||||
//-------------------------------------
|
||||
Thread.sleep(60000);
|
||||
} catch (Exception ex) {
|
||||
Utils_.MainLog.PrintException(ex);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -87,6 +87,5 @@ public enum ServerCode {
|
||||
StartNecessaryMachines,
|
||||
GetSapforForCompilation,
|
||||
GetMaxSapforVersion,
|
||||
PerformAutoSapforTesting
|
||||
;
|
||||
PerformAutoSapforTesting;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package _VisualDVM.Repository.SubscriberRights;
|
||||
import Common.Database.Objects.DBObject;
|
||||
public class SubscriberRights extends DBObject {
|
||||
public class SubscriberRights extends DBObject {
|
||||
public String email; //почта
|
||||
|
||||
@Override
|
||||
public Object getPK() {
|
||||
return email;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
package _VisualDVM.Repository.SubscriberWorkspace;
|
||||
import _VisualDVM.Current;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import _VisualDVM.Global;
|
||||
public class SubscriberWorkspace extends iDBObject {
|
||||
@@ -9,10 +8,9 @@ public class SubscriberWorkspace extends iDBObject {
|
||||
public String path; //рабочая папка на машине
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return Global.mainModule.HasSubscriber()&&
|
||||
Global.mainModule.getSubscriber().address.equals(email)&&
|
||||
return Global.mainModule.HasSubscriber() &&
|
||||
Global.mainModule.getSubscriber().address.equals(email) &&
|
||||
(Global.mainModule.getAccount().isAdmin() || Global.mainModule.getAccount().email.equals(Global.mainModule.getSubscriber().address));
|
||||
}
|
||||
//-
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package _VisualDVM.Repository.SubscriberWorkspace;
|
||||
import _VisualDVM.Current;
|
||||
import Common.Database.Tables.iDBTable;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import _VisualDVM.Current;
|
||||
public class SubscriberWorkspaceDBTable extends iDBTable<SubscriberWorkspace> {
|
||||
public SubscriberWorkspaceDBTable() {
|
||||
super(SubscriberWorkspace.class);
|
||||
|
||||
@@ -25,9 +25,9 @@ public class Subscriber extends DBObject {
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
super.SynchronizeFields(src);
|
||||
Subscriber s = (Subscriber) src;
|
||||
name= s.name;
|
||||
name = s.name;
|
||||
role = s.role;
|
||||
mailOn= s.mailOn;
|
||||
mailOn = s.mailOn;
|
||||
}
|
||||
//как объект будут называть по внешним ключам.
|
||||
public String getFKName() {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package _VisualDVM.Repository.Subscribes;
|
||||
import _VisualDVM.Current;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.DBTable;
|
||||
import Common.Database.Tables.FKBehaviour;
|
||||
import Common.Database.Tables.FKCurrentObjectBehaviuor;
|
||||
import Common.Database.Tables.FKDataBehaviour;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
import _VisualDVM.Repository.SubscriberWorkspace.SubscriberWorkspace;
|
||||
@@ -51,7 +51,7 @@ public class SubsribersDBTable extends DBTable<String, Subscriber> {
|
||||
case 3:
|
||||
return object.role.getDescription();
|
||||
case 4:
|
||||
return (object.mailOn==0)?"выключена":"включена";
|
||||
return (object.mailOn == 0) ? "выключена" : "включена";
|
||||
}
|
||||
return object.name;
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@ import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class SubscriberFields implements DialogFields {
|
||||
private JPanel content;
|
||||
public JTextField tfName;
|
||||
public JTextField tfAddress;
|
||||
public JComboBox<AccountRole> cbRole;
|
||||
public JCheckBox cbMail;
|
||||
private JPanel content;
|
||||
@Override
|
||||
public Component getContent() {
|
||||
return content;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package _VisualDVM.Repository.Subscribes.UI;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
import _VisualDVM.Repository.Subscribes.Subscriber;
|
||||
public class SubscriberForm extends DBObjectDialog<Subscriber, SubscriberFields> {
|
||||
@@ -32,7 +32,7 @@ public class SubscriberForm extends DBObjectDialog<Subscriber, SubscriberFields>
|
||||
public void fillFields() {
|
||||
fields.tfName.setText(Result.name);
|
||||
fields.tfAddress.setText(Result.address);
|
||||
fields.cbMail.setSelected(Result.mailOn!=0);
|
||||
fields.cbMail.setSelected(Result.mailOn != 0);
|
||||
UI_.TrySelect(fields.cbRole, Result.role);
|
||||
}
|
||||
@Override
|
||||
@@ -46,7 +46,7 @@ public class SubscriberForm extends DBObjectDialog<Subscriber, SubscriberFields>
|
||||
public void ProcessResult() {
|
||||
Result.name = fields.tfName.getText();
|
||||
Result.address = fields.tfAddress.getText();
|
||||
Result.mailOn = fields.cbMail.isSelected()?1:0;
|
||||
Result.mailOn = fields.cbMail.isSelected() ? 1 : 0;
|
||||
Result.role = getSelectedRole();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user