From 26bb859e9ec3d0fb5c8d6f5c9fae6c7da7c12d83 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Wed, 30 Sep 2020 11:20:53 +0200 Subject: [PATCH] Removed PluginDeclaration class according to the new APis version --- .../extra-resources/WEB-INF/plugin.properties | 4 + .settings/.gitignore | 1 + pom.xml | 12 +++ .../helloworld/HelloWorldPlugin.java | 13 ++- .../HelloWorldPluginDeclaration.java | 84 ------------------- 5 files changed, 26 insertions(+), 88 deletions(-) create mode 100644 gcube/extra-resources/WEB-INF/plugin.properties delete mode 100644 src/main/java/org/gcube/vremanagement/helloworld/HelloWorldPluginDeclaration.java diff --git a/ gcube/extra-resources/WEB-INF/plugin.properties b/ gcube/extra-resources/WEB-INF/plugin.properties new file mode 100644 index 0000000..27b1aba --- /dev/null +++ b/ gcube/extra-resources/WEB-INF/plugin.properties @@ -0,0 +1,4 @@ +groupId=${groupId} +artifactId=${artifactId} +version=${version} +description=${description} \ No newline at end of file diff --git a/.settings/.gitignore b/.settings/.gitignore index 57d3934..f80ee1c 100644 --- a/.settings/.gitignore +++ b/.settings/.gitignore @@ -1,2 +1,3 @@ /org.eclipse.jdt.core.prefs /org.eclipse.core.resources.prefs +/org.eclipse.m2e.core.prefs diff --git a/pom.xml b/pom.xml index 7449bd2..5e6fe3d 100644 --- a/pom.xml +++ b/pom.xml @@ -45,6 +45,18 @@ org.slf4j slf4j-api + + + junit + junit + 4.11 + test + + + ch.qos.logback + logback-classic + test + diff --git a/src/main/java/org/gcube/vremanagement/helloworld/HelloWorldPlugin.java b/src/main/java/org/gcube/vremanagement/helloworld/HelloWorldPlugin.java index b5b1574..53a2e22 100644 --- a/src/main/java/org/gcube/vremanagement/helloworld/HelloWorldPlugin.java +++ b/src/main/java/org/gcube/vremanagement/helloworld/HelloWorldPlugin.java @@ -11,7 +11,7 @@ import org.slf4j.LoggerFactory; /** * @author Luca Frosini (ISTI - CNR) */ -public class HelloWorldPlugin extends Plugin { +public class HelloWorldPlugin extends Plugin { /** * Logger @@ -20,9 +20,9 @@ public class HelloWorldPlugin extends Plugin { public static final String SLEEP_TIME = "sleepTime"; - public HelloWorldPlugin(HelloWorldPluginDeclaration pluginDeclaration) { - super(pluginDeclaration); - logger.debug("contructor"); + public HelloWorldPlugin() { + super(); + logger.debug("{} contructor", this.getClass().getSimpleName()); } /**{@inheritDoc}*/ @@ -66,5 +66,10 @@ public class HelloWorldPlugin extends Plugin { logger.debug("onStop()"); Thread.currentThread().interrupt(); } + + public Map getSupportedCapabilities() { + logger.debug("getSupportedCapabilities() {}", HelloWorldPlugin.class.getSimpleName()); + return null; + } } diff --git a/src/main/java/org/gcube/vremanagement/helloworld/HelloWorldPluginDeclaration.java b/src/main/java/org/gcube/vremanagement/helloworld/HelloWorldPluginDeclaration.java deleted file mode 100644 index f9280a8..0000000 --- a/src/main/java/org/gcube/vremanagement/helloworld/HelloWorldPluginDeclaration.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * - */ -package org.gcube.vremanagement.helloworld; - -import java.util.HashMap; -import java.util.Map; - -import org.gcube.vremanagement.executor.plugin.Plugin; -import org.gcube.vremanagement.executor.plugin.PluginDeclaration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author Luca Frosini (ISTI - CNR) - */ -public class HelloWorldPluginDeclaration implements PluginDeclaration { - /** - * Logger - */ - private static Logger logger = LoggerFactory.getLogger(HelloWorldPlugin.class); - - /** - * Plugin name used by the Executor to retrieve this class - */ - public static final String NAME = "HelloWorld"; - - public static final String DESCRIPTION = "Hello World Smart Executor Plugin"; - - public static final String VERSION = "1.0.0"; - - /**{@inheritDoc}*/ - @Override - public void init() { - logger.debug(String.format("%s initialized", HelloWorldPlugin.class.getSimpleName())); - } - - /**{@inheritDoc}*/ - @Override - public String getName() { - return NAME; - } - - /**{@inheritDoc}*/ - @Override - public String getDescription() { - return DESCRIPTION; - } - - /**{@inheritDoc}*/ - @Override - public String getVersion() { - return VERSION; - } - - /**{@inheritDoc}*/ - @Override - public Map getSupportedCapabilities() { - Map discoveredCapabilities = new HashMap(); - discoveredCapabilities.put("HelloKey", "HelloValue"); - return discoveredCapabilities; - } - - /**{@inheritDoc}*/ - @Override - public Class> getPluginImplementation() { - return HelloWorldPlugin.class; - } - - @Override - public String toString(){ - return String.format("{" - + "name:%s," - + "version:%s," - + "description:%s," - + "pluginImplementation:%s," - + "}", - getName(), - getVersion(), - getDescription(), - getPluginImplementation().getClass().getSimpleName()); - } - -}