aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demo_gradle/.gitignore1
-rw-r--r--demo_gradle/app/build.gradle4
-rw-r--r--demo_gradle/app/src/main/java/ro/fortsoft/pf4j/demo/Boot.java25
-rw-r--r--demo_gradle/plugins/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java12
-rw-r--r--demo_gradle/settings.gradle3
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<Greeting> 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<String> 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<String> extensionClassNames = pluginManager.getExtensionClassNames(null);
+ // for (String extension : extensionClassNames) {
+ // System.out.println(" " + 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));
- 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