diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..3f8870e
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.project b/.project
new file mode 100644
index 0000000..0017adc
--- /dev/null
+++ b/.project
@@ -0,0 +1,42 @@
+
+
+ ws-task-executor-widget-TRUNK
+
+
+
+
+
+ org.eclipse.wst.jsdt.core.javascriptValidator
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.wst.common.project.facet.core.builder
+
+
+
+
+ org.eclipse.wst.validation.validationbuilder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+
+ org.eclipse.jem.workbench.JavaEMFNature
+ org.eclipse.wst.common.modulecore.ModuleCoreNature
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+ org.eclipse.wst.common.project.facet.core.nature
+ org.eclipse.wst.jsdt.core.jsNature
+
+
diff --git a/.settings/.jsdtscope b/.settings/.jsdtscope
new file mode 100644
index 0000000..b72a6a4
--- /dev/null
+++ b/.settings/.jsdtscope
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..160c7b8
--- /dev/null
+++ b/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/main/resources=UTF-8
+encoding//src/test/java=UTF-8
+encoding//src/test/resources=UTF-8
+encoding//target/generated-sources/gwt=UTF-8
+encoding/=UTF-8
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..6e80039
--- /dev/null
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
new file mode 100644
index 0000000..fd49b1a
--- /dev/null
+++ b/.settings/org.eclipse.wst.common.component
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100644
index 0000000..9f23f94
--- /dev/null
+++ b/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.container b/.settings/org.eclipse.wst.jsdt.ui.superType.container
new file mode 100644
index 0000000..3bd5d0a
--- /dev/null
+++ b/.settings/org.eclipse.wst.jsdt.ui.superType.container
@@ -0,0 +1 @@
+org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.name b/.settings/org.eclipse.wst.jsdt.ui.superType.name
new file mode 100644
index 0000000..05bd71b
--- /dev/null
+++ b/.settings/org.eclipse.wst.jsdt.ui.superType.name
@@ -0,0 +1 @@
+Window
\ No newline at end of file
diff --git a/.settings/org.eclipse.wst.validation.prefs b/.settings/org.eclipse.wst.validation.prefs
new file mode 100644
index 0000000..04cad8c
--- /dev/null
+++ b/.settings/org.eclipse.wst.validation.prefs
@@ -0,0 +1,2 @@
+disabled=06target
+eclipse.preferences.version=1
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..f7fbfcd
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,232 @@
+
+
+ 4.0.0
+
+ maven-parent
+ org.gcube.tools
+ 1.0.0
+
+
+
+ org.gcube.portlets.widgets
+ ws-task-executor-widget
+ jar
+ 1.0.0-SNAPSHOT
+
+ The workspace-task-executor-widget is a widget to execute data miner's algorithms from gCube Workspace
+
+
+
+
+ scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/${project.artifactId}
+ scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/${project.artifactId}
+ http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/${project.artifactId}
+
+
+
+
+ 2.7.0
+ distro
+
+ 1.8
+ 1.8
+
+
+ UTF-8
+ UTF-8
+
+
+
+
+
+ org.gcube.distribution
+ maven-portal-bom
+ LATEST
+ pom
+ import
+
+
+
+
+
+
+ com.google.gwt
+ gwt-user
+ ${gwtVersion}
+ provided
+
+
+ com.github.gwtbootstrap
+ gwt-bootstrap
+
+
+
+
+ org.gcube.common.portal
+ portal-manager
+ provided
+
+
+
+ com.liferay.portal
+ portal-service
+ provided
+
+
+
+
+ org.gcube.dvos
+ usermanagement-core
+ provided
+
+
+
+ org.gcube.common
+ workspace-task-executor-library
+ [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)
+
+
+
+
+
+
+
+
+
+
+ org.gcube.common
+ authorization-client
+ [2.0.0-SNAPSHOT, 3-0-0-SNAPSHOT)
+
+
+
+
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+ org.slf4j
+ slf4j-api
+
+
+
+ junit
+ junit
+ 4.11
+ test
+
+
+
+
+
+
+ src/main/java
+
+ **/*.*
+
+
+
+
+
+ maven-compiler-plugin
+
+
+ ${maven.compiler.target}
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.2
+
+
+
+ test-jar
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.12
+
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+ 2.5
+
+
+ copy-profile
+ install
+
+ copy-resources
+
+
+ target
+
+
+ ${distroDirectory}
+ true
+
+ profile.xml
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+ 2.2
+
+
+ ${distroDirectory}/descriptor.xml
+
+
+
+ fully.qualified.MainClass
+
+
+
+
+
+ servicearchive
+ install
+
+ single
+
+
+
+
+
+
+
+ org.codehaus.mojo
+ gwt-maven-plugin
+ ${gwtVersion}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/WsTaskExecutorWidget.gwt.xml b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/WsTaskExecutorWidget.gwt.xml
new file mode 100644
index 0000000..edabe4a
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/WsTaskExecutorWidget.gwt.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/GreetingService.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/GreetingService.java
new file mode 100644
index 0000000..b1e07be
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/GreetingService.java
@@ -0,0 +1,12 @@
+package org.gcube.portlets.widgets.wstaskexecutor.client;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
+
+/**
+ * The client side stub for the RPC service.
+ */
+@RemoteServiceRelativePath("greet")
+public interface GreetingService extends RemoteService {
+ String greetServer(String name) throws IllegalArgumentException;
+}
diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/GreetingServiceAsync.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/GreetingServiceAsync.java
new file mode 100644
index 0000000..6c77709
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/GreetingServiceAsync.java
@@ -0,0 +1,50 @@
+/**
+ *
+ */
+package org.gcube.portlets.widgets.wstaskexecutor.client;
+
+import com.google.gwt.core.client.GWT;
+
+
+/**
+ * The Interface GreetingServiceAsync.
+ *
+ * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
+ * May 4, 2018
+ */
+public interface GreetingServiceAsync {
+
+
+ /**
+ * The Class Util.
+ *
+ * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
+ * May 4, 2018
+ */
+ public static final class Util
+ {
+ private static GreetingServiceAsync instance;
+
+ /**
+ * Gets the single instance of Util.
+ *
+ * @return single instance of Util
+ */
+ public static final GreetingServiceAsync getInstance()
+ {
+ if ( instance == null )
+ {
+ instance = (GreetingServiceAsync) GWT.create( GreetingService.class );
+ }
+ return instance;
+ }
+
+ /**
+ * Instantiates a new util.
+ */
+ private Util()
+ {
+ // Utility class should not be instantiated
+ }
+ }
+}
diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/WsTaskExecutorWidget.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/WsTaskExecutorWidget.java
new file mode 100644
index 0000000..0056e79
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/WsTaskExecutorWidget.java
@@ -0,0 +1,28 @@
+package org.gcube.portlets.widgets.wstaskexecutor.client;
+
+import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.core.client.GWT;
+
+/**
+ * Entry point classes define onModuleLoad().
+ */
+public class WsTaskExecutorWidget implements EntryPoint {
+ /**
+ * The message displayed to the user when the server cannot be reached or
+ * returns an error.
+ */
+ private static final String SERVER_ERROR = "An error occurred while "
+ + "attempting to contact the server. Please check your network "
+ + "connection and try again.";
+
+ /**
+ * Create a remote service proxy to talk to the server-side Greeting service.
+ */
+ private final GreetingServiceAsync greetingService = GWT.create(GreetingService.class);
+
+ /**
+ * This is the entry point method.
+ */
+ public void onModuleLoad() {
+ }
+}
diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/server/GreetingServiceImpl.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/server/GreetingServiceImpl.java
new file mode 100644
index 0000000..c973901
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/server/GreetingServiceImpl.java
@@ -0,0 +1,48 @@
+package org.gcube.portlets.widgets.wstaskexecutor.server;
+
+import org.gcube.portlets.widgets.wstaskexecutor.client.GreetingService;
+import org.gcube.portlets.widgets.wstaskexecutor.shared.FieldVerifier;
+import com.google.gwt.user.server.rpc.RemoteServiceServlet;
+
+/**
+ * The server side implementation of the RPC service.
+ */
+@SuppressWarnings("serial")
+public class GreetingServiceImpl extends RemoteServiceServlet implements
+ GreetingService {
+
+ public String greetServer(String input) throws IllegalArgumentException {
+ // Verify that the input is valid.
+ if (!FieldVerifier.isValidName(input)) {
+ // If the input is not valid, throw an IllegalArgumentException back to
+ // the client.
+ throw new IllegalArgumentException(
+ "Name must be at least 4 characters long");
+ }
+
+ String serverInfo = getServletContext().getServerInfo();
+ String userAgent = getThreadLocalRequest().getHeader("User-Agent");
+
+ // Escape data from the client to avoid cross-site script vulnerabilities.
+ input = escapeHtml(input);
+ userAgent = escapeHtml(userAgent);
+
+ return "Hello, " + input + "!
I am running " + serverInfo
+ + ".
It looks like you are using: " + userAgent;
+ }
+
+ /**
+ * Escape an html string. Escaping data received from the client helps to
+ * prevent cross-site script vulnerabilities.
+ *
+ * @param html the html string to escape
+ * @return the escaped string
+ */
+ private String escapeHtml(String html) {
+ if (html == null) {
+ return null;
+ }
+ return html.replaceAll("&", "&").replaceAll("<", "<").replaceAll(
+ ">", ">");
+ }
+}
diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/shared/FieldVerifier.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/shared/FieldVerifier.java
new file mode 100644
index 0000000..3a27bbf
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/shared/FieldVerifier.java
@@ -0,0 +1,42 @@
+package org.gcube.portlets.widgets.wstaskexecutor.shared;
+
+/**
+ *
+ * FieldVerifier validates that the name the user enters is valid.
+ *
+ *
+ * This class is in the shared packing because we use it in both
+ * the client code and on the server. On the client, we verify that the name is
+ * valid before sending an RPC request so the user doesn't have to wait for a
+ * network round trip to get feedback. On the server, we verify that the name is
+ * correct to ensure that the input is correct regardless of where the RPC
+ * originates.
+ *
+ *
+ * When creating a class that is used on both the client and the server, be sure
+ * that all code is translatable and does not use native JavaScript. Code that
+ * is note translatable (such as code that interacts with a database or the file
+ * system) cannot be compiled into client side JavaScript. Code that uses native
+ * JavaScript (such as Widgets) cannot be run on the server.
+ *
+ */
+public class FieldVerifier {
+
+ /**
+ * Verifies that the specified name is valid for our service.
+ *
+ * In this example, we only require that the name is at least four
+ * characters. In your application, you can use more complex checks to ensure
+ * that usernames, passwords, email addresses, URLs, and other fields have the
+ * proper syntax.
+ *
+ * @param name the name to validate
+ * @return true if valid, false if invalid
+ */
+ public static boolean isValidName(String name) {
+ if (name == null) {
+ return false;
+ }
+ return name.length() > 3;
+ }
+}
diff --git a/src/main/resources/org/gcube/portlets/widgets/wstaskexecutor/WsTaskExecutorWidget.gwt.xml b/src/main/resources/org/gcube/portlets/widgets/wstaskexecutor/WsTaskExecutorWidget.gwt.xml
new file mode 100644
index 0000000..edabe4a
--- /dev/null
+++ b/src/main/resources/org/gcube/portlets/widgets/wstaskexecutor/WsTaskExecutorWidget.gwt.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..5318ca9
--- /dev/null
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+ greetServlet
+ org.gcube.portlets.widgets.wstaskexecutor.server.GreetingServiceImpl
+
+
+
+ greetServlet
+ /WsTaskExecutorWidget/greet
+
+
+
+
+ WsTaskExecutorWidget.html
+
+
+
diff --git a/src/main/webapp/WsTaskExecutorWidget.css b/src/main/webapp/WsTaskExecutorWidget.css
new file mode 100644
index 0000000..7aca7ac
--- /dev/null
+++ b/src/main/webapp/WsTaskExecutorWidget.css
@@ -0,0 +1,34 @@
+/** Add css rules here for your application. */
+
+
+/** Example rules used by the template application (remove for your app) */
+h1 {
+ font-size: 2em;
+ font-weight: bold;
+ color: #777777;
+ margin: 40px 0px 70px;
+ text-align: center;
+}
+
+.sendButton {
+ display: block;
+ font-size: 16pt;
+}
+
+/** Most GWT widgets already have a style name defined */
+.gwt-DialogBox {
+ width: 400px;
+}
+
+.dialogVPanel {
+ margin: 5px;
+}
+
+.serverResponseLabelError {
+ color: red;
+}
+
+/** Set ids using widget.getElement().setId("idOfElement") */
+#closeButton {
+ margin: 15px 6px 6px;
+}
diff --git a/src/main/webapp/WsTaskExecutorWidget.html b/src/main/webapp/WsTaskExecutorWidget.html
new file mode 100644
index 0000000..a521201
--- /dev/null
+++ b/src/main/webapp/WsTaskExecutorWidget.html
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Web Application Starter Project
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+