2023-11-19 02:12:44 +03:00
|
|
|
package Visual_DVM_2021.Passes.All;
|
2024-10-09 23:37:58 +03:00
|
|
|
import Common.Current_;
|
2024-10-07 22:22:51 +03:00
|
|
|
import Common.Utils.CommonUtils;
|
2024-10-09 22:01:19 +03:00
|
|
|
import _VisualDVM.Constants;
|
|
|
|
|
import _VisualDVM.Current;
|
2024-10-09 22:21:57 +03:00
|
|
|
import _VisualDVM.GlobalData.RemoteFile.RemoteFile;
|
2024-10-10 23:57:36 +03:00
|
|
|
import Common.Passes.PassException;
|
2024-01-08 20:37:16 +03:00
|
|
|
import Visual_DVM_2021.Passes.SSH.ConnectionPass;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
2023-12-20 02:47:47 +03:00
|
|
|
import java.util.Vector;
|
2024-01-08 20:37:16 +03:00
|
|
|
public class RemoteInitialiseUser extends ConnectionPass<RemoteFile> {
|
2023-12-20 02:47:47 +03:00
|
|
|
RemoteFile modulesDirectory;
|
2023-09-17 22:13:42 +03:00
|
|
|
@Override
|
2023-12-20 02:47:47 +03:00
|
|
|
protected boolean needsAnimation() {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean canStart(Object... args) {
|
2024-10-09 23:37:58 +03:00
|
|
|
return Current_.Check(Log, Current.User);
|
2023-12-20 02:47:47 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void Connect() throws Exception {
|
|
|
|
|
machine = Current.getMachine();
|
|
|
|
|
user = Current.getUser();
|
|
|
|
|
super.Connect();
|
|
|
|
|
}
|
2023-09-17 22:13:42 +03:00
|
|
|
@Override
|
|
|
|
|
protected void ServerAction() throws Exception {
|
2024-10-07 22:22:51 +03:00
|
|
|
String workspace_name = CommonUtils.getDateName("visual_sapfor_workspace");
|
2023-12-20 02:47:47 +03:00
|
|
|
ShowMessage1("Создание рабочего пространства...");
|
|
|
|
|
target = new RemoteFile(user.connection.sftpChannel.getHome(), workspace_name);
|
|
|
|
|
user.connection.sftpChannel.mkdir(target.full_name);
|
|
|
|
|
Vector<RemoteFile> subdirectories = new Vector<>();
|
|
|
|
|
subdirectories.add(new RemoteFile(target, "projects"));
|
|
|
|
|
subdirectories.add(modulesDirectory = new RemoteFile(target, "modules"));
|
|
|
|
|
subdirectories.add(new RemoteFile(target, "tests"));
|
2023-09-17 22:13:42 +03:00
|
|
|
//-------------------------------------
|
2023-12-20 02:47:47 +03:00
|
|
|
for (RemoteFile remoteFile : subdirectories)
|
|
|
|
|
user.connection.sftpChannel.mkdir(remoteFile.full_name);
|
2023-09-17 22:13:42 +03:00
|
|
|
//----------------------------------
|
2023-12-20 16:56:18 +03:00
|
|
|
ShowMessage1("Закачка кода модулей...");
|
2023-12-24 01:36:52 +03:00
|
|
|
for (String resource_name : Constants.resourses_names) {
|
2023-12-20 02:47:47 +03:00
|
|
|
ShowMessage2(resource_name);
|
2023-12-24 01:36:52 +03:00
|
|
|
user.connection.putResource(modulesDirectory, resource_name);
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
//-------------------------------------
|
|
|
|
|
ShowMessage1("Сборка модулей...");
|
2023-12-24 01:36:52 +03:00
|
|
|
String modules_log = user.connection.compileModules(modulesDirectory);
|
|
|
|
|
if (!modules_log.isEmpty())
|
|
|
|
|
throw new PassException(modules_log);
|
2023-09-17 22:13:42 +03:00
|
|
|
//--------------------------------------
|
|
|
|
|
RemoteFile info = new RemoteFile(target, Current.getAccount().email);
|
2023-12-20 02:47:47 +03:00
|
|
|
user.connection.writeToFile("", info);
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
}
|