From 0b3ac7fa749e188abbbfd21a550183bfcbbcb8f3 Mon Sep 17 00:00:00 2001 From: Stix Date: Sun, 1 Mar 2015 17:24:43 +0100 Subject: [PATCH 1/3] added base files --- demo_gradle/.gitignore | 1 + demo_gradle/api/.gitignore | 1 + demo_gradle/api/build.gradle | 5 + .../ro/fortsoft/pf4j/demo/api/Greeting.java | 24 +++++ demo_gradle/app/.gitignore | 1 + demo_gradle/app/build.gradle | 11 +++ .../main/java/ro/fortsoft/pf4j/demo/Boot.java | 93 +++++++++++++++++++ .../fortsoft/pf4j/demo/WhazzupGreeting.java | 29 ++++++ .../app/src/main/resources/log4j.properties | 16 ++++ demo_gradle/build.gradle | 13 +++ demo_gradle/plugins/disabled.txt | 6 ++ demo_gradle/plugins/enabled.txt | 6 ++ demo_gradle/plugins/plugin1/.gitignore | 1 + demo_gradle/plugins/plugin1/build.gradle | 25 +++++ demo_gradle/plugins/plugin1/plugin.properties | 5 + .../pf4j/demo/welcome/WelcomePlugin.java | 56 +++++++++++ demo_gradle/plugins/plugin2/.gitignore | 1 + demo_gradle/plugins/plugin2/build.gradle | 25 +++++ demo_gradle/plugins/plugin2/plugin.properties | 5 + .../fortsoft/pf4j/demo/hello/HelloPlugin.java | 51 ++++++++++ demo_gradle/settings.gradle | 3 + 21 files changed, 378 insertions(+) create mode 100644 demo_gradle/.gitignore create mode 100644 demo_gradle/api/.gitignore create mode 100644 demo_gradle/api/build.gradle create mode 100644 demo_gradle/api/src/main/java/ro/fortsoft/pf4j/demo/api/Greeting.java create mode 100644 demo_gradle/app/.gitignore create mode 100644 demo_gradle/app/build.gradle create mode 100644 demo_gradle/app/src/main/java/ro/fortsoft/pf4j/demo/Boot.java create mode 100644 demo_gradle/app/src/main/java/ro/fortsoft/pf4j/demo/WhazzupGreeting.java create mode 100644 demo_gradle/app/src/main/resources/log4j.properties create mode 100644 demo_gradle/build.gradle create mode 100644 demo_gradle/plugins/disabled.txt create mode 100644 demo_gradle/plugins/enabled.txt create mode 100644 demo_gradle/plugins/plugin1/.gitignore create mode 100644 demo_gradle/plugins/plugin1/build.gradle create mode 100644 demo_gradle/plugins/plugin1/plugin.properties create mode 100644 demo_gradle/plugins/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java create mode 100644 demo_gradle/plugins/plugin2/.gitignore create mode 100644 demo_gradle/plugins/plugin2/build.gradle create mode 100644 demo_gradle/plugins/plugin2/plugin.properties create mode 100644 demo_gradle/plugins/plugin2/src/main/java/ro/fortsoft/pf4j/demo/hello/HelloPlugin.java create mode 100644 demo_gradle/settings.gradle diff --git a/demo_gradle/.gitignore b/demo_gradle/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/demo_gradle/.gitignore @@ -0,0 +1 @@ +build diff --git a/demo_gradle/api/.gitignore b/demo_gradle/api/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/demo_gradle/api/.gitignore @@ -0,0 +1 @@ +build diff --git a/demo_gradle/api/build.gradle b/demo_gradle/api/build.gradle new file mode 100644 index 0000000..a77fb9d --- /dev/null +++ b/demo_gradle/api/build.gradle @@ -0,0 +1,5 @@ +dependencies { + compile 'ro.fortsoft.pf4j:pf4j:0.4' + compile 'org.apache.commons:commons-lang3:3.0' + testCompile group: 'junit', name: 'junit', version: '4.+' +} \ No newline at end of file diff --git a/demo_gradle/api/src/main/java/ro/fortsoft/pf4j/demo/api/Greeting.java b/demo_gradle/api/src/main/java/ro/fortsoft/pf4j/demo/api/Greeting.java new file mode 100644 index 0000000..9a700c2 --- /dev/null +++ b/demo_gradle/api/src/main/java/ro/fortsoft/pf4j/demo/api/Greeting.java @@ -0,0 +1,24 @@ +/* + * Copyright 2012 Decebal Suiu + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with + * the License. You may obtain a copy of the License in the LICENSE file, or at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package ro.fortsoft.pf4j.demo.api; + +import ro.fortsoft.pf4j.ExtensionPoint; + +/** + * @author Decebal Suiu + */ +public interface Greeting extends ExtensionPoint { + + public String getGreeting(); + +} diff --git a/demo_gradle/app/.gitignore b/demo_gradle/app/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/demo_gradle/app/.gitignore @@ -0,0 +1 @@ +build diff --git a/demo_gradle/app/build.gradle b/demo_gradle/app/build.gradle new file mode 100644 index 0000000..22145d8 --- /dev/null +++ b/demo_gradle/app/build.gradle @@ -0,0 +1,11 @@ +dependencies { + compile project(':api') + compile 'ro.fortsoft.pf4j:pf4j:0.4' + compile 'org.apache.commons:commons-lang3:3.0' + testCompile group: 'junit', name: 'junit', version: '4.+' +} + +jar { + baseName = 'Plugin Demo' + version = '0.1.0' +} 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 new file mode 100644 index 0000000..2619531 --- /dev/null +++ b/demo_gradle/app/src/main/java/ro/fortsoft/pf4j/demo/Boot.java @@ -0,0 +1,93 @@ +/* + * Copyright 2012 Decebal Suiu + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with + * the License. You may obtain a copy of the License in the LICENSE file, or at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package ro.fortsoft.pf4j.demo; + +import java.util.List; +import java.util.Set; + +import org.apache.commons.lang.StringUtils; + +import ro.fortsoft.pf4j.DefaultPluginManager; +import ro.fortsoft.pf4j.PluginManager; +import ro.fortsoft.pf4j.PluginWrapper; +import ro.fortsoft.pf4j.demo.api.Greeting; + +/** + * A boot class that start the demo. + * + * @author Decebal Suiu + */ +public class Boot { + + public static void main(String[] args) { + // print logo + printLogo(); + + // create the plugin manager + final PluginManager pluginManager = new DefaultPluginManager(); + + // load the plugins + pluginManager.loadPlugins(); + + // enable a disabled plugin +// pluginManager.enablePlugin("welcome-plugin"); + + // start (active/resolved) the plugins + pluginManager.startPlugins(); + + // retrieves the extensions for Greeting extension point + List greetings = pluginManager.getExtensions(Greeting.class); + System.out.println(String.format("Found %d extensions for extension point '%s'", greetings.size(), Greeting.class.getName())); + for (Greeting greeting : greetings) { + System.out.println(">>> " + greeting.getGreeting()); + } + + // print extensions from classpath (non plugin) + System.out.println(String.format("Extensions added by classpath:")); + Set extensionClassNames = pluginManager.getExtensionClassNames(null); + for (String extension : extensionClassNames) { + System.out.println(" " + extension); + } + + // print extensions for each started plugin + List startedPlugins = pluginManager.getStartedPlugins(); + for (PluginWrapper plugin : startedPlugins) { + String pluginId = plugin.getDescriptor().getPluginId(); + System.out.println(String.format("Extensions added by plugin '%s':", pluginId)); + extensionClassNames = pluginManager.getExtensionClassNames(pluginId); + for (String extension : extensionClassNames) { + System.out.println(" " + extension); + } + } + + // stop the plugins + pluginManager.stopPlugins(); + /* + Runtime.getRuntime().addShutdownHook(new Thread() { + + @Override + public void run() { + pluginManager.stopPlugins(); + } + + }); + */ + } + + private static void printLogo() { + System.out.println(StringUtils.repeat("#", 40)); + System.out.println(StringUtils.center("PF4J-DEMO", 40)); + System.out.println(StringUtils.repeat("#", 40)); + } + +} diff --git a/demo_gradle/app/src/main/java/ro/fortsoft/pf4j/demo/WhazzupGreeting.java b/demo_gradle/app/src/main/java/ro/fortsoft/pf4j/demo/WhazzupGreeting.java new file mode 100644 index 0000000..9cf7e35 --- /dev/null +++ b/demo_gradle/app/src/main/java/ro/fortsoft/pf4j/demo/WhazzupGreeting.java @@ -0,0 +1,29 @@ +/* + * Copyright 2014 Decebal Suiu + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with + * the License. You may obtain a copy of the License in the LICENSE file, or at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package ro.fortsoft.pf4j.demo; + +import ro.fortsoft.pf4j.Extension; +import ro.fortsoft.pf4j.demo.api.Greeting; + +/** + * @author Decebal Suiu + */ +@Extension +public class WhazzupGreeting implements Greeting { + + @Override + public String getGreeting() { + return "Whazzup"; + } + +} diff --git a/demo_gradle/app/src/main/resources/log4j.properties b/demo_gradle/app/src/main/resources/log4j.properties new file mode 100644 index 0000000..16ce034 --- /dev/null +++ b/demo_gradle/app/src/main/resources/log4j.properties @@ -0,0 +1,16 @@ +log4j.rootLogger=DEBUG, Console + +# +# PF4J log +# +log4j.logger.ro.fortsoft.pf4j=DEBUG, Console +log4j.logger.ro.fortsoft.pf4j.PluginClassLoader=WARN, Console +log4j.additivity.ro.fortsoft.pf4j=false + +# +# Appenders +# +log4j.appender.Console=org.apache.log4j.ConsoleAppender +log4j.appender.Console.layout=org.apache.log4j.PatternLayout +#log4j.appender.Console.layout.conversionPattern=%-5p - %-32.32c{1} - %m\n +log4j.appender.Console.layout.ConversionPattern=%d %p %c - %m%n diff --git a/demo_gradle/build.gradle b/demo_gradle/build.gradle new file mode 100644 index 0000000..51cbce5 --- /dev/null +++ b/demo_gradle/build.gradle @@ -0,0 +1,13 @@ +subprojects { + apply plugin: 'java' + + repositories { + mavenLocal() + mavenCentral() + } + + + task wrapper(type: Wrapper) { + gradleVersion = '1.11' + } +} \ No newline at end of file diff --git a/demo_gradle/plugins/disabled.txt b/demo_gradle/plugins/disabled.txt new file mode 100644 index 0000000..fcaef50 --- /dev/null +++ b/demo_gradle/plugins/disabled.txt @@ -0,0 +1,6 @@ +######################################## +# - load all plugins except these +# - add one plugin id on each line +# - put this file in plugins folder +######################################## +#welcome-plugin \ No newline at end of file diff --git a/demo_gradle/plugins/enabled.txt b/demo_gradle/plugins/enabled.txt new file mode 100644 index 0000000..5594017 --- /dev/null +++ b/demo_gradle/plugins/enabled.txt @@ -0,0 +1,6 @@ +######################################## +# - load only these plugins +# - add one plugin id on each line +# - put this file in plugins folder +######################################## +#welcome-plugin \ No newline at end of file diff --git a/demo_gradle/plugins/plugin1/.gitignore b/demo_gradle/plugins/plugin1/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/demo_gradle/plugins/plugin1/.gitignore @@ -0,0 +1 @@ +build diff --git a/demo_gradle/plugins/plugin1/build.gradle b/demo_gradle/plugins/plugin1/build.gradle new file mode 100644 index 0000000..e5f574c --- /dev/null +++ b/demo_gradle/plugins/plugin1/build.gradle @@ -0,0 +1,25 @@ +jar { + baseName = 'WelcomePlugin' + version = '0.1.0' + manifest { + attributes 'Plugin-Class' : 'ro.fortsoft.pf4j.demo.welcome.WelcomePlugin', + 'Plugin-Id' : 'WelcomePlugin', + 'Plugin-Version' : '1.0', + 'Plugin-Provider' : 'Yannick Bäumer' + } +} + +task plugin(type: Jar) { + baseName = 'WelcomePlugin' + version = '0.1.0' + into('classes') + extension('zip') + with jar +} + +dependencies { + compile project(':api') + compile 'ro.fortsoft.pf4j:pf4j:0.4' + compile 'org.apache.commons:commons-lang3:3.0' + testCompile group: 'junit', name: 'junit', version: '4.+' +} \ No newline at end of file diff --git a/demo_gradle/plugins/plugin1/plugin.properties b/demo_gradle/plugins/plugin1/plugin.properties new file mode 100644 index 0000000..4f95d99 --- /dev/null +++ b/demo_gradle/plugins/plugin1/plugin.properties @@ -0,0 +1,5 @@ +plugin.id=welcome-plugin +plugin.class=ro.fortsoft.pf4j.demo.welcome.WelcomePlugin +plugin.version=0.0.1 +plugin.provider=Decebal Suiu +plugin.dependencies= diff --git a/demo_gradle/plugins/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java b/demo_gradle/plugins/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java new file mode 100644 index 0000000..1c35259 --- /dev/null +++ b/demo_gradle/plugins/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java @@ -0,0 +1,56 @@ +/* + * Copyright 2012 Decebal Suiu + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with + * the License. You may obtain a copy of the License in the LICENSE file, or at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package ro.fortsoft.pf4j.demo.welcome; + +import org.apache.commons.lang.StringUtils; + +import ro.fortsoft.pf4j.Extension; +import ro.fortsoft.pf4j.Plugin; +import ro.fortsoft.pf4j.PluginWrapper; +import ro.fortsoft.pf4j.RuntimeMode; +import ro.fortsoft.pf4j.demo.api.Greeting; + +/** + * @author Decebal Suiu + */ +public class WelcomePlugin extends Plugin { + + public WelcomePlugin(PluginWrapper wrapper) { + super(wrapper); + } + + @Override + public void start() { + System.out.println("WelcomePlugin.start()"); + // for testing the development mode + if (RuntimeMode.DEVELOPMENT.equals(wrapper.getRuntimeMode())) { + System.out.println(StringUtils.upperCase("WelcomePlugin")); + } + } + + @Override + public void stop() { + System.out.println("WelcomePlugin.stop()"); + } + + @Extension + public static class WelcomeGreeting implements Greeting { + + @Override + public String getGreeting() { + return "Welcome"; + } + + } + +} diff --git a/demo_gradle/plugins/plugin2/.gitignore b/demo_gradle/plugins/plugin2/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/demo_gradle/plugins/plugin2/.gitignore @@ -0,0 +1 @@ +build diff --git a/demo_gradle/plugins/plugin2/build.gradle b/demo_gradle/plugins/plugin2/build.gradle new file mode 100644 index 0000000..3c8c750 --- /dev/null +++ b/demo_gradle/plugins/plugin2/build.gradle @@ -0,0 +1,25 @@ +jar { + baseName = 'HelloPlugin' + version = '0.1.0' + manifest { + attributes 'Plugin-Class' : 'ro.fortsoft.pf4j.demo.welcome.HelloPlugin', + 'Plugin-Id' : 'HelloPlugin', + 'Plugin-Version' : '1.0', + 'Plugin-Provider' : 'Yannick Bäumer' + } +} + +task plugin(type: Jar) { + baseName = 'HelloPlugin' + version = '0.1.0' + into('classes') + extension('zip') + with jar +} + +dependencies { + compile project(':api') + compile 'ro.fortsoft.pf4j:pf4j:0.4' + compile 'org.apache.commons:commons-lang3:3.0' + testCompile group: 'junit', name: 'junit', version: '4.+' +} \ No newline at end of file diff --git a/demo_gradle/plugins/plugin2/plugin.properties b/demo_gradle/plugins/plugin2/plugin.properties new file mode 100644 index 0000000..0de45e6 --- /dev/null +++ b/demo_gradle/plugins/plugin2/plugin.properties @@ -0,0 +1,5 @@ +plugin.id=hello-plugin +plugin.class=ro.fortsoft.pf4j.demo.hello.HelloPlugin +plugin.version=0.0.1 +plugin.provider=Decebal Suiu +plugin.dependencies= diff --git a/demo_gradle/plugins/plugin2/src/main/java/ro/fortsoft/pf4j/demo/hello/HelloPlugin.java b/demo_gradle/plugins/plugin2/src/main/java/ro/fortsoft/pf4j/demo/hello/HelloPlugin.java new file mode 100644 index 0000000..7072e3d --- /dev/null +++ b/demo_gradle/plugins/plugin2/src/main/java/ro/fortsoft/pf4j/demo/hello/HelloPlugin.java @@ -0,0 +1,51 @@ +/* + * Copyright 2012 Decebal Suiu + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with + * the License. You may obtain a copy of the License in the LICENSE file, or at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package ro.fortsoft.pf4j.demo.hello; + +import ro.fortsoft.pf4j.Extension; +import ro.fortsoft.pf4j.Plugin; +import ro.fortsoft.pf4j.PluginWrapper; +import ro.fortsoft.pf4j.demo.api.Greeting; + +/** + * A very simple plugin. + * + * @author Decebal Suiu + */ +public class HelloPlugin extends Plugin { + + public HelloPlugin(PluginWrapper wrapper) { + super(wrapper); + } + + @Override + public void start() { + System.out.println("HelloPlugin.start()"); + } + + @Override + public void stop() { + System.out.println("HelloPlugin.stop()"); + } + + @Extension(ordinal=1) + public static class HelloGreeting implements Greeting { + + @Override + public String getGreeting() { + return "Hello"; + } + + } + +} diff --git a/demo_gradle/settings.gradle b/demo_gradle/settings.gradle new file mode 100644 index 0000000..01be4bd --- /dev/null +++ b/demo_gradle/settings.gradle @@ -0,0 +1,3 @@ +include 'api' +include 'app' +include 'plugins' \ No newline at end of file From 8ee33ea45548455f2f3242cd51779cb4f7d5839d Mon Sep 17 00:00:00 2001 From: Stix Date: Sun, 1 Mar 2015 17:50:25 +0100 Subject: [PATCH 2/3] minor fixes --- demo_gradle/.gitignore | 1 + demo_gradle/app/build.gradle | 4 +++ .../main/java/ro/fortsoft/pf4j/demo/Boot.java | 25 +++++++++++-------- .../pf4j/demo/welcome/WelcomePlugin.java | 12 +++------ demo_gradle/settings.gradle | 3 ++- 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/demo_gradle/.gitignore b/demo_gradle/.gitignore index 378eac2..91ea741 100644 --- a/demo_gradle/.gitignore +++ b/demo_gradle/.gitignore @@ -1 +1,2 @@ build +.gradle diff --git a/demo_gradle/app/build.gradle b/demo_gradle/app/build.gradle index 22145d8..7532967 100644 --- a/demo_gradle/app/build.gradle +++ b/demo_gradle/app/build.gradle @@ -1,3 +1,7 @@ +apply plugin:'application' + +mainClassName = 'ro.fortsoft.pf4j.demo.Boot' + dependencies { compile project(':api') compile 'ro.fortsoft.pf4j:pf4j:0.4' 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 2619531..503e7c0 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,7 +15,7 @@ package ro.fortsoft.pf4j.demo; import java.util.List; import java.util.Set; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import ro.fortsoft.pf4j.DefaultPluginManager; import ro.fortsoft.pf4j.PluginManager; @@ -45,6 +45,9 @@ public class Boot { // start (active/resolved) the plugins pluginManager.startPlugins(); + System.out.println("Plugindirectory: "); + System.out.println("\t" + System.getProperty("pf4j.pluginsDir", "plugins") + "\n"); + // retrieves the extensions for Greeting extension point List greetings = pluginManager.getExtensions(Greeting.class); System.out.println(String.format("Found %d extensions for extension point '%s'", greetings.size(), Greeting.class.getName())); @@ -52,22 +55,22 @@ public class Boot { System.out.println(">>> " + greeting.getGreeting()); } - // print extensions from classpath (non plugin) - System.out.println(String.format("Extensions added by classpath:")); - Set extensionClassNames = pluginManager.getExtensionClassNames(null); - for (String extension : extensionClassNames) { - System.out.println(" " + extension); - } + // // print extensions from classpath (non plugin) + // System.out.println(String.format("Extensions added by classpath:")); + // Set extensionClassNames = pluginManager.getExtensionClassNames(null); + // for (String extension : extensionClassNames) { + // System.out.println(" " + extension); + // } // print extensions for each started plugin List startedPlugins = pluginManager.getStartedPlugins(); for (PluginWrapper plugin : startedPlugins) { String pluginId = plugin.getDescriptor().getPluginId(); System.out.println(String.format("Extensions added by plugin '%s':", pluginId)); - extensionClassNames = pluginManager.getExtensionClassNames(pluginId); - for (String extension : extensionClassNames) { - System.out.println(" " + extension); - } + // extensionClassNames = pluginManager.getExtensionClassNames(pluginId); + // for (String extension : extensionClassNames) { + // System.out.println(" " + extension); + // } } // stop the plugins diff --git a/demo_gradle/plugins/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java b/demo_gradle/plugins/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java index 1c35259..824180c 100644 --- a/demo_gradle/plugins/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java +++ b/demo_gradle/plugins/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java @@ -1,23 +1,22 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ package ro.fortsoft.pf4j.demo.welcome; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import ro.fortsoft.pf4j.Extension; import ro.fortsoft.pf4j.Plugin; import ro.fortsoft.pf4j.PluginWrapper; -import ro.fortsoft.pf4j.RuntimeMode; import ro.fortsoft.pf4j.demo.api.Greeting; /** @@ -32,10 +31,7 @@ public class WelcomePlugin extends Plugin { @Override public void start() { System.out.println("WelcomePlugin.start()"); - // for testing the development mode - if (RuntimeMode.DEVELOPMENT.equals(wrapper.getRuntimeMode())) { System.out.println(StringUtils.upperCase("WelcomePlugin")); - } } @Override diff --git a/demo_gradle/settings.gradle b/demo_gradle/settings.gradle index 01be4bd..e76ea04 100644 --- a/demo_gradle/settings.gradle +++ b/demo_gradle/settings.gradle @@ -1,3 +1,4 @@ include 'api' include 'app' -include 'plugins' \ No newline at end of file +include 'plugins/plugin1' +include 'plugins/plugin2' \ No newline at end of file From d33c73a66c9d4eca2f0f07f24323e70785b58b3f Mon Sep 17 00:00:00 2001 From: Stix Date: Sun, 1 Mar 2015 17:59:53 +0100 Subject: [PATCH 3/3] unified plugin-provider with pluginproperties --- demo_gradle/plugins/plugin1/build.gradle | 2 +- demo_gradle/plugins/plugin2/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/demo_gradle/plugins/plugin1/build.gradle b/demo_gradle/plugins/plugin1/build.gradle index e5f574c..3655668 100644 --- a/demo_gradle/plugins/plugin1/build.gradle +++ b/demo_gradle/plugins/plugin1/build.gradle @@ -5,7 +5,7 @@ jar { attributes 'Plugin-Class' : 'ro.fortsoft.pf4j.demo.welcome.WelcomePlugin', 'Plugin-Id' : 'WelcomePlugin', 'Plugin-Version' : '1.0', - 'Plugin-Provider' : 'Yannick Bäumer' + 'Plugin-Provider' : 'Decebal Suiu' } } diff --git a/demo_gradle/plugins/plugin2/build.gradle b/demo_gradle/plugins/plugin2/build.gradle index 3c8c750..ee49c47 100644 --- a/demo_gradle/plugins/plugin2/build.gradle +++ b/demo_gradle/plugins/plugin2/build.gradle @@ -5,7 +5,7 @@ jar { attributes 'Plugin-Class' : 'ro.fortsoft.pf4j.demo.welcome.HelloPlugin', 'Plugin-Id' : 'HelloPlugin', 'Plugin-Version' : '1.0', - 'Plugin-Provider' : 'Yannick Bäumer' + 'Plugin-Provider' : 'Decebal Suiu' } }