import org.tizen.emulator.manager.plugin.EMPlugin;
import org.tizen.emulator.manager.plugin.ExtensionItem;
import org.tizen.emulator.manager.plugin.PluginStringResources;
-import org.tizen.emulator.manager.resources.FilePathResources;
import org.tizen.emulator.manager.resources.StringResources;
import org.tizen.emulator.manager.template.ITemplate;
import org.tizen.emulator.manager.ui.renewal.dialog.ItemListUtil;
private SKIN_SHAPE skinShape;
private String binaryVersion;
private String description = "";
- private boolean isDeleted = false;
private boolean isStandard;
+ private boolean isDeleted = false;
private boolean isFilePathExist = true;
+ // for create, delete, modify custom base image
private CustomBaseImageWorker worker;
- private String information;
+ // detail information (for cli)
+ private String information = "";
private VMProperty defaultProperty;
private ITemplate itemTemplate;
protected List<ModifyDialogItem> defaultItemList;
protected List<ModifyDialogItem> advancedItemList;
-
-
protected List<IOption> optionList;
//private LaunchConfig launchTemplate; // TODO replace xDefaultOption.java
return version;
}
+ public void setCpuType(Architecture type) {
+ cpu = type;
+ }
+
public String getCpu() {
if (cpu == null) {
return "";
version = platform.getVersion();
profile = platform.getProfile();
type = "custom"; // TODO //$NON-NLS-1$
- cpu = findCpuTypeFromPath();
skinShape = SKIN_SHAPE.NONE; // TODO
binaryVersion = ""; //$NON-NLS-1$
extension = platform.isChildPlatform()
: "";
}
- private Architecture findCpuTypeFromPath() {
- String ext = FilePathResources.getFileExtention(this.path);
- return Architecture.getType(ext);
- }
-
private void settingImagePath(File path) throws IOException {
for (File f : path.listFiles()) {
// TODO: find first .x86 file.
import org.tizen.emulator.manager.vms.RESOLUTION;
import org.tizen.emulator.manager.vms.SKIN_SHAPE;
import org.tizen.emulator.manager.vms.VMProperty;
+import org.tizen.emulator.manager.vms.VMProperty.Architecture;
import org.tizen.emulator.manager.vms.xml.template.v2.ItemList;
public class Platform {
}
return null;
}
+
// platform name = profile + version = profile-version
private String platformName = null;
private String platformPath = null;
// for custom base image
private ITemplate customItemTemplate;
+ private List<Architecture> archList = new ArrayList<Architecture>();
+
private Platform(Profile profile, EMPlugin plugin) {
initializePlatform(profile, plugin);
}
}
return defaultTemplate;
}
+
+ /**
+ * support kernel architecture list (32bit or 64bit kernel)
+ * @return
+ */
+ public List<Architecture> getArchitectureList() {
+ if (archList.isEmpty()) {
+ makeArchitectureList();
+ }
+ return archList;
+ }
+
+ public Architecture findArchitecture(int bit) {
+ for (Architecture arch : archList) {
+ if (arch.getBit() == bit) {
+ return arch;
+ }
+ }
+ return null;
+ }
+
+ private void makeArchitectureList() {
+ String kernelPath = FilePathResources.getEmulatorKernelPath(FilePathResources.getPlatformEmulatorPath(version));
+ File kernelDir = new File(kernelPath);
+ if (!kernelDir.isDirectory() || !kernelDir.exists()) {
+ archList.add(Architecture.x86);
+ return;
+ }
+
+ for (File f : kernelDir.listFiles()) {
+ String ext = FilePathResources.getFileExtention(f.getPath());
+ archList.add(Architecture.getType(ext));
+ }
+ }
}
if (image != null) {
vm.getPropertyValue().setBaseImage(image);
- image.addEmulator(vm);
vmList.add(vm);
+ if (!name.equals(StringResources.TOTAL_PROFILE)) {
+ image.addEmulator(vm);
+ }
}
}
import org.tizen.emulator.manager.platform.ProfileList;
import org.tizen.emulator.manager.resources.FilePathResources;
import org.tizen.emulator.manager.resources.StringResources;
+import org.tizen.emulator.manager.vms.VMProperty.Architecture;
public class CustomBaseImageLoader {
private static JAXBContext context = null;
return false;
}
- baseImageType.setId(image.getID());
- baseImageType.setName(image.getName());
- baseImageType.setProfile(image.getProfile());
- baseImageType.setPlatform(image.getPlatformName());
if (!baseImageType.getPath().equals(image.getPath())) {
- baseImageType.setPath(image.getPath());
File dir = new File(image.getPath());
if (dir.exists()) {
setLastDirectory(dir.getParentFile().getAbsolutePath());
}
}
- baseImageType.setDescription(image.getDescription());
- baseImageType.setIsDeleted(image.isDeleted());
+ settingConfiguration(image, baseImageType);
return storeXML(conf);
}
}
BaseImageType baseImageType = factory.createBaseImageType();
- baseImageType.setId(image.getID());
- baseImageType.setName(image.getName());
- baseImageType.setProfile(image.getProfile());
- baseImageType.setPlatform(image.getPlatformName());
- baseImageType.setPath(image.getPath());
- baseImageType.setDescription(image.getDescription());
+ settingConfiguration(image, baseImageType);
conf.getCustomBaseImage().add(baseImageType);
ArrayList<BaseImageType> list = (ArrayList<BaseImageType>) conf.getCustomBaseImage();
for (BaseImage image : baseImageList) {
BaseImageType type = factory.createBaseImageType();
- type.setId(image.getID());
- type.setName(image.getName());
- type.setProfile(image.getProfile());
- type.setPlatform(image.getPlatformName());
- type.setPath(image.getPath());
- type.setDescription(image.getDescription());
+ settingConfiguration(image, type);
list.add(type);
}
return storeXML(conf);
}
+ private static void settingConfiguration(BaseImage image, BaseImageType type) {
+ type.setId(image.getID());
+ type.setName(image.getName());
+ type.setProfile(image.getProfile());
+ type.setPlatform(image.getPlatformName());
+ type.setCpu(image.getCpu());
+ type.setSkinShape(image.getSkinShape().toString());
+ type.setPath(image.getPath());
+ type.setDescription(image.getDescription());
+ type.setIsDeleted(image.isDeleted());
+ }
+
private synchronized static void loadConfiguration() {
if (baseImageConfFile == null || !baseImageConfFile.exists()) {
return;
}
image.setID(baseImage.getId());
+ image.setCpuType(Architecture.getType(baseImage.getCpu()));
image.setDescription((baseImage.getDescription() == null
? ""
: baseImage.getDescription()));
import org.tizen.emulator.manager.platform.BaseImage;
import org.tizen.emulator.manager.platform.Platform;
+import org.tizen.emulator.manager.vms.VMProperty.Architecture;
public class CustomBaseImageValue {
+ // name == id
private String name = "";
private String profile = "";
private String platformName = "";
private Platform platform = null;
+ // default value is i386
+ private Architecture cpu = Architecture.i386;
private String filePath = "";
private String description = "";
private boolean isAmendable = false;
profile = image.getProfile();
platformName = image.getPlatformName();
platform = image.getPlatform();
+ cpu = image.getCpuType();
filePath = image.getPath();
description = image.getDescription();
// emulator list is empty - you can modify base image properties
this.platform = platform;
}
+ public Architecture getCpu() {
+ return cpu;
+ }
+
+ public void setCpu(Architecture cpu) {
+ this.cpu = cpu;
+ }
+
public String getFilePath() {
return filePath;
}
import org.tizen.emulator.manager.platform.Platform;
import org.tizen.emulator.manager.platform.Profile;
import org.tizen.emulator.manager.platform.ProfileList;
+import org.tizen.emulator.manager.vms.VMProperty.Architecture;
public class CustomBaseImageWorker {
private BaseImage image;
}
image.setID(image.getName());
+ image.setCpuType(Architecture.findCpuTypeFromPath(path));
image.setWorker(new CustomBaseImageWorker(image));
platform.getProfileClass().addBaseImage(image);
return null;
}
- image.setDescription(value.getDescription());
image.setID(value.getName());
+ image.setCpuType(value.getCpu());
+ image.setDescription(value.getDescription());
image.setWorker(new CustomBaseImageWorker(image));
Profile profile = ProfileList.getProfile(value.getProfile());
image.setName(value.getName());
image.setPath(value.getFilePath());
image.setPlatform(value.getPlatform());
+ image.setCpuType(value.getCpu());
image.setDescription(value.getDescription());
return CustomBaseImageLoader.modfiyBaseImageConfiguration(image);
}
import org.tizen.emulator.manager.plugin.EMPlugin;
import org.tizen.emulator.manager.plugin.ExtensionItem;
import org.tizen.emulator.manager.plugin.PluginStringResources;
+import org.tizen.emulator.manager.resources.FilePathResources;
import org.tizen.emulator.manager.vms.helper.VMLogUtil;
import org.tizen.emulator.manager.vms.xml.EmulatorConfiguration;
import org.tizen.emulator.manager.vms.xml.ObjectFactory;
}
public enum Architecture {
- x86("x86"), i386("i386"), x86_64("x86_64"); //$NON-NLS-1$ //$NON-NLS-2$
+ x86("x86", 32), i386("i386", 32), x86_64("x86_64", 64); //$NON-NLS-1$ //$NON-NLS-2$
private String name;
+ private int bit;
- Architecture(String arch) {
+ Architecture(String arch, int bit) {
this.name = arch;
+ this.bit = bit;
}
@Override
return name;
}
+ public int getBit(){
+ return bit;
+ }
+
+ public static Architecture findCpuTypeFromPath(String path) {
+ String ext = FilePathResources.getFileExtention(path);
+ return Architecture.getType(ext);
+ }
+
public static boolean isSupported(String extension) {
for (Architecture arch : Architecture.values()) {
if (arch.name.equals(extension.toLowerCase())) {