aboutsummaryrefslogtreecommitdiffstats
path: root/demo/plugins/plugin1
diff options
context:
space:
mode:
authorDecebal Suiu <decebal.suiu@gmail.com>2013-10-03 16:01:16 +0300
committerDecebal Suiu <decebal.suiu@gmail.com>2013-10-03 16:01:16 +0300
commit6df8db4c34abb0fbbeddda7cee39124a53c4cdf5 (patch)
tree955d991dc934ea369a1fa4fe939bf18da18e9831 /demo/plugins/plugin1
parentaab4e0129a722f98a70ca1b9ed1917befd31c9f0 (diff)
downloadpf4j-6df8db4c34abb0fbbeddda7cee39124a53c4cdf5.tar.gz
pf4j-6df8db4c34abb0fbbeddda7cee39124a53c4cdf5.zip
add RuntimeMode with DEVELOPMENT and DEPLOYMENT values and working on DEVELOPMENT mode
Diffstat (limited to 'demo/plugins/plugin1')
-rw-r--r--demo/plugins/plugin1/pom.xml254
-rw-r--r--demo/plugins/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java10
2 files changed, 133 insertions, 131 deletions
diff --git a/demo/plugins/plugin1/pom.xml b/demo/plugins/plugin1/pom.xml
index 8fe5f7b..bf8abe5 100644
--- a/demo/plugins/plugin1/pom.xml
+++ b/demo/plugins/plugin1/pom.xml
@@ -1,131 +1,123 @@
-<?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>ro.fortsoft.pf4j.demo</groupId>
- <artifactId>pf4j-demo-plugins</artifactId>
- <version>0.6-SNAPSHOT</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>pf4j-demo-plugin1</artifactId>
- <version>0.6-SNAPSHOT</version>
- <packaging>jar</packaging>
- <name>Demo Plugin #1</name>
-
- <properties>
- <plugin.id>welcome-plugin</plugin.id>
- <plugin.class>ro.fortsoft.pf4j.demo.welcome.WelcomePlugin</plugin.class>
- <plugin.version>0.0.1</plugin.version>
- <plugin.provider>Decebal Suiu</plugin.provider>
- <plugin.dependencies />
- </properties>
-
- <build>
- <plugins>
- <!-- DOESN'T WORK WITH MAVEN 3 (I defined the plugin metadata in properties section)
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>properties-maven-plugin</artifactId>
- <version>1.0-alpha-2</version>
- <executions>
- <execution>
- <phase>initialize</phase>
- <goals>
- <goal>read-project-properties</goal>
- </goals>
- <configuration>
- <files>
- <file>plugin.properties</file>
- </files>
- </configuration>
- </execution>
- </executions>
- </plugin>
- -->
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.6</version>
- <executions>
- <execution>
- <id>unzip jar file</id>
- <phase>package</phase>
- <configuration>
- <target>
- <unzip src="target/${artifactId}-${version}.${packaging}" dest="target/plugin-classes" />
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.3</version>
- <configuration>
- <descriptors>
- <descriptor>
- src/main/assembly/assembly.xml
- </descriptor>
- </descriptors>
- <appendAssemblyId>false</appendAssemblyId>
- </configuration>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.4</version>
- <configuration>
- <archive>
- <manifestEntries>
- <Plugin-Id>${plugin.id}</Plugin-Id>
- <Plugin-Class>${plugin.class}</Plugin-Class>
- <Plugin-Version>${plugin.version}</Plugin-Version>
- <Plugin-Provider>${plugin.provider}</Plugin-Provider>
- <Plugin-Dependencies>${plugin.dependencies}</Plugin-Dependencies>
- </manifestEntries>
- </archive>
- </configuration>
- </plugin>
-
- <plugin>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>ro.fortsoft.pf4j</groupId>
- <artifactId>pf4j</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>ro.fortsoft.pf4j.demo</groupId>
- <artifactId>pf4j-demo-api</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
-</project>
+<?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>ro.fortsoft.pf4j.demo</groupId>
+ <artifactId>pf4j-demo-plugins</artifactId>
+ <version>0.6-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>pf4j-demo-plugin1</artifactId>
+ <version>0.6-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Demo Plugin #1</name>
+
+ <properties>
+ <plugin.id>welcome-plugin</plugin.id>
+ <plugin.class>ro.fortsoft.pf4j.demo.welcome.WelcomePlugin</plugin.class>
+ <plugin.version>0.0.1</plugin.version>
+ <plugin.provider>Decebal Suiu</plugin.provider>
+ <plugin.dependencies />
+ </properties>
+
+ <build>
+ <plugins>
+ <!-- DOESN'T WORK WITH MAVEN 3 (I defined the plugin metadata in properties section)
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>properties-maven-plugin</artifactId>
+ <version>1.0-alpha-2</version>
+ <executions>
+ <execution>
+ <phase>initialize</phase>
+ <goals>
+ <goal>read-project-properties</goal>
+ </goals>
+ <configuration>
+ <files>
+ <file>plugin.properties</file>
+ </files>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ -->
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.6</version>
+ <executions>
+ <execution>
+ <id>unzip jar file</id>
+ <phase>package</phase>
+ <configuration>
+ <target>
+ <unzip src="target/${artifactId}-${version}.${packaging}" dest="target/plugin-classes" />
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <descriptors>
+ <descriptor>
+ src/main/assembly/assembly.xml
+ </descriptor>
+ </descriptors>
+ <appendAssemblyId>false</appendAssemblyId>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Plugin-Id>${plugin.id}</Plugin-Id>
+ <Plugin-Class>${plugin.class}</Plugin-Class>
+ <Plugin-Version>${plugin.version}</Plugin-Version>
+ <Plugin-Provider>${plugin.provider}</Plugin-Provider>
+ <Plugin-Dependencies>${plugin.dependencies}</Plugin-Dependencies>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/demo/plugins/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java b/demo/plugins/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java
index d10d3dd..1c35259 100644
--- a/demo/plugins/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java
+++ b/demo/plugins/plugin1/src/main/java/ro/fortsoft/pf4j/demo/welcome/WelcomePlugin.java
@@ -12,9 +12,12 @@
*/
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;
/**
@@ -26,10 +29,16 @@ public class WelcomePlugin extends Plugin {
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()");
}
@@ -37,6 +46,7 @@ public class WelcomePlugin extends Plugin {
@Extension
public static class WelcomeGreeting implements Greeting {
+ @Override
public String getGreeting() {
return "Welcome";
}