no message

This commit is contained in:
2024-10-07 14:22:52 +03:00
parent 6b1576461d
commit 61fc37b574
173 changed files with 960 additions and 1526 deletions

View File

@@ -1,8 +1,8 @@
package Repository.BugReport;
import Common.Utils.CommonUtils;
import Common_old.Current;
import _VisualDVM.Global;
import Common.Utils.TextLog;
import Common_old.Utils.Utils;
import Repository.RepositoryServer;
import Repository.Subscribes.Subscriber;
@@ -61,7 +61,7 @@ public class BugReportInterface {
return true;
}
public static String getMailTitlePrefix(BugReport object) {
return "Ошибка " + Utils.Brackets(object.id) + ", автор " + Utils.Brackets(object.sender_name) + " : ";
return "Ошибка " + CommonUtils.Brackets(object.id) + ", автор " + CommonUtils.Brackets(object.sender_name) + " : ";
}
public static Vector<String> getRecipients(BugReport object) {
Vector<String> res = new Vector<>();

View File

@@ -1,4 +1,6 @@
package Repository.Component;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import Common.Database.Objects.DBObject;
import _VisualDVM.Global;
@@ -14,9 +16,9 @@ import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
public abstract class Component extends DBObject implements Loggable {
public String date_text = Constants.dateNaN;
public long version = Constants.Nan;
public long actual_version = Constants.Nan;
public long minimal_version = Constants.Nan;
public long version = CommonConstants.Nan;
public long actual_version = CommonConstants.Nan;
public long minimal_version = CommonConstants.Nan;
//--
public String code = "";
public String actual_code = "";
@@ -26,7 +28,7 @@ public abstract class Component extends DBObject implements Loggable {
VFileChooser fileChooser = null; ///для ручной установки.
public VFileChooser getFileChooser() {
return (fileChooser == null) ? (fileChooser = new VFileChooser("выбор файла для компонента " +
Utils.Brackets(getComponentType().getDescription()), Utils.getExtension(getFile())))
CommonUtils.Brackets(getComponentType().getDescription()), CommonUtils.getExtension(getFile())))
: fileChooser;
}
//--
@@ -34,7 +36,7 @@ public abstract class Component extends DBObject implements Loggable {
return String.valueOf(version);
}
public void CheckIfNeedsUpdateOrPublish() {
if (actual_version != Constants.Nan) {
if (actual_version != CommonConstants.Nan) {
if (version < minimal_version) setState(ComponentState.Old_version);
else {
ComponentState new_state =
@@ -48,7 +50,7 @@ public abstract class Component extends DBObject implements Loggable {
setState(ComponentState.Undefined);
if (getFile().exists()) {
GetVersionInfo();
if (version == Constants.Nan)
if (version == CommonConstants.Nan)
setState(ComponentState.Unknown_version);
} else setState(ComponentState.Not_found);
}
@@ -84,8 +86,8 @@ public abstract class Component extends DBObject implements Loggable {
return getComponentType();
}
public boolean isValidVersion(TextLog Log, String desc) {
if (version == Constants.Nan) {
Log.Writeln_("Не определена версия " + desc + " компонента " + Utils.Brackets(getComponentType().getDescription()));
if (version == CommonConstants.Nan) {
Log.Writeln_("Не определена версия " + desc + " компонента " + CommonUtils.Brackets(getComponentType().getDescription()));
return false;
}
return true;

View File

@@ -1,4 +1,5 @@
package Repository.Component.PerformanceAnalyzer;
import Common.Utils.CommonUtils;
import Common_old.Current;
import _VisualDVM.Global;
import analyzer.common.MessageJtoJ;
@@ -102,7 +103,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 "+ CommonUtils.DQuotes(Global.performanceAnalyzer.getFile()) + " --port "+ getPort()+ " --version" );
//-
server_thread.join();
} catch (Exception ex) {
@@ -124,7 +125,7 @@ public class PerformanceAnalyzer extends Component {
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 "+ CommonUtils.DQuotes(Global.performanceAnalyzer.getFile()) + " --port "+ getPort());
//-
} catch (Exception ex) {
ex.printStackTrace();

View File

@@ -1,4 +1,6 @@
package Repository.Component.Sapfor;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import Common_old.Current;
import _VisualDVM.Global;
@@ -137,7 +139,7 @@ public abstract class Sapfor extends OSDComponent {
Visualizer_2.UnpackVersionInfo(this, getResult());
} catch (Exception e) {
Global.Log.PrintException(e);
UI.Error("Не удалось получить версию компонента " + Utils.DQuotes(getComponentType().getDescription()));
UI.Error("Не удалось получить версию компонента " + CommonUtils.DQuotes(getComponentType().getDescription()));
}
}
public abstract String getUpdateCommand();
@@ -165,9 +167,9 @@ public abstract class Sapfor extends OSDComponent {
RunAnalysis("SPF_StatisticAnalyzer",
-1,
"",
Utils.DQuotes(src.getAbsolutePath()) +
CommonUtils.DQuotes(src.getAbsolutePath()) +
" "
+ Utils.DQuotes(dst.getAbsolutePath())
+ CommonUtils.DQuotes(dst.getAbsolutePath())
);
}
public void Restart() throws Exception {
@@ -181,7 +183,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: Не удалось перейти в папку "
+ Utils.Brackets(directory_in.getAbsolutePath()) +
+ CommonUtils.Brackets(directory_in.getAbsolutePath()) +
"\n" + "Код возврата: " + getErrorCode());
}
public String getResult() {
@@ -253,7 +255,7 @@ public abstract class Sapfor extends OSDComponent {
}
} else if (z == 1) file_text = sub;
else if (z == 2) {
ModifiedFiles.put(Utils.toW(sub), file_text);
ModifiedFiles.put(CommonUtils.toW(sub), file_text);
file_text = null;
}
codeIdx += count;
@@ -444,7 +446,7 @@ public abstract class Sapfor extends OSDComponent {
Vector<String> resultLines
) throws Exception {
Process process = null;
int exit_code = Constants.Nan;
int exit_code = CommonConstants.Nan;
//---
File data_workspace = new File(workspace, Constants.data);
Utils.CheckDirectory(data_workspace);
@@ -455,14 +457,14 @@ public abstract class Sapfor extends OSDComponent {
//---
File file = new File(data_workspace, name + (Global.isWindows ? ".bat" : ".sh"));
FileUtils.write(file,
Utils.DQuotes(sapfor_drv)
CommonUtils.DQuotes(sapfor_drv)
+ (flags.isEmpty() ? "" : (" " + flags))
+ " -noLogo"
+ " " + command +
" 1>" +
Utils.DQuotes(outputFile.getAbsolutePath()) +
CommonUtils.DQuotes(outputFile.getAbsolutePath()) +
" 2>" +
Utils.DQuotes(errorsFile.getAbsolutePath()),
CommonUtils.DQuotes(errorsFile.getAbsolutePath()),
Charset.defaultCharset());
if (!file.setExecutable(true))
throw new Exception("Не удалось сделать файл скрипта " + name + " исполняемым!");
@@ -557,7 +559,7 @@ public abstract class Sapfor extends OSDComponent {
return false;
}
public static int readVersionFromCode(File versionFile) {
int res = Constants.Nan;
int res = CommonConstants.Nan;
if (versionFile.exists()) {
try {
List<String> data = FileUtils.readLines(versionFile);

View File

@@ -1,4 +1,5 @@
package Repository.Component;
import Common.Utils.CommonUtils;
import _VisualDVM.Global;
import Common_old.UI.UI;
import Common_old.Utils.Utils;
@@ -119,7 +120,7 @@ public class Visualizer_2 extends OSDComponent {
case "NOT_FOUND":
case "WRONG":
case "SEG_FAULT":
throw new PassException("Команда серверу SAPFOR вернула " + Utils.Brackets(response));
throw new PassException("Команда серверу SAPFOR вернула " + CommonUtils.Brackets(response));
default:
break;
}

View File

@@ -1,4 +1,5 @@
package Repository;
import Common.Utils.CommonUtils;
import Common_old.Utils.Utils;
import Repository.Server.ServerCode;
import Repository.Server.ServerExchangeUnit_2021;
@@ -21,7 +22,7 @@ public abstract class RepositoryClient {
try {
if (isPrintOn()) {
FileWriter testLog = new FileWriter(getClass().getSimpleName() + "_Log.txt", true);
String dmessage = Utils.Brackets(new Date()) + " " + message;
String dmessage = CommonUtils.Brackets(new Date()) + " " + message;
System.out.println(dmessage);
testLog.write(dmessage + "\n");
testLog.close();
@@ -59,7 +60,7 @@ 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(CommonUtils.Brackets(new Date().toString())+" Ошибка взаимодействия с сервером " + code_in);
}
public abstract void perform() throws Exception;
public void Perform(){

View File

@@ -1,4 +1,5 @@
package Repository;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import Common.Database.Objects.DBObject;
import Common.Database.Database;
@@ -73,7 +74,7 @@ public abstract class RepositoryServer<D extends Database> {
if (printOn) {
try {
Log = new FileWriter("Log.txt", true);
String dmessage = Utils.Brackets("SESSION -> ") + new Date() +
String dmessage = CommonUtils.Brackets("SESSION -> ") + new Date() +
" " + message;
Log.write(dmessage + "\n");
Log.close();
@@ -150,7 +151,7 @@ public abstract class RepositoryServer<D extends Database> {
Transport.send(message);
done = true;
} catch (Exception ex) {
System.out.println("Исключение во время отправки сообщения абоненту " + Utils.Brackets(target));
System.out.println("Исключение во время отправки сообщения абоненту " + CommonUtils.Brackets(target));
ex.printStackTrace();
Utils.sleep(1000);
} finally {
@@ -209,17 +210,17 @@ public abstract class RepositoryServer<D extends Database> {
switch (code) {
//<editor-fold desc="файлы и почта">
case ReadFile:
Print("Отправить клиенту текст файла по пути " + Utils.Brackets(request.arg));
Print("Отправить клиенту текст файла по пути " + CommonUtils.Brackets(request.arg));
response = new ServerExchangeUnit_2021(ServerCode.OK, "", Utils.ReadAllText(new File(request.arg)));
break;
case SendFile:
//нам пришел файл.
Print("Получить от клиента файл, и распаковать его по пути " + Utils.Brackets(request.arg));
Print("Получить от клиента файл, и распаковать его по пути " + CommonUtils.Brackets(request.arg));
request.Unpack(); //распаковка идет по его аргу-пути назначения
response = new ServerExchangeUnit_2021(ServerCode.OK);
break;
case ReceiveFile:
Print("Отправить клиенту файл по пути " + Utils.Brackets(request.arg));
Print("Отправить клиенту файл по пути " + CommonUtils.Brackets(request.arg));
response = new ServerExchangeUnit_2021(ServerCode.OK);
File file = new File(request.arg);
response.object = file.exists() ? Utils.packFile(file) : null;

View File

@@ -1,5 +1,6 @@
package Repository.Server;
import Common.Database.Objects.DBObject;
import Common.Utils.CommonUtils;
import _VisualDVM.Global;
import Common_old.Utils.Utils;
import GlobalData.Account.Account;
@@ -307,14 +308,14 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
File program = Paths.get(project.getAbsolutePath(), fileName).toFile();
//--
File convertedProgram = Paths.get(program.getParent(),
Utils.getFileNameWithoutExtension(program) + ".DVMH." +
CommonUtils.getFileNameWithoutExtension(program) + ".DVMH." +
(projectLanguage.equals(LanguageName.fortran) ? "f" : "c")
).toFile();
String command =
Utils.DQuotes(server_dvm_drv) + " " +
CommonUtils.DQuotes(server_dvm_drv) + " " +
projectLanguage.getDVMCompile() + "dv " +
options + " "
+ Utils.DQuotes(program.getName());
+ CommonUtils.DQuotes(program.getName());
//--
File fileWorkspace = program.getParentFile();
Process process = Utils.startScript(workspace, fileWorkspace, Utils.getDateName("convert_script"), command);

View File

@@ -1,4 +1,5 @@
package Repository.Server;
import Common.Utils.CommonUtils;
import Common_old.Utils.Utils;
import java.io.File;
@@ -35,7 +36,7 @@ public class ServerExchangeUnit_2021 implements Serializable {
Utils.unpackFile((byte[]) object, file);
}
public void Print() {
System.out.println("codeName=" + Utils.Brackets(codeName));
System.out.println("codeName=" + CommonUtils.Brackets(codeName));
System.out.println(arg);
}
}

View File

@@ -1,4 +1,5 @@
package Repository.Subscribes.UI;
import Common.Utils.CommonUtils;
import _VisualDVM.Global;
import Common_old.UI.UI;
import Common_old.UI.Windows.Dialog.DBObjectDialog;
@@ -25,7 +26,7 @@ public class SubscriberForm extends DBObjectDialog<Subscriber, SubscriberFields>
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_("Адрес электронной почты " + Utils.Brackets(fields.tfAddress.getText()) + " уже есть в списке.");
Log.Writeln_("Адрес электронной почты " + CommonUtils.Brackets(fields.tfAddress.getText()) + " уже есть в списке.");
}
}
@Override