[Title] add swap image path
authorjihye kim <jihye1128.kim@samsung.com>
Tue, 10 Jul 2012 01:01:04 +0000 (10:01 +0900)
committerjihye kim <jihye1128.kim@samsung.com>
Tue, 10 Jul 2012 01:01:04 +0000 (10:01 +0900)
[Type] Enhancement
[Module] emulator manager
[Priority] major
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

28 files changed:
jaxb_src/org/tizen/emulator/manager/vms/xml/BaseInformationType.java
jaxb_src/org/tizen/emulator/manager/vms/xml/DeviceType.java
jaxb_src/org/tizen/emulator/manager/vms/xml/DiskImageFormatType.java
jaxb_src/org/tizen/emulator/manager/vms/xml/DisplayType.java
jaxb_src/org/tizen/emulator/manager/vms/xml/EmulatorConfiguration.java
jaxb_src/org/tizen/emulator/manager/vms/xml/ObjectFactory.java
jaxb_src/org/tizen/emulator/manager/vms/xml/RamType.java
jaxb_src/org/tizen/emulator/manager/vms/xml/SkinType.java
jaxb_src/org/tizen/emulator/manager/vms/xml/TouchType.java
jaxb_src/org/tizen/emulator/manager/vms/xml/UsabilityType.java
jaxb_src/org/tizen/emulator/manager/vms/xml/package-info.java
package/pkginfo.manifest
src/org/tizen/emulator/manager/EmulatorManager.java
src/org/tizen/emulator/manager/console/ActionList.java
src/org/tizen/emulator/manager/image/EmulatorImages.java
src/org/tizen/emulator/manager/logging/EMLogger.java
src/org/tizen/emulator/manager/tool/CheckSDCard.java
src/org/tizen/emulator/manager/tool/CheckVirtualization.java
src/org/tizen/emulator/manager/tool/FilePath.java [moved from src/org/tizen/emulator/manager/tool/FileIO.java with 95% similarity]
src/org/tizen/emulator/manager/tool/SelectWorkspace.java
src/org/tizen/emulator/manager/ui/MenuHandling.java
src/org/tizen/emulator/manager/vms/Creator.java
src/org/tizen/emulator/manager/vms/Launcher.java
src/org/tizen/emulator/manager/vms/Modifier.java
src/org/tizen/emulator/manager/vms/QemuImgProc.java
src/org/tizen/emulator/manager/vms/VMPropertyValue.java
src/org/tizen/emulator/manager/vms/VMsWorker.java
xsd/em.xsd

index c6f1e8e..0026c72 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2012.07.03 at 02:07:17 PM KST 
+// Generated on: 2012.07.10 at 09:39:08 AM KST 
 //
 
 
@@ -43,6 +43,7 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
  *                 &lt;sequence>
  *                   &lt;element name="baseDiskImage" type="{http://www.tizen.org/em}diskImageFormatType"/>
  *                   &lt;element name="currentDiskImage" type="{http://www.tizen.org/em}diskImageFormatType"/>
+ *                   &lt;element name="swapDiskImage" type="{http://www.tizen.org/em}diskImageFormatType"/>
  *                 &lt;/sequence>
  *                 &lt;attribute name="type" use="required">
  *                   &lt;simpleType>
@@ -166,6 +167,7 @@ public class BaseInformationType {
      *       &lt;sequence>
      *         &lt;element name="baseDiskImage" type="{http://www.tizen.org/em}diskImageFormatType"/>
      *         &lt;element name="currentDiskImage" type="{http://www.tizen.org/em}diskImageFormatType"/>
+     *         &lt;element name="swapDiskImage" type="{http://www.tizen.org/em}diskImageFormatType"/>
      *       &lt;/sequence>
      *       &lt;attribute name="type" use="required">
      *         &lt;simpleType>
@@ -186,7 +188,8 @@ public class BaseInformationType {
     @XmlAccessorType(XmlAccessType.FIELD)
     @XmlType(name = "", propOrder = {
         "baseDiskImage",
-        "currentDiskImage"
+        "currentDiskImage",
+        "swapDiskImage"
     })
     public static class DiskImage {
 
@@ -194,6 +197,8 @@ public class BaseInformationType {
         protected DiskImageFormatType baseDiskImage;
         @XmlElement(required = true)
         protected DiskImageFormatType currentDiskImage;
+        @XmlElement(required = true)
+        protected DiskImageFormatType swapDiskImage;
         @XmlAttribute(required = true)
         @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
         protected String type;
@@ -249,6 +254,30 @@ public class BaseInformationType {
         }
 
         /**
+         * Gets the value of the swapDiskImage property.
+         * 
+         * @return
+         *     possible object is
+         *     {@link DiskImageFormatType }
+         *     
+         */
+        public DiskImageFormatType getSwapDiskImage() {
+            return swapDiskImage;
+        }
+
+        /**
+         * Sets the value of the swapDiskImage property.
+         * 
+         * @param value
+         *     allowed object is
+         *     {@link DiskImageFormatType }
+         *     
+         */
+        public void setSwapDiskImage(DiskImageFormatType value) {
+            this.swapDiskImage = value;
+        }
+
+        /**
          * Gets the value of the type property.
          * 
          * @return
index 5a267c0..02c1f96 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2012.07.03 at 02:07:17 PM KST 
+// Generated on: 2012.07.10 at 09:39:08 AM KST 
 //
 
 
index 479f789..2734773 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2012.07.03 at 02:07:17 PM KST 
+// Generated on: 2012.07.10 at 09:39:08 AM KST 
 //
 
 
index 3d34280..5cdd515 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2012.07.03 at 02:07:17 PM KST 
+// Generated on: 2012.07.10 at 09:39:08 AM KST 
 //
 
 
index 653a47d..6f61fba 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2012.07.03 at 02:07:17 PM KST 
+// Generated on: 2012.07.10 at 09:39:08 AM KST 
 //
 
 
index 0e3b42d..c48200a 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2012.07.03 at 02:07:17 PM KST 
+// Generated on: 2012.07.10 at 09:39:08 AM KST 
 //
 
 
@@ -37,11 +37,11 @@ public class ObjectFactory {
     }
 
     /**
-     * Create an instance of {@link EmulatorConfiguration }
+     * Create an instance of {@link DisplayType.Density }
      * 
      */
-    public EmulatorConfiguration createEmulatorConfiguration() {
-        return new EmulatorConfiguration();
+    public DisplayType.Density createDisplayTypeDensity() {
+        return new DisplayType.Density();
     }
 
     /**
@@ -53,115 +53,115 @@ public class ObjectFactory {
     }
 
     /**
-     * Create an instance of {@link TouchType }
+     * Create an instance of {@link DisplayType.SkinPath }
      * 
      */
-    public TouchType createTouchType() {
-        return new TouchType();
+    public DisplayType.SkinPath createDisplayTypeSkinPath() {
+        return new DisplayType.SkinPath();
     }
 
     /**
-     * Create an instance of {@link SkinType }
+     * Create an instance of {@link DisplayType }
      * 
      */
-    public SkinType createSkinType() {
-        return new SkinType();
+    public DisplayType createDisplayType() {
+        return new DisplayType();
     }
 
     /**
-     * Create an instance of {@link DeviceType }
+     * Create an instance of {@link UsabilityType }
      * 
      */
-    public DeviceType createDeviceType() {
-        return new DeviceType();
+    public UsabilityType createUsabilityType() {
+        return new UsabilityType();
     }
 
     /**
-     * Create an instance of {@link BaseInformationType.DiskImage }
+     * Create an instance of {@link DeviceType }
      * 
      */
-    public BaseInformationType.DiskImage createBaseInformationTypeDiskImage() {
-        return new BaseInformationType.DiskImage();
+    public DeviceType createDeviceType() {
+        return new DeviceType();
     }
 
     /**
-     * Create an instance of {@link DisplayType.Density }
+     * Create an instance of {@link RamType.Size }
      * 
      */
-    public DisplayType.Density createDisplayTypeDensity() {
-        return new DisplayType.Density();
+    public RamType.Size createRamTypeSize() {
+        return new RamType.Size();
     }
 
     /**
-     * Create an instance of {@link UsabilityType.Logging }
+     * Create an instance of {@link DisplayType.Resolution }
      * 
      */
-    public UsabilityType.Logging createUsabilityTypeLogging() {
-        return new UsabilityType.Logging();
+    public DisplayType.Resolution createDisplayTypeResolution() {
+        return new DisplayType.Resolution();
     }
 
     /**
-     * Create an instance of {@link UsabilityType }
+     * Create an instance of {@link SkinType }
      * 
      */
-    public UsabilityType createUsabilityType() {
-        return new UsabilityType();
+    public SkinType createSkinType() {
+        return new SkinType();
     }
 
     /**
-     * Create an instance of {@link DisplayType.Resolution }
+     * Create an instance of {@link UsabilityType.Logging }
      * 
      */
-    public DisplayType.Resolution createDisplayTypeResolution() {
-        return new DisplayType.Resolution();
+    public UsabilityType.Logging createUsabilityTypeLogging() {
+        return new UsabilityType.Logging();
     }
 
     /**
-     * Create an instance of {@link RamType.Size }
+     * Create an instance of {@link BaseInformationType.DiskImage }
      * 
      */
-    public RamType.Size createRamTypeSize() {
-        return new RamType.Size();
+    public BaseInformationType.DiskImage createBaseInformationTypeDiskImage() {
+        return new BaseInformationType.DiskImage();
     }
 
     /**
-     * Create an instance of {@link RamType }
+     * Create an instance of {@link UsabilityType.FileSharing }
      * 
      */
-    public RamType createRamType() {
-        return new RamType();
+    public UsabilityType.FileSharing createUsabilityTypeFileSharing() {
+        return new UsabilityType.FileSharing();
     }
 
     /**
-     * Create an instance of {@link DisplayType }
+     * Create an instance of {@link DiskImageFormatType }
      * 
      */
-    public DisplayType createDisplayType() {
-        return new DisplayType();
+    public DiskImageFormatType createDiskImageFormatType() {
+        return new DiskImageFormatType();
     }
 
     /**
-     * Create an instance of {@link DiskImageFormatType }
+     * Create an instance of {@link RamType }
      * 
      */
-    public DiskImageFormatType createDiskImageFormatType() {
-        return new DiskImageFormatType();
+    public RamType createRamType() {
+        return new RamType();
     }
 
     /**
-     * Create an instance of {@link UsabilityType.FileSharing }
+     * Create an instance of {@link EmulatorConfiguration }
      * 
      */
-    public UsabilityType.FileSharing createUsabilityTypeFileSharing() {
-        return new UsabilityType.FileSharing();
+    public EmulatorConfiguration createEmulatorConfiguration() {
+        return new EmulatorConfiguration();
     }
 
     /**
-     * Create an instance of {@link DisplayType.SkinPath }
+     * Create an instance of {@link TouchType }
      * 
      */
-    public DisplayType.SkinPath createDisplayTypeSkinPath() {
-        return new DisplayType.SkinPath();
+    public TouchType createTouchType() {
+        return new TouchType();
     }
 
 }
index b5086ed..9bd98c0 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2012.07.03 at 02:07:17 PM KST 
+// Generated on: 2012.07.10 at 09:39:08 AM KST 
 //
 
 
index fd0e5a0..3f1a1e6 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2012.07.03 at 02:07:17 PM KST 
+// Generated on: 2012.07.10 at 09:39:08 AM KST 
 //
 
 
index 3c84d29..e11c13f 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2012.07.03 at 02:07:17 PM KST 
+// Generated on: 2012.07.10 at 09:39:08 AM KST 
 //
 
 
index ec359ec..4b805a4 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2012.07.03 at 02:07:17 PM KST 
+// Generated on: 2012.07.10 at 09:39:08 AM KST 
 //
 
 
index ec7b080..99d535f 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2012.07.03 at 02:07:17 PM KST 
+// Generated on: 2012.07.10 at 09:39:08 AM KST 
 //
 
 @javax.xml.bind.annotation.XmlSchema(namespace = "http://www.tizen.org/em", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
index 4d01505..6d3a47a 100644 (file)
@@ -1,5 +1,5 @@
 Package: emulator-manager
-Version: 1.0.67
+Version: 1.0.69
 OS: linux
 Build-host-os: linux
 Maintainer: Yeong-Kyoon Lee<yeongkyoon.lee@samsung.com>
@@ -7,7 +7,7 @@ Source: emulator-manager
 Description: Tizen Emulator Manager
 
 Package: emulator-manager
-Version: 1.0.67
+Version: 1.0.69
 OS: windows
 Build-host-os: windows
 Maintainer: Yeong-Kyoon Lee<yeongkyoon.lee@samsung.com>
index d4f34e1..f1b15db 100644 (file)
@@ -43,7 +43,7 @@ import org.tizen.emulator.manager.image.EmulatorImages;
 import org.tizen.emulator.manager.logging.EMLogger;
 import org.tizen.emulator.manager.tool.CheckSDCard;
 import org.tizen.emulator.manager.tool.CheckVirtualization;
-import org.tizen.emulator.manager.tool.FileIO;
+import org.tizen.emulator.manager.tool.FilePath;
 import org.tizen.emulator.manager.tool.SelectWorkspace;
 import org.tizen.emulator.manager.ui.MainDialog;
 import org.tizen.emulator.manager.ui.MessageDialog;
@@ -179,7 +179,7 @@ public class EmulatorManager {
 
                        EMLogger.getInstance().initConsoleLogger();
                        try {
-                               FileLock lock = new RandomAccessFile(new File(FileIO.getInstance().getBinPath()
+                               FileLock lock = new RandomAccessFile(new File(FilePath.getInstance().getBinPath()
                                                                + File.separator + "." +System.getProperty("user.name"))+ ".lock",
                                                                "rw").getChannel().tryLock();
                                if (lock == null) {
@@ -217,7 +217,7 @@ public class EmulatorManager {
                        EMLogger.getInstance().initLogger();
                        MessageDialog msg = new MessageDialog(new Shell(Display.getCurrent()));
                        try {
-                               FileLock lock = new RandomAccessFile(new File(FileIO.getInstance().getBinPath()
+                               FileLock lock = new RandomAccessFile(new File(FilePath.getInstance().getBinPath()
                                                                + File.separator + "." +System.getProperty("user.name"))+ ".lock",
                                                                "rw").getChannel().tryLock();
                                if (lock == null) {
index b1e33c0..87a4aae 100644 (file)
@@ -36,7 +36,7 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.tool.FileIO;
+import org.tizen.emulator.manager.tool.FilePath;
 import org.tizen.emulator.manager.tool.SelectWorkspace;
 import org.tizen.emulator.manager.vms.RAM_SIZE;
 import org.tizen.emulator.manager.vms.RESOLUTION;
@@ -206,11 +206,11 @@ class ListImage extends Action {
 class Detail extends Action {
        public Detail() {
                this.action     = Actions.AC_DETAIL;
-               this.description = "Display more information of selected 'Virtual Target'.";
+               this.description = "Display more information of selected 'Virtual Machine'.";
                this.usage = "detail -n test";
 
                commandList.add(new Command("n", Actions.OP_NAME,
-                               "Name of vertual target.\n" +
+                               "Name of virtual machine.\n" +
                                "                       If you do not enter a name, emulator manager's information is printed.","", false, true));
        }
 
@@ -250,10 +250,10 @@ class Workspace extends Action {
                                                                "       Get workspace : workspace -g");
 
                commandList.add(new Command("s", Actions.OP_SET,
-                               "Set path of workspace.", FileIO.getInstance().getTizenVmsPath(),
+                               "Set path of workspace.", FilePath.getInstance().getTizenVmsPath(),
                                false, true));
                commandList.add(new Command("g", Actions.OP_GET,
-                               "Get current workspace path.", FileIO.getInstance().getTizenVmsPath(),
+                               "Get current workspace path.", FilePath.getInstance().getTizenVmsPath(),
                                false, false));
        }
 
@@ -278,7 +278,7 @@ class Workspace extends Action {
 
                if (isGet) {
                        System.out.println("Current Workspace : ");
-                       System.out.println(FileIO.getInstance().getTizenVmsPath());
+                       System.out.println(FilePath.getInstance().getTizenVmsPath());
                } else {
                        File f = null;
                        try {
@@ -443,7 +443,7 @@ class Launch extends Action {
 
                commandList.add(new Command("p", Actions.OP_PATH,
                                "Setting path of emulator program.",
-                               FileIO.getInstance().getBinPath(), false, true));
+                               FilePath.getInstance().getBinPath(), false, true));
 
                commandList.add(new Command("t", Actions.OP_TEST,
                                "Print parameters of emulator without executing emulator.",
@@ -545,14 +545,14 @@ class Reset extends Action {
 class CreateBaseImage extends Action {
        public CreateBaseImage() {
                this.action     = Actions.AC_CREATE_IMAGE;
-               this.description = "Create base target image using VM's child image.";
+               this.description = "Create base disk image using VM's child image.";
                this.usage = "create-image -n test [options]";
 
                commandList.add(new Command("n", Actions.OP_NAME,
                                "Name of VM to create base target image.","", true, true));
                commandList.add(new Command("p", Actions.OP_PATH,
                                "Setting Location to generate base target image.",
-                               FileIO.getInstance().getTizenVmsPath(), false, true));
+                               FilePath.getInstance().getTizenVmsPath(), false, true));
        }
 
        @Override
@@ -583,7 +583,7 @@ class CreateBaseImage extends Action {
 class Clone extends Action {
        public Clone() {
                this.action     = Actions.AC_COLONE;
-               this.description = "Clone new VM which has the same configurations ad you selected..";
+               this.description = "Create new VM which has the same configurations as you selected..";
                this.usage = "clone -n test -t target";
 
                commandList.add(new Command("n", Actions.OP_NAME,
index a2ddb37..e92d86e 100644 (file)
@@ -36,7 +36,7 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Properties;
 
-import org.tizen.emulator.manager.tool.FileIO;
+import org.tizen.emulator.manager.tool.FilePath;
 import org.tizen.emulator.manager.tool.StringResource;
 
 public class EmulatorImages {
@@ -62,7 +62,7 @@ public class EmulatorImages {
                // TODO : only one base image
                BaseImage image = null;
                int id = 1;
-               String path = FileIO.getInstance().getEtcPath();
+               String path = FilePath.getInstance().getEtcPath();
                File f = new File(path + File.separator + StringResource.IMAGE_INFO_FILENAME);
                try {
                        if (f.exists()) {
@@ -72,7 +72,7 @@ public class EmulatorImages {
                                String domain   = prop.getProperty(StringResource.PRODUCT_DOMAIN, "Phone");
                                String cpu              = prop.getProperty(StringResource.TARGET_CPU, "X86");
                                String release  = prop.getProperty(StringResource.RELEASE_VERSION, "Not identified");
-                               image = new BaseImage(Integer.toString(id++), version, FileIO.getInstance().getBaseimgPath(),
+                               image = new BaseImage(Integer.toString(id++), version, FilePath.getInstance().getBaseimgPath(),
                                                domain, cpu, release);
                        }
                } catch (FileNotFoundException e) {
@@ -81,7 +81,7 @@ public class EmulatorImages {
                        // TODO
                } finally {
                        if (image == null) {
-                               image = new BaseImage(Integer.toString(id++), "Standard", FileIO.getInstance().getBaseimgPath(),
+                               image = new BaseImage(Integer.toString(id++), "Standard", FilePath.getInstance().getBaseimgPath(),
                                                "Phone", "X86", "Not identified");
                        }
                        imageList.add(image);
index d891e03..5633aaf 100644 (file)
@@ -39,7 +39,7 @@ import java.util.logging.Level;
 import java.util.logging.LogRecord;
 import java.util.logging.Logger;
 
-import org.tizen.emulator.manager.tool.FileIO;
+import org.tizen.emulator.manager.tool.FilePath;
 
 public class EMLogger {
        private static EMLogger instance;
@@ -83,7 +83,7 @@ public class EMLogger {
                File logFolder;
                Handler logFileHandler;
                try {
-                       logFolder = new File(FileIO.getInstance().getTizenVmsArchPath());
+                       logFolder = new File(FilePath.getInstance().getTizenVmsArchPath());
                        if (!logFolder.exists()) {
                                logFolder.mkdirs();
                        }
index 093218c..58699db 100644 (file)
@@ -44,7 +44,7 @@ public class CheckSDCard {
        }
 
        public static void CheckSDCardDir() {
-               File dir = new File(FileIO.getInstance().getTizenVmsPath()
+               File dir = new File(FilePath.getInstance().getTizenVmsPath()
                                                + File.separator + StringResource.SD_CARD_DIR);
                
                if (!dir.exists()) {
@@ -54,11 +54,11 @@ public class CheckSDCard {
                File dest = null;
                File src = null;
                for (String s : StringResource.SD_CARD) {
-                       dest = new File(FileIO.getInstance().getTizenVmsPath()
+                       dest = new File(FilePath.getInstance().getTizenVmsPath()
                                                + File.separator + StringResource.SD_CARD_DIR
                                                + File.separator + s);
                        if (!dest.exists()) {
-                               src = new File(FileIO.getInstance().getSDCardPath()
+                               src = new File(FilePath.getInstance().getSDCardPath()
                                                + File.separator +s);
                                if (!src.exists()) {
                                        EMLogger.getLogger().log(Level.WARNING,
index b0def22..d975e8e 100644 (file)
@@ -108,9 +108,9 @@ public class CheckVirtualization {
                                int exitValue = 0;
 
                                List<String> cmd = new ArrayList<String>();
-                               cmd.add(FileIO.getInstance().getBinPath() + File.separator + "check-hax.exe");
+                               cmd.add(FilePath.getInstance().getBinPath() + File.separator + "check-hax.exe");
                                ProcessBuilder pb = new ProcessBuilder(cmd);
-                               pb.directory(new File(FileIO.getInstance().getBinPath()));
+                               pb.directory(new File(FilePath.getInstance().getBinPath()));
 
                                try {
                                        Process process = null;
@@ -37,7 +37,7 @@ import java.net.URISyntaxException;
 import org.tizen.emulator.manager.EmulatorManager;
 import org.tizen.emulator.manager.vms.EmulatorVMs;
 
-public class FileIO {
+public class FilePath {
        private final static String arch_suffix = File.separator +"x86";
        private final static String icon_suffix = File.separator +"skins"+ File.separator +"icons" + File.separator +"vtm.ico";
        private final static String data_suffix = File.separator +"data";
@@ -66,6 +66,7 @@ public class FileIO {
        private static String biosPath;
        private static String skinPath;
        private static String sdcardPath;
+       private static String swapPath;
 
        private static String vmsPath;
        private static String vmsArchPath;
@@ -115,6 +116,7 @@ public class FileIO {
                confPath = arcPath + conf_suffix;
                baseImagePath = arcPath + baseimg_suffix;
                sdcardPath = dataPath + File.separator + "sdcard";
+               swapPath = dataPath + File.separator + "swap";
 
                x86KernelPath = dataPath + x86_kernel_suffix;
                biosPath = dataPath + bios_suffix;
@@ -148,18 +150,18 @@ public class FileIO {
 
        }
 
-       static FileIO instance = null;
+       static FilePath instance = null;
 
        static {
-               synchronized(FileIO.class) {
-                       instance = new FileIO();
+               synchronized(FilePath.class) {
+                       instance = new FilePath();
                }
        }
 
-       private FileIO() {
+       private FilePath() {
        }
 
-       public static FileIO getInstance() {
+       public static FilePath getInstance() {
                return instance;
        }
 
@@ -235,4 +237,8 @@ public class FileIO {
        public String getSDCardPath() {
                return sdcardPath;
        }
+
+       public String getSwapPath() {
+               return swapPath;
+       }
 }
index f37848e..ff1b7eb 100644 (file)
@@ -319,7 +319,7 @@ public class SelectWorkspace {
                        }
 
                        EmulatorVMs.getInstance().setVMsBaseDirectory(workspacePath);
-                       FileIO.setVMSPath();
+                       FilePath.setVMSPath();
                }
                return true;
        }
index 58a61d6..55a934b 100644 (file)
@@ -33,7 +33,7 @@ package org.tizen.emulator.manager.ui;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.FileDialog;
 import org.eclipse.swt.widgets.Shell;
-import org.tizen.emulator.manager.tool.FileIO;
+import org.tizen.emulator.manager.tool.FilePath;
 import org.tizen.emulator.manager.ui.vmstree.VMsTree;
 import org.tizen.emulator.manager.vms.VMsProperty;
 import org.tizen.emulator.manager.vms.VMsWorkerException;
@@ -127,7 +127,7 @@ public class MenuHandling {
                fd.setFilterExtensions(filter);
                fd.setFilterNames(filterName);
                fd.setFileName("emulimg-" + property.getName());
-               fd.setFilterPath(FileIO.getInstance().getTizenVmsPath());
+               fd.setFilterPath(FilePath.getInstance().getTizenVmsPath());
 
                String path = null;
                path = fd.open();
index 3d87490..c80ef9d 100644 (file)
@@ -35,7 +35,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.tizen.emulator.manager.tool.About;
-import org.tizen.emulator.manager.tool.FileIO;
+import org.tizen.emulator.manager.tool.FilePath;
 import org.tizen.emulator.manager.vms.VMsProperty.Architecture;
 import org.tizen.emulator.manager.vms.xml.DisplayType.Resolution;
 import org.tizen.emulator.manager.vms.xml.EmulatorConfiguration;
@@ -53,7 +53,7 @@ public class Creator {
                this.property = EmulatorVMs.getInstance().getNewProperty(newVM.imageName, Architecture.x86);
                this.newVM = newVM;
                
-               this.folder = new File(FileIO.getInstance().getVirtualTargetPath(newVM.imageName));
+               this.folder = new File(FilePath.getInstance().getVirtualTargetPath(newVM.imageName));
        }
        
        public VMsProperty createInternal() throws VMsWorkerException {
@@ -75,7 +75,7 @@ public class Creator {
                        throw e;
                }
 
-               File log = new File(FileIO.getInstance().getVirtualTargetLogPath(newVM.imageName));
+               File log = new File(FilePath.getInstance().getVirtualTargetLogPath(newVM.imageName));
                log.mkdir();
 
                settingProperty();
@@ -103,24 +103,51 @@ public class Creator {
                }       
        }
 
+       private String customPath = null;
+       private String swapPath = null;
        private void createDiskImage() throws VMsCreatorException {
                if (newVM.baseImagePath != null && !newVM.baseImagePath.isEmpty()) {
                        checkCustomBaseImage(newVM.baseImagePath);
                } else {
-                       newVM.baseImagePath = FileIO.getInstance().getBaseimgPath();
+                       newVM.baseImagePath = FilePath.getInstance().getBaseimgPath();
                }
 
                if (!new File(newVM.baseImagePath).exists()) {
                        throw new VMsCreatorException("Base image does not exist.");
                }
 
-               String targetPath = folder.getAbsolutePath() + File.separator + "emulimg-" + 
+               customPath = folder.getAbsolutePath() + File.separator + "emulimg-" + 
                                newVM.imageName + "." + Architecture.x86.toString();
-               createInitialVMImageInternal(newVM.baseImagePath, targetPath);
+               createInitialVMImageInternal(newVM.baseImagePath, customPath);
+               createSwapImageInternal();
+       }
+
+       private void createSwapImageInternal() throws VMsCreatorException {
+               String exe_path         = FilePath.getInstance().getBinPath() + File.separator + "qemu-img";
+               String swap_base_path   = FilePath.getInstance().getSwapPath() + File.separator + "swap.img";
+               if (!new File(swap_base_path).exists()) {
+                       return;
+               }
+               swapPath        = folder.getAbsolutePath() + File.separator
+                                                       + "swap-"+ newVM.imageName + "." + "img";
+               List<String> cmd = new ArrayList<String>();
+               cmd.add(exe_path);
+               cmd.add("create");
+               cmd.add("-b");
+               cmd.add(swap_base_path);
+               cmd.add("-f");
+               cmd.add("qcow2");
+               cmd.add(swapPath);
+
+               if (!new QemuImgProc(cmd).Running()) {
+                       throw new VMsCreatorException("Failed to create the VM because of failed qemu-img processing.\n"
+                                       + "You can get more information in log file ("
+                                       + FilePath.getInstance().getTizenVmsArchPath() +  File.separator + "emulator-manager)");
+               }
        }
 
        private void checkCustomBaseImage(final String path) throws VMsCreatorException {
-               String exe_path = FileIO.getInstance().getBinPath() + File.separator + "qemu-img";
+               String exe_path = FilePath.getInstance().getBinPath() + File.separator + "qemu-img";
 
                List<String> cmd = new ArrayList<String>();
                cmd.add(exe_path);
@@ -217,7 +244,7 @@ public class Creator {
        }
 
        public void createInitialVMImageInternal(String baseImagePath, String targetImagePath) throws VMsCreatorException {
-               String exe_path = FileIO.getInstance().getBinPath() + File.separator + "qemu-img";
+               String exe_path = FilePath.getInstance().getBinPath() + File.separator + "qemu-img";
 
                List<String> cmd = new ArrayList<String>();
                cmd.add(exe_path);
@@ -231,7 +258,7 @@ public class Creator {
                if (!new QemuImgProc(cmd).Running()) {
                        throw new VMsCreatorException("Failed to create the VM because of failed qemu-img processing.\n"
                                        + "You can get more information in log file ("
-                                       + FileIO.getInstance().getTizenVmsArchPath() +  File.separator + "emulator-manager)");
+                                       + FilePath.getInstance().getTizenVmsArchPath() +  File.separator + "emulator-manager)");
                }
        }
 
@@ -253,9 +280,9 @@ public class Creator {
 
                // TODO
                if (newVM.keyType == 1) { // 1key
-                       newVM.skinPath = FileIO.getInstance().getSkinPath() + File.separator + "emul_" + newVM.resolution;
+                       newVM.skinPath = FilePath.getInstance().getSkinPath() + File.separator + "emul_" + newVM.resolution;
                } else if (newVM.keyType == 3){ // 3 key
-                       newVM.skinPath = FileIO.getInstance().getSkinPath() + File.separator + "emul_3keys_" + newVM.resolution;
+                       newVM.skinPath = FilePath.getInstance().getSkinPath() + File.separator + "emul_3keys_" + newVM.resolution;
                }
        }
 
@@ -290,13 +317,19 @@ public class Creator {
                //
                ec.getBaseInformation().getDiskImage().setBaseDiskImage(factory.createDiskImageFormatType());
                ec.getBaseInformation().getDiskImage().setCurrentDiskImage(factory.createDiskImageFormatType());
-               
                // TODO :
                ec.getBaseInformation().getDiskImage().getBaseDiskImage().setFormat("qcow2");
                ec.getBaseInformation().getDiskImage().getBaseDiskImage().setValue(newVM.baseImagePath);
                ec.getBaseInformation().getDiskImage().getCurrentDiskImage().setFormat("qcow2");
-               ec.getBaseInformation().getDiskImage().getCurrentDiskImage().setValue(
-                               folder.getAbsolutePath() + File.separator + "emulimg-" +  newVM.imageName + "." + Architecture.x86.toString());
+               //ec.getBaseInformation().getDiskImage().getCurrentDiskImage().setValue(
+               //              folder.getAbsolutePath() + File.separator + "emulimg-" +  newVM.imageName + "." + Architecture.x86.toString());
+               ec.getBaseInformation().getDiskImage().getCurrentDiskImage().setValue(customPath);
+
+               if (swapPath != null) {
+                       ec.getBaseInformation().getDiskImage().setSwapDiskImage(factory.createDiskImageFormatType());
+                       ec.getBaseInformation().getDiskImage().getSwapDiskImage().setFormat("qcow2");
+                       ec.getBaseInformation().getDiskImage().getSwapDiskImage().setValue(swapPath);
+               }
 
                ec.getUsability().setLogging(factory.createUsabilityTypeLogging());
                ec.getUsability().getLogging().setLevel("NONE");
index b368ad4..e2a38ce 100644 (file)
@@ -44,7 +44,7 @@ import org.eclipse.swt.widgets.Shell;
 import org.tizen.emulator.manager.EmulatorManager;
 import org.tizen.emulator.manager.logging.EMLogger;
 import org.tizen.emulator.manager.tool.CheckVirtualization;
-import org.tizen.emulator.manager.tool.FileIO;
+import org.tizen.emulator.manager.tool.FilePath;
 import org.tizen.emulator.manager.tool.PortHelper;
 import org.tizen.emulator.manager.tool.SelectWorkspace;
 import org.tizen.emulator.manager.ui.MessageDialog;
@@ -114,7 +114,7 @@ public class Launcher {
                        logger.log(Level.INFO, String.format("MAC set as default = %s", macAddr));
                }
 
-               FileIO fio = FileIO.getInstance();
+               FilePath fio = FilePath.getInstance();
                if (path == null || path.isEmpty()) {
                        cmd.add(fio.getBinPath() + File.separator + binary);
                } else {
@@ -130,7 +130,8 @@ public class Launcher {
                }
                cmd.add("--qemu-args");
                cmd.add("-drive");
-               cmd.add("file=" + EmulatorVMs.getInstance().getVMsBaseDirectory() + File.separator + property.getArch().toString() + File.separator + property.getName() + File.separator +"emulimg-" + property.getName() + ".x86,if=virtio");
+               //cmd.add("file=" + EmulatorVMs.getInstance().getVMsBaseDirectory() + File.separator + property.getArch().toString() + File.separator + property.getName() + File.separator +"emulimg-" + property.getName() + ".x86,if=virtio");
+               cmd.add("file=" + property.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue()+ ",if=virtio");
                cmd.add( "-boot");
                cmd.add("c");
                cmd.add("-append");
@@ -255,7 +256,11 @@ public class Launcher {
                cmd.add("user");
                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);
@@ -303,7 +308,7 @@ public class Launcher {
        }
 
        public boolean launch(List<String> cmd) {
-               FileIO fio = FileIO.getInstance();
+               FilePath fio = FilePath.getInstance();
                ProcessBuilder pb = new ProcessBuilder(cmd);
                
                if (this.binPath == null || this.binPath.isEmpty()) {
index 9f96ee0..f201582 100644 (file)
@@ -32,7 +32,7 @@ package org.tizen.emulator.manager.vms;
 
 import java.io.File;
 
-import org.tizen.emulator.manager.tool.FileIO;
+import org.tizen.emulator.manager.tool.FilePath;
 import org.tizen.emulator.manager.vms.xml.EmulatorConfiguration;
 import org.tizen.emulator.manager.vms.xml.TouchType;
 
@@ -51,9 +51,9 @@ public class Modifier {
                        property.getConfiguration().getDevice().getDisplay().setResolution(oldVM.resolutionType);
 
                        if (newVM.keyType == 1) { // 1key
-                               newVM.skinPath = FileIO.getInstance().getSkinPath() + File.separator + "emul_" + newVM.resolution;
+                               newVM.skinPath = FilePath.getInstance().getSkinPath() + File.separator + "emul_" + newVM.resolution;
                        } else if (newVM.keyType == 3){ // 3 key
-                               newVM.skinPath = FileIO.getInstance().getSkinPath() + File.separator + "emul_3keys_" + newVM.resolution;
+                               newVM.skinPath = FilePath.getInstance().getSkinPath() + File.separator + "emul_3keys_" + newVM.resolution;
                        }
                        property.getConfiguration().getDevice().getDisplay().getSkinPath().setPath(newVM.skinPath);
 
@@ -61,9 +61,9 @@ public class Modifier {
                        // TODO
                        if (newVM.keyType != oldVM.keyType) {
                                if (newVM.keyType == 1) { // 1key
-                                       newVM.skinPath = FileIO.getInstance().getSkinPath() + File.separator + "emul_" + newVM.resolution;
+                                       newVM.skinPath = FilePath.getInstance().getSkinPath() + File.separator + "emul_" + newVM.resolution;
                                } else if (newVM.keyType == 3){ // 3 key
-                                       newVM.skinPath = FileIO.getInstance().getSkinPath() + File.separator + "emul_3keys_" + newVM.resolution;
+                                       newVM.skinPath = FilePath.getInstance().getSkinPath() + File.separator + "emul_3keys_" + newVM.resolution;
                                }
                                property.getConfiguration().getDevice().getDisplay().getSkinPath().setPath(newVM.skinPath);
                        }
index ae4bc3d..38dd968 100644 (file)
@@ -37,7 +37,7 @@ import java.util.List;
 import java.util.logging.Level;
 
 import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.tool.FileIO;
+import org.tizen.emulator.manager.tool.FilePath;
 
 public class QemuImgProc {
        private List<String> cmd = null;
@@ -115,7 +115,7 @@ public class QemuImgProc {
                                                                "Error while running 'qemu-img'. Exit value : " + process.exitValue());
                                                errorMsg = "Error while running 'qemu-img'. Exit value : " + process.exitValue() +
                                                                "\nYou can get more information in log file ("
-                                                               + FileIO.getInstance().getTizenVmsArchPath() +  File.separator + "emulator-manager)";
+                                                               + FilePath.getInstance().getTizenVmsArchPath() +  File.separator + "emulator-manager)";
                                        }
                                } catch (InterruptedException e) {
                                        isError  = true;
@@ -134,6 +134,7 @@ public class QemuImgProc {
                }
                return errorMsg;
        }
+
        public boolean Running() {
                assert cmd == null;
 
index d1e0d8d..0664756 100644 (file)
@@ -32,7 +32,7 @@ package org.tizen.emulator.manager.vms;
 
 import java.io.File;
 
-import org.tizen.emulator.manager.tool.FileIO;
+import org.tizen.emulator.manager.tool.FilePath;
 import org.tizen.emulator.manager.tool.StringResource;
 import org.tizen.emulator.manager.vms.xml.DisplayType.Resolution;
 import org.tizen.emulator.manager.vms.xml.TouchType;
@@ -214,7 +214,7 @@ public class VMPropertyValue implements Cloneable {
                value.resolution                        =  RESOLUTION.HD.toString();
                value.dpi = RESOLUTION.HD.getDPI(); // this value be related to resolution
                // TODO : Skin Path
-               value.skinPath = FileIO.getInstance().getSkinPath() + File.separator + "emul_" + value.resolution;
+               value.skinPath = FilePath.getInstance().getSkinPath() + File.separator + "emul_" + value.resolution;
                value.keyType = 1;
                //
 
index e95a5ef..043b227 100644 (file)
@@ -41,7 +41,7 @@ import java.util.logging.Logger;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
 import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.tool.FileIO;
+import org.tizen.emulator.manager.tool.FilePath;
 import org.tizen.emulator.manager.ui.MessageDialog;
 
 
@@ -82,7 +82,7 @@ public class VMsWorker {
                        throw new VMsWorkerException("Failed to create base image!\nFile does not exist :" + childImage);
                }
 
-               String exe_path = FileIO.getInstance().getBinPath() + File.separator + "qemu-img";
+               String exe_path = FilePath.getInstance().getBinPath() + File.separator + "qemu-img";
 
                List<String> cmd = new ArrayList<String>();
                cmd.add(exe_path);
@@ -115,7 +115,7 @@ public class VMsWorker {
                                if (worker.isError()) {
                                        throw new VMsWorkerException("Failed to create new base image becauese of failed qemu-img processing!\n"
                                                        + "You can get more information in log file ("
-                                                       + FileIO.getInstance().getTizenVmsArchPath() +  File.separator + "emulator-manager)");
+                                                       + FilePath.getInstance().getTizenVmsArchPath() +  File.separator + "emulator-manager)");
                                }
                        }
                }
@@ -227,7 +227,7 @@ public class VMsWorker {
                        BufferedReader stdOut = new BufferedReader(new InputStreamReader(p.getInputStream()));
                        if(isLinux > -1) {
                                while ((line = stdOut.readLine()) != null) {
-                                       String imagePath = FileIO.getInstance().getVirtualTargetImagePath(property.getName());
+                                       String imagePath = FilePath.getInstance().getVirtualTargetImagePath(property.getName());
                                        if(line.contains(imagePath)) {
                                                //logger.log(Level.INFO, line + " contains " + imagePath);
                                                logger.log(Level.INFO, "emulator instance with the same name is running now (" + imagePath + ")");
index 731077a..c4312f2 100644 (file)
@@ -35,6 +35,8 @@
                                                        minOccurs="1" maxOccurs="1" />
                                                <element name="currentDiskImage" type="em:diskImageFormatType"
                                                        minOccurs="1" maxOccurs="1" />
+                                               <element name="swapDiskImage" type="em:diskImageFormatType"
+                                                   minOccurs="1" maxOccurs="1" />
                                        </sequence>
                                        <attribute name="type" use="required">
                                                <simpleType>