List<String> cmd;
try {
- cmd = prop.getWorker().getLauncher().getLaunchCommand(prop, path);
+ ILauncher launcher = prop.getWorker().getLauncher();
+ if (launcher == null) {
+ throw new VMWorkerException("Fail to get launcher");
+ }
+ cmd = launcher.getLaunchCommand(prop, path);
+
} catch (VMWorkerException e) {
EMLogger.getLogger().log(Level.WARNING, "Failed to launch :" + e.getMessage());
System.out.println("Error: " + "Failed to launch: " + e.getMessage());
if (item != null) {
worker = (VMWorkerCommon)item.createInstance();
}
- if (worker != null) {
- worker.setVMProperty(this);
- worker.initLauncher();
+
+ if (worker == null) {
+ worker = new VMWorkerCommon();
}
+
+ worker.setVMProperty(this);
+ worker.initLauncher();
+
}
// TODO
}
public VMWorkerCommon getWorker() {
+ if (worker == null) {
+ worker = new VMWorkerCommon();
+ worker.setVMProperty(this);
+ }
return worker;
}
-
+
public String getName() {
if(configuration == null
|| configuration.getBaseInformation() == null) {
import org.tizen.emulator.manager.vms.helper.WorkerLock;
-public abstract class VMWorkerCommon {
+public class VMWorkerCommon {
private VMProperty property;
private ILauncher launcher;
private WorkerThread worker = null;
private String baseImagePath = null;
private String baseImagePartPath = null;
- public abstract void initLauncher();
+ public void initLauncher() {
+
+ }
protected void setLauncher(ILauncher launcher) {
this.launcher = launcher;
import org.tizen.emulator.manager.ui.VMsMainView;
import org.tizen.emulator.manager.ui.dialog.MessageDialog;
import org.tizen.emulator.manager.vms.EmulatorVMList;
+import org.tizen.emulator.manager.vms.ILauncher;
import org.tizen.emulator.manager.vms.VMProperty;
import org.tizen.emulator.manager.vms.helper.VMSocketQueue.QueueObject;
} else {
addLaunchedVMList(prop.getName());
connectToECS(prop);
- if (prop.getWorker() != null) {
- prop.getWorker().getLauncher().sendRemoteLog("start");
+ ILauncher launcher = prop.getWorker().getLauncher();
+ if (launcher != null) {
+ launcher.sendRemoteLog("start");
}
}
}
}
private static void setVMExit(VMSocket vms) {
- if (vms != null) {
- if (vms.getProperty() != null && vms.getProperty().getWorker() != null) {
- vms.getProperty().getWorker().getLauncher().sendRemoteLog("stop");
+ if (vms.getProperty() != null) {
+ ILauncher launcher = vms.getProperty().getWorker().getLauncher();
+ if (launcher != null) {
+ launcher.sendRemoteLog("stop");
}
- // Check remote.
-// if (isRemote(vms.getProperty())) {
-// killServer(vms);
-// }
}
disconnect(vms);
}