diff options
author | Michael "Lyze" Weinberger <michael.weinberger@lyze.at> | 2017-06-19 10:41:58 +0200 |
---|---|---|
committer | Decebal Suiu <decebal.suiu@gmail.com> | 2017-06-19 11:41:58 +0300 |
commit | a9c70ff19adf06c940f925a3c09e1a3dee7aa9a4 (patch) | |
tree | c97a6d65608082663b52c342c5aa149ee5808f3f /demo_gradle/app | |
parent | 443191d0cc75079099278596c686c29d18cf9a01 (diff) | |
download | pf4j-a9c70ff19adf06c940f925a3c09e1a3dee7aa9a4.tar.gz pf4j-a9c70ff19adf06c940f925a3c09e1a3dee7aa9a4.zip |
Updated gradle demo dependencies and switched from System.out.println to slf4j.log (#149)
Diffstat (limited to 'demo_gradle/app')
-rw-r--r-- | demo_gradle/app/build.gradle | 6 | ||||
-rw-r--r-- | demo_gradle/app/src/main/java/ro/fortsoft/pf4j/demo/Boot.java | 31 |
2 files changed, 19 insertions, 18 deletions
diff --git a/demo_gradle/app/build.gradle b/demo_gradle/app/build.gradle index 029779d..2478937 100644 --- a/demo_gradle/app/build.gradle +++ b/demo_gradle/app/build.gradle @@ -4,10 +4,10 @@ mainClassName = 'ro.fortsoft.pf4j.demo.Boot' dependencies { compile project(':api') - compile 'ro.fortsoft.pf4j:pf4j:1.1.1' - compile 'org.apache.commons:commons-lang3:3.0' + compile 'ro.fortsoft.pf4j:pf4j:1.3.0' + compile 'org.apache.commons:commons-lang3:3.5' testCompile group: 'junit', name: 'junit', version: '4.+' - compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.6.1' + compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25' } jar { diff --git a/demo_gradle/app/src/main/java/ro/fortsoft/pf4j/demo/Boot.java b/demo_gradle/app/src/main/java/ro/fortsoft/pf4j/demo/Boot.java index 77e230a..d3e1502 100644 --- a/demo_gradle/app/src/main/java/ro/fortsoft/pf4j/demo/Boot.java +++ b/demo_gradle/app/src/main/java/ro/fortsoft/pf4j/demo/Boot.java @@ -15,22 +15,23 @@ */ package ro.fortsoft.pf4j.demo; -import java.util.List; -import java.util.Set; - import org.apache.commons.lang3.StringUtils; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import ro.fortsoft.pf4j.DefaultPluginManager; import ro.fortsoft.pf4j.PluginManager; import ro.fortsoft.pf4j.PluginWrapper; import ro.fortsoft.pf4j.demo.api.Greeting; +import java.util.List; + /** * A boot class that start the demo. * * @author Decebal Suiu */ public class Boot { + private static final Logger logger = LoggerFactory.getLogger(Boot.class); public static void main(String[] args) { // print logo @@ -48,31 +49,31 @@ public class Boot { // start (active/resolved) the plugins pluginManager.startPlugins(); - System.out.println("Plugindirectory: "); - System.out.println("\t" + System.getProperty("pf4j.pluginsDir", "plugins") + "\n"); + logger.info("Plugindirectory: "); + logger.info("\t" + System.getProperty("pf4j.pluginsDir", "plugins") + "\n"); // retrieves the extensions for Greeting extension point List<Greeting> greetings = pluginManager.getExtensions(Greeting.class); - System.out.println(String.format("Found %d extensions for extension point '%s'", greetings.size(), Greeting.class.getName())); + logger.info(String.format("Found %d extensions for extension point '%s'", greetings.size(), Greeting.class.getName())); for (Greeting greeting : greetings) { - System.out.println(">>> " + greeting.getGreeting()); + logger.info(">>> " + greeting.getGreeting()); } // // print extensions from classpath (non plugin) - // System.out.println(String.format("Extensions added by classpath:")); + // logger.info(String.format("Extensions added by classpath:")); // Set<String> extensionClassNames = pluginManager.getExtensionClassNames(null); // for (String extension : extensionClassNames) { - // System.out.println(" " + extension); + // logger.info(" " + extension); // } // print extensions for each started plugin List<PluginWrapper> startedPlugins = pluginManager.getStartedPlugins(); for (PluginWrapper plugin : startedPlugins) { String pluginId = plugin.getDescriptor().getPluginId(); - System.out.println(String.format("Extensions added by plugin '%s':", pluginId)); + logger.info(String.format("Extensions added by plugin '%s':", pluginId)); // extensionClassNames = pluginManager.getExtensionClassNames(pluginId); // for (String extension : extensionClassNames) { - // System.out.println(" " + extension); + // logger.info(" " + extension); // } } @@ -91,9 +92,9 @@ public class Boot { } private static void printLogo() { - System.out.println(StringUtils.repeat("#", 40)); - System.out.println(StringUtils.center("PF4J-DEMO", 40)); - System.out.println(StringUtils.repeat("#", 40)); + logger.info(StringUtils.repeat("#", 40)); + logger.info(StringUtils.center("PF4J-DEMO", 40)); + logger.info(StringUtils.repeat("#", 40)); } } |