no message
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
package _VisualDVM.Repository.BugReport;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Current;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Objects.rDBObject;
|
||||
@@ -64,7 +64,7 @@ public class BugReport extends rDBObject {
|
||||
project_version = version_in;
|
||||
visualiser_version = Global.visualiser.version;
|
||||
sapfor_version = Global.Components.get(ComponentType.Sapfor_F).version;
|
||||
sapfor_settings = ((GlobalDatabase)CommonUtils.db).settings.getSapforSettingsText();
|
||||
sapfor_settings = ((GlobalDatabase) Utils_.db).settings.getSapforSettingsText();
|
||||
percentage = 0;
|
||||
description = description_in;
|
||||
date = new Date().getTime();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package _VisualDVM.Repository.BugReport;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Utils.TextLog;
|
||||
@@ -61,7 +61,7 @@ public class BugReportInterface {
|
||||
return true;
|
||||
}
|
||||
public static String getMailTitlePrefix(BugReport object) {
|
||||
return "Ошибка " + CommonUtils.Brackets(object.id) + ", автор " + CommonUtils.Brackets(object.sender_name) + " : ";
|
||||
return "Ошибка " + Utils_.Brackets(object.id) + ", автор " + Utils_.Brackets(object.sender_name) + " : ";
|
||||
}
|
||||
public static Vector<String> getRecipients(BugReport object) {
|
||||
Vector<String> res = new Vector<>();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.Repository.Component;
|
||||
import Common.CommonConstants;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Constants;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import _VisualDVM.Global;
|
||||
@@ -28,7 +28,7 @@ public abstract class Component extends DBObject implements Loggable {
|
||||
VFileChooser fileChooser = null; ///для ручной установки.
|
||||
public VFileChooser getFileChooser() {
|
||||
return (fileChooser == null) ? (fileChooser = new VFileChooser("выбор файла для компонента " +
|
||||
CommonUtils.Brackets(getComponentType().getDescription()), CommonUtils.getExtension(getFile())))
|
||||
Utils_.Brackets(getComponentType().getDescription()), Utils_.getExtension(getFile())))
|
||||
: fileChooser;
|
||||
}
|
||||
//--
|
||||
@@ -87,7 +87,7 @@ public abstract class Component extends DBObject implements Loggable {
|
||||
}
|
||||
public boolean isValidVersion(TextLog Log, String desc) {
|
||||
if (version == CommonConstants.Nan) {
|
||||
Log.Writeln_("Не определена версия " + desc + " компонента " + CommonUtils.Brackets(getComponentType().getDescription()));
|
||||
Log.Writeln_("Не определена версия " + desc + " компонента " + Utils_.Brackets(getComponentType().getDescription()));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package _VisualDVM.Repository.Component;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Menus.DataMenuBar;
|
||||
import _VisualDVM.Visual.Menus.VisualiserMenu;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
@@ -12,7 +12,7 @@ public class ComponentsMenuBar extends DataMenuBar {
|
||||
new VisualiserMenu(
|
||||
"Восстановление предыдущей версии компонента", "/icons/Resurrect.png") {
|
||||
{
|
||||
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
add(Pass.passes.get(PassCode.ResurrectComponent).createMenuItem());
|
||||
add(Pass.passes.get(PassCode.ResurrectComponentFromServer).createMenuItem());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package _VisualDVM.Repository.Component;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Utils;
|
||||
|
||||
import java.text.DateFormat;
|
||||
@@ -51,7 +51,7 @@ public class Instruction extends Component {
|
||||
DateFormat df = new SimpleDateFormat("MMM dd yyyy HH:mm:ss", Locale.ENGLISH);
|
||||
date_text = df.format(getFile().lastModified());
|
||||
} catch (Exception e) {
|
||||
CommonUtils.MainLog.PrintException(e);
|
||||
Utils_.MainLog.PrintException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package _VisualDVM.Repository.Component;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Utils.Utils_;
|
||||
public abstract class OSDComponent extends Component {
|
||||
@Override
|
||||
public String getFileName() {
|
||||
return getComponentType().toString() + (CommonUtils.isWindows() ? ".exe" : "");
|
||||
return getComponentType().toString() + (Utils_.isWindows() ? ".exe" : "");
|
||||
}
|
||||
@Override
|
||||
public String getNewFileName() {
|
||||
return getComponentType().toString() + "_new" + (CommonUtils.isWindows() ? ".exe" : "");
|
||||
return getComponentType().toString() + "_new" + (Utils_.isWindows() ? ".exe" : "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.Repository.Component.PerformanceAnalyzer;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import analyzer.common.MessageJtoJ;
|
||||
@@ -103,7 +103,7 @@ public class PerformanceAnalyzer extends Component {
|
||||
return null;
|
||||
});
|
||||
Utils.startScript(Global.TempDirectory, Global.ComponentsDirectory, "analyzer",
|
||||
"java -jar -Dprism.order=sw "+ CommonUtils.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) {
|
||||
@@ -125,7 +125,7 @@ public class PerformanceAnalyzer extends Component {
|
||||
try {
|
||||
|
||||
Utils.startScript(Global.TempDirectory, Global.ComponentsDirectory, "analyzer",
|
||||
"java -jar -Dprism.order=sw "+ CommonUtils.DQuotes(Global.performanceAnalyzer.getFile()) + " --port "+ getPort());
|
||||
"java -jar -Dprism.order=sw "+ Utils_.DQuotes(Global.performanceAnalyzer.getFile()) + " --port "+ getPort());
|
||||
//-
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
@@ -144,7 +144,7 @@ public class PerformanceAnalyzer extends Component {
|
||||
}
|
||||
public void Start() {
|
||||
if (isActive) {
|
||||
CommonUI.Info("Анализатор уже запущен");
|
||||
UI_.Info("Анализатор уже запущен");
|
||||
} else {
|
||||
main_thread = new Thread(this::ServerBody);
|
||||
main_thread.start();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package _VisualDVM.Repository.Component.Sapfor;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Current;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@@ -47,7 +47,7 @@ public class MessagesServer {
|
||||
if (serverSocket != null)
|
||||
serverSocket.close();
|
||||
} catch (Exception e) {
|
||||
CommonUtils.MainLog.PrintException(e);
|
||||
Utils_.MainLog.PrintException(e);
|
||||
}
|
||||
}
|
||||
public int getPort() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package _VisualDVM.Repository.Component.Sapfor;
|
||||
import Common.CommonConstants;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.GlobalData.GlobalDatabase;
|
||||
@@ -140,8 +140,8 @@ public abstract class Sapfor extends OSDComponent {
|
||||
RunAnalysis("SPF_GetVersionAndBuildDate", -1, "", "");
|
||||
Visualizer_2.UnpackVersionInfo(this, getResult());
|
||||
} catch (Exception e) {
|
||||
CommonUtils.MainLog.PrintException(e);
|
||||
CommonUI.Error("Не удалось получить версию компонента " + CommonUtils.DQuotes(getComponentType().getDescription()));
|
||||
Utils_.MainLog.PrintException(e);
|
||||
UI_.Error("Не удалось получить версию компонента " + Utils_.DQuotes(getComponentType().getDescription()));
|
||||
}
|
||||
}
|
||||
public abstract String getUpdateCommand();
|
||||
@@ -169,9 +169,9 @@ public abstract class Sapfor extends OSDComponent {
|
||||
RunAnalysis("SPF_StatisticAnalyzer",
|
||||
-1,
|
||||
"",
|
||||
CommonUtils.DQuotes(src.getAbsolutePath()) +
|
||||
Utils_.DQuotes(src.getAbsolutePath()) +
|
||||
" "
|
||||
+ CommonUtils.DQuotes(dst.getAbsolutePath())
|
||||
+ Utils_.DQuotes(dst.getAbsolutePath())
|
||||
);
|
||||
}
|
||||
public void Restart() throws Exception {
|
||||
@@ -185,7 +185,7 @@ public abstract class Sapfor extends OSDComponent {
|
||||
public void cd(File directory_in) throws Exception {
|
||||
if (RunAnalysis("SPF_ChangeDirectory", -1, directory_in.getAbsolutePath(), "") != 0)
|
||||
throw new PassException("Sapfor: Не удалось перейти в папку "
|
||||
+ CommonUtils.Brackets(directory_in.getAbsolutePath()) +
|
||||
+ Utils_.Brackets(directory_in.getAbsolutePath()) +
|
||||
"\n" + "Код возврата: " + getErrorCode());
|
||||
}
|
||||
public String getResult() {
|
||||
@@ -257,7 +257,7 @@ public abstract class Sapfor extends OSDComponent {
|
||||
}
|
||||
} else if (z == 1) file_text = sub;
|
||||
else if (z == 2) {
|
||||
ModifiedFiles.put(CommonUtils.toW(sub), file_text);
|
||||
ModifiedFiles.put(Utils_.toW(sub), file_text);
|
||||
file_text = null;
|
||||
}
|
||||
codeIdx += count;
|
||||
@@ -336,7 +336,7 @@ public abstract class Sapfor extends OSDComponent {
|
||||
Utils.WriteToFile(file, OldFiles.get(name));
|
||||
}
|
||||
OldFiles.clear();
|
||||
} else CommonUI.Info("Сохранение файлов отсутствует.");
|
||||
} else UI_.Info("Сохранение файлов отсутствует.");
|
||||
}
|
||||
if (cuf != null)
|
||||
Pass.passes.get(PassCode.OpenCurrentFile).Do(cuf);
|
||||
@@ -353,20 +353,20 @@ public abstract class Sapfor extends OSDComponent {
|
||||
for (PassCode code : getAnalysesCodes())
|
||||
(Pass.passes.get(code)).Reset();
|
||||
//------------------------------------------------------------------------------------------>>>> пакетный режим.
|
||||
if (CommonUI.isActive()) {
|
||||
if (UI_.isActive()) {
|
||||
Pass.passes.get(PassCode.Precompilation).Reset();
|
||||
Pass.passes.get(PassCode.SPF_GetGCovInfo).Reset();
|
||||
}
|
||||
Global.enable_text_changed = false;
|
||||
Global.transformationPermission = TransformationPermission.None;
|
||||
if ((CommonUI.isActive()) && (UI.HasMainWindow()) && (UI.getVersionsWindow() != null))
|
||||
if ((UI_.isActive()) && (UI.HasMainWindow()) && (UI.getVersionsWindow() != null))
|
||||
UI.getVersionsWindow().BlockVariants();
|
||||
}
|
||||
//--------------------------------------------------------------------------->>
|
||||
//временный (?) проход, по тихому получить размерность теста, предварительно выполнив тихий парс.
|
||||
//тут все одноразовое. считаем что таблицы бд уже заполнены как надо.
|
||||
public LanguageStyle getStyle() throws Exception {
|
||||
return ((GlobalDatabase)CommonUtils.db).settings.get(SettingName.FREE_FORM).toBoolean() ? LanguageStyle.free : LanguageStyle.fixed;
|
||||
return ((GlobalDatabase) Utils_.db).settings.get(SettingName.FREE_FORM).toBoolean() ? LanguageStyle.free : LanguageStyle.fixed;
|
||||
}
|
||||
//----------
|
||||
public static Vector<PassCode> getScenariosCodes() {
|
||||
@@ -411,12 +411,12 @@ public abstract class Sapfor extends OSDComponent {
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
public String getConsoleFlags() throws Exception {
|
||||
Vector<String> res = new Vector<>();
|
||||
if (((GlobalDatabase)CommonUtils.db).settings.get(SettingName.FREE_FORM).toBoolean())
|
||||
if (((GlobalDatabase) Utils_.db).settings.get(SettingName.FREE_FORM).toBoolean())
|
||||
res.add("-f90");
|
||||
if (((GlobalDatabase)CommonUtils.db).settings.get(SettingName.STATIC_SHADOW_ANALYSIS).toBoolean())
|
||||
if (((GlobalDatabase) Utils_.db).settings.get(SettingName.STATIC_SHADOW_ANALYSIS).toBoolean())
|
||||
res.add("-sh");
|
||||
res.add("-shwidth " + ((GlobalDatabase)CommonUtils.db).settings.get(SettingName.MAX_SHADOW_WIDTH));
|
||||
if (((GlobalDatabase)CommonUtils.db).settings.get(SettingName.KEEP_SPF_DIRECTIVES).toBoolean())
|
||||
res.add("-shwidth " + ((GlobalDatabase) Utils_.db).settings.get(SettingName.MAX_SHADOW_WIDTH));
|
||||
if (((GlobalDatabase) Utils_.db).settings.get(SettingName.KEEP_SPF_DIRECTIVES).toBoolean())
|
||||
res.add("-keepSPF");
|
||||
return String.join(" ", res);
|
||||
}
|
||||
@@ -457,16 +457,16 @@ public abstract class Sapfor extends OSDComponent {
|
||||
Utils.delete_with_check(outputFile);
|
||||
Utils.delete_with_check(errorsFile);
|
||||
//---
|
||||
File file = new File(data_workspace, name + (CommonUtils.isWindows() ? ".bat" : ".sh"));
|
||||
File file = new File(data_workspace, name + (Utils_.isWindows() ? ".bat" : ".sh"));
|
||||
FileUtils.write(file,
|
||||
CommonUtils.DQuotes(sapfor_drv)
|
||||
Utils_.DQuotes(sapfor_drv)
|
||||
+ (flags.isEmpty() ? "" : (" " + flags))
|
||||
+ " -noLogo"
|
||||
+ " " + command +
|
||||
" 1>" +
|
||||
CommonUtils.DQuotes(outputFile.getAbsolutePath()) +
|
||||
Utils_.DQuotes(outputFile.getAbsolutePath()) +
|
||||
" 2>" +
|
||||
CommonUtils.DQuotes(errorsFile.getAbsolutePath()),
|
||||
Utils_.DQuotes(errorsFile.getAbsolutePath()),
|
||||
Charset.defaultCharset());
|
||||
if (!file.setExecutable(true))
|
||||
throw new Exception("Не удалось сделать файл скрипта " + name + " исполняемым!");
|
||||
@@ -480,8 +480,8 @@ public abstract class Sapfor extends OSDComponent {
|
||||
exit_code = process.waitFor();
|
||||
flag = true;
|
||||
} catch (Exception ex) {
|
||||
CommonUtils.MainLog.PrintException(ex);
|
||||
CommonUtils.sleep(1000);
|
||||
Utils_.MainLog.PrintException(ex);
|
||||
Utils_.sleep(1000);
|
||||
}
|
||||
}
|
||||
while (!flag);
|
||||
@@ -531,7 +531,7 @@ public abstract class Sapfor extends OSDComponent {
|
||||
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" + (CommonUtils.isWindows() ? ".exe" : ""));
|
||||
temp_copy = Utils.getTempFileName("SAPFOR" + (Utils_.isWindows() ? ".exe" : ""));
|
||||
FileUtils.copyFile(src, temp_copy);
|
||||
temp_copy.setExecutable(true);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package _VisualDVM.Repository.Component;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.GlobalData.GlobalDatabase;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Settings.SettingName;
|
||||
@@ -76,8 +76,8 @@ public class Visualiser extends Component {
|
||||
System.exit(0);
|
||||
}
|
||||
public File getWorkspace() {
|
||||
if (!((GlobalDatabase)CommonUtils.db).settings.get(SettingName.Workspace).toString().isEmpty()) {
|
||||
File workspace = new File(((GlobalDatabase)CommonUtils.db).settings.get(SettingName.Workspace).toString());
|
||||
if (!((GlobalDatabase) Utils_.db).settings.get(SettingName.Workspace).toString().isEmpty()) {
|
||||
File workspace = new File(((GlobalDatabase) Utils_.db).settings.get(SettingName.Workspace).toString());
|
||||
if (workspace.exists())
|
||||
return workspace;
|
||||
else
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.Repository.Component;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Utils;
|
||||
import Common.Passes.PassException;
|
||||
@@ -40,7 +40,7 @@ public class Visualizer_2 extends OSDComponent {
|
||||
}
|
||||
@Override
|
||||
public String getHome() {
|
||||
return CommonUtils.getHomePath();
|
||||
return Utils_.getHomePath();
|
||||
}
|
||||
@Override
|
||||
public void GetVersionInfo() {
|
||||
@@ -48,7 +48,7 @@ public class Visualizer_2 extends OSDComponent {
|
||||
Command("get_version: ");
|
||||
UnpackVersionInfo(this, response);
|
||||
} catch (Exception e) {
|
||||
CommonUtils.MainLog.PrintException(e);
|
||||
Utils_.MainLog.PrintException(e);
|
||||
}
|
||||
}
|
||||
public void refreshPid(){
|
||||
@@ -58,7 +58,7 @@ public class Visualizer_2 extends OSDComponent {
|
||||
PID = response;
|
||||
// UI.Info("SERVER PID = "+Utils.Brackets(PID));
|
||||
} catch (Exception e) {
|
||||
CommonUtils.MainLog.PrintException(e);
|
||||
Utils_.MainLog.PrintException(e);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@@ -66,7 +66,7 @@ public class Visualizer_2 extends OSDComponent {
|
||||
super.Update();
|
||||
SendRequest("update_server: ");
|
||||
ReplaceOldFile();
|
||||
CommonUI.Info("Сервер успешно обновлен.\n" +
|
||||
UI_.Info("Сервер успешно обновлен.\n" +
|
||||
"Визуализатор завершает работу.\n" +
|
||||
"Для продолжения перезапустите визуализатор вручную.");
|
||||
System.exit(0);
|
||||
@@ -120,7 +120,7 @@ public class Visualizer_2 extends OSDComponent {
|
||||
case "NOT_FOUND":
|
||||
case "WRONG":
|
||||
case "SEG_FAULT":
|
||||
throw new PassException("Команда серверу SAPFOR вернула " + CommonUtils.Brackets(response));
|
||||
throw new PassException("Команда серверу SAPFOR вернула " + Utils_.Brackets(response));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package _VisualDVM.Repository;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Utils.Utils_;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.Serializable;
|
||||
@@ -18,6 +18,6 @@ public class EmailMessage implements Serializable {
|
||||
targets.addAll(targets_in);
|
||||
}
|
||||
public void addAttachement(File f) throws Exception {
|
||||
files.put(f.getName(), CommonUtils.fileToBytes(f));
|
||||
files.put(f.getName(), Utils_.fileToBytes(f));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package _VisualDVM.Repository;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
||||
import Common.Passes.PassException;
|
||||
@@ -21,7 +21,7 @@ public abstract class RepositoryClient {
|
||||
try {
|
||||
if (isPrintOn()) {
|
||||
FileWriter testLog = new FileWriter(getClass().getSimpleName() + "_Log.txt", true);
|
||||
String dmessage = CommonUtils.Brackets(new Date()) + " " + message;
|
||||
String dmessage = Utils_.Brackets(new Date()) + " " + message;
|
||||
System.out.println(dmessage);
|
||||
testLog.write(dmessage + "\n");
|
||||
testLog.close();
|
||||
@@ -59,7 +59,7 @@ public abstract class RepositoryClient {
|
||||
return ServerCommand(code_in, "", null);
|
||||
}
|
||||
protected void ServerConnectionError(ServerCode code_in, String logText) throws Exception {
|
||||
throw new PassException(CommonUtils.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(){
|
||||
@@ -68,7 +68,7 @@ public abstract class RepositoryClient {
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
CommonUtils.sleep(getSleepMillis());
|
||||
Utils_.sleep(getSleepMillis());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package _VisualDVM.Repository;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Constants;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Database;
|
||||
@@ -74,7 +74,7 @@ public abstract class RepositoryServer<D extends Database> {
|
||||
if (printOn) {
|
||||
try {
|
||||
Log = new FileWriter("Log.txt", true);
|
||||
String dmessage = CommonUtils.Brackets("SESSION -> ") + new Date() +
|
||||
String dmessage = Utils_.Brackets("SESSION -> ") + new Date() +
|
||||
" " + message;
|
||||
Log.write(dmessage + "\n");
|
||||
Log.close();
|
||||
@@ -102,7 +102,7 @@ public abstract class RepositoryServer<D extends Database> {
|
||||
LinkedHashMap<String, File> innerFiles = new LinkedHashMap<>();
|
||||
for (String aName : message_in.files.keySet()) {
|
||||
File f = Utils.getTempFileName(aName);
|
||||
CommonUtils.bytesToFile(message_in.files.get(aName), f);
|
||||
Utils_.bytesToFile(message_in.files.get(aName), f);
|
||||
innerFiles.put(aName, f);
|
||||
}
|
||||
Vector<String> targets_ = new Vector<>(message_in.targets);
|
||||
@@ -151,9 +151,9 @@ public abstract class RepositoryServer<D extends Database> {
|
||||
Transport.send(message);
|
||||
done = true;
|
||||
} catch (Exception ex) {
|
||||
System.out.println("Исключение во время отправки сообщения абоненту " + CommonUtils.Brackets(target));
|
||||
System.out.println("Исключение во время отправки сообщения абоненту " + Utils_.Brackets(target));
|
||||
ex.printStackTrace();
|
||||
CommonUtils.sleep(1000);
|
||||
Utils_.sleep(1000);
|
||||
} finally {
|
||||
attempts--;
|
||||
}
|
||||
@@ -210,20 +210,20 @@ public abstract class RepositoryServer<D extends Database> {
|
||||
switch (code) {
|
||||
//<editor-fold desc="файлы и почта">
|
||||
case ReadFile:
|
||||
Print("Отправить клиенту текст файла по пути " + CommonUtils.Brackets(request.arg));
|
||||
Print("Отправить клиенту текст файла по пути " + Utils_.Brackets(request.arg));
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK, "", Utils.ReadAllText(new File(request.arg)));
|
||||
break;
|
||||
case SendFile:
|
||||
//нам пришел файл.
|
||||
Print("Получить от клиента файл, и распаковать его по пути " + CommonUtils.Brackets(request.arg));
|
||||
Print("Получить от клиента файл, и распаковать его по пути " + Utils_.Brackets(request.arg));
|
||||
request.Unpack(); //распаковка идет по его аргу-пути назначения
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
break;
|
||||
case ReceiveFile:
|
||||
Print("Отправить клиенту файл по пути " + CommonUtils.Brackets(request.arg));
|
||||
Print("Отправить клиенту файл по пути " + Utils_.Brackets(request.arg));
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
File file = new File(request.arg);
|
||||
response.object = file.exists() ? CommonUtils.fileToBytes(file) : null;
|
||||
response.object = file.exists() ? Utils_.fileToBytes(file) : null;
|
||||
break;
|
||||
case Email:
|
||||
Print("Отправка сообщения электронной почты");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.Repository.Server;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.GlobalData.Account.Account;
|
||||
@@ -99,9 +99,9 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
Print("Отправить клиенту архив всех архивов баг репортов");
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
ZipFolderPass zip = new ZipFolderPass();
|
||||
File archives = new File(CommonUtils.getDateName("Bugs"));
|
||||
File archives = new File(Utils_.getDateName("Bugs"));
|
||||
if (zip.Do("Bugs", archives.getAbsolutePath())) {
|
||||
response.object = CommonUtils.fileToBytes(archives);
|
||||
response.object = Utils_.fileToBytes(archives);
|
||||
Print("Архив успешно запакован");
|
||||
} else throw new RepositoryRefuseException("Не удалось запаковать архивы");
|
||||
break;
|
||||
@@ -135,24 +135,24 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
case ReceiveBugReportsDatabase:
|
||||
Print("Получить базу данных баг репортов");
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
response.object = CommonUtils.fileToBytes(db.getFile());
|
||||
response.object = Utils_.fileToBytes(db.getFile());
|
||||
break;
|
||||
case ReceiveBugReport:
|
||||
Print("Скачать баг репорт по ключу " + request.arg);
|
||||
File bugArchive = Paths.get(CommonUtils.getHomePath(), "Bugs", request.arg).toFile();
|
||||
File bugArchive = Paths.get(Utils_.getHomePath(), "Bugs", request.arg).toFile();
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
response.object = CommonUtils.fileToBytes(bugArchive);
|
||||
response.object = Utils_.fileToBytes(bugArchive);
|
||||
break;
|
||||
case SendBugReport:
|
||||
Print("Отправить баг репорт " + request.arg);
|
||||
File bugArchive1 = Paths.get(CommonUtils.getHomePath(), "Bugs", request.arg).toFile();
|
||||
CommonUtils.bytesToFile((byte[]) request.object, bugArchive1);
|
||||
File bugArchive1 = Paths.get(Utils_.getHomePath(), "Bugs", request.arg).toFile();
|
||||
Utils_.bytesToFile((byte[]) request.object, bugArchive1);
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
break;
|
||||
//</editor-fold>
|
||||
case GetComponentsBackups:
|
||||
Print("Получить список сохраненных версий компонента " + request.arg);
|
||||
File backupsDirectory = Paths.get(CommonUtils.getHomePath(), "Components", request.arg, "Backups").toFile();
|
||||
File backupsDirectory = Paths.get(Utils_.getHomePath(), "Components", request.arg, "Backups").toFile();
|
||||
//--
|
||||
if (backupsDirectory.exists()) {
|
||||
File[] files = backupsDirectory.listFiles(File::isFile);
|
||||
@@ -182,9 +182,9 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
3
|
||||
);
|
||||
Print("Опубликовать компонент " + sComponentType);
|
||||
File componentFile = Paths.get(CommonUtils.getHomePath(), "Components", sComponentType, componentFileName).toFile();
|
||||
File versionFile = Paths.get(CommonUtils.getHomePath(), "Components", sComponentType, "version.txt").toFile();
|
||||
File backupsFolder = Paths.get(CommonUtils.getHomePath(), "Components", sComponentType, "Backups").toFile();
|
||||
File componentFile = Paths.get(Utils_.getHomePath(), "Components", sComponentType, componentFileName).toFile();
|
||||
File versionFile = Paths.get(Utils_.getHomePath(), "Components", sComponentType, "version.txt").toFile();
|
||||
File backupsFolder = Paths.get(Utils_.getHomePath(), "Components", sComponentType, "Backups").toFile();
|
||||
//0 архивация старой версии, если она есть.
|
||||
if (componentFile.exists()) {
|
||||
String versionText = "";
|
||||
@@ -200,11 +200,11 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
FileUtils.moveFile(componentFile, backupFile);
|
||||
}
|
||||
//1 распаковка компонента
|
||||
CommonUtils.bytesToFile((byte[]) request.object, componentFile);
|
||||
Utils_.bytesToFile((byte[]) request.object, componentFile);
|
||||
//2 запись версии компонента
|
||||
FileUtils.writeStringToFile(versionFile, sComponentVersion);
|
||||
//3 запись в журнал компонента
|
||||
File changesLog = Paths.get(CommonUtils.getHomePath(), "Components", sComponentType, "changes.txt").toFile();
|
||||
File changesLog = Paths.get(Utils_.getHomePath(), "Components", sComponentType, "changes.txt").toFile();
|
||||
FileWriter writer = new FileWriter(changesLog.getAbsolutePath(), true);
|
||||
BufferedWriter bufferWriter = new BufferedWriter(writer);
|
||||
bufferWriter.write(componentChangeRecord);
|
||||
@@ -217,11 +217,11 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
String sComponentType_ = packed_[0];
|
||||
String sComponentMinimalVersion = packed_[1];
|
||||
Print("Поднять минимальную версию компонента " + sComponentType_);
|
||||
File minimal_versionFile = Paths.get(CommonUtils.getHomePath(), "Components", sComponentType_, "minimal_version.txt").toFile();
|
||||
File minimal_versionFile = Paths.get(Utils_.getHomePath(), "Components", sComponentType_, "minimal_version.txt").toFile();
|
||||
FileUtils.writeStringToFile(minimal_versionFile, sComponentMinimalVersion);
|
||||
//-
|
||||
//3 запись в журнал компонента
|
||||
File changesLog_ = Paths.get(CommonUtils.getHomePath(), "Components", sComponentType_, "changes.txt").toFile();
|
||||
File changesLog_ = Paths.get(Utils_.getHomePath(), "Components", sComponentType_, "changes.txt").toFile();
|
||||
FileWriter writer_ = new FileWriter(changesLog_.getAbsolutePath(), true);
|
||||
BufferedWriter bufferWriter_ = new BufferedWriter(writer_);
|
||||
bufferWriter_.write("Минимальная версия поднята до " + sComponentMinimalVersion + "\n");
|
||||
@@ -233,10 +233,10 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
case ReceiveComponent:
|
||||
String[] packed1 = request.arg.split("\n");
|
||||
//тип/имя файла
|
||||
File componentFile1 = Paths.get(CommonUtils.getHomePath(), "Components", packed1[0], packed1[1]).toFile();
|
||||
File componentFile1 = Paths.get(Utils_.getHomePath(), "Components", packed1[0], packed1[1]).toFile();
|
||||
Print("Получить компонент " + packed1[0]);
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
response.object = CommonUtils.fileToBytes(componentFile1);
|
||||
response.object = Utils_.fileToBytes(componentFile1);
|
||||
break;
|
||||
default:
|
||||
throw new RepositoryRefuseException("Неподдерживаемый код: " + code);
|
||||
@@ -246,8 +246,8 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
LinkedHashMap<ComponentType, String> response_actual_versions_ = new LinkedHashMap<>();
|
||||
for (String sType : types) {
|
||||
ComponentType componentType = ComponentType.valueOf(sType);
|
||||
File vFile = Paths.get(CommonUtils.getHomePath(), "Components", sType, "version.txt").toFile();
|
||||
String v_string = CommonUtils.removeCharacters(
|
||||
File vFile = Paths.get(Utils_.getHomePath(), "Components", sType, "version.txt").toFile();
|
||||
String v_string = Utils_.removeCharacters(
|
||||
Utils.ReadAllText(vFile),
|
||||
"\n", "\r"
|
||||
);
|
||||
@@ -262,8 +262,8 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
LinkedHashMap<ComponentType, String> response_minimal_versions_ = new LinkedHashMap<>();
|
||||
for (String sType : types_) {
|
||||
ComponentType componentType = ComponentType.valueOf(sType);
|
||||
File vFile = Paths.get(CommonUtils.getHomePath(), "Components", sType, "minimal_version.txt").toFile();
|
||||
String mv_string = CommonUtils.removeCharacters(
|
||||
File vFile = Paths.get(Utils_.getHomePath(), "Components", sType, "minimal_version.txt").toFile();
|
||||
String mv_string = Utils_.removeCharacters(
|
||||
Utils.ReadAllText(vFile),
|
||||
"\n", "\r"
|
||||
);
|
||||
@@ -275,7 +275,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
case GetComponentChangesLog:
|
||||
Print("Получить журнал изменений компонента " + request.arg);
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
response.object = CommonUtils.fileToBytes(Paths.get(CommonUtils.getHomePath(), "Components", request.arg, "changes.txt").toFile());
|
||||
response.object = Utils_.fileToBytes(Paths.get(Utils_.getHomePath(), "Components", request.arg, "changes.txt").toFile());
|
||||
break;
|
||||
case CheckURLRegistered:
|
||||
Print("Проверить учетную запись на машине");
|
||||
@@ -308,17 +308,17 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
File program = Paths.get(project.getAbsolutePath(), fileName).toFile();
|
||||
//--
|
||||
File convertedProgram = Paths.get(program.getParent(),
|
||||
CommonUtils.getFileNameWithoutExtension(program) + ".DVMH." +
|
||||
Utils_.getFileNameWithoutExtension(program) + ".DVMH." +
|
||||
(projectLanguage.equals(LanguageName.fortran) ? "f" : "c")
|
||||
).toFile();
|
||||
String command =
|
||||
CommonUtils.DQuotes(server_dvm_drv) + " " +
|
||||
Utils_.DQuotes(server_dvm_drv) + " " +
|
||||
projectLanguage.getDVMCompile() + "dv " +
|
||||
options + " "
|
||||
+ CommonUtils.DQuotes(program.getName());
|
||||
+ Utils_.DQuotes(program.getName());
|
||||
//--
|
||||
File fileWorkspace = program.getParentFile();
|
||||
Process process = Utils.startScript(workspace, fileWorkspace, CommonUtils.getDateName("convert_script"), command);
|
||||
Process process = Utils.startScript(workspace, fileWorkspace, Utils_.getDateName("convert_script"), command);
|
||||
process.waitFor();
|
||||
String convertationOut = Utils.readAllOutput(process);
|
||||
convertationOut = convertationOut.replace(program.getName(), fileName); //для учета пути.
|
||||
@@ -337,7 +337,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
response.arg = String.join("\n", badFiles) + "|" + output;
|
||||
File resultArchive = new File(workspace, projectName + "_result.zip");
|
||||
if (ComponentsServer.zip.Do(project.getAbsolutePath(), resultArchive.getAbsolutePath())) {
|
||||
response.object = CommonUtils.fileToBytes(resultArchive);
|
||||
response.object = Utils_.fileToBytes(resultArchive);
|
||||
} else
|
||||
throw new RepositoryRefuseException("Внутренняя ошибка. Не удалось запаковать версию");
|
||||
//--
|
||||
@@ -417,7 +417,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
//-------------------------------------
|
||||
Thread.sleep(60000);
|
||||
} catch (Exception ex) {
|
||||
CommonUtils.MainLog.PrintException(ex);
|
||||
Utils_.MainLog.PrintException(ex);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package _VisualDVM.Repository.Server;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Utils.Utils_;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.Serializable;
|
||||
@@ -29,13 +29,13 @@ public class ServerExchangeUnit_2021 implements Serializable {
|
||||
}
|
||||
//--------
|
||||
public void Unpack() throws Exception {
|
||||
CommonUtils.bytesToFile((byte[]) object, new File(arg));
|
||||
Utils_.bytesToFile((byte[]) object, new File(arg));
|
||||
}
|
||||
public void Unpack(File file) throws Exception {
|
||||
CommonUtils.bytesToFile((byte[]) object, file);
|
||||
Utils_.bytesToFile((byte[]) object, file);
|
||||
}
|
||||
public void Print() {
|
||||
System.out.println("codeName=" + CommonUtils.Brackets(codeName));
|
||||
System.out.println("codeName=" + Utils_.Brackets(codeName));
|
||||
System.out.println(arg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.Repository.Subscribes.UI;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
@@ -21,11 +21,11 @@ public class SubscriberForm extends DBObjectDialog<Subscriber, SubscriberFields>
|
||||
public void validateFields() {
|
||||
if (fields.tfName.getText().isEmpty())
|
||||
Log.Writeln("Имя учётной записи не может быть пустым");
|
||||
CommonUtils.validateEmail(fields.tfAddress.getText(), Log);
|
||||
Utils_.validateEmail(fields.tfAddress.getText(), Log);
|
||||
if (fields.tfAddress.getText().isEmpty())
|
||||
Log.Writeln_("Адрес электронной почты не может быть пустым");
|
||||
if (!title_text.equals("Регистрация") && (fields.tfAddress.isEditable() && Global.componentsServer.db.subscribers.Data.containsKey(fields.tfAddress.getText()))) {
|
||||
Log.Writeln_("Адрес электронной почты " + CommonUtils.Brackets(fields.tfAddress.getText()) + " уже есть в списке.");
|
||||
Log.Writeln_("Адрес электронной почты " + Utils_.Brackets(fields.tfAddress.getText()) + " уже есть в списке.");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@@ -33,7 +33,7 @@ public class SubscriberForm extends DBObjectDialog<Subscriber, SubscriberFields>
|
||||
fields.tfName.setText(Result.name);
|
||||
fields.tfAddress.setText(Result.address);
|
||||
fields.cbMail.setSelected(Result.mailOn!=0);
|
||||
CommonUI.TrySelect(fields.cbRole, Result.role);
|
||||
UI_.TrySelect(fields.cbRole, Result.role);
|
||||
}
|
||||
@Override
|
||||
public void SetEditLimits() {
|
||||
|
||||
Reference in New Issue
Block a user