diff options
Diffstat (limited to 'demo')
-rw-r--r-- | demo/app/src/main/java/ro/fortsoft/pf4j/demo/Boot.java | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/demo/app/src/main/java/ro/fortsoft/pf4j/demo/Boot.java b/demo/app/src/main/java/ro/fortsoft/pf4j/demo/Boot.java index 2394761..fa779e2 100644 --- a/demo/app/src/main/java/ro/fortsoft/pf4j/demo/Boot.java +++ b/demo/app/src/main/java/ro/fortsoft/pf4j/demo/Boot.java @@ -56,13 +56,13 @@ public class Boot { } // print extensions from classpath (non plugin) - System.out.println(String.format("Extensions added by classpath:")); + System.out.println("Extensions added by classpath:"); Set<String> extensionClassNames = pluginManager.getExtensionClassNames(null); for (String extension : extensionClassNames) { System.out.println(" " + extension); } - // print extensions for each started plugin + // print extensions ids for each started plugin List<PluginWrapper> startedPlugins = pluginManager.getStartedPlugins(); for (PluginWrapper plugin : startedPlugins) { String pluginId = plugin.getDescriptor().getPluginId(); @@ -73,6 +73,33 @@ public class Boot { } } + // print the extensions instances for Greeting extension point for each started plugin + for (PluginWrapper plugin : startedPlugins) { + String pluginId = plugin.getDescriptor().getPluginId(); + System.out.println(String.format("Extensions instances added by plugin '%s' for extension point '%s':", pluginId, Greeting.class.getName())); + List<Greeting> extensions = pluginManager.getExtensions(Greeting.class, pluginId); + for (Object extension : extensions) { + System.out.println(" " + extension); + } + } + + // print extensions instances from classpath (non plugin) + System.out.println("Extensions instances added by classpath:"); + List extensions = pluginManager.getExtensions((String) null); + for (Object extension : extensions) { + System.out.println(" " + extension); + } + + // print extensions instances for each started plugin + for (PluginWrapper plugin : startedPlugins) { + String pluginId = plugin.getDescriptor().getPluginId(); + System.out.println(String.format("Extensions instances added by plugin '%s':", pluginId)); + extensions = pluginManager.getExtensions(pluginId); + for (Object extension : extensions) { + System.out.println(" " + extension); + } + } + // stop the plugins pluginManager.stopPlugins(); /* |