@Test public void testRegisterPlugin() { ReaderPlugin testPlugin = proxyService.registerPlugin(factory1); Map<String, ReaderPlugin> testPlugins = proxyService.getPlugins(); Assert.assertNotNull(testPlugin); Assert.assertEquals(PLUGIN_NAME_1, testPlugin.getName()); Assert.assertEquals(1, testPlugins.size()); proxyService.unregisterPlugin(PLUGIN_NAME_1); }
public ReaderPlugin registerPlugin(PluginFactory pluginFactory) { if (pluginFactory == null) { throw new IllegalArgumentException("Factory must not be null"); } synchronized (MONITOR) { final String pluginName = pluginFactory.getPluginName(); if (this.plugins.containsKey(pluginName)) { logger.warn("Plugin has already been registered to the platform : {}", pluginName); return this.plugins.get(pluginName); } else { ReaderPlugin pluginInstance = pluginFactory.getPlugin(); logger.info("Registering a new Plugin to the platform : {}", pluginName); this.plugins.put(pluginName, pluginInstance); return pluginInstance; } } }
SeProxyService { public ReaderPlugin registerPlugin(PluginFactory pluginFactory) { if (pluginFactory == null) { throw new IllegalArgumentException("Factory must not be null"); } synchronized (MONITOR) { final String pluginName = pluginFactory.getPluginName(); if (this.plugins.containsKey(pluginName)) { logger.warn("Plugin has already been registered to the platform : {}", pluginName); return this.plugins.get(pluginName); } else { ReaderPlugin pluginInstance = pluginFactory.getPlugin(); logger.info("Registering a new Plugin to the platform : {}", pluginName); this.plugins.put(pluginName, pluginInstance); return pluginInstance; } } } }
SeProxyService { public ReaderPlugin registerPlugin(PluginFactory pluginFactory) { if (pluginFactory == null) { throw new IllegalArgumentException("Factory must not be null"); } synchronized (MONITOR) { final String pluginName = pluginFactory.getPluginName(); if (this.plugins.containsKey(pluginName)) { logger.warn("Plugin has already been registered to the platform : {}", pluginName); return this.plugins.get(pluginName); } else { ReaderPlugin pluginInstance = pluginFactory.getPlugin(); logger.info("Registering a new Plugin to the platform : {}", pluginName); this.plugins.put(pluginName, pluginInstance); return pluginInstance; } } } private  SeProxyService(); }
SeProxyService { public ReaderPlugin registerPlugin(PluginFactory pluginFactory) { if (pluginFactory == null) { throw new IllegalArgumentException("Factory must not be null"); } synchronized (MONITOR) { final String pluginName = pluginFactory.getPluginName(); if (this.plugins.containsKey(pluginName)) { logger.warn("Plugin has already been registered to the platform : {}", pluginName); return this.plugins.get(pluginName); } else { ReaderPlugin pluginInstance = pluginFactory.getPlugin(); logger.info("Registering a new Plugin to the platform : {}", pluginName); this.plugins.put(pluginName, pluginInstance); return pluginInstance; } } } private  SeProxyService(); static SeProxyService getInstance(); ReaderPlugin registerPlugin(PluginFactory pluginFactory); boolean unregisterPlugin(String pluginName); synchronized boolean isRegistered(String pluginName); synchronized Map<String, ReaderPlugin> getPlugins(); synchronized ReaderPlugin getPlugin(String name); String getVersion(); }
SeProxyService { public ReaderPlugin registerPlugin(PluginFactory pluginFactory) { if (pluginFactory == null) { throw new IllegalArgumentException("Factory must not be null"); } synchronized (MONITOR) { final String pluginName = pluginFactory.getPluginName(); if (this.plugins.containsKey(pluginName)) { logger.warn("Plugin has already been registered to the platform : {}", pluginName); return this.plugins.get(pluginName); } else { ReaderPlugin pluginInstance = pluginFactory.getPlugin(); logger.info("Registering a new Plugin to the platform : {}", pluginName); this.plugins.put(pluginName, pluginInstance); return pluginInstance; } } } private  SeProxyService(); static SeProxyService getInstance(); ReaderPlugin registerPlugin(PluginFactory pluginFactory); boolean unregisterPlugin(String pluginName); synchronized boolean isRegistered(String pluginName); synchronized Map<String, ReaderPlugin> getPlugins(); synchronized ReaderPlugin getPlugin(String name); String getVersion();  }