@Override public void registerPlugin(String pluginName, Properties pluginProps) { Plugin plugin = null; switch (pluginName) { case "logOperations": plugin = new LogOperationsPlugin(); break; case "topSites": plugin = new TopSitesPlugin(); break; case "favourites": plugin = new FavouritesPlugin(); break; case "cosmSensors": plugin = new CosmSensorsPlugin(); break; case "news": plugin = new NewsPlugin(); break; default: plugin = new PluginImpl(); break; } plugin.register(pluginName, pluginProps); plugins.add(plugin); }
@Override public boolean view(String pluginName) { Plugin plugin = getPlugin(pluginName); if (plugin != null) { return plugin.view(); } return false; }
@Override public boolean unload(String pluginName) { Plugin plugin = getPlugin(pluginName); if (plugin != null) { plugin.unload(); return plugin.isLoaded(); } return false; }
@Override public Plugin getPlugin(String pluginName) { for (Plugin plugin : plugins) { if (plugin.getName().equalsIgnoreCase(pluginName)) { return plugin; } } return null; }