aboutsummaryrefslogtreecommitdiffstats
path: root/demo/maven/plugins/plugin1
diff options
context:
space:
mode:
Diffstat (limited to 'demo/maven/plugins/plugin1')
-rw-r--r--demo/maven/plugins/plugin1/plugin.properties5
-rw-r--r--demo/maven/plugins/plugin1/pom.xml32
-rw-r--r--demo/maven/plugins/plugin1/src/main/java/org/pf4j/demo/welcome/WelcomePlugin.java58
3 files changed, 95 insertions, 0 deletions
diff --git a/demo/maven/plugins/plugin1/plugin.properties b/demo/maven/plugins/plugin1/plugin.properties
new file mode 100644
index 0000000..9da9bcc
--- /dev/null
+++ b/demo/maven/plugins/plugin1/plugin.properties
@@ -0,0 +1,5 @@
+plugin.id=welcome-plugin
+plugin.class=org.pf4j.demo.welcome.WelcomePlugin
+plugin.version=0.0.1
+plugin.provider=Decebal Suiu
+plugin.dependencies=
diff --git a/demo/maven/plugins/plugin1/pom.xml b/demo/maven/plugins/plugin1/pom.xml
new file mode 100644
index 0000000..5873fdd
--- /dev/null
+++ b/demo/maven/plugins/plugin1/pom.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <groupId>org.pf4j.demo</groupId>
+ <artifactId>pf4j-demo-plugins</artifactId>
+ <version>3.12.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>pf4j-demo-plugin1</artifactId>
+ <version>3.12.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Demo Plugin #1</name>
+
+ <properties>
+ <plugin.id>welcome-plugin</plugin.id>
+ <plugin.class>org.pf4j.demo.welcome.WelcomePlugin</plugin.class>
+ <plugin.version>0.0.1</plugin.version>
+ <plugin.provider>Decebal Suiu</plugin.provider>
+ <plugin.dependencies />
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/demo/maven/plugins/plugin1/src/main/java/org/pf4j/demo/welcome/WelcomePlugin.java b/demo/maven/plugins/plugin1/src/main/java/org/pf4j/demo/welcome/WelcomePlugin.java
new file mode 100644
index 0000000..3064902
--- /dev/null
+++ b/demo/maven/plugins/plugin1/src/main/java/org/pf4j/demo/welcome/WelcomePlugin.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012-present the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License 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 org.pf4j.demo.welcome;
+
+import org.apache.commons.lang.StringUtils;
+import org.pf4j.Extension;
+import org.pf4j.RuntimeMode;
+import org.pf4j.demo.api.DemoPlugin;
+import org.pf4j.demo.api.Greeting;
+import org.pf4j.demo.api.PluginContext;
+
+/**
+ * @author Decebal Suiu
+ */
+public class WelcomePlugin extends DemoPlugin {
+
+ public WelcomePlugin(PluginContext context) {
+ super(context);
+ }
+
+ @Override
+ public void start() {
+ log.info("WelcomePlugin.start()");
+ // for testing the development mode
+ if (RuntimeMode.DEVELOPMENT.equals(context.getRuntimeMode())) {
+ log.info(StringUtils.upperCase("WelcomePlugin"));
+ }
+ }
+
+ @Override
+ public void stop() {
+ log.info("WelcomePlugin.stop()");
+ }
+
+ @Extension
+ public static class WelcomeGreeting implements Greeting {
+
+ @Override
+ public String getGreeting() {
+ return "Welcome";
+ }
+
+ }
+
+}