platform: make temporary custom platform
authorjihye424.kim <jihye424.kim@samsung.com>
Sat, 12 Mar 2016 03:49:00 +0000 (12:49 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 14 Mar 2016 04:05:08 +0000 (13:05 +0900)
- do not save configuration of this platform to custom-base-imgaes.xml
- use this platform to make custom vm in cli

Change-Id: I8675b3fd95c0079fd9671d04e5074fdc4e680dad
Signed-off-by: jihye424.kim <jihye424.kim@samsung.com>
src/org/tizen/emulator/manager/console/processor/ConsoleCreateVM.java
src/org/tizen/emulator/manager/platform/Platform.java
src/org/tizen/emulator/manager/platform/custom/CustomPlatform.java
src/org/tizen/emulator/manager/platform/custom/TemporaryCustomPlatform.java [new file with mode: 0644]
src/org/tizen/emulator/manager/vms/VMConfigurationCreator.java
src/org/tizen/emulator/manager/vms/VMPropertyValueCreator.java

index e2cc78b..f9750f6 100644 (file)
@@ -152,7 +152,7 @@ public class ConsoleCreateVM {
                imagePath = checkImagePath(imagePath);
 
                CustomPlatformImageValue value = new CustomPlatformImageValue(imagePath, basePlatform);
-               platform = Platform.createCustomInstance(value);
+               platform = Platform.createTemporaryCustomInstance(value);
                if (platform == null) {
                        throw new ConsoleException(Messages.getString("ConsoleCreateVM.PlatformError.3"));
                }
index 5c90b18..8cf2baa 100644 (file)
@@ -38,6 +38,7 @@ import java.util.List;
 import org.tizen.emulator.manager.logging.EMLogger;
 import org.tizen.emulator.manager.platform.custom.CustomPlatform;
 import org.tizen.emulator.manager.platform.custom.CustomPlatformImageValue;
+import org.tizen.emulator.manager.platform.custom.TemporaryCustomPlatform;
 import org.tizen.emulator.manager.plugin.EMPlugin;
 import org.tizen.emulator.manager.template.renewal.VMItem;
 import org.tizen.emulator.manager.template.renewal.VMTemplate;
@@ -91,6 +92,16 @@ public abstract class Platform {
                return platform;
        }
 
+       public static Platform createTemporaryCustomInstance(CustomPlatformImageValue value) {
+               if (value == null || value.getPlatform() == null) {
+                       return null;
+               }
+
+               Platform platform = new TemporaryCustomPlatform(value);
+
+               return platform;
+       }
+
        private static List<Platform> platformList = new ArrayList<Platform>();
 
        private synchronized static void addPlatform(Platform platform) {
@@ -264,6 +275,11 @@ public abstract class Platform {
                return false;
        }
 
+       @Override
+       public String toString() {
+               return getName();
+       }
+
        public abstract Architecture getImageArch();
        public abstract SKIN_SHAPE getImageSkinShape();
        public abstract String getImageBinaryVersion();
index a628d4b..45ec734 100644 (file)
@@ -48,7 +48,7 @@ import org.tizen.emulator.manager.vms.option.IOption;
 
 
 public class CustomPlatform extends Platform {
-       private Platform basePlatform = null;
+       protected Platform basePlatform = null;
 
        public CustomPlatform(CustomPlatformImageValue value) {
                setValue(value);
diff --git a/src/org/tizen/emulator/manager/platform/custom/TemporaryCustomPlatform.java b/src/org/tizen/emulator/manager/platform/custom/TemporaryCustomPlatform.java
new file mode 100644 (file)
index 0000000..9a42a78
--- /dev/null
@@ -0,0 +1,13 @@
+package org.tizen.emulator.manager.platform.custom;
+
+
+public class TemporaryCustomPlatform extends CustomPlatform {
+       public TemporaryCustomPlatform(CustomPlatformImageValue value) {
+               super(value);
+       }
+
+       @Override
+       public String toString() {
+               return basePlatform.getName();
+       }
+}
index 827c169..4b2b372 100644 (file)
@@ -55,7 +55,7 @@ public class VMConfigurationCreator {
 
                configuration.getBaseInformation().setName(value.vmsName);
                configuration.getBaseInformation().setArchitecture(value.getImageArch().toString());
-               configuration.getBaseInformation().setPlatform(value.getPlatformName());
+               configuration.getBaseInformation().setPlatform(value.getPlatform().toString());
 
                if (value.deviceName != null && !value.deviceName.isEmpty()) {
                        DeviceTemplateType device = new DeviceTemplateType();
index 1315588..fe6969f 100644 (file)
@@ -164,7 +164,7 @@ public class VMPropertyValueCreator {
                if (basePlatform instanceof StandardPlatform) {
                        CustomPlatformImageValue value
                        = new CustomPlatformImageValue(getBaseImagePath(), basePlatform);
-                       newPlatform = Platform.createCustomInstance(value);
+                       newPlatform = Platform.createTemporaryCustomInstance(value);
                }
 
                return newPlatform;