aboutsummaryrefslogtreecommitdiffstats
path: root/demo_gradle/plugins
diff options
context:
space:
mode:
authorStix <stix@phcn.de>2015-03-01 17:24:43 +0100
committerStix <stix@phcn.de>2015-03-01 17:24:43 +0100
commit0b3ac7fa749e188abbbfd21a550183bfcbbcb8f3 (patch)
treec8a07bf4ef7957e50182e99d8d43fd721f8556cb /demo_gradle/plugins
parent07d115c456266ba5c0a83e393927e4264c2ff160 (diff)
downloadpf4j-0b3ac7fa749e188abbbfd21a550183bfcbbcb8f3.tar.gz
pf4j-0b3ac7fa749e188abbbfd21a550183bfcbbcb8f3.zip
added base files
Diffstat (limited to 'demo_gradle/plugins')
-rw-r--r--demo_gradle/plugins/disabled.txt6
-rw-r--r--demo_gradle/plugins/enabled.txt6
-rw-r--r--demo_gradle/plugins/plugin1/.gitignore1
-rw-r--r--demo_gradle/plugins/plugin1/build.gradle25
-rw-r--r--demo_gradle/plugins/plugin1/plugin.properties5
-rw-r--r--demo_gradle/plugins/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java56
-rw-r--r--demo_gradle/plugins/plugin2/.gitignore1
-rw-r--r--demo_gradle/plugins/plugin2/build.gradle25
-rw-r--r--demo_gradle/plugins/plugin2/plugin.properties5
-rw-r--r--demo_gradle/plugins/plugin2/src/main/java/ro/fortsoft/pf4j/demo/hello/HelloPlugin.java51
10 files changed, 181 insertions, 0 deletions
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";
+ }
+
+ }
+
+}