Files
VisualSapfor/src/TestingSystem/DVM/DVMPackage/DVMPackage.java

61 lines
2.0 KiB
Java
Raw Normal View History

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;
import Common.Utils.Utils;
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;
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;
//---
@Description("IGNORE")
public DVMPackage_json package_json = null;
//---
2023-12-11 01:24:30 +03:00
@Override
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;
}
public File getLocalWorkspace() {
return new File(Global.PackagesDirectory, String.valueOf(id));
2023-12-12 01:01:36 +03:00
}
public File getJsonFile() {
return new File(getLocalWorkspace(), "package_json");
}
public void saveJson() throws Exception {
Utils.jsonToFile(package_json, getJsonFile());
}
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
}