From 1e9e639fca945d478d64d6e0cefe0765748871ab Mon Sep 17 00:00:00 2001 From: "minkee.lee" Date: Wed, 6 May 2015 12:12:32 +0900 Subject: [PATCH] Source: Removed plugin source, template. Change-Id: Icf2549bc56bbd9e5f1767769a342253866f9fa99 Signed-off-by: minkee.lee --- .../manager/mobile/ui/detail/ItemListFactory.java | 192 ----- .../emulator/manager/mobile/vms/Launcher.java | 854 -------------------- .../emulator/manager/wearable/vms/Launcher.java | 869 --------------------- template/w-x86-standard-template-win.xml | 114 --- template/w-x86-standard-template.xml | 114 --- 5 files changed, 2143 deletions(-) delete mode 100644 plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/ItemListFactory.java delete mode 100644 plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/vms/Launcher.java delete mode 100644 plugin-project/wearable-plugin/src/org/tizen/emulator/manager/wearable/vms/Launcher.java delete mode 100644 template/w-x86-standard-template-win.xml delete mode 100644 template/w-x86-standard-template.xml diff --git a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/ItemListFactory.java b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/ItemListFactory.java deleted file mode 100644 index 23ad641..0000000 --- a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/ItemListFactory.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Emulator Manager - * - * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * JiHye Kim - * SeokYeon Hwang - * YeongKyoon Lee - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributors: - * - S-Core Co., Ltd - * - */ - -package org.tizen.emulator.manager.mobile.ui.detail; - -import java.util.List; - -import org.tizen.emulator.manager.EmulatorManager; -import org.tizen.emulator.manager.EmulatorManager.ManagerModeType; -import org.tizen.emulator.manager.ui.detail.item.CommonItemListFactory; -import org.tizen.emulator.manager.ui.detail.item.IViewItem; -import org.tizen.emulator.manager.ui.detail.item.ItemType; -import org.tizen.emulator.manager.ui.detail.item.LineLabelViewItem; -import org.tizen.emulator.manager.ui.detail.item.property.NetConnectTypeViewItem; -import org.tizen.emulator.manager.ui.detail.item.property.NetDnsViewItem; -import org.tizen.emulator.manager.ui.detail.item.property.NetIPInfoViewItem; -import org.tizen.emulator.manager.ui.detail.item.property.NetMacViewItem; -import org.tizen.emulator.manager.ui.detail.item.property.NetProxyViewItem; -import org.tizen.emulator.manager.ui.detail.item.property.NetTapDeviceViewItem; -import org.tizen.emulator.manager.ui.detail.item.property.NetTapDeviceViewItemWin; -import org.tizen.emulator.manager.ui.detail.item.template.CheckLabelViewItem; -import org.tizen.emulator.manager.ui.detail.item.template.ComboViewItem; -import org.tizen.emulator.manager.ui.detail.item.template.FileViewItem; -import org.tizen.emulator.manager.ui.detail.item.template.LabelViewItem; -import org.tizen.emulator.manager.ui.detail.item.template.OnOffViewItem; -import org.tizen.emulator.manager.ui.detail.item.template.TextViewItem; -import org.tizen.emulator.manager.vms.helper.CheckingRunningEmulator; -import org.tizen.emulator.manager.vms.xml.template.DeviceList; -import org.tizen.emulator.manager.vms.xml.template.Item; -import org.tizen.emulator.manager.vms.xml.template.ItemList; - -public class ItemListFactory extends CommonItemListFactory { - - public static String ITEM_EXPERIMENTAL = "experimental"; - - private static void makeItemListOld(List list) { - List itemList = (List)list; - - itemList.add(new TNameTextItem()); - itemList.add(new TDisplayItem()); - itemList.add(new TRAMItem()); - itemList.add(new TTouchPointItem()); - if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) { - itemList.add(new TSupportSuspendItem()); - } - - itemList.add(new TFileShareItem()); - itemList.add(new THWSupportItem()); - - } - - @Override - public void makeItemList(List itemList, - ItemList template) { - if (template == null) { - makeItemListOld(itemList); // TODO old - } else { - makePropertyItemList(itemList, template.getPropertyList(), template.getProfile(), true); - makeDeviceItemList(itemList, template.getDeviceList()); - - } - } - - @Override - public void makeDeviceItemList(List list, DeviceList deviceList) { - - if (deviceList != null) { - List itemList = (List)list; - List deviceItemList = deviceList.getItem(); - LineLabelViewItem currentLineLabel = null; // Top categorizing item - boolean isExperimentalLabel = false; - - for (Item item : deviceItemList) { - String type = item.getType(); - String name = item.getName(); - - if (isExperimentalLabel && EmulatorManager.getManagerMode() != ManagerModeType.INHOUSE_MODE) { - continue; - } - - if (name.equals(CheckingRunningEmulator.OPTION_VIEWER)) { - if (EmulatorManager.isLinux()) { - itemList.add(new LabelViewItem(item, currentLineLabel)); - } - continue; - - } else if (name.equals(ITEM_NET_CONNECT_TYPE)) { - itemList.add(new NetConnectTypeViewItem(item, - currentLineLabel)); - continue; - - } else if (name.equals(ITEM_NET_TAP_DEVICE)) { - if (EmulatorManager.isWin()) { - itemList.add(new NetTapDeviceViewItemWin(item, - currentLineLabel)); - } else { - itemList.add(new NetTapDeviceViewItem(item, - currentLineLabel)); - } - continue; - - } else if (name.equals(ITEM_NET_PROXY)) { - itemList.add(new NetProxyViewItem(item, currentLineLabel)); - continue; - - } else if (name.equals(ITEM_NET_IP_INFO)) { - itemList.add(new NetIPInfoViewItem(item, currentLineLabel)); - continue; - - } else if (name.equals(ITEM_NET_DNS)) { - itemList.add(new NetDnsViewItem(item, currentLineLabel)); - continue; - - } else if (name.equals(ITEM_NET_MAC)) { - itemList.add(new NetMacViewItem(item, currentLineLabel)); - continue; - - } - - if (type.equals(ItemType.LINE_LABEL.getName())) { // Top categorizing item - if (name.equals(ITEM_EXPERIMENTAL)) { - isExperimentalLabel = true; - if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) { - currentLineLabel = new LineLabelViewItem(item); - itemList.add(currentLineLabel); - } - } else { - currentLineLabel = new LineLabelViewItem(item); - itemList.add(currentLineLabel); - isExperimentalLabel = false; - } - - } else if (type.equals(ItemType.TOGGLE.getName())) { - itemList.add(new OnOffViewItem(item, currentLineLabel)); - - } else if (type.equals(ItemType.LABEL.getName())) { - itemList.add(new LabelViewItem(item, currentLineLabel)); - - } else if (type.equals(ItemType.COMBO.getName())) { - itemList.add(new ComboViewItem(item, currentLineLabel)); - - } else if (type.equals(ItemType.FILE.getName())) { - itemList.add(new FileViewItem(item, currentLineLabel)); - - } else if (type.equals(ItemType.CHECK_LABEL.getName())) { - itemList.add(new CheckLabelViewItem(item, currentLineLabel)); - - } else if (type.equals(ItemType.TEXT.getName())) { - itemList.add(new TextViewItem(item, currentLineLabel)); - } - } - } - } - - - @Override - public void makeCustomItemList(List itemList, - List templateList) { - if (templateList == null || templateList.size() == 0) { - makeItemListOld(itemList); // TODO old - } else { - - makeCustomDeviceItemList(itemList, templateList); - } - } -} diff --git a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/vms/Launcher.java b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/vms/Launcher.java deleted file mode 100644 index 53dfdf9..0000000 --- a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/vms/Launcher.java +++ /dev/null @@ -1,854 +0,0 @@ -/* - * Emulator Manager - * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * MunKyu Im - * SeokYeon Hwang - * JiHye Kim - * YeongKyoon Lee - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributors: - * - S-Core Co., Ltd - * - */ - -package org.tizen.emulator.manager.mobile.vms; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.logging.Level; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.tizen.emulator.manager.EmulatorManager; -import org.tizen.emulator.manager.EmulatorManager.ManagerModeType; -import org.tizen.emulator.manager.console.RemoteManager; -import org.tizen.emulator.manager.logging.EMLogger; -import org.tizen.emulator.manager.mobile.ui.detail.ItemListFactory; -import org.tizen.emulator.manager.resources.FilePathResources; -import org.tizen.emulator.manager.resources.StringResources; -import org.tizen.emulator.manager.tool.CheckVirtualization; -import org.tizen.emulator.manager.tool.PortHelper; -import org.tizen.emulator.manager.tool.SettingInfoFile; -import org.tizen.emulator.manager.tool.TapUtil; -import org.tizen.emulator.manager.ui.detail.item.CommonItemListFactory; -import org.tizen.emulator.manager.ui.detail.item.property.NetIPInfoViewItem; -import org.tizen.emulator.manager.ui.detail.item.property.NetProxyViewItem; -import org.tizen.emulator.manager.ui.dialog.IPAddressInputDialog; -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.CheckingRunningEmulator; -import org.tizen.emulator.manager.vms.helper.HelperClass; -import org.tizen.emulator.manager.vms.helper.MonitoringEmulator; -import org.tizen.emulator.manager.vms.helper.ProcessResult; -import org.tizen.emulator.manager.vms.helper.VMLauncherException; -import org.tizen.emulator.manager.vms.xml.CpuType; -import org.tizen.emulator.manager.vms.helper.VMWorkerException; -import org.tizen.emulator.manager.vms.xml.OptionType; -import org.tizen.emulator.manager.vms.xml.TouchType; - -public class Launcher implements ILauncher { - private boolean isConsole = false; - private String binPath = null; - private static Launcher launcher; - - public static final String IFUP_SCRIPT = "emulator-ifup.sh"; - // Option names in vm_config.xml - // Add if need. - public static final String OPT_DEVICE = "device"; - public static final String OPT_NFC = "nfc"; - public static final String OPT_BATTERY = "battery"; - public static final String OPT_CAMERA = "camera"; - public static final String OPT_HWKEY = "hwkey"; - public static final String OPT_SWAP = "swap"; - public static final String OPT_CODEC = "codec"; - - public static final String OPT_JACK = "jack"; - public static final String OPT_EARJACK = "earjack"; - public static final String OPT_USB = "usb"; - public static final String OPT_CHARGER = "charger"; - - public static final String OPT_SENSOR = "sensor"; - public static final String OPT_ACCEL = "accel"; - public static final String OPT_GYRO = "gyro"; - public static final String OPT_GEO = "geo"; - public static final String OPT_LIGHT = "light"; - public static final String OPT_PROXI = "proxi"; - public static final String OPT_HAPTIC = "haptic"; - public static final String OPT_PRESS = "press"; // pressure - public static final String OPT_UV = "uv"; // ultra violet - public static final String OPT_HRM = "hrm"; // heartbeat rate meter - - public static final String OPT_EXPERIMENTAL = ItemListFactory.ITEM_EXPERIMENTAL; - public static final String OPT_QT_ENABLE = "qtEnable"; - - - // Network option. - public static final String OPT_NET_CONNECT_TYPE = CommonItemListFactory.ITEM_NET_CONNECT_TYPE; - public static final String OPT_NET_TAP_DEVICE = CommonItemListFactory.ITEM_NET_TAP_DEVICE; - public static final String OPT_NET_IP_INFO = CommonItemListFactory.ITEM_NET_IP_INFO; - public static final String OPT_NET_IPADDR = NetIPInfoViewItem.ITEM_IP; - public static final String OPT_NET_SUBNET = NetIPInfoViewItem.ITEM_SUBNET; - public static final String OPT_NET_GATEWAY = NetIPInfoViewItem.ITEM_GATEWAY; - public static final String OPT_NET_DNS = CommonItemListFactory.ITEM_NET_DNS; - public static final String OPT_NET_MAC = CommonItemListFactory.ITEM_NET_MAC; - public static final String OPT_NET_PROXY = CommonItemListFactory.ITEM_NET_PROXY; - public static final String OPT_NET_DHCP = NetIPInfoViewItem.ITEM_USE_DHCP; - - public static Launcher getInstance() { - if (launcher == null) { - launcher = new Launcher(); - } - return launcher; - } - - private Launcher() { - isConsole = EmulatorManager.isConsoleMode(); - } - - @Override - public List getLaunchCommand(VMProperty property, String path) throws VMLauncherException { - String binary; - String hwVirtualization = ""; - int portNo; - boolean useBridgeNet = property.getPropertyValue() - .getAdvancedOptionValue(OPT_NET_CONNECT_TYPE).equals("Bridge") && - (EmulatorManager.isLinux() || EmulatorManager.isWin() || EmulatorManager.isMac()); - String tapName = null; - if (useBridgeNet) { - if (EmulatorManager.isWin()) { - tapName = property.getPropertyValue() - .getAdvancedOptionValue(OPT_NET_TAP_DEVICE); - if (TapUtil.nameNotExist(tapName)) - throw new VMLauncherException((new StringBuilder()) - .append("Tap device is not exist : ").append(tapName) - .append("\nCheck VM's tap configuration.").toString()); - if (isTapUsing(tapName)) - throw new VMLauncherException( - (new StringBuilder()) - .append("Tap device(") - .append(tapName) - .append(") is being used by other VM.") - .append("\nPlease select another tap device for current VM.") - .toString()); - String ipAddr = property.getPropertyValue() - .getAdvancedOptionSubValue(OPT_NET_IP_INFO, "ipAddr"); - if (isIpAddrUsing(ipAddr)) - throw new VMLauncherException((new StringBuilder()) - .append("VM's ip address(").append(ipAddr) - .append(") is being used by other VM.") - .append("\nPlease modify current VM's ip address.") - .toString()); - } - if (EmulatorManager.isWin()) { - try { - if (!TapUtil.isTapInBridge(tapName)) { - MessageDialog dialog = new MessageDialog(); - int res = dialog - .openWarningAndSelectionDialog("\nTap device is not connected with Bridge." - + "\nGuest network would work as NAT." - + "\nKeep launching ?"); - if (res != SWT.OK) { - throw new VMLauncherException("User canceled."); - } - useBridgeNet = false; - } - - } catch (VMWorkerException e) { - throw new VMLauncherException(e.getMessage()); - } - } - } - /* check available port number */ - portNo = new PortHelper().getPortNo(); - if(portNo == -1) { - String error = "Can not execute emulator." - + StringResources.NEW_LINE - + "All available ports are in use."; - throw new VMLauncherException(error); - } - - if (property.getArch().toString().equals("x86")) { - if (EmulatorManager.isWin()) { - binary = "emulator-x86.exe"; - } else { - binary = "emulator-x86"; - } - } else { - if (EmulatorManager.isWin()) { - binary = "emulator-arm.exe"; - } else { - binary = "emulator-arm"; - } - } - - // check disk image - File child = new File(property.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue()); - File base = new File(property.getConfiguration().getBaseInformation().getDiskImage().getBaseDiskImage().getValue()); - if (!child.exists()) { - throw new VMLauncherException("Child disk image does not exist." - + StringResources.NEW_LINE + child.getAbsolutePath() - , true); - } - if (!base.exists()) { - throw new VMLauncherException("Base disk image does not exist." - + StringResources.NEW_LINE + base.getAbsolutePath() - , true); - } - - if (property.getConfiguration().getUsability().isHwVirtualization() && CheckVirtualization.getInstance().isSupportVirtualization()) { - hwVirtualization = CheckVirtualization.getInstance().getVirtualizationEnableCommnad(); - } else { - hwVirtualization = CheckVirtualization.getInstance().getVirtualizationDisableCommnad(); - } - - List cmd = new ArrayList(); - int width = property.getConfiguration().getDevice().getDisplay().getResolution().getWidth(); - int height = property.getConfiguration().getDevice().getDisplay().getResolution().getHeight(); - String skinPath = null; - if (property.getConfiguration().getDevice().getDisplay().getSkinPath() != null) { - skinPath = property.getConfiguration().getDevice().getDisplay().getSkinPath().getPath(); - if (skinPath != null && skinPath.isEmpty()) { - skinPath = null; - } - } - String fileshare = property.getConfiguration().getUsability().getFileSharing().getPath(); - String osVersion = System.getProperty("os.version"); - boolean isFileshare = true; - if (fileshare == null) { - isFileshare = false; - } - - /* get MAC address of host set as guest MAC address */ - String macAddr = useBridgeNet ? property.getPropertyValue() - .getAdvancedOptionValue(OPT_NET_MAC) : SettingInfoFile - .getMACaddr(); - - if(macAddr.isEmpty()) { - macAddr = "52:54:00:12:34:56"; - EMLogger.getLogger().log(Level.INFO, String.format("MAC set as default = %s", macAddr)); - } - - if (path == null || path.isEmpty()) { - cmd.add(FilePathResources.getBinPath() + File.separator + binary); - } else { - this.binPath = path; - cmd.add(binPath + File.separator + binary); - } - - cmd.add("--skin-args"); - cmd.add("width=" + width); - cmd.add("height=" + height); - if (skinPath != null) { - cmd.add("skin.path=" + skinPath); - } - - if (RemoteManager.getSpiceMode()) { - cmd.add("hb.ignore=true"); - } - - cmd.add("--qemu-args"); - - // x86 part of cmd - if (property.getArch().toString().equals("x86")) { - cmd.add("-drive"); - cmd.add("file=" + property.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue()+ ",if=virtio,index=1"); - cmd.add( "-boot"); - cmd.add("c"); - cmd.add("-append"); - String kernelOption = "console=ttyS0 video=LVDS-1:" - + width - + "x" - + height - + "-32@60" - + " dpi=" + property.getConfiguration().getDevice().getDisplay().getDensity().getValue() * 10 - + getIP(useBridgeNet, property) - + " vm_name=" + property.getConfiguration().getBaseInformation().getName(); - String hostIp = "10.0.2.2"; - if (useBridgeNet && EmulatorManager.isWin()) { - String bridgeIp = TapUtil.getBridgeIpAddr(property - .getPropertyValue().getAdvancedOptionValue( - OPT_NET_TAP_DEVICE)); - if (bridgeIp == null) { - MessageDialog dialog = new MessageDialog(); - int res = dialog.openInfoDialog( - "\nCannot find host(bridge) IP address." - + "\nTo use bridge network, host IP is required." - + "\nPlease input manually."); - if (res != SWT.OK) { - throw new VMLauncherException("User canceled."); - } - - // Input host IP address. - String ip = IPAddressInputDialog.open("Input host's IP address"); - if (ip == null) { - throw new VMLauncherException("User canceled."); - - } else { - hostIp = ip; - } - - } else { - hostIp = bridgeIp; - } - } - kernelOption += " host_ip=" + hostIp; - - // Set proxy. - if (EmulatorManager.isLinux() || EmulatorManager.isWin()) { - String proxyConfig = null; - String proxyMode = property.getPropertyValue(). - getAdvancedOptionSubValue(OPT_NET_PROXY, NetProxyViewItem.ITEM_PROXY_MODE); - if (proxyMode.equals(NetProxyViewItem.MODE_AUTO)) { - proxyConfig = getHostProxy(); - - } else if (proxyMode.equals(NetProxyViewItem.MODE_MANUAL)) { - proxyConfig = "http_proxy=" + property.getPropertyValue(). - getAdvancedOptionSubValue(OPT_NET_PROXY, NetProxyViewItem.ITEM_HTTP_PROXY) - + " https_proxy=" + property.getPropertyValue(). - getAdvancedOptionSubValue(OPT_NET_PROXY, NetProxyViewItem.ITEM_HTTPS_PROXY) - + " ftp_proxy=" + property.getPropertyValue(). - getAdvancedOptionSubValue(OPT_NET_PROXY, NetProxyViewItem.ITEM_FTP_PROXY) - + " socks_proxy=" + property.getPropertyValue(). - getAdvancedOptionSubValue(OPT_NET_PROXY, NetProxyViewItem.ITEM_SOCKS_PROXY); - } - - if (proxyConfig != null) { - kernelOption += (" " + proxyConfig); - } - } - - /* set virtio-9p string in case of using directory share [kernel option] */ - if(isFileshare) { - kernelOption += " virtio-9p"; - } - - /* - if(property.getPropertyValue().skin != null && property.getPropertyValue().skin.getButtonType() == SKIN_BUTTON_TYPE.THREE_BUTTON_TYPE) { - kernelOption += " platform_feature=3btn"; - } else { - kernelOption += " platform_feature=1btn"; - } - */ - - cmd.add(kernelOption); - - /* use fileshare [non-kernel option] */ - if(isFileshare) { - cmd.add("-virtfs"); - cmd.add("local,path=" + property.getConfiguration().getUsability().getFileSharing().getPath() +",security_model=none,mount_tag=fileshare"); - } - - cmd.add("-serial"); - cmd.add("file:" + FilePathResources.getTizenVmsPath() + File.separator + property.getName() + File.separator + "logs" + File.separator + "emulator.klog"); - CpuType cpuOption = property.getConfiguration().getDevice().getCPU(); - if (cpuOption != null) { - cmd.add("-smp"); - cmd.add(String.valueOf(cpuOption.getValue().getValue())); - } - cmd.add("-m"); - cmd.add(String.valueOf(property.getConfiguration().getDevice().getRAM().getSize().getValue())); - cmd.add("-M"); - cmd.add("maru-x86-machine"); - cmd.add("-net"); - cmd.add("nic,model=virtio,macaddr=" + macAddr); - cmd.add("-soundhw"); - cmd.add("all"); - cmd.add("-usb"); - cmd.add("-vga"); - cmd.add("none"); - cmd.add("-enable-vigs"); - cmd.add("-L"); - cmd.add(FilePathResources.getBiosPath()); - cmd.add("-kernel"); - cmd.add(FilePathResources.getKernelPath() + File.separator+ "bzImage." + property.getArch().toString()); - cmd.add("-net"); - if (useBridgeNet && EmulatorManager.isWin()) { - tapName = property.getPropertyValue() - .getAdvancedOptionValue(OPT_NET_TAP_DEVICE); - if (TapUtil.nameNotExist(tapName)) { - throw new VMLauncherException("Tap device is not exist : " - + tapName + "\nCheck VM's tap configuration."); - } - cmd.add("tap,ifname=" + tapName + ",script=no,downscript=no"); - } else if (useBridgeNet && EmulatorManager.isLinux()) { - cmd.add("tap,script=/etc/" + IFUP_SCRIPT +",downscript=no"); - } else if (useBridgeNet && EmulatorManager.isMac()) { - //TODO: need changing path to /etc/emulator-ifup.sh - cmd.add("tap,script=" + FilePathResources.getBinPath() + File.separator + IFUP_SCRIPT +",downscript=no"); - } else { - cmd.add("user,dhcpstart=10.0.2.16"); - } - cmd.add("-rtc"); - cmd.add("base=utc"); - if (property.getConfiguration().getBaseInformation().getDiskImage().getSwapDiskImage() != null - && checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_DEVICE, OPT_SWAP))) { - cmd.add("-drive"); - cmd.add("file=" + property.getConfiguration().getBaseInformation().getDiskImage().getSwapDiskImage().getValue() + ",if=virtio,index=2"); - } - - /* append HW virtualization option if supports */ - if (hwVirtualization != null) { - cmd.add(hwVirtualization); - } - - // add hw gl acceleration - if (property.getConfiguration().getUsability().isHwGLAcceleration() - && CheckVirtualization.getInstance().isSupportGPU()) { -// cmd.add(CheckVirtualization.getInstance().getGPU_enable_command()); - cmd.add("-vigs-backend"); - cmd.add("gl"); - cmd.add("-enable-yagl"); - cmd.add("-yagl-backend"); - cmd.add("vigs"); - } else { - cmd.add("-vigs-backend"); - cmd.add("sw"); - } - - // for suspend - if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE - && property.getConfiguration().getUsability().isSupoortSuspend()) { - cmd.add("-enable-suspend"); - } - - // for bootup status - cmd.add("-device"); - cmd.add("virtio-esm-pci"); - - // for host keyboard - cmd.add("-device"); - cmd.add("virtio-keyboard-pci"); - - // for ecp - cmd.add("-device"); - cmd.add("virtio-evdi-pci,profile=" + property.getPropertyValue().profile - + "-" + property.getPropertyValue().version); - - // for brightness - cmd.add("-device"); - cmd.add("maru-brightness"); - - // for vmodem - cmd.add("-device"); - cmd.add("virtio-vmodem-pci"); - - // for hardware key - if (checkOnOff(property.getPropertyValue().getAdvancedOptionValue(OPT_HWKEY))) { - cmd.add("-device"); - cmd.add("virtio-hwkey-pci"); - } - - // for codec - if (checkOnOff(property.getPropertyValue().getAdvancedOptionValue(OPT_CODEC))) { - cmd.add("-device"); - cmd.add("codec-pci"); - } - - // for nfc - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_DEVICE, OPT_NFC))) { - cmd.add("-device"); - cmd.add("virtio-nfc-pci"); - } - - // for battery - cmd.add("-device"); - cmd.add("virtio-power-pci"); - /*if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_DEVICE, OPT_BATTERY))) { - cmd.add("-device"); - cmd.add("virtio-power-pci"); - }*/ - - // for camera - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_DEVICE, OPT_CAMERA))) { - cmd.add("-device"); - cmd.add("maru-camera"); - } - - cmd.add("-device"); - TouchType touchType = property.getConfiguration().getDevice().getTouch(); - if (touchType != null) { - cmd.add("virtio-touchscreen-pci,max_point=" + touchType.getMaxTouchPoint()); - } else { - cmd.add("virtio-touchscreen-pci"); - } - - // for sensor (accel, geo, gyro, light, proxi, haptic, pressure, ultra violet, heart rate meter) - OptionType sensor = property.getPropertyValue().getAdvancedOption(OPT_SENSOR); - if (sensor != null) { - cmd.add("-device"); - - StringBuilder sb = new StringBuilder(); - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_ACCEL))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("accel"); - } - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_GEO))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("geo"); - } - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_GYRO))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("gyro"); - } - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_LIGHT))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("light"); - } - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_PROXI))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("proxi"); - } - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_HAPTIC))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("haptic"); - } - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_PRESS))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("press"); - } - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_UV))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("uv"); - } - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_HRM))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("hrm"); - } - - if (sb.toString().isEmpty()) { - cmd.add("virtio-sensor-pci"); - } else { - sb.insert(0, "virtio-sensor-pci,sensors="); - cmd.add(sb.toString()); - } - } - - // for jacks (enabled charger, earjack and usb) - cmd.add("-device"); - cmd.add("virtio-jack-pci,jacks=earjack&charger&usb"); - /* OptionType jacks = property.getPropertyValue().getAdvancedOption(OPT_JACK); - if (jacks != null) { - cmd.add("-device"); - - StringBuilder sb = new StringBuilder(); - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_JACK, OPT_EARJACK))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("earjack"); - } - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_JACK, OPT_CHARGER))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("charger"); - } - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_JACK, OPT_USB))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("usb"); - } - - if (sb.toString().isEmpty()) { - cmd.add("virtio-jack-pci"); - } else { - sb.insert(0, "virtio-jack-pci,jacks="); - cmd.add(sb.toString()); - } - } */ - } - - /* append user added options if exists */ - String advancedOptions = property.getConfiguration().getUsability().getAdvancedOptions(); - if (advancedOptions != null) { - String[] arrOptions = advancedOptions.split(" "); - for (String option : arrOptions) { - cmd.add(option); - } - } - - /* spice options */ - if (RemoteManager.getSpiceMode() - || CheckingRunningEmulator.isRemote(property)) { - cmd.add("-spice"); - cmd.add("disable-ticketing"); - cmd.add("-device"); - cmd.add("virtio-serial-pci,id=virtio-serial0,max_ports=16,bus=pci.0"); - cmd.add("-chardev"); - cmd.add("spicevmc,id=vdagent,name=vdagent"); - cmd.add("-device"); - cmd.add("virtserialport,nr=1,bus=virtio-serial0.0,chardev=vdagent,name=com.redhat.spice.0"); - } - - //for qt enable - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue( - OPT_EXPERIMENTAL, OPT_QT_ENABLE))) { - if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) { - cmd.add("-display"); - if (EmulatorManager.isMac()) { - cmd.add("maru_qt,rendering=offscreen"); - } else { - cmd.add("maru_qt,rendering=onscreen"); - } - } - } - - EMLogger.getLogger().log(Level.INFO, "Starting Emulator Command : "); - String temp = cmd.get(0) + " "; - for (String s : cmd.subList(1, cmd.size())) { - temp += ("\"" + s + "\" "); - } - EMLogger.getLogger().log(Level.INFO, temp); - System.out.println("cmd : " + cmd); - return cmd; - } - - @Override - public boolean launch(VMProperty property) throws VMLauncherException { - return launch(property, false); - } - - @Override - public boolean launch(VMProperty property, boolean wait) throws VMLauncherException { - List cmd; - - cmd = getLaunchCommand(property, null); - - if (cmd == null) { - return false; - } - - CheckingRunningEmulator.addEmulator(property); - MonitoringEmulator monitor = new MonitoringEmulator(property); - Process process = launch(cmd); - if (process != null) { - monitor.setProcess(process); - monitor.start(); - if (wait) { - try { - monitor.join(); - } catch (InterruptedException e) { - EMLogger.getLogger().warning(e.getMessage()); - } - if (monitor.isSuccess()) { - return true; - } else { - return false; - } - } - return true; - } else { - CheckingRunningEmulator.removeEmulator(property, false); - monitor.interrupt(); - return false; - } - } - - @Override - public Process launch(List cmd) { - ProcessBuilder pb = new ProcessBuilder(cmd); - Map env = pb.environment(); - if (EmulatorManager.isLinux()) { - String value = env.get("LD_LIBRARY_PATH"); - env.put("LD_LIBRARY_PATH", ((value == null) ? "" : value + ":") + FilePathResources.getBinPath() + ":" + FilePathResources.getRemotePath() + File.separator + "lib:"); - EMLogger.getLogger().log(Level.INFO, "LD_LIBRARY_PATH=" + env.get("LD_LIBRARY_PATH")); - } - env.put("GL_VERSION", "2"); - EMLogger.getLogger().log(Level.INFO, "GL_VERSION: " + env.get("GL_VERSION")); - - if (this.binPath == null || this.binPath.isEmpty()) { - pb.directory(new File(FilePathResources.getBinPath())); - } else { - pb.directory(new File(this.binPath)); - } - - Process process = null; - try { - process = pb.start(); - } catch (IOException e) { - if (!isConsole) { - MessageDialog msg = new MessageDialog(new Shell(Display.getCurrent())); - msg.openWarningDialog("Failed to launch" + StringResources.NEW_LINE + e.getMessage()); - } - EMLogger.getLogger().log(Level.WARNING, "Failed to launch." + StringResources.NEW_LINE + e.getMessage()); - } - - return process; - } - - - private boolean checkOnOff(String value) { - if (value.toLowerCase().equals("on")) { - return true; - } else if (value.toLowerCase().equals("off")) { - return false; - } else if (value.isEmpty()){ - return true; - } else { - return false; - } - } - - private boolean checkOn(String value) { - if (value.toLowerCase().equals("on")) { - return true; - } - return false; - } - - - @Override - public void sendRemoteLog(String msg) { - EMLogger.getLogger().info("Launcher log : " + msg); - } - - private static boolean isTapUsing(String tapName) { - boolean isUsing = false; -// VMProperty arr[] = (VMProperty[]) EmulatorVMList.getInstance() -// .getProperties(); -// int len$ = arr$.length; -// for (int i$ = 0; i$ < len$; i$++) { - for (VMProperty prop : EmulatorVMList.getInstance().getProperties()) { - if (!prop.isRunning()) { - continue; - } - String name = prop.getPropertyValue().getAdvancedOptionValue( - OPT_NET_TAP_DEVICE); - if (tapName.equals(name)) { - isUsing = true; - break; - } - } - - return isUsing; - } - - private static boolean isIpAddrUsing(String ipAddr) { - boolean isUsing = false; - - for (VMProperty prop : EmulatorVMList.getInstance().getProperties()) { - if (!prop.isRunning()) { - continue; - } - String ip = prop.getPropertyValue().getAdvancedOptionSubValue( - OPT_NET_IP_INFO, "ipAddr"); - if (!ipAddr.equals(ip)) { - continue; - } - isUsing = true; - break; - } - - return isUsing; - } - - private String getIP(boolean useBridgeNet, VMProperty prop) { - StringBuilder sb = new StringBuilder(); - sb.append(" ip="); - if (useBridgeNet) { - String useDHCP = prop.getPropertyValue().getAdvancedOptionSubValue( - OPT_NET_IP_INFO, OPT_NET_DHCP); - if (checkOn(useDHCP)) { - return ""; - } - - sb.append(prop.getPropertyValue().getAdvancedOptionSubValue( - OPT_NET_IP_INFO, OPT_NET_IPADDR)); - sb.append("::"); - sb.append(prop.getPropertyValue().getAdvancedOptionSubValue( - OPT_NET_IP_INFO, OPT_NET_GATEWAY)); - sb.append(":"); - sb.append(prop.getPropertyValue().getAdvancedOptionSubValue( - OPT_NET_IP_INFO, OPT_NET_SUBNET)); - sb.append("::eth0:none:"); - sb.append(prop.getPropertyValue().getAdvancedOptionValue( - OPT_NET_DNS)); - - } else { // NAT (default) - sb.append("10.0.2.16::10.0.2.2:255.255.255.0::eth0:none:10.0.2.3"); - } - return sb.toString(); - } - - private String getHostProxy() throws VMLauncherException{ - String result = null; - String proxyCommand = "check-net"; - if (EmulatorManager.isWin()) { - proxyCommand = "check-net.exe"; - } - - List cmd = Arrays.asList(FilePathResources.getBinPath() + File.separator + proxyCommand, "--proxy"); - ProcessResult res = HelperClass.runProcess(cmd); - boolean isCommandSuccess = false; - if (res.isSuccess()) { - for (String str : res.getStdOutMsg()) { - if (str.startsWith("MODE:")) { - isCommandSuccess = true; - } - if (str.startsWith("http_proxy")) { - result = str; - } - } - - } else if (!res.isSuccess() || !isCommandSuccess) { - EMLogger.getLogger().warning(res.getResultMessage()); - int dialogRes = new MessageDialog().openWarningAndSelectionDialog - ("Failed to get host proxy setting." - + "\n" + res.getResultMessage() - + "\nContinue launching anyway ?"); - if (dialogRes != SWT.OK) { - throw new VMLauncherException("User canceled launching VM."); - } - } - - if (result == null) { - EMLogger.getLogger().warning("Can't find host proxy setting."); - EMLogger.getLogger().warning("check-net result : " + res.getResultMessage()); - } - - return result; - } -} diff --git a/plugin-project/wearable-plugin/src/org/tizen/emulator/manager/wearable/vms/Launcher.java b/plugin-project/wearable-plugin/src/org/tizen/emulator/manager/wearable/vms/Launcher.java deleted file mode 100644 index 7c43ea7..0000000 --- a/plugin-project/wearable-plugin/src/org/tizen/emulator/manager/wearable/vms/Launcher.java +++ /dev/null @@ -1,869 +0,0 @@ -/* - * Emulator Manager - * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * MunKyu Im - * SeokYeon Hwang - * JiHye Kim - * YeongKyoon Lee - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributors: - * - S-Core Co., Ltd - * - */ - -package org.tizen.emulator.manager.wearable.vms; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.logging.Level; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.tizen.emulator.manager.EmulatorManager; -import org.tizen.emulator.manager.EmulatorManager.ManagerModeType; -import org.tizen.emulator.manager.console.RemoteManager; -import org.tizen.emulator.manager.logging.EMLogger; -import org.tizen.emulator.manager.wearable.ui.detail.ItemListFactory; -import org.tizen.emulator.manager.resources.FilePathResources; -import org.tizen.emulator.manager.resources.StringResources; -import org.tizen.emulator.manager.tool.CheckVirtualization; -import org.tizen.emulator.manager.tool.PortHelper; -import org.tizen.emulator.manager.tool.SettingInfoFile; -import org.tizen.emulator.manager.tool.TapUtil; -import org.tizen.emulator.manager.ui.detail.item.CommonItemListFactory; -import org.tizen.emulator.manager.ui.detail.item.property.NetIPInfoViewItem; -import org.tizen.emulator.manager.ui.detail.item.property.NetProxyViewItem; -import org.tizen.emulator.manager.ui.dialog.IPAddressInputDialog; -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.CheckingRunningEmulator; -import org.tizen.emulator.manager.vms.helper.HelperClass; -import org.tizen.emulator.manager.vms.helper.MonitoringEmulator; -import org.tizen.emulator.manager.vms.helper.ProcessResult; -import org.tizen.emulator.manager.vms.helper.VMLauncherException; -import org.tizen.emulator.manager.vms.xml.CpuType; -import org.tizen.emulator.manager.vms.xml.OptionType; -import org.tizen.emulator.manager.vms.helper.VMWorkerException; -import org.tizen.emulator.manager.vms.xml.TouchType; - -public class Launcher implements ILauncher { - private boolean isConsole = false; - private String binPath = null; - private static Launcher launcher; - public static final String IFUP_SCRIPT = "emulator-ifup.sh"; - - // Option names in vm_config.xml - // Add if need. - public static final String OPT_DEVICE = "device"; - public static final String OPT_NFC = "nfc"; - public static final String OPT_BATTERY = "battery"; - public static final String OPT_CAMERA = "camera"; - public static final String OPT_HWKEY = "hwkey"; - public static final String OPT_SWAP = "swap"; - public static final String OPT_CODEC = "codec"; - - public static final String OPT_JACK = "jack"; - public static final String OPT_USB = "usb"; - public static final String OPT_CHARGER = "charger"; - - public static final String OPT_SENSOR = "sensor"; - public static final String OPT_ACCEL = "accel"; - public static final String OPT_GYRO = "gyro"; - public static final String OPT_GEO = "geo"; - public static final String OPT_LIGHT = "light"; - public static final String OPT_PROXI = "proxi"; - public static final String OPT_HAPTIC = "haptic"; - public static final String OPT_PRESS = "press"; // pressure - public static final String OPT_UV = "uv"; // ultra violet - public static final String OPT_HRM = "hrm"; // heartbeat rate meter - - public static final String OPT_EXPERIMENTAL = ItemListFactory.ITEM_EXPERIMENTAL; - public static final String OPT_QT_ENABLE = "qtEnable"; - - // Network option. - public static final String OPT_NET_CONNECT_TYPE = CommonItemListFactory.ITEM_NET_CONNECT_TYPE; - public static final String OPT_NET_TAP_DEVICE = CommonItemListFactory.ITEM_NET_TAP_DEVICE; - public static final String OPT_NET_IP_INFO = CommonItemListFactory.ITEM_NET_IP_INFO; - public static final String OPT_NET_IPADDR = NetIPInfoViewItem.ITEM_IP; - public static final String OPT_NET_SUBNET = NetIPInfoViewItem.ITEM_SUBNET; - public static final String OPT_NET_GATEWAY = NetIPInfoViewItem.ITEM_GATEWAY; - public static final String OPT_NET_DNS = CommonItemListFactory.ITEM_NET_DNS; - public static final String OPT_NET_MAC = CommonItemListFactory.ITEM_NET_MAC; - public static final String OPT_NET_PROXY = CommonItemListFactory.ITEM_NET_PROXY; - public static final String OPT_NET_DHCP = NetIPInfoViewItem.ITEM_USE_DHCP; - - public static Launcher getInstance() { - if (launcher == null) { - launcher = new Launcher(); - } - return launcher; - } - - public Launcher() { - isConsole = EmulatorManager.isConsoleMode(); - } - - @Override - public List getLaunchCommand(VMProperty property, String path) - throws VMLauncherException { - String binary; - String hwVirtualization = ""; - int portNo; - boolean useBridgeNet = property.getPropertyValue() - .getAdvancedOptionValue(OPT_NET_CONNECT_TYPE).equals("Bridge") && - (EmulatorManager.isLinux() || EmulatorManager.isWin() || EmulatorManager.isMac()); - String tapName = null; - if (useBridgeNet) { - if (EmulatorManager.isWin()) { - tapName = property.getPropertyValue() - .getAdvancedOptionValue(OPT_NET_TAP_DEVICE); - if (TapUtil.nameNotExist(tapName)) - throw new VMLauncherException((new StringBuilder()) - .append("Tap device is not exist : ").append(tapName) - .append("\nCheck VM's tap configuration.").toString()); - if (isTapUsing(tapName)) - throw new VMLauncherException( - (new StringBuilder()) - .append("Tap device(") - .append(tapName) - .append(") is being used by other VM.") - .append("\nPlease select another tap device for current VM.") - .toString()); - String ipAddr = property.getPropertyValue() - .getAdvancedOptionSubValue(OPT_NET_IP_INFO, "ipAddr"); - if (isIpAddrUsing(ipAddr)) - throw new VMLauncherException((new StringBuilder()) - .append("VM's ip address(").append(ipAddr) - .append(") is being used by other VM.") - .append("\nPlease modify current VM's ip address.") - .toString()); - } - if (EmulatorManager.isWin()) { - try { - if (!TapUtil.isTapInBridge(tapName)) { - MessageDialog dialog = new MessageDialog(); - int res = dialog - .openWarningAndSelectionDialog("\nTap device is not connected with Bridge." - + "\nGuest network would work as NAT." - + "\nKeep launching ?"); - if (res != SWT.OK) { - throw new VMLauncherException("User canceled."); - } - useBridgeNet = false; - } - - } catch (VMWorkerException e) { - throw new VMLauncherException(e.getMessage()); - } - } - } - /* check available port number */ - portNo = new PortHelper().getPortNo(); - if(portNo == -1) { - String error = "Can not execute emulator." - + StringResources.NEW_LINE - + "All available ports are in use."; - throw new VMLauncherException(error); - } - - if (property.getArch().toString().equals("x86")) { - if (EmulatorManager.isWin()) { - binary = "emulator-x86.exe"; - } else { - binary = "emulator-x86"; - } - } else { - if (EmulatorManager.isWin()) { - binary = "emulator-arm.exe"; - } else { - binary = "emulator-arm"; - } - } - - // check disk image - File child = new File(property.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue()); - File base = new File(property.getConfiguration().getBaseInformation().getDiskImage().getBaseDiskImage().getValue()); - if (!child.exists()) { - throw new VMLauncherException("Child disk image does not exist." - + StringResources.NEW_LINE + child.getAbsolutePath() - , true); - } - if (!base.exists()) { - throw new VMLauncherException("Base disk image does not exist." - + StringResources.NEW_LINE + base.getAbsolutePath() - , true); - } - if (property.getConfiguration().getUsability().isHwVirtualization() && CheckVirtualization.getInstance().isSupportVirtualization()) { - hwVirtualization = CheckVirtualization.getInstance().getVirtualizationEnableCommnad(); - } else { - hwVirtualization = CheckVirtualization.getInstance().getVirtualizationDisableCommnad(); - } - - List cmd = new ArrayList(); - int width = property.getConfiguration().getDevice().getDisplay().getResolution().getWidth(); - int height = property.getConfiguration().getDevice().getDisplay().getResolution().getHeight(); - String skinPath = null; - if (property.getConfiguration().getDevice().getDisplay().getSkinPath() != null) { - skinPath = property.getConfiguration().getDevice().getDisplay().getSkinPath().getPath(); - if (skinPath != null && skinPath.isEmpty()) { - skinPath = null; - } - } - String fileshare = property.getConfiguration().getUsability().getFileSharing().getPath(); - String osVersion = System.getProperty("os.version"); - boolean isFileshare = true; - if (fileshare == null) { - isFileshare = false; - } - - /* get MAC address of host set as guest MAC address */ - String macAddr = useBridgeNet ? property.getPropertyValue() - .getAdvancedOptionValue(OPT_NET_MAC) : SettingInfoFile - .getMACaddr(); - - if(macAddr.isEmpty()) { - macAddr = "52:54:00:12:34:56"; - EMLogger.getLogger().log(Level.INFO, String.format("MAC set as default = %s", macAddr)); - } - - if (path == null || path.isEmpty()) { - cmd.add(FilePathResources.getBinPath() + File.separator + binary); - } else { - this.binPath = path; - cmd.add(binPath + File.separator + binary); - } - - cmd.add("--skin-args"); - cmd.add("width=" + width); - cmd.add("height=" + height); - if (skinPath != null) { - cmd.add("skin.path=" + skinPath); - } - - if (RemoteManager.getSpiceMode()) { - cmd.add("hb.ignore=true"); - } - - cmd.add("--qemu-args"); - // x86 part of cmd - if (property.getArch().toString().equals("x86")) { - cmd.add("-drive"); - cmd.add("file=" + property.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue()+ ",if=virtio,index=1"); - cmd.add( "-boot"); - cmd.add("c"); - cmd.add("-append"); - - String kernelOption = "console=ttyS0 video=LVDS-1:" - + width - + "x" - + height - + "-32@60" - + " dpi=" + property.getConfiguration().getDevice().getDisplay().getDensity().getValue() * 10 - + " ip=10.0.2.16::10.0.2.2:255.255.255.0::eth0:none" - + " vm_name=" + property.getConfiguration().getBaseInformation().getName(); - String hostIp = "10.0.2.2"; - if (useBridgeNet && EmulatorManager.isWin()) { - String bridgeIp = TapUtil.getBridgeIpAddr(property - .getPropertyValue().getAdvancedOptionValue( - OPT_NET_TAP_DEVICE)); - if (bridgeIp == null) { - MessageDialog dialog = new MessageDialog(); - int res = dialog.openInfoDialog( - "\nCannot find host(bridge) IP address." - + "\nTo use bridge network, host IP is required." - + "\nPlease input manually."); - if (res != SWT.OK) { - throw new VMLauncherException("User canceled."); - } - - // Input host IP address. - String ip = IPAddressInputDialog.open("Input host's IP address"); - if (ip == null) { - throw new VMLauncherException("User canceled."); - - } else { - hostIp = ip; - } - - } else { - hostIp = bridgeIp; - } - } - kernelOption += " host_ip=" + hostIp; - - // Set proxy. - if (EmulatorManager.isLinux() || EmulatorManager.isWin()) { - String proxyConfig = null; - String proxyMode = property.getPropertyValue(). - getAdvancedOptionSubValue(OPT_NET_PROXY, NetProxyViewItem.ITEM_PROXY_MODE); - if (proxyMode.equals(NetProxyViewItem.MODE_AUTO)) { - proxyConfig = getHostProxy(); - - } else if (proxyMode.equals(NetProxyViewItem.MODE_MANUAL)) { - proxyConfig = "http_proxy=" + property.getPropertyValue(). - getAdvancedOptionSubValue(OPT_NET_PROXY, NetProxyViewItem.ITEM_HTTP_PROXY) - + " https_proxy=" + property.getPropertyValue(). - getAdvancedOptionSubValue(OPT_NET_PROXY, NetProxyViewItem.ITEM_HTTPS_PROXY) - + " ftp_proxy=" + property.getPropertyValue(). - getAdvancedOptionSubValue(OPT_NET_PROXY, NetProxyViewItem.ITEM_FTP_PROXY) - + " socks_proxy=" + property.getPropertyValue(). - getAdvancedOptionSubValue(OPT_NET_PROXY, NetProxyViewItem.ITEM_SOCKS_PROXY); - } - - if (proxyConfig != null) { - kernelOption += (" " + proxyConfig); - } - } - - /* set virtio-9p string in case of using directory share [kernel option] */ - if(isFileshare) { - kernelOption += " virtio-9p"; - } - /* - if(property.getPropertyValue().skin != null && property.getPropertyValue().skin.getButtonType() == SKIN_BUTTON_TYPE.THREE_BUTTON_TYPE) { - kernelOption += " platform_feature=3btn"; - } else { - kernelOption += " platform_feature=1btn"; - } - */ - - cmd.add(kernelOption); - - /* use fileshare [non-kernel option] */ - if (isFileshare) { - cmd.add("-virtfs"); - cmd.add("local,path=" + property.getConfiguration().getUsability().getFileSharing().getPath() +",security_model=none,mount_tag=fileshare"); - } - - cmd.add("-serial"); - cmd.add("file:" + FilePathResources.getTizenVmsPath() + File.separator + property.getName() + File.separator + "logs" + File.separator + "emulator.klog"); - CpuType cpuOption = property.getConfiguration().getDevice().getCPU(); - if (cpuOption != null) { - cmd.add("-smp"); - cmd.add(String.valueOf(cpuOption.getValue().getValue())); - } - cmd.add("-m"); - cmd.add(String.valueOf(property.getConfiguration().getDevice().getRAM().getSize().getValue())); - cmd.add("-M"); - cmd.add("maru-x86-machine"); - cmd.add("-net"); - cmd.add("nic,model=virtio,macaddr=" + macAddr); - cmd.add("-soundhw"); - cmd.add("all"); - cmd.add("-usb"); - cmd.add("-vga"); - cmd.add("none"); - cmd.add("-enable-vigs"); - cmd.add("-L"); - cmd.add(FilePathResources.getBiosPath()); - cmd.add("-kernel"); - cmd.add(FilePathResources.getKernelPath() + File.separator+ "bzImage." + property.getArch().toString()); - cmd.add("-net"); - if (useBridgeNet && EmulatorManager.isWin()) { - tapName = property.getPropertyValue() - .getAdvancedOptionValue(OPT_NET_TAP_DEVICE); - if (TapUtil.nameNotExist(tapName)) { - throw new VMLauncherException("Tap device is not exist : " - + tapName + "\nCheck VM's tap configuration."); - } - cmd.add("tap,ifname=" + tapName + ",script=no,downscript=no"); - } else if (useBridgeNet && EmulatorManager.isLinux()) { - cmd.add("tap,script=/etc/" + IFUP_SCRIPT +",downscript=no"); - } else if (useBridgeNet && EmulatorManager.isMac()) { - //TODO: need changing path to /etc/emulator-ifup.sh - cmd.add("tap,script=" + FilePathResources.getBinPath() + File.separator + IFUP_SCRIPT +",downscript=no"); - } else { - cmd.add("user,dhcpstart=10.0.2.16"); - } - cmd.add("-rtc"); - cmd.add("base=utc"); - if (property.getConfiguration().getBaseInformation().getDiskImage().getSwapDiskImage() != null) { - cmd.add("-drive"); - cmd.add("file=" + property.getConfiguration().getBaseInformation().getDiskImage().getSwapDiskImage().getValue() + ",if=virtio,index=2"); - } - - /* append HW virtualization option if supports */ - if (hwVirtualization != null) { - cmd.add(hwVirtualization); - } - - // add hw gl acceleration - if (property.getConfiguration().getUsability().isHwGLAcceleration() - && CheckVirtualization.getInstance().isSupportGPU()) { - //cmd.add(CheckVirtualization.getInstance().getGPU_enable_command()); - cmd.add("-vigs-backend"); - cmd.add("gl"); - cmd.add("-enable-yagl"); - cmd.add("-yagl-backend"); - cmd.add("vigs"); - } else { - cmd.add("-vigs-backend"); - cmd.add("sw"); - } - - // for bootup status - cmd.add("-device"); - cmd.add("virtio-esm-pci"); - - // for brightness - cmd.add("-device"); - cmd.add("maru-brightness"); - - // for vmodem - cmd.add("-device"); - cmd.add("virtio-vmodem-pci"); - - // for hardware key - if (checkOnOff(property.getPropertyValue().getAdvancedOptionValue(OPT_HWKEY))) { - cmd.add("-device"); - cmd.add("virtio-hwkey-pci"); - } - - // for codec - if (checkOnOff(property.getPropertyValue().getAdvancedOptionValue(OPT_CODEC))) { - cmd.add("-device"); - cmd.add("codec-pci"); - } - - // for ecp - cmd.add("-device"); - cmd.add("virtio-evdi-pci,profile=" + property.getPropertyValue().profile - + "-" + property.getPropertyValue().version); - - // for camera - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_DEVICE, OPT_CAMERA))) { - cmd.add("-device"); - cmd.add("maru-camera"); - } - - // for battery - cmd.add("-device"); - cmd.add("virtio-power-pci"); - - // for nfc - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_DEVICE, OPT_NFC))) { - cmd.add("-device"); - cmd.add("virtio-nfc-pci"); - } - - // for sensor (accel, geo, gyro, light, proxi, haptic, pressure, ultra violet, heart rate meter) - OptionType sensor = property.getPropertyValue().getAdvancedOption(OPT_SENSOR); - if (sensor != null) { - cmd.add("-device"); - - StringBuilder sb = new StringBuilder(); - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_ACCEL))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("accel"); - } - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_GEO))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("geo"); - } - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_GYRO))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("gyro"); - } - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_LIGHT))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("light"); - } - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_PROXI))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("proxi"); - } - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_HAPTIC))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("haptic"); - } - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_PRESS))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("press"); - } - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_UV))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("uv"); - } - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_HRM))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("hrm"); - } - - if (sb.toString().isEmpty()) { - cmd.add("virtio-sensor-pci"); - } else { - sb.insert(0, "virtio-sensor-pci,sensors="); - cmd.add(sb.toString()); - } - } - - // for jacks (enabled charger, and usb) - cmd.add("-device"); - cmd.add("virtio-jack-pci,jacks=charger&usb"); - /* OptionType jacks = property.getPropertyValue().getAdvancedOption(OPT_JACK); - if (jacks != null) { - cmd.add("-device"); - - StringBuilder sb = new StringBuilder(); - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_JACK, OPT_CHARGER))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("charger"); - } - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_JACK, OPT_USB))) { - if(!sb.toString().isEmpty()) { - sb.append("&"); - } - sb.append("usb"); - } - - if (sb.toString().isEmpty()) { - cmd.add("virtio-jack-pci"); - } else { - sb.insert(0, "virtio-jack-pci,jacks="); - cmd.add(sb.toString()); - } - } */ - - - cmd.add("-device"); - TouchType touchType = property.getConfiguration().getDevice().getTouch(); - if (touchType != null) { - cmd.add("virtio-touchscreen-pci,max_point=" + touchType.getMaxTouchPoint()); - } else { - cmd.add("virtio-touchscreen-pci"); - } - - } else { // ARM part of cmd - cmd.add("-drive"); - cmd.add("file=" + property.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue()+ ",id=virtio-blk,if=none"); - cmd.add( "-device"); - cmd.add("virtio-blk,drive=virtio-blk,transport=virtio-mmio.0"); - cmd.add("-netdev"); - cmd.add("user,id=virtio-net"); - cmd.add("-device"); - cmd.add("virtio-net,netdev=virtio-net,transport=virtio-mmio.1"); - cmd.add("-append"); - cmd.add("yagl=1 console=ttySAC2,115200 video=s3cfb:" - + width - + "x" - + height - + "-24" - + " dpi=" + property.getConfiguration().getDevice().getDisplay().getDensity().getValue() * 10 - + " rootwait root=/dev/vda rw rootfstype=ext4" - + " ip=10.0.2.16::10.0.2.2:255.255.255.0::eth0:none" - + " vm_name=" + property.getConfiguration().getBaseInformation().getName() - + " virtio_mmio.device=4K@0x10AD0000:423 virtio_mmio.device=4K@0x10AC0000:422"); - cmd.add("-serial"); - cmd.add(EmulatorManager.isLinux() ? "/dev/null" : "none"); - cmd.add("-serial"); - cmd.add(EmulatorManager.isLinux() ? "/dev/null" : "none"); - cmd.add("-serial"); - cmd.add("file:" + FilePathResources.getTizenVmsPath() + File.separator + property.getName() + File.separator + "logs" + File.separator + "emulator.klog"); - cmd.add("-m"); - cmd.add(String.valueOf(property.getConfiguration().getDevice().getRAM().getSize().getValue())); - cmd.add("-M"); - cmd.add("maru-arm-machine"); - cmd.add("-soundhw"); - cmd.add("all"); - cmd.add("-usb"); - cmd.add("-usbdevice"); - cmd.add("maru-touchscreen"); - cmd.add("-kernel"); - cmd.add(FilePathResources.getKernelPath() + File.separator+ "bzImage." + property.getArch().toString()); - } - - //} - - /* append user added options if exists */ - String advancedOptions = property.getConfiguration().getUsability().getAdvancedOptions(); - if (advancedOptions != null) { - String[] arrOptions = advancedOptions.split(" "); - for (String option : arrOptions) { - cmd.add(option); - } - } - - /* spice options */ - if (RemoteManager.getSpiceMode()) { - cmd.add("-spice"); - cmd.add("disable-ticketing"); - cmd.add("-device"); - cmd.add("virtio-serial-pci,id=virtio-serial0,max_ports=16,bus=pci.0"); - cmd.add("-chardev"); - cmd.add("spicevmc,id=vdagent,name=vdagent"); - cmd.add("-device"); - cmd.add("virtserialport,nr=1,bus=virtio-serial0.0,chardev=vdagent,name=com.redhat.spice.0"); - } - - //for qt enable - if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue( - OPT_EXPERIMENTAL, OPT_QT_ENABLE))) { - if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) { - cmd.add("-display"); - if (EmulatorManager.isMac()) { - cmd.add("maru_qt,rendering=offscreen"); - } else { - cmd.add("maru_qt,rendering=onscreen"); - } - } - } - - EMLogger.getLogger().log(Level.INFO, "Starting Emulator Command : "); - String temp = cmd.get(0) + " "; - for (String s : cmd.subList(1, cmd.size())) { - temp += ("\"" + s + "\" "); - } - EMLogger.getLogger().log(Level.INFO, temp); - System.out.println("cmd : " + cmd); - return cmd; - } - - @Override - public boolean launch(VMProperty property) throws VMLauncherException { - return launch(property, false); - } - - @Override - public boolean launch(VMProperty property, boolean wait) throws VMLauncherException { - List cmd; - - cmd = getLaunchCommand(property, null); - - if (cmd == null) { - return false; - } - - CheckingRunningEmulator.addEmulator(property); - MonitoringEmulator monitor = new MonitoringEmulator(property); - Process process = launch(cmd); - if (process != null) { - monitor.setProcess(process); - monitor.start(); - if (wait) { - try { - monitor.join(); - } catch (InterruptedException e) { - EMLogger.getLogger().warning(e.getMessage()); - } - if (monitor.isSuccess()) { - return true; - } else { - return false; - } - } - return true; - } else { - CheckingRunningEmulator.removeEmulator(property, false); - monitor.interrupt(); - return false; - } - } - - @Override - public Process launch(List cmd) { - ProcessBuilder pb = new ProcessBuilder(cmd); - Map env = pb.environment(); - if (EmulatorManager.isLinux()) { - String value = env.get("LD_LIBRARY_PATH"); - env.put("LD_LIBRARY_PATH", ((value == null) ? "" : value + ":") + FilePathResources.getBinPath() + ":" + FilePathResources.getRemotePath() + File.separator + "lib:"); - EMLogger.getLogger().log(Level.INFO, "LD_LIBRARY_PATH=" + env.get("LD_LIBRARY_PATH")); - } - env.put("GL_VERSION", "2"); - EMLogger.getLogger().log(Level.INFO, "GL_VERSION: " + env.get("GL_VERSION")); - - if (this.binPath == null || this.binPath.isEmpty()) { - pb.directory(new File(FilePathResources.getBinPath())); - } else { - pb.directory(new File(this.binPath)); - } - - Process process = null; - try { - process = pb.start(); - } catch (IOException e) { - if (!isConsole) { - MessageDialog msg = new MessageDialog(new Shell(Display.getCurrent())); - msg.openWarningDialog("Failed to launch" + StringResources.NEW_LINE + e.getMessage()); - } - EMLogger.getLogger().log(Level.WARNING, "Failed to launch." + StringResources.NEW_LINE + e.getMessage()); - } - - return process; - } - - private boolean checkOnOff(String value) { - if (value.toLowerCase().equals("on")) { - return true; - } else if (value.toLowerCase().equals("off")) { - return false; - } else if (value.isEmpty()){ - return true; - } else { - return false; - } - } - - private boolean checkOn(String value) { - if (value.toLowerCase().equals("on")) { - return true; - } - return false; - } - - @Override - public void sendRemoteLog(String msg) { - EMLogger.getLogger().info("Launcher log : " + msg); - } - - private static boolean isTapUsing(String tapName) { - boolean isUsing = false; -// VMProperty arr[] = (VMProperty[]) EmulatorVMList.getInstance() -// .getProperties(); -// int len$ = arr$.length; -// for (int i$ = 0; i$ < len$; i$++) { - for (VMProperty prop : EmulatorVMList.getInstance().getProperties()) { - if (!prop.isRunning()) { - continue; - } - String name = prop.getPropertyValue().getAdvancedOptionValue( - OPT_NET_TAP_DEVICE); - if (tapName.equals(name)) { - isUsing = true; - break; - } - } - - return isUsing; - } - - private static boolean isIpAddrUsing(String ipAddr) { - boolean isUsing = false; - - for (VMProperty prop : EmulatorVMList.getInstance().getProperties()) { - if (!prop.isRunning()) { - continue; - } - String ip = prop.getPropertyValue().getAdvancedOptionSubValue( - OPT_NET_IP_INFO, "ipAddr"); - if (!ipAddr.equals(ip)) { - continue; - } - isUsing = true; - break; - } - - return isUsing; - } - - private String getIP(boolean useBridgeNet, VMProperty prop) { - StringBuilder sb = new StringBuilder(); - sb.append(" ip="); - if (useBridgeNet) { - String useDHCP = prop.getPropertyValue().getAdvancedOptionSubValue( - OPT_NET_IP_INFO, OPT_NET_DHCP); - if (checkOn(useDHCP)) { - return ""; - } - - sb.append(prop.getPropertyValue().getAdvancedOptionSubValue( - OPT_NET_IP_INFO, OPT_NET_IPADDR)); - sb.append("::"); - sb.append(prop.getPropertyValue().getAdvancedOptionSubValue( - OPT_NET_IP_INFO, OPT_NET_GATEWAY)); - sb.append(":"); - sb.append(prop.getPropertyValue().getAdvancedOptionSubValue( - OPT_NET_IP_INFO, OPT_NET_SUBNET)); - sb.append("::eth0:none:"); - sb.append(prop.getPropertyValue().getAdvancedOptionValue( - OPT_NET_DNS)); - - } else { // NAT (default) - sb.append("10.0.2.16::10.0.2.2:255.255.255.0::eth0:none:10.0.2.3"); - } - return sb.toString(); - } - - private String getHostProxy() throws VMLauncherException{ - String result = null; - String proxyCommand = "check-net"; - if (EmulatorManager.isWin()) { - proxyCommand = "check-net.exe"; - } - - List cmd = Arrays.asList(FilePathResources.getBinPath() + File.separator + proxyCommand, "--proxy"); - ProcessResult res = HelperClass.runProcess(cmd); - boolean isCommandSuccess = false; - if (res.isSuccess()) { - for (String str : res.getStdOutMsg()) { - if (str.startsWith("MODE:")) { - isCommandSuccess = true; - } - if (str.startsWith("http_proxy")) { - result = str; - } - } - - } else if (!res.isSuccess() || !isCommandSuccess) { - EMLogger.getLogger().warning(res.getResultMessage()); - int dialogRes = new MessageDialog().openWarningAndSelectionDialog - ("Failed to get host proxy setting." - + "\n" + res.getResultMessage() - + "\nContinue launching anyway ?"); - if (dialogRes != SWT.OK) { - throw new VMLauncherException("User canceled launching VM."); - } - } - - if (result == null) { - EMLogger.getLogger().warning("Can't find host proxy setting."); - EMLogger.getLogger().warning("check-net result : " + res.getResultMessage()); - } - - return result; - } - -} diff --git a/template/w-x86-standard-template-win.xml b/template/w-x86-standard-template-win.xml deleted file mode 100644 index 256c509..0000000 --- a/template/w-x86-standard-template-win.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/template/w-x86-standard-template.xml b/template/w-x86-standard-template.xml deleted file mode 100644 index 60d7171..0000000 --- a/template/w-x86-standard-template.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 2.7.4