2023-11-19 02:12:44 +03:00
|
|
|
package Visual_DVM_2021.Passes.SSH;
|
2024-10-07 22:04:09 +03:00
|
|
|
import Common.Utils.CommonUtils;
|
2024-10-09 22:01:19 +03:00
|
|
|
import _VisualDVM.Current;
|
2024-10-09 22:21:57 +03:00
|
|
|
import _VisualDVM.GlobalData.Tasks.Supervisor.Remote.RemoteTaskSupervisor;
|
2023-09-17 22:13:42 +03:00
|
|
|
public abstract class TaskConnectionPass<S extends RemoteTaskSupervisor> extends ConnectionPass {
|
|
|
|
|
public S supervisor; //инициализация идет в конструкторе потомка.
|
|
|
|
|
public TaskConnectionPass(Class<S> s_class) {
|
|
|
|
|
try {
|
|
|
|
|
supervisor = s_class.newInstance();
|
|
|
|
|
} catch (Exception e) {
|
2024-10-07 22:04:09 +03:00
|
|
|
CommonUtils.MainLog.PrintException(e);
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean needsAnimation() {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void Connect() throws Exception {
|
|
|
|
|
machine = supervisor.task.getMachine();
|
|
|
|
|
user = supervisor.task.getUser();
|
|
|
|
|
super.Connect();
|
2024-05-21 23:48:01 +03:00
|
|
|
user.connection.CheckUserInitialization(Current.getAccount().email);
|
|
|
|
|
/*
|
2024-05-22 00:09:01 +03:00
|
|
|
String log = user.connection.CheckModulesVersion();
|
|
|
|
|
if (!log.isEmpty()) {
|
|
|
|
|
throw new PassException("Сборка модулей не выполнена");
|
|
|
|
|
}
|
2024-05-21 23:48:01 +03:00
|
|
|
*/
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void ServerAction() throws Exception {
|
|
|
|
|
supervisor.PerformTask();
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void performFinish() throws Exception {
|
|
|
|
|
supervisor.UpdateTask();
|
|
|
|
|
super.performFinish(); //disconnect
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void Interrupt() throws Exception {
|
|
|
|
|
Current.getProject().CreateInterruptFile();
|
|
|
|
|
}
|
|
|
|
|
}
|