import org.tizen.emulator.manager.resources.FilePathResources;
import org.tizen.emulator.manager.resources.StringResources;
+import org.tizen.emulator.manager.vms.EmulatorVMList;
public class CustomBaseImage extends BaseImage {
this.version = "0";
this.binaryVersion = "";
initLastCreatedPropertyPath();
+ loadProperty();
}
protected void initLastCreatedPropertyPath() {
.append(imageName).append(".xml");
lastCreatedPropertyPath = sb.toString();
}
+
+ private void loadProperty() {
+ // load default
+ File propertyFile = new File(platform.platformPath + File.separator
+ + FilePathResources.getPlatformTemplatePath()
+ + File.separator
+ + imageName + "." + PlatformStringResources.CONFIG_EXTENSION);
+ if (propertyFile.exists()) {
+ EmulatorVMList vmList = EmulatorVMList.getInstance();
+ defaultProperty = vmList.parseXML(propertyFile);
+
+ } else {
+ // If custom default property not exist, load standard property
+ if (PlatformList.getPlatformList() != null) {
+ Platform latest = null;
+ for (Platform p : PlatformList.getPlatformList()) {
+ if (p.getProfile().equals(profile)) {
+ if (latest == null) {
+ latest = p;
+ } else {
+ if (p.getVersion().compareTo(latest.getVersion()) > 0) {
+ latest = p;
+ }
+ }
+ }
+ }
+
+ if (latest != null) {
+ for (BaseImage image : latest.getImageList()) {
+ if (image.getType() != null && image.getType().equals("default")) {
+ defaultProperty = image.getDefaultProperty();
+ }
+ }
+ if (defaultProperty == null) {
+ if (latest.getImageList().size() > 0) {
+ defaultProperty = latest.getImageList().get(0).getDefaultProperty();
+ }
+ }
+ }
+ // TODO if defaultProperty == null ???
+ }
+ }
+ }
}