From c102b5959122c3242c4201150d2631f8c24d6fc4 Mon Sep 17 00:00:00 2001 From: "minkee.lee" Date: Wed, 27 May 2015 17:25:46 +0900 Subject: [PATCH] Launcher: Applied new VM launching method. - It uses launch config file and script to launch VM. - Legacy source code is not removed yet. Change-Id: I20dbe087f46d0300ef437b903d1bcc797a4893c5 Signed-off-by: minkee.lee --- .../emulator/manager/console/ConsoleProcessor.java | 125 ++++++++++++--------- .../tizen/emulator/manager/vms/VMWorkerCommon.java | 8 +- 2 files changed, 77 insertions(+), 56 deletions(-) diff --git a/src/org/tizen/emulator/manager/console/ConsoleProcessor.java b/src/org/tizen/emulator/manager/console/ConsoleProcessor.java index 7d9ec1b..179e4f0 100644 --- a/src/org/tizen/emulator/manager/console/ConsoleProcessor.java +++ b/src/org/tizen/emulator/manager/console/ConsoleProcessor.java @@ -214,65 +214,88 @@ public class ConsoleProcessor { } } - if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) { - if (!isTest) { - try { - System.out.println("Arguments from vm_launch.conf..."); - System.out.println(); - for (String str : LaunchConfig.readLaunchConfig(prop.getName())) { - System.out.println(str); - } - System.out.println(); - - prop.getWorker().launchVM(true, path); - } catch (VMWorkerException e) { - System.out.println("Error: Can not execute this VM." - + StringResources.NEW_LINE - + e.getMessage()); - return false; - } - - System.out.println("Success: To start emulator is completed."); + if (isTest || EMLogger.getLogger().getLevel() == Level.WARNING) { + System.out.println("Print launch config file : " + + LaunchConfig.getLaunchConfigPath(prop.getName()) + + StringResources.NEW_LINE); + for (String str : LaunchConfig.readLaunchConfig(prop.getName())) { + System.out.println(str); } + System.out.println(); + } - } else { - List cmd; + if (!isTest) { try { - ILauncher launcher = prop.getWorker().getLauncher(); - if (launcher == null) { - throw new VMWorkerException("Fail to get launcher"); - } - cmd = launcher.getLaunchCommand(prop, path); - + prop.getWorker().launchVM(true, path); } catch (VMWorkerException e) { - EMLogger.getLogger().log(Level.WARNING, "Failed to launch :" + e.getMessage()); - System.out.println("Error: " + "Failed to launch: " + e.getMessage()); + System.out.println("Error: Can not execute this VM." + + StringResources.NEW_LINE + + e.getMessage()); return false; } - if (isTest || EMLogger.getLogger().getLevel() == Level.WARNING) { - System.out.println("Arguments of emulator : "); - String temp = cmd.get(0) + " "; - for (String s : cmd.subList(1, cmd.size())) { - temp += ("\"" + s + "\" "); - } - System.out.println(temp); - System.out.println(); - } - - if (!isTest) { - try { - prop.getWorker().launchVM(true, null); - } catch (VMWorkerException e) { - System.out.println("Error: Can not execute this VM." - + StringResources.NEW_LINE - + e.getMessage()); - return false; - } - - System.out.println("Success: To start emulator is completed."); - } + System.out.println("Success: To start emulator is completed."); } + +// if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) { +// if (!isTest) { +// try { +// System.out.println("Arguments from vm_launch.conf..."); +// System.out.println(); +// for (String str : LaunchConfig.readLaunchConfig(prop.getName())) { +// System.out.println(str); +// } +// System.out.println(); +// +// prop.getWorker().launchVM(true, path); +// } catch (VMWorkerException e) { +// System.out.println("Error: Can not execute this VM." +// + StringResources.NEW_LINE +// + e.getMessage()); +// return false; +// } +// +// System.out.println("Success: To start emulator is completed."); +// } +// +// } else { +// List cmd; +// try { +// 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()); +// return false; +// } +// +// if (isTest || EMLogger.getLogger().getLevel() == Level.WARNING) { +// System.out.println("Arguments of emulator : "); +// String temp = cmd.get(0) + " "; +// for (String s : cmd.subList(1, cmd.size())) { +// temp += ("\"" + s + "\" "); +// } +// System.out.println(temp); +// System.out.println(); +// } +// +// if (!isTest) { +// try { +// prop.getWorker().launchVM(true, null); +// } catch (VMWorkerException e) { +// System.out.println("Error: Can not execute this VM." +// + StringResources.NEW_LINE +// + e.getMessage()); +// return false; +// } +// +// System.out.println("Success: To start emulator is completed."); +// } +// } return true; } diff --git a/src/org/tizen/emulator/manager/vms/VMWorkerCommon.java b/src/org/tizen/emulator/manager/vms/VMWorkerCommon.java index 75f2c40..f1e6f8c 100644 --- a/src/org/tizen/emulator/manager/vms/VMWorkerCommon.java +++ b/src/org/tizen/emulator/manager/vms/VMWorkerCommon.java @@ -132,11 +132,9 @@ public class VMWorkerCommon { isRunningNow(); boolean isSuccess; - if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) { - isSuccess = VMLauncher.Launch(property, wait, path); - } else { - isSuccess = launcher.launch(property, wait); - } + isSuccess = VMLauncher.Launch(property, wait, path); +// isSuccess = launcher.launch(property, wait); + if (!isSuccess) { throw new VMWorkerException(""); } else { -- 2.7.4