Emulator List: change variable type to private from package
authorjihye424.kim <jihye424.kim@samsung.com>
Thu, 21 May 2015 07:44:07 +0000 (16:44 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Fri, 22 May 2015 11:03:32 +0000 (20:03 +0900)
- delete arm arch type

Change-Id: Ia4cc773dacaf6d55b3b85299715598de87a7967b
Signed-off-by: jihye424.kim <jihye424.kim@samsung.com>
src/org/tizen/emulator/manager/console/ConsoleCreateVM.java
src/org/tizen/emulator/manager/ui/detail/item/property/BaseImageViewItem.java
src/org/tizen/emulator/manager/vms/Creator.java
src/org/tizen/emulator/manager/vms/EmulatorVMList.java
src/org/tizen/emulator/manager/vms/VMWorkerCommon.java

index bbd08e9..96f1f67 100644 (file)
@@ -44,7 +44,6 @@ import org.tizen.emulator.manager.platform.Skin;
 import org.tizen.emulator.manager.resources.StringResources;
 import org.tizen.emulator.manager.tool.CheckVirtualization;
 import org.tizen.emulator.manager.vms.Creator;
-import org.tizen.emulator.manager.vms.EmulatorVMList;
 import org.tizen.emulator.manager.vms.RAM_SIZE;
 import org.tizen.emulator.manager.vms.RESOLUTION;
 import org.tizen.emulator.manager.vms.SKIN_TYPE;
@@ -160,10 +159,6 @@ public class ConsoleCreateVM {
                                                property.baseImagePath = checkImagePath(c.getCurrentValue());
                                                if (property.baseImagePath.endsWith(".x86")) {
                                                        property.archType = "x86";
-                                                       EmulatorVMList.getInstance().CustomArch = "x86";
-                                               } else if (property.baseImagePath.endsWith(".arm")) {
-                                                       property.archType = "arm";
-                                                       EmulatorVMList.getInstance().CustomArch = "arm";
                                                } else {
                                                        throw new ConsoleException("Avaliable format of base image is .x86 or .arm.");
                                                }
index 6e4170f..cf82ce2 100644 (file)
@@ -45,7 +45,6 @@ import org.eclipse.swt.layout.FormLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.FileDialog;
 import org.tizen.emulator.manager.EmulatorManager;
-import org.tizen.emulator.manager.EmulatorManager.ManagerModeType;
 import org.tizen.emulator.manager.platform.BaseImage;
 import org.tizen.emulator.manager.platform.Profile;
 import org.tizen.emulator.manager.platform.ProfileList;
@@ -61,7 +60,6 @@ import org.tizen.emulator.manager.ui.dialog.MessageDialog;
 import org.tizen.emulator.manager.ui.widgets.ImageCombo;
 import org.tizen.emulator.manager.ui.widgets.ImageLabel;
 import org.tizen.emulator.manager.ui.widgets.WSTATE;
-import org.tizen.emulator.manager.vms.EmulatorVMList;
 import org.tizen.emulator.manager.vms.SKIN_SHAPE;
 import org.tizen.emulator.manager.vms.VMPropertyValue;
 import org.tizen.emulator.manager.vms.helper.HelperClass;
@@ -219,14 +217,8 @@ public class BaseImageViewItem extends ComboViewItem {
                                        fd.setText(String.format("Select existing Base Image"));
                                        String[] filter = null;
                                        String[] filterName = null;
-                                       if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) {
-                                               filter = new String[] { "*.x86", "*.arm" };
-                                               filterName = new String[] { "Disk Image Files(*.x86)",
-                                                               "Disk Image Files(*.arm)" };
-                                       } else {
-                                               filter = new String[] { "*.x86" };
-                                               filterName = new String[] { "Disk Image Files(*.x86)" };
-                                       }
+                                       filter = new String[] { "*.x86" };
+                                       filterName = new String[] { "Disk Image Files(*.x86)" };
                                        fd.setFilterExtensions(filter);
                                        fd.setFilterNames(filterName);
                                }
@@ -244,11 +236,6 @@ public class BaseImageViewItem extends ComboViewItem {
                                        String newPathName = path.substring(
                                                        path.lastIndexOf(File.separator) + 1, path.length());
 
-                                       // for arm emulator
-                                       boolean isArm = newPathName.endsWith("arm");
-                                       EmulatorVMList.getInstance().CustomArch = !isArm ? "x86"
-                                                       : "arm";
-
                                        BaseImageItem newItem = new BaseImageItem(newPathName,
                                                        newPathName, newPath, profile, "", false, SKIN_SHAPE.NONE);
                                        addToBaseImageItemList(newItem);
index b4e45b1..866a46b 100644 (file)
@@ -169,8 +169,8 @@ public class Creator {
                }
                checkCustomBaseImage(newVM.baseImagePath);
 
-               customPath = folder.getAbsolutePath() + File.separator + "emulimg-" + 
-                               newVM.vmsName + "." + (newVM.isStandard ? newVM.archType.toString() : EmulatorVMList.getInstance().CustomArch.toString());
+               customPath = folder.getAbsolutePath() + File.separator + "emulimg-" +
+                               newVM.vmsName + "." + newVM.archType.toString();
 
                createInitialVMImageInternal(newVM.baseImagePath, customPath);
 
@@ -289,7 +289,6 @@ public class Creator {
                        ec.getBaseInformation().getDiskImage().setType("standard");
                } else {
                        ec.getBaseInformation().getDiskImage().setType("custom");
-                       ec.getBaseInformation().setArchitecture(EmulatorVMList.getInstance().CustomArch);
                }
 
                // TODO : get version
index 170e425..7c98041 100644 (file)
@@ -48,14 +48,16 @@ import javax.xml.transform.stream.StreamSource;
 import org.tizen.emulator.manager.logging.EMLogger;
 import org.tizen.emulator.manager.resources.FilePathResources;
 import org.tizen.emulator.manager.resources.StringResources;
-import org.tizen.emulator.manager.tool.CheckEmulatorDir;
 import org.tizen.emulator.manager.vms.xml.EmulatorConfiguration;
 import org.tizen.emulator.manager.vms.xml.ObjectFactory;
 
-
 public class EmulatorVMList {
-       static EmulatorVMList instance = null;
-       static JAXBContext context = null;
+       static private EmulatorVMList instance = null;
+       static private JAXBContext context = null;
+       static private String vmsConfigDirectory   = "";
+
+       private List<VMProperty> propertiesList = new ArrayList<VMProperty>();
+       private ObjectFactory objectFactory = new ObjectFactory();
 
        static {
                synchronized(EmulatorVMList.class) {
@@ -68,10 +70,6 @@ public class EmulatorVMList {
                }
        }
 
-       static String vmsConfigDirectory   = "";
-
-       public String CustomArch = "x86";
-
        public static void makeSDKDataPath(String vmsPath) {
                vmsConfigDirectory = vmsPath;
                File vmsFolder = new File (vmsPath);
@@ -80,10 +78,6 @@ public class EmulatorVMList {
                }
        }
 
-       List<VMProperty> propertiesList = new ArrayList<VMProperty>();
-
-       ObjectFactory objectFactory = new ObjectFactory();
-
        public static EmulatorVMList getInstance() {
                return instance;
        }
@@ -130,57 +124,27 @@ public class EmulatorVMList {
                                }
                        }
                }
-               loadOldVersionProperties();
        }
 
-       private void loadOldVersionProperties() {
-               if (CheckEmulatorDir.CheckOldEmulatorVmsDir()) {
-                       // traverse VMs...
-                       File vmsDirectory = new File(FilePathResources.getOldSdkDataVmsPath());
-                       String configFilename = null;
-                       File configFile = null;
-                       VMProperty property = null;
-                       File[] files =  vmsDirectory.listFiles(new FileFilter() {
-                               @Override
-                               public boolean accept(File pathname) {
-                                       if(!pathname.isDirectory()) {
-                                               return false;
-                                       }
-                                       return true;
-                               }
-                       });
-
-                       for(File vm : files) {
-                               configFilename = StringResources.PROPERTY_XML_NAME;
-                               configFile = new File(vm, configFilename);
-                               if(!configFile.exists()) {
-                                       EMLogger.getLogger().info(StringResources.PROPERTY_XML_NAME + " file dose not exist."
-                                                       + StringResources.NEW_LINE + "VM Path: " + configFile.getAbsolutePath());
-                                       continue ; // FIXME
-                               }
+       public VMProperty parseXML(File configFile) {
+               JAXBElement<EmulatorConfiguration> element = null;
 
-                               property = parseXML(configFile);
-                               if (property != null) {
-                                       // check duplicate name
-                                       boolean isDuplicated = false;
-                                       for (VMProperty prop : propertiesList) {
-                                               if (prop.getName().equals(property.getName())) {
-                                                       EMLogger.getLogger().warning(property.getName() + " is exist already."
-                                                       + StringResources.NEW_LINE + "Check vms path: " + FilePathResources.getOldSdkDataVmsPath());
-                                                       isDuplicated = true;
-                                                       break;
-                                               }
-                                       }
-                                       if (!isDuplicated) {
-                                               propertiesList.add(property);
-                                       }
-                               }
-                       }
+               try {
+                       Unmarshaller unmarshaller = context.createUnmarshaller();
+                       element = unmarshaller.unmarshal(new StreamSource(configFile), EmulatorConfiguration.class);
+               } catch (JAXBException e) {
+                       e.printStackTrace();
+                       EMLogger.getLogger().warning("Can not load config file( "
+                                                       + configFile.getName() + ")" + StringResources.NEW_LINE + e.getMessage());
+                       return null;
                }
+
+               return new VMProperty(configFile, element.getValue());
        }
 
-       public VMProperty parseXML(File configFile) {
+       public EmulatorConfiguration parseXML(VMProperty prop) {
                JAXBElement<EmulatorConfiguration> element = null;
+               File configFile = prop.getPropertyFile();
 
                try {
                        Unmarshaller unmarshaller = context.createUnmarshaller();
@@ -192,7 +156,7 @@ public class EmulatorVMList {
                        return null;
                }
 
-               return new VMProperty(configFile, element.getValue());
+               return element.getValue();
        }
 
        public VMProperty getProperty(String name) {
@@ -213,6 +177,12 @@ public class EmulatorVMList {
                return propertiesList.toArray(new VMProperty[propertiesList.size()]);
        }
 
+       public void addProperty(VMProperty prop) {
+               if (prop != null) {
+                       propertiesList.add(prop);
+               }
+       }
+
        public boolean storeXML(VMProperty property) {
                return storeXML(property, null);
        }
@@ -280,23 +250,4 @@ public class EmulatorVMList {
 
                return new VMProperty(configFile, ec);
        }
-
-       // for testing "load properties"...
-       /*
-       public static void main(String[] args) {
-               EmulatorVMs fsImage = EmulatorVMs.getInstance();
-               try {
-                       fsImage.loadProperties();
-               } catch (Exception e) {
-                       e.printStackTrace();
-               }
-
-               for(VMsProperty property : fsImage.getProperties()) {
-                       System.out.println(property.getName());
-               }
-
-               VMsProperty property = fsImage.getNewProperty("test6");
-               fsImage.storeXML(property);
-       }
-       */
 }
index b91faec..c5e0008 100644 (file)
@@ -460,7 +460,6 @@ public class VMWorkerCommon {
        }
 
        public void cloneVM(String newVMName) throws VMWorkerException {
-               EmulatorVMList.getInstance().CustomArch = property.getArch().toString();
                VMPropertyValue newValue = property.getPropertyValue();
                newValue.vmsName = newVMName;
                // TODO