2023-12-11 01:24:30 +03:00
|
|
|
package TestingSystem.DVM.DVMPackage;
|
|
|
|
|
import Common.Database.DBObject;
|
2023-12-12 01:01:36 +03:00
|
|
|
import Common.Global;
|
2023-12-12 16:09:14 +03:00
|
|
|
import Common.Utils.Utils;
|
2023-12-14 18:45:41 +03:00
|
|
|
import GlobalData.Machine.Machine;
|
|
|
|
|
import GlobalData.Machine.MachineType;
|
|
|
|
|
import GlobalData.User.User;
|
2023-12-11 01:24:30 +03:00
|
|
|
import TestingSystem.Common.TestingPackage.TestingPackage;
|
2023-12-12 16:09:14 +03:00
|
|
|
import com.sun.org.glassfish.gmbal.Description;
|
2023-12-12 01:01:36 +03:00
|
|
|
|
|
|
|
|
import java.io.File;
|
2023-12-11 01:24:30 +03:00
|
|
|
public class DVMPackage extends TestingPackage {
|
2023-12-11 01:38:44 +03:00
|
|
|
public String PID = ""; //сишная часть.
|
2023-12-11 01:24:30 +03:00
|
|
|
//---
|
|
|
|
|
public String machine_name = "";
|
|
|
|
|
public String machine_address = "";
|
|
|
|
|
public int machine_port = 22;
|
|
|
|
|
//---
|
|
|
|
|
public String user_name = "";
|
|
|
|
|
public String user_password;
|
|
|
|
|
public String user_workspace;
|
|
|
|
|
//---
|
2023-12-12 16:09:14 +03:00
|
|
|
@Description("IGNORE")
|
|
|
|
|
public DVMPackage_json package_json = null;
|
2023-12-15 14:02:12 +03:00
|
|
|
public DVMPackage(){}
|
|
|
|
|
public DVMPackage(DVMPackage p) {
|
|
|
|
|
super(p);
|
|
|
|
|
this.SynchronizeFields(p);
|
|
|
|
|
}
|
2023-12-12 16:09:14 +03:00
|
|
|
//---
|
2023-12-11 01:24:30 +03:00
|
|
|
@Override
|
2023-12-14 18:45:41 +03:00
|
|
|
public void destructor() {
|
|
|
|
|
package_json = null;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
2023-12-11 01:24:30 +03:00
|
|
|
public void SynchronizeFields(DBObject src) {
|
|
|
|
|
super.SynchronizeFields(src);
|
|
|
|
|
DVMPackage tasksPackage = (DVMPackage) src;
|
|
|
|
|
PID = tasksPackage.PID;
|
|
|
|
|
machine_name = tasksPackage.machine_name;
|
|
|
|
|
machine_address = tasksPackage.machine_address;
|
|
|
|
|
machine_port = tasksPackage.machine_port;
|
|
|
|
|
user_name = tasksPackage.user_name;
|
|
|
|
|
user_workspace = tasksPackage.user_workspace;
|
|
|
|
|
user_password = tasksPackage.user_password;
|
|
|
|
|
}
|
2023-12-12 16:09:14 +03:00
|
|
|
public File getLocalWorkspace() {
|
2023-12-14 02:30:56 +03:00
|
|
|
return new File(Global.PackagesDirectory, String.valueOf(id));
|
2023-12-12 01:01:36 +03:00
|
|
|
}
|
2023-12-12 16:09:14 +03:00
|
|
|
public File getJsonFile() {
|
|
|
|
|
return new File(getLocalWorkspace(), "package_json");
|
|
|
|
|
}
|
|
|
|
|
public void saveJson() throws Exception {
|
|
|
|
|
Utils.jsonToFile(package_json, getJsonFile());
|
|
|
|
|
}
|
2023-12-14 18:45:41 +03:00
|
|
|
public void readJson() throws Exception {
|
|
|
|
|
package_json = (DVMPackage_json) Utils.jsonFromFile(getJsonFile(), DVMPackage_json.class);
|
|
|
|
|
}
|
|
|
|
|
public Machine getMachine(){
|
|
|
|
|
return new Machine(machine_name,machine_address,machine_port,MachineType.Server);
|
|
|
|
|
}
|
|
|
|
|
public User getUser(){
|
|
|
|
|
return new User(user_name, user_password, user_workspace);
|
|
|
|
|
}
|
2023-12-11 01:24:30 +03:00
|
|
|
}
|