CLI : fixed cli functions to work under new platforms and profiles directory
authorjihye424.kim <jihye424.kim@samsung.com>
Thu, 14 May 2015 09:02:25 +0000 (18:02 +0900)
committerjihye424.kim <jihye424.kim@samsung.com>
Thu, 14 May 2015 09:02:25 +0000 (18:02 +0900)
- add function setting base image id in ProfileList
- add checking profile list initialize routine in ProfileList
- add calling to create profile list or vm list in ConsoleProcessor

Change-Id: I1ae661de44f133a3be7f2c960d9e199dcfaaacc8
Signed-off-by: jihye424.kim <jihye424.kim@samsung.com>
src/org/tizen/emulator/manager/console/ConsoleProcessor.java
src/org/tizen/emulator/manager/platform/BaseImage.java
src/org/tizen/emulator/manager/platform/ProfileList.java

index ec675ec..7d9ec1b 100644 (file)
@@ -47,7 +47,6 @@ import org.tizen.emulator.manager.tool.About;
 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.VMProperty.FSImageType;
 import org.tizen.emulator.manager.vms.helper.HelperClass;
 import org.tizen.emulator.manager.vms.helper.VMWorkerException;
 import org.tizen.emulator.manager.vms.option.LaunchConfig;
@@ -55,8 +54,14 @@ import org.tizen.emulator.manager.vms.option.LaunchConfig;
 public class ConsoleProcessor {
        private EmulatorVMList vms = EmulatorVMList.getInstance();
 
-       public VMProperty getProperty(String value) {
-               return vms.getProperty(value);
+       public VMProperty getProperty(String name) {
+               ProfileList.settingVMPropertyList();
+               return vms.getProperty(name);
+       }
+
+       public VMProperty[] getProperties() {
+               vms.refreshProperties();
+               return vms.getProperties();
        }
 
        public String getAboutInfo() {
@@ -69,13 +74,11 @@ public class ConsoleProcessor {
                try {
                        str += String.format("%s" + StringResources.NEW_LINE, prop.getName());
                        str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "ImageType",prop.getImageType());
-                       if (prop.getImageType() == FSImageType.standard) {
-                               str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "Version" ,
-                                                                       prop.getConfiguration().getBaseInformation().getDiskImage().getVersion());
-                               str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "Image Version" ,
-                                                                       prop.getConfiguration().getBaseInformation().getDiskImage().getBase());
-                       }
-                       
+                       str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "Platform", prop.getImagePlatform());
+                       str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "Profile", prop.getImageProfile());
+                       str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "Version", prop.getImageVersion());
+                       str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "Image Name" ,
+                                                               prop.getConfiguration().getBaseInformation().getDiskImage().getBase());
                        str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "Base Disk Image",
                                prop.getConfiguration().getBaseInformation().getDiskImage().getBaseDiskImage().getValue());
                        str+= String.format("\t%-17s : %s" + StringResources.NEW_LINE, "Child Disk Image",
@@ -122,7 +125,7 @@ public class ConsoleProcessor {
        }
 
        public String getDetailInfoOfVM(String value) {
-               VMProperty prop = vms.getProperty(value);
+               VMProperty prop = getProperty(value);
                if (prop == null) {
                        // error
                        return "Error: The name (" + value + ") dose not exist in the VM list.";
@@ -133,7 +136,7 @@ public class ConsoleProcessor {
 
        public ArrayList<String> getInfoOfVMList(boolean isDetail) {
                ArrayList<String> message = new ArrayList<String>();
-               VMProperty[] properties = (VMProperty[])vms.getProperties();
+               VMProperty[] properties = (VMProperty[])getProperties();
                if (properties.length == 0) {
                        // error
                        message.add("VM list is empty.");
@@ -158,7 +161,7 @@ public class ConsoleProcessor {
        }
 
        public int getCountOfVMList() {
-               return ((VMProperty[])vms.getProperties()).length;
+               return ((VMProperty[])getProperties()).length;
        }
 
        public ArrayList<String> getInfoOfImageList(boolean isDetail) {
index 9d3dcfa..e356ff6 100644 (file)
@@ -201,6 +201,9 @@ public class BaseImage {
                                + "     Version         : " + getVersion() + StringResources.NEW_LINE
                                + "     Type            : " + getType() + StringResources.NEW_LINE
                                + "     Target CPU      : " + getCpu() + StringResources.NEW_LINE
+                               + (skinShape != SKIN_SHAPE.SQUARE
+                                       ? "     Skin Shape      : " + getSkinShape() + StringResources.NEW_LINE
+                                       : "")
                                + "     Base Disk Image Path : " + getPath() + StringResources.NEW_LINE;
                //
        }
index 9f641f6..4104fea 100644 (file)
@@ -57,6 +57,9 @@ public class ProfileList {
        }
 
        public static Profile getTotalProfile() {
+               if (profileList == null) {
+                       initProfileList();
+               }
                return totalProfile;
        }
 
@@ -147,6 +150,7 @@ public class ProfileList {
                return p;
        }
 
+       private static int imageID = 1;
        private static void makeBaesImageList(Profile profile, Platform platform, String platformPath) {
                if (platform == null || platformPath == null) {
                        return;
@@ -175,9 +179,18 @@ public class ProfileList {
                                }
                        }
                }
+
+               // setting base image id and information
+               for (BaseImage b : profile.getImageList()) {
+                       b.setID(imageID++);
+               }
        }
 
        public static void settingVMPropertyList() {
+               if (profileList == null) {
+                       initProfileList();
+               }
+
                EmulatorVMList vms = EmulatorVMList.getInstance();
                vms.refreshProperties();