@Test public void testList() { LogUtil.info(getClass().getName(), " ===testList=== "); Collection<Plugin> list = pluginManager.list(); for (Plugin p : list) { LogUtil.info(getClass().getName(), " plugin: " + p.getName() + "; " + p.getClass().getName()); } }
public Collection<Plugin> list() { Collection<Plugin> list = new ArrayList<Plugin>(); BundleContext context = felix.getBundleContext(); Bundle[] bundles = context.getBundles(); for (Bundle b : bundles) { ServiceReference[] refs = b.getRegisteredServices(); if (refs != null) { for (ServiceReference sr : refs) { LogUtil.debug(PluginManager.class.getName(), " bundle service: " + sr); Object obj = context.getService(sr); if (obj instanceof Plugin) { list.add((Plugin) obj); } context.ungetService(sr); } } } return list; }
PluginManager implements ApplicationContextAware { public Collection<Plugin> list() { Collection<Plugin> list = new ArrayList<Plugin>(); BundleContext context = felix.getBundleContext(); Bundle[] bundles = context.getBundles(); for (Bundle b : bundles) { ServiceReference[] refs = b.getRegisteredServices(); if (refs != null) { for (ServiceReference sr : refs) { LogUtil.debug(PluginManager.class.getName(), " bundle service: " + sr); Object obj = context.getService(sr); if (obj instanceof Plugin) { list.add((Plugin) obj); } context.ungetService(sr); } } } return list; } }
PluginManager implements ApplicationContextAware { public Collection<Plugin> list() { Collection<Plugin> list = new ArrayList<Plugin>(); BundleContext context = felix.getBundleContext(); Bundle[] bundles = context.getBundles(); for (Bundle b : bundles) { ServiceReference[] refs = b.getRegisteredServices(); if (refs != null) { for (ServiceReference sr : refs) { LogUtil.debug(PluginManager.class.getName(), " bundle service: " + sr); Object obj = context.getService(sr); if (obj instanceof Plugin) { list.add((Plugin) obj); } context.ungetService(sr); } } } return list; } PluginManager();  PluginManager(String baseDirectory); }
PluginManager implements ApplicationContextAware { public Collection<Plugin> list() { Collection<Plugin> list = new ArrayList<Plugin>(); BundleContext context = felix.getBundleContext(); Bundle[] bundles = context.getBundles(); for (Bundle b : bundles) { ServiceReference[] refs = b.getRegisteredServices(); if (refs != null) { for (ServiceReference sr : refs) { LogUtil.debug(PluginManager.class.getName(), " bundle service: " + sr); Object obj = context.getService(sr); if (obj instanceof Plugin) { list.add((Plugin) obj); } context.ungetService(sr); } } } return list; } PluginManager();  PluginManager(String baseDirectory); String getBaseDirectory(); void refresh(); Collection<Plugin> list(); boolean disable(String name); boolean upload(String filename, InputStream in); void uninstallAll(boolean deleteFiles); boolean uninstall(String name); boolean uninstall(String name, boolean deleteFile); Plugin getPlugin(String name); Object execute(String name, Map properties); void shutdown(); @Override void finalize(); void testPlugin(String name, String location, Map properties, boolean override); static void main(String[] args); Object getBean(String beanName); void setApplicationContext(ApplicationContext appContext); }
PluginManager implements ApplicationContextAware { public Collection<Plugin> list() { Collection<Plugin> list = new ArrayList<Plugin>(); BundleContext context = felix.getBundleContext(); Bundle[] bundles = context.getBundles(); for (Bundle b : bundles) { ServiceReference[] refs = b.getRegisteredServices(); if (refs != null) { for (ServiceReference sr : refs) { LogUtil.debug(PluginManager.class.getName(), " bundle service: " + sr); Object obj = context.getService(sr); if (obj instanceof Plugin) { list.add((Plugin) obj); } context.ungetService(sr); } } } return list; } PluginManager();  PluginManager(String baseDirectory); String getBaseDirectory(); void refresh(); Collection<Plugin> list(); boolean disable(String name); boolean upload(String filename, InputStream in); void uninstallAll(boolean deleteFiles); boolean uninstall(String name); boolean uninstall(String name, boolean deleteFile); Plugin getPlugin(String name); Object execute(String name, Map properties); void shutdown(); @Override void finalize(); void testPlugin(String name, String location, Map properties, boolean override); static void main(String[] args); Object getBean(String beanName); void setApplicationContext(ApplicationContext appContext);  }