Platform: add relationship child and parent
authorjihye424.kim <jihye424.kim@samsung.com>
Tue, 16 Jun 2015 04:09:29 +0000 (13:09 +0900)
committerjihye424.kim <jihye424.kim@samsung.com>
Tue, 16 Jun 2015 04:28:50 +0000 (13:28 +0900)
- add child platform and plugin that using parent's resources

Change-Id: I48a04a07679e466a948d254eaf74b2093057eca0
Signed-off-by: jihye424.kim <jihye424.kim@samsung.com>
src/org/tizen/emulator/manager/platform/Platform.java
src/org/tizen/emulator/manager/platform/ProfileList.java
src/org/tizen/emulator/manager/plugin/EMPlugin.java
src/org/tizen/emulator/manager/plugin/EMPluginLoader.java
src/org/tizen/emulator/manager/plugin/ExtensionItem.java
src/org/tizen/emulator/manager/plugin/PluginImageResources.java
src/org/tizen/emulator/manager/plugin/PluginStringResources.java

index f581e53..e7f274f 100644 (file)
@@ -43,7 +43,6 @@ import javax.xml.transform.stream.StreamSource;
 
 import org.tizen.emulator.manager.logging.EMLogger;
 import org.tizen.emulator.manager.plugin.EMPlugin;
-import org.tizen.emulator.manager.plugin.EMPluginLoader;
 import org.tizen.emulator.manager.plugin.ExtensionItem;
 import org.tizen.emulator.manager.plugin.PluginStringResources;
 import org.tizen.emulator.manager.resources.FilePathResources;
@@ -56,13 +55,34 @@ import org.tizen.emulator.manager.vms.option.IOptionFactory;
 import org.tizen.emulator.manager.vms.xml.template.ItemList;
 
 public class Platform {
+       public static Platform createInstance(Profile profile, EMPlugin plugin) {
+               String basePlatform = plugin.getAttribute(PluginStringResources.BasePlatform);
+               if (basePlatform == null) {
+                       return new Platform(profile, plugin);
+               } else {
+                       Platform base = profile.getPlatformByName(basePlatform);
+                       if (base != null) {
+                               return new Platform(base, plugin);
+                       } else {
+                               for (EMPlugin p : ProfileList.getPluginList()) {
+                                       if (p.getPlatformName().equals(basePlatform)) {
+                                               base = Platform.createInstance(profile, p);
+                                               return new Platform(base, plugin);
+                                       }
+                               }
+                       }
+               }
+               return null;
+       }
        // platform name = profile + version = profile-version
        private String platformName = null;
        private String platformPath = null;
+       // default platforms/tizen-{version}/common/emulator dir
+       private String emulatorPath = null;
        private String profile = null;
        private Profile profileClass = null;
        private String version = null;
-       //private static int id = 1;
+       private Platform parentPlatform = null;
 
        private ArrayList<Skin>skinList = new ArrayList<Skin>();
        private EMPlugin plugin;
@@ -86,32 +106,32 @@ public class Platform {
                }
        }
 
-       protected Platform() {
+       private Platform(Profile profile, EMPlugin plugin) {
+               initializePlatform(profile, plugin);
        }
 
-       Platform(Profile profile, String version, String path) {
+       private Platform(Platform p, EMPlugin plugin) {
+               this.parentPlatform = p;
+               initializePlatform(p.getProfileClass(), plugin);
+       }
+
+       private void initializePlatform(Profile profile, EMPlugin plugin) {
                this.profileClass = profile;
                this.profile = profile.getName();
-               this.version = version;
-               this.platformName = this.profile + "-" + version;
-               this.platformPath = path;
+               this.version = plugin.getAttribute(PluginStringResources.PlatformVersion);
+               this.platformName = plugin.getPlatformName();
+               this.platformPath = plugin.getPlatformPath();
+               this.emulatorPath = plugin.getAttribute(PluginStringResources.EmulatorDir);
+               if (this.emulatorPath == null) {
+                       this.emulatorPath = FilePathResources.getEmulatorBinPath(version);
+               }
+               this.plugin = plugin;
 
                loadSkins();
                loadPlugin();
                loadTemplate();
        }
 
-       public static String getPlatformPath(String platformName) {
-               String split[] = platformName.split("-");
-               if (split != null && split.length == 2) {
-                       String profile = split[0];
-                       String ver = split[1];
-                       return "tizen" + "-" + ver + File.separator + profile;
-               }
-               EMLogger.getLogger().warning("Failed to get platform path from platform name : " + platformName);
-               return "";
-       }
-
        public String getName() {
                return platformName;
        }
@@ -226,34 +246,9 @@ public class Platform {
        }
 
        private void loadPlugin() {
-               File pluginDir = new File(platformPath + File.separator
-                               + FilePathResources.getPlatformPluginsPath());
-               if(!pluginDir.isDirectory()) {
-                       return;
-               }
-
-               File pluginJar = null;
-               File[] fileList = pluginDir.listFiles();
-               for (File file : fileList) {
-                       if (file.getName().startsWith(PlatformStringResources.PLUGIN_PREFIX) &&
-                                       file.getName().endsWith(PlatformStringResources.PLUGIN_EXTENSION)) {
-                               pluginJar = file;
-                               break;
-                       }
-               }
-
-               if (pluginJar != null && pluginJar.exists()) {
-                       plugin = EMPluginLoader.makePlugin(pluginJar, this);
-                       if (plugin == null) {
-                               EMLogger.getLogger().warning("Making plug-in is failed." +
-                                               StringResources.NEW_LINE + "Plug-in file: " + pluginJar.getAbsolutePath());
-                       }
-               } else {
-                       EMLogger.getLogger().warning("Plug-in file does not exist." +
-                                       StringResources.NEW_LINE + "Plug-in file: " + pluginDir.getAbsolutePath()
-                                       + File.separator + PlatformStringResources.PLUGIN_PREFIX
-                                       + "-" + profile
-                                       + "." + PlatformStringResources.PLUGIN_EXTENSION);
+               if (!plugin.initEMPlugin(this)) {
+                       EMLogger.getLogger().warning("Initializing plug-in("
+                                       + platformPath + FilePathResources.getPlatformPluginsPath() + ") is failed.");
                }
        }
 
@@ -288,8 +283,11 @@ public class Platform {
                        EMLogger.getLogger().info("This Skin path does not exist (" + dir.getPath() + ")");
                }
 
-               for (Skin s : SkinList.getInstance().getSkinList()) {
-                       skinList.add(s);
+               // add parent Skin List
+               if (isChildPlatform()) {
+                       for (Skin s : parentPlatform.getSkins()) {
+                               skinList.add(s);
+                       }
                }
 
                skinList = SkinList.getInstance().sortForPriority(skinList);
@@ -314,4 +312,16 @@ public class Platform {
        public ArrayList<Skin> findGeneralSkinList() {
                return SkinList.getInstance().findGeneralSkinList(skinList);
        }
+
+       public boolean isChildPlatform() {
+               return (parentPlatform == null) ? false : true;
+       }
+
+       public Platform getParentPlatform() {
+               return parentPlatform;
+       }
+
+       public String getEmulatorPath() {
+               return emulatorPath;
+       }
 }
index 6964171..7155da4 100644 (file)
@@ -37,6 +37,8 @@ import java.util.List;
 
 import org.tizen.emulator.manager.EmulatorManager;
 import org.tizen.emulator.manager.logging.EMLogger;
+import org.tizen.emulator.manager.plugin.EMPlugin;
+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.vms.EmulatorVMList;
@@ -46,9 +48,11 @@ import org.tizen.emulator.manager.vms.helper.VMWorkerException;
 
 public class ProfileList {
        private static ArrayList<Profile> profileList = null;
-       // TODO
        private static Profile totalProfile = new Profile(StringResources.TOTAL_PROFILE);
 
+       // for making platform
+       private static ArrayList<EMPlugin> pluginList = new ArrayList<EMPlugin>();
+
        public static ArrayList<Profile> getProfileList() {
                if (profileList == null) {
                        initProfileList();
@@ -77,6 +81,13 @@ public class ProfileList {
                return null;
        }
 
+       public static ArrayList<EMPlugin> getPluginList() {
+               if (profileList == null) {
+                       initProfileList();
+               }
+               return pluginList;
+       }
+
        private static void initProfileList() {
                profileList = new ArrayList<Profile>();
 
@@ -91,22 +102,24 @@ public class ProfileList {
                                continue;
                        }
 
-                       for (File profile : platform.listFiles()) {
-                               if (profile.isDirectory() && isProfileDir(profile)) {
-                                       Profile p = ProfileList.makeProfile(profile.getName());
-                                       String version = platform.getName();
-                                       // delete 'tizen' string from platform directory name
-                                       if (version.contains("tizen-")) {
-                                               version = version.substring(version.lastIndexOf("-") + 1);
+                       // make platform directory list
+                       // plug-in jar file is positively necessary in platform directory
+                       for (File profileDir : platform.listFiles()) {
+                               if (profileDir.isDirectory()) {
+                                       EMPlugin plugin = makePlugin(profileDir);
+                                       if (plugin != null) {
+                                               pluginList.add(plugin);
                                        }
-                                       Platform pl = ProfileList.makePlatform (p, // profile
-                                                       version, // version
-                                                       profile.getAbsolutePath()); // platform path
-                                       ProfileList.makeBaesImageList(p, pl, profile.getAbsolutePath());
                                }
                        }
                }
 
+               // make platform
+               for (EMPlugin plugin : pluginList) {
+                       makePlatform(plugin);
+               }
+
+               // sorting base image and platform
                for (Profile profile : profileList) {
                        profile.sortBaseImageList();
                        profile.sortPlatformList();
@@ -116,23 +129,44 @@ public class ProfileList {
                        }
                }
 
-               // Check base image version()
+               // check base image version
                checkingBaseImageBinaryVersion();
-               // Make emulator list
+
+               // make emulator list
                settingVMPropertyList();
 
-               // Remove invalid last-created property file.
+               // remove invalid last-created property file.
                checkLastCreatedPropertyFile();
        }
 
-       private static boolean isProfileDir(File profile) {
-               for (File f : profile.listFiles()) {
-                       if (f.isDirectory() && f.getName().equalsIgnoreCase("emulator-resources")) {
-                               // this is profile directory
-                               return true;
+       private static void makePlatform(EMPlugin plugin) {
+               Profile profile = ProfileList.makeProfile(plugin.getAttribute(PluginStringResources.PlatformProfile));
+
+               Platform pl = Platform.createInstance(profile, plugin);
+               if (pl != null) {
+                       profile.addPlatform(pl);
+                       ProfileList.makeBaesImageList(profile, pl, pl.getPlatformPath());
+               }
+       }
+
+       private static EMPlugin makePlugin(File profile) {
+               File pluginDir = new File(profile.getAbsolutePath() + File.separator
+                               + FilePathResources.getPlatformPluginsPath());
+               if (!pluginDir.exists() || !pluginDir.isDirectory()) {
+                       return null;
+               }
+
+               File pluginJar = null;
+               File[] fileList = pluginDir.listFiles();
+               for (File file : fileList) {
+                       if (file.getName().startsWith(PlatformStringResources.PLUGIN_PREFIX) &&
+                                       file.getName().endsWith(PlatformStringResources.PLUGIN_EXTENSION)) {
+                               pluginJar = file;
+                               break;
                        }
                }
-               return false;
+
+               return EMPlugin.createInstance(pluginJar, profile.getAbsolutePath());
        }
 
        private static Profile makeProfile(String profile) {
@@ -147,18 +181,6 @@ public class ProfileList {
                return p;
        }
 
-       private static Platform makePlatform(Profile profile, String version, String path) {
-               if (path == null) {
-                       return null;
-               }
-
-               Platform p = new Platform(profile, version, path);
-               if (p != null) {
-                       profile.addPlatform(p);
-               }
-               return p;
-       }
-
        private static int imageID = 1;
        private static void makeBaesImageList(Profile profile, Platform platform, String platformPath) {
                if (platform == null || platformPath == null) {
@@ -173,8 +195,6 @@ public class ProfileList {
                                if (imageDir.isDirectory()) {
                                        try {
                                                image = new BaseImage(platform, imageDir);
-                                               //TODO: Default image is added at first index of image list
-                                               //TODO: need sort image
                                                profile.addBaseImage(image);
                                                totalProfile.addBaseImage(image);
                                        } catch (IOException e) {
index f433a98..18ee28e 100644 (file)
@@ -29,7 +29,7 @@
 
 package org.tizen.emulator.manager.plugin;
 
-import java.io.IOException;
+import java.io.File;
 import java.net.URLClassLoader;
 import java.util.ArrayList;
 import java.util.jar.Attributes;
@@ -38,69 +38,136 @@ import org.tizen.emulator.manager.logging.EMLogger;
 import org.tizen.emulator.manager.platform.Platform;
 
 public class EMPlugin {
-       private String profile;
-       private String version;
+       public static EMPlugin createInstance(File pluginJar, String platformPath) {
+               if (pluginJar == null || platformPath == null) {
+                       return null;
+               }
+
+               Attributes attr = EMPluginLoader.makeAttributes(pluginJar);
+               if (attr == null) {
+                       return null;
+               }
+
+               if (attr.getValue(PluginStringResources.PlatformProfile) == null) {
+                       EMLogger.getLogger().warning("Can not found "
+                                       + PluginStringResources.PlatformProfile + " attribute in "
+                                       + pluginJar.getName() + ".");
+                       return null;
+               }
+
+               if (attr.getValue(PluginStringResources.PlatformVersion) == null) {
+                       EMLogger.getLogger().warning("Can not found "
+                                       + PluginStringResources.PlatformVersion + " attribute in "
+                                       + pluginJar.getName() + ".");
+                       return null;
+               }
+
+               if (attr.getValue(PluginStringResources.BasePlatform) != null
+                       && attr.getValue(PluginStringResources.PlatformName) == null) {
+                       EMLogger.getLogger().warning("Platform Name is positively nescessary in Child Platform");
+                       return null;
+               }
+
+               return new EMPlugin(pluginJar, attr, platformPath);
+       }
+
+       private String platformName;
+       private String platformPath;
+       private File pluginJar;
+       private Attributes attr;
        private URLClassLoader loader;
        private ArrayList<ExtensionItem> exItemList
                = new ArrayList<ExtensionItem>();
+       private EMPlugin parentPlugin;
 
-       public EMPlugin(Attributes attr, URLClassLoader loader, Platform platform) throws IOException {
-               profile = attr.getValue(PluginStringResources.PlatformProfile);
-               version = attr.getValue(PluginStringResources.PlatformVersion);
+       private EMPlugin(File pluginJar, Attributes attr, String platformPath) {
+               this.pluginJar = pluginJar;
+               this.attr = attr;
+               this.platformPath = platformPath;
 
-               if (profile == null) {
-                       throw new IOException("Can not found " + PluginStringResources.PlatformProfile + " attribute.");
-               }
-               if (version == null) {
-                       throw new IOException("Can not found " + PluginStringResources.PlatformVersion + " attribute.");
+               platformName = getAttribute(PluginStringResources.PlatformName);
+               if (platformName == null) {
+                       platformName = getAttribute(PluginStringResources.PlatformProfile)
+                                       + "-" + getAttribute(PluginStringResources.PlatformVersion);
                }
+       }
 
-               if (!platform.getProfile().equals(profile)) {
-                       throw new IOException("Profile of plug-in does not correspond with profile of platform.");
+       public boolean initEMPlugin(Platform platform) {
+               ClassLoader parentLoader = null;
+               if (platform.getParentPlatform() != null) {
+                       parentPlugin = platform.getParentPlatform().getPlugin();
+                       parentLoader = parentPlugin.getLoader();
                }
-               if (!platform.getVersion().equals(version)) {
-                       throw new IOException("Version of plug-in does not correspond with version of platform.");
+
+               loader = EMPluginLoader.makeLoader(pluginJar, parentLoader);
+               if (loader == null) {
+                       return false;
                }
 
-               this.loader = loader;
+               ExtensionItem item = null;
+               String pointClass = null;
+               for (String ex : PluginStringResources.getPointList()) {
+                       pointClass = attr.getValue(ex);
+                       if (pointClass == null) {
+                               // find parent's plug in
+                               item = getExtensionItem(ex);
+                       } else {
+                               item = new ExtensionItem(ex, pointClass, loader);
+                       }
 
-               for (String ex : EMPluginLoader.getExtensionList()) {
-                       try {
-                               exItemList.add(new ExtensionItem(ex, attr, this));
-                       } catch (IOException e) {
-                               EMLogger.getLogger().warning("This plugin does not have " + ex
+                       if (item != null) {
+                               exItemList.add(item);
+                       } else {
+                               EMLogger.getLogger().info("This plugin does not have " + ex
                                                + " extension point.");
                        }
                }
+               return true;
+       }
 
+       /**
+        * Find attributes in manifest file.
+        * If key does not exist in manifest file,
+        * this method will be return null.
+        * @param key
+        * @return
+        */
+       public String getAttribute(String key) {
+               if (attr == null) {
+                       return null;
+               }
+               return attr.getValue(key);
        }
 
        public ArrayList<ExtensionItem> getExItemList() {
                return exItemList;
        }
 
-       public void setExItemList(ArrayList<ExtensionItem> exItemList) {
-               this.exItemList = exItemList;
-       }
-
        public ExtensionItem getExtensionItem(String point) {
                for (ExtensionItem i : exItemList) {
                        if (i.getExtensionPoint().equals(point)) {
                                return i;
                        }
                }
+               if (parentPlugin != null) {
+                       return parentPlugin.getExtensionItem(point);
+               }
                return null;
        }
 
-       public String getProfile() {
-               return profile;
+       public URLClassLoader getLoader() {
+               return loader;
        }
 
-       public String getVersion() {
-               return version;
+       public String getPlatformName() {
+               return platformName;
        }
 
-       public URLClassLoader getLoader() {
-               return loader;
+       public String getPlatformPath() {
+               return platformPath;
+       }
+
+       public EMPlugin getParentPlugin() {
+               return parentPlugin;
        }
 }
index b5401b2..110ba94 100644 (file)
@@ -34,27 +34,15 @@ import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
-import java.util.ArrayList;
 import java.util.jar.Attributes;
 import java.util.jar.JarFile;
 
 import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.platform.Platform;
 import org.tizen.emulator.manager.resources.StringResources;
 
 public class EMPluginLoader {
-       private static ArrayList<String>  exPonitList = new ArrayList<String>();
-       static {
-               for (String point : PluginStringResources.getPointList()) {
-                       exPonitList.add(point);
-               }
-       }
-
-       public static ArrayList<String> getExtensionList() {
-               return exPonitList;
-       }
 
-       private static URLClassLoader makeLoader(File plugin) {
+       public static URLClassLoader makeLoader(File plugin, ClassLoader parent) {
                URL url = null;
                URLClassLoader loader;
                try {
@@ -72,7 +60,12 @@ public class EMPluginLoader {
 
                URL[] urls = new URL[1];
                urls[0] = url;
-               loader = URLClassLoader.newInstance(urls);
+               if (parent == null) {
+                       loader = URLClassLoader.newInstance(urls);
+               } else {
+                       loader = URLClassLoader.newInstance(urls, parent);
+               }
+
                if (loader == null) {
                        EMLogger.getLogger().warning("Failed to create instance of URLClassLoader.");
                        return null;
@@ -81,51 +74,24 @@ public class EMPluginLoader {
                return loader;
        }
 
-       private static Attributes makeAttribute(JarFile jarFile) {
+       public static Attributes makeAttributes(File pluginJar) {
+               JarFile jarFile = null;
                Attributes attr = null;
+
                try {
-                       if (jarFile.getManifest() != null) {
+                       jarFile = new JarFile(pluginJar.getAbsolutePath());
+               } catch (IOException e) {
+                       EMLogger.addStaticLog("Failed to load plugin jar file: " + e.getMessage());
+               }
+
+               try {
+                       if (jarFile != null && jarFile.getManifest() != null) {
                                attr = jarFile.getManifest().getMainAttributes();
                        }
                } catch (IOException e) {
                        EMLogger.addStaticLog("Failed to load Manifest file: " + e.getMessage());
                        return null;
                }
-               return attr;
-       }
-
-       public static EMPlugin makePlugin(File plugin, Platform platform) {
-               EMPlugin emPlugin = null;
-
-               JarFile jarFile = null;
-               if (plugin.isFile()) {
-                       try {
-                               jarFile = new JarFile(plugin.getAbsolutePath());
-                       } catch (IOException e) {
-                               EMLogger.addStaticLog("Failed to load plugin jar file: " + e.getMessage());
-                       }
-
-                       if (jarFile != null) {
-                               Attributes attr = EMPluginLoader.makeAttribute(jarFile);
-                               if (attr == null) {
-                                       return null;
-                               }
-
-                               URLClassLoader loader = EMPluginLoader.makeLoader(plugin);
-                               if (loader == null) {
-                                       return null;
-                               }
-
-                               try {
-                                       emPlugin = new EMPlugin (attr, loader, platform);
-                               } catch (IOException e) {
-                                       EMLogger.getLogger().warning("Failed to load em-plugin"
-                                                       + StringResources.NEW_LINE + "Path: " + plugin.getAbsolutePath()
-                                                       + StringResources.NEW_LINE + "Error: " + e.getMessage());
-                               }
-
-                       }
-               }
 
                if (jarFile != null) {
                        try {
@@ -135,6 +101,6 @@ public class EMPluginLoader {
                        }
                }
 
-               return emPlugin;
+               return attr;
        }
 }
index e14de27..987e715 100644 (file)
 
 package org.tizen.emulator.manager.plugin;
 
-import java.io.IOException;
-import java.util.jar.Attributes;
-
+import java.net.URLClassLoader;
 import org.tizen.emulator.manager.logging.EMLogger;
 
 public class ExtensionItem {
        private String exPoint;
        private String pointClass;
-       private EMPlugin plugin;
+       private URLClassLoader loader;
        private Object instance;
 
-       public ExtensionItem(String ex, Attributes attr, EMPlugin plugin) throws IOException {
+       public ExtensionItem(String ex, String pointClass, URLClassLoader loader){
                this.exPoint = ex;
-               this.plugin = plugin;
-               pointClass = attr.getValue(exPoint);
-               if (pointClass == null) {
-                       throw new IOException("Not found " + exPoint + " attribute.");
-               }
+               this.loader = loader;
+               this.pointClass = pointClass;
        }
 
        public String getExtensionPoint() {
@@ -64,12 +59,11 @@ public class ExtensionItem {
                return loadingClass();
        }
 
+       @SuppressWarnings("rawtypes")
        private Object loadingClass() {
-               @SuppressWarnings("rawtypes")
                Class classToLoad = null;
-
                try {
-                       classToLoad = Class.forName(pointClass, true, plugin.getLoader());
+                       classToLoad = Class.forName(pointClass, true, loader);
                } catch (ClassNotFoundException e) {
                        EMLogger.getLogger().warning("Failed to load point class jar file: " + e.getMessage());
                        return null;
@@ -82,7 +76,6 @@ public class ExtensionItem {
                } catch (IllegalAccessException e) {
                        EMLogger.getLogger().warning("Failed to create new instance from class: " + e.getMessage());
                }
-
                return null;
        }
 }
index 11f2d99..0a7359f 100644 (file)
@@ -133,7 +133,6 @@ public enum PluginImageResources {
 class ImageRegistry {
        //private static final String ID = "org.tizen.dynamicanalyzer";
        private static Map<String, Image> map = new HashMap<String, Image>();
-       private static URLClassLoader loader;
 
        public static void dispose() {
                for (Image i : map.values()) {
@@ -149,18 +148,35 @@ class ImageRegistry {
                return getImage(name, platformName, skinShape, "gif");
        }
 
-       private static URLClassLoader findLoader(String platformName) {
+       private static EMPlugin findPlugin(String platformName) {
                for (Profile p : ProfileList.getProfileList()) {
                        for (Platform pl : p.getPlatformList()) {
                                if (pl.getName().equals(platformName)) {
                                        if (pl.getPlugin() != null) {
-                                               return pl.getPlugin().getLoader();
+                                               return pl.getPlugin();
                                        }
                                }
                        }
                }
                return null;
        }
+
+       private static URL findImageURL(EMPlugin plugin, String name, String shape, String extension) {
+               URL url = null;
+               URLClassLoader loader = plugin.getLoader();
+               if (loader != null) {
+                       url = loader.findResource("res/" + shape + "_" + name + "." + extension);
+                       if (url == null) {
+                               // remove shape prefix
+                               url = loader.findResource("res/" + name + "." + extension);
+                       }
+                       if (url == null && plugin.getParentPlugin() != null) {
+                               url = findImageURL(plugin.getParentPlugin(), name, shape, extension);
+                       }
+               }
+               return url;
+       }
+
        public static Image getImage(String name, String platformName, SKIN_SHAPE skinShape, String extension) {
                String shape = "";
                if (skinShape != null) {
@@ -170,14 +186,10 @@ class ImageRegistry {
 
                // Get image from plugin resource.
                if (i == null) {
-                       loader = findLoader(platformName);
-                       if (loader != null) {
+                       EMPlugin plugin = findPlugin(platformName);
+                       if (plugin != null) {
                                InputStream is = null;
-                               URL url = loader.findResource("res/" + shape + "_" + name + "." + extension);
-                               if (url == null) {
-                                       // remove shape prefix
-                                       url = loader.findResource("res/" + name + "." + extension);
-                               }
+                               URL url = findImageURL(plugin, name, shape, extension);
                                if (url != null) {
                                        try {
                                                is = url.openStream();
@@ -217,9 +229,9 @@ class ImageRegistry {
 
        public static ImageData[] getImageData(String name, String platformName, String extension) {
                ImageData[] frames = null;
-               loader = findLoader(platformName);
-               if (loader != null) {
-                       InputStream is = loader.getResourceAsStream("res/" + platformName + "_" + name + "." + extension);
+               EMPlugin plugin = findPlugin(platformName);
+               if (plugin != null) {
+                       InputStream is = plugin.getLoader().getResourceAsStream("res/" + platformName + "_" + name + "." + extension);
                        if (is != null) {
                                frames = new ImageLoader().load(is);
                                try {
index 04d713b..3f0a58a 100644 (file)
@@ -35,15 +35,23 @@ public class PluginStringResources {
        // extension point
        // org.tizen.emulator.manager.ui.detail.IItemListFactory
        public final static String ItemFactory = "Item-Factory";
-       // org.eclipse.swt.events.PaintListener;
+       // org.tizen.emulator.manager.ui.widgets.IVMButtonPainter
        public final static String VMButtonPainter = "VMButton-Painter";
-       // org.tizen.emulator.manager.vms.VMWorkerCommon
+       // org.tizen.emulator.manager.vms.IVMWorker
        public final static String VMWorker = "VM-Worker";
+       // org.tizen.emulator.manager.vms.option.IOptionFactory
        public final static String OptionFactory = "Option-Factory";
 
+       // this is platform's name. this value will be unique. default value is profile-version
+       public final static String PlatformName = "Platform-Name";
        public final static String PlatformVersion = "Platform-Version";
        public final static String PlatformProfile = "Platform-Profile";
 
+       // for child plug in
+       // base platform name
+       public final static String BasePlatform = "Base-Platform";
+       public final static String EmulatorDir = "Emulator-Dir";
+
        private static ArrayList<String> pointList = new ArrayList<String>();
        static {
                pointList.add(ItemFactory);