Version 2.0.0
This commit is contained in:
parent
519fa9d69f
commit
fda62b6576
|
@ -27,7 +27,7 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
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/<project>=UTF-8
|
|
@ -0,0 +1,5 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.8
|
93
pom.xml
93
pom.xml
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.vremanagement</groupId>
|
<groupId>org.gcube.vremanagement</groupId>
|
||||||
<artifactId>smart-executor</artifactId>
|
<artifactId>smart-executor</artifactId>
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
<version>2.0.0</version>
|
||||||
<name>SmartExecutor</name>
|
<name>SmartExecutor</name>
|
||||||
<description>Smart Executor Service</description>
|
<description>Smart Executor Service</description>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
|
@ -22,7 +22,12 @@
|
||||||
<distroDirectory>${project.basedir}/distro</distroDirectory>
|
<distroDirectory>${project.basedir}/distro</distroDirectory>
|
||||||
<serviceClass>VREManagement</serviceClass>
|
<serviceClass>VREManagement</serviceClass>
|
||||||
<wiki>https://wiki.gcube-system.org/gcube/SmartExecutor</wiki>
|
<wiki>https://wiki.gcube-system.org/gcube/SmartExecutor</wiki>
|
||||||
<jackson.version>2.2.3</jackson.version>
|
<orientdb.version>3.0.15</orientdb.version>
|
||||||
|
<!-- OrientDB version has impact on jackson and thinkerpop version.
|
||||||
|
When OrientDB version is changed jackson and thinkerpop version
|
||||||
|
must be coherent with the one declared by orientdb -->
|
||||||
|
<jackson.version>2.6.0</jackson.version>
|
||||||
|
<thinkerpop.version>2.6.0</thinkerpop.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
|
@ -33,24 +38,10 @@
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.distribution</groupId>
|
|
||||||
<artifactId>gcube-bom</artifactId>
|
|
||||||
<version>LATEST</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.distribution</groupId>
|
<groupId>org.gcube.distribution</groupId>
|
||||||
<artifactId>gcube-smartgears-bom</artifactId>
|
<artifactId>gcube-smartgears-bom</artifactId>
|
||||||
<version>LATEST</version>
|
<version>1.1.0</version>
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.information-system</groupId>
|
|
||||||
<artifactId>information-system-bom</artifactId>
|
|
||||||
<version>LATEST</version>
|
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -62,84 +53,42 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.resources.discovery</groupId>
|
<groupId>org.gcube.resources.discovery</groupId>
|
||||||
<artifactId>ic-client</artifactId>
|
<artifactId>ic-client</artifactId>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.resources.discovery</groupId>
|
<groupId>org.gcube.resources.discovery</groupId>
|
||||||
<artifactId>discovery-client</artifactId>
|
<artifactId>discovery-client</artifactId>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.core</groupId>
|
|
||||||
<artifactId>common-scope</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.core</groupId>
|
<groupId>org.gcube.core</groupId>
|
||||||
<artifactId>common-smartgears</artifactId>
|
<artifactId>common-smartgears</artifactId>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.core</groupId>
|
<groupId>org.gcube.core</groupId>
|
||||||
<artifactId>common-encryption</artifactId>
|
<artifactId>common-encryption</artifactId>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.resources</groupId>
|
<groupId>org.gcube.core</groupId>
|
||||||
<artifactId>common-gcore-resources</artifactId>
|
<artifactId>common-smartgears-app</artifactId>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.common</groupId>
|
<groupId>com.orientechnologies</groupId>
|
||||||
<artifactId>authorization-client</artifactId>
|
<artifactId>orientdb-client</artifactId>
|
||||||
<scope>provided</scope>
|
<version>${orientdb.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.common</groupId>
|
<groupId>org.gcube.vremanagement</groupId>
|
||||||
<artifactId>common-authorization</artifactId>
|
<artifactId>smart-executor-api</artifactId>
|
||||||
<scope>provided</scope>
|
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.vremanagement</groupId>
|
<groupId>org.gcube.vremanagement</groupId>
|
||||||
<artifactId>smart-executor-client</artifactId>
|
<artifactId>smart-executor-client</artifactId>
|
||||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-databind</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-annotations</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-core</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.core</groupId>
|
|
||||||
<artifactId>common-generic-clients</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.core</groupId>
|
|
||||||
<artifactId>common-smartgears-app</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.orientechnologies</groupId>
|
|
||||||
<artifactId>orientdb-client</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.vremanagement</groupId>
|
|
||||||
<artifactId>smart-executor-api</artifactId>
|
|
||||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Jersey -->
|
<!-- Jersey -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -161,7 +110,6 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
@ -209,7 +157,6 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
<version>2.6</version>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<warName>${artifactId}</warName>
|
<warName>${artifactId}</warName>
|
||||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
|
|
@ -66,6 +66,7 @@ public class OrientDBPersistenceConnector extends SmartExecutorPersistenceConnec
|
||||||
oDatabasePool.close();
|
oDatabasePool.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PluginStateEvolution getPluginInstanceState(UUID uuid, Integer iterationNumber)
|
public PluginStateEvolution getPluginInstanceState(UUID uuid, Integer iterationNumber)
|
||||||
throws PluginInstanceNotFoundException, ExecutorException {
|
throws PluginInstanceNotFoundException, ExecutorException {
|
||||||
ODatabaseSession oDatabaseSession = null;
|
ODatabaseSession oDatabaseSession = null;
|
||||||
|
@ -121,7 +122,7 @@ public class OrientDBPersistenceConnector extends SmartExecutorPersistenceConnec
|
||||||
|
|
||||||
return pluginStateEvolution;
|
return pluginStateEvolution;
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
throw new PluginInstanceNotFoundException();
|
throw new PluginInstanceNotFoundException(uuid);
|
||||||
} finally {
|
} finally {
|
||||||
if(oDatabaseSession != null) {
|
if(oDatabaseSession != null) {
|
||||||
oDatabaseSession.close();
|
oDatabaseSession.close();
|
||||||
|
|
|
@ -7,6 +7,11 @@ import javax.ws.rs.core.Response.Status;
|
||||||
import javax.ws.rs.ext.ExceptionMapper;
|
import javax.ws.rs.ext.ExceptionMapper;
|
||||||
import javax.ws.rs.ext.Provider;
|
import javax.ws.rs.ext.Provider;
|
||||||
|
|
||||||
|
import org.gcube.vremanagement.executor.exception.InputsNullException;
|
||||||
|
import org.gcube.vremanagement.executor.exception.InvalidInputsException;
|
||||||
|
import org.gcube.vremanagement.executor.exception.PluginInstanceNotFoundException;
|
||||||
|
import org.gcube.vremanagement.executor.exception.PluginNotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
*/
|
*/
|
||||||
|
@ -20,12 +25,21 @@ public class ExecutorExceptionMapper implements ExceptionMapper<Exception> {
|
||||||
String exceptionMessage = exception.getMessage();
|
String exceptionMessage = exception.getMessage();
|
||||||
MediaType mediaType = MediaType.TEXT_PLAIN_TYPE;
|
MediaType mediaType = MediaType.TEXT_PLAIN_TYPE;
|
||||||
|
|
||||||
|
Class<? extends Exception> clz = exception.getClass();
|
||||||
|
|
||||||
if(WebApplicationException.class.isAssignableFrom(exception.getClass())) {
|
if(WebApplicationException.class.isAssignableFrom(clz)) {
|
||||||
Response gotResponse = ((WebApplicationException) exception).getResponse();
|
Response gotResponse = ((WebApplicationException) exception).getResponse();
|
||||||
status = Status.fromStatusCode(gotResponse.getStatusInfo().getStatusCode());
|
status = Status.fromStatusCode(gotResponse.getStatusInfo().getStatusCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(PluginInstanceNotFoundException.class.isAssignableFrom(clz)|| PluginNotFoundException.class.isAssignableFrom(clz)) {
|
||||||
|
status = Status.NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(InputsNullException.class.isAssignableFrom(clz) || InvalidInputsException.class.isAssignableFrom(clz)) {
|
||||||
|
status = Status.BAD_REQUEST;
|
||||||
|
}
|
||||||
|
|
||||||
return Response.status(status).entity(exceptionMessage).type(mediaType).build();
|
return Response.status(status).entity(exceptionMessage).type(mediaType).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ import java.util.UUID;
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.DELETE;
|
import javax.ws.rs.DELETE;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.HttpMethod;
|
|
||||||
import javax.ws.rs.POST;
|
import javax.ws.rs.POST;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.PathParam;
|
import javax.ws.rs.PathParam;
|
||||||
|
@ -16,14 +15,15 @@ import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.QueryParam;
|
import javax.ws.rs.QueryParam;
|
||||||
import javax.ws.rs.core.Context;
|
import javax.ws.rs.core.Context;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.Response.ResponseBuilder;
|
import javax.ws.rs.core.Response.ResponseBuilder;
|
||||||
|
import javax.ws.rs.core.Response.Status;
|
||||||
import javax.ws.rs.core.UriInfo;
|
import javax.ws.rs.core.UriInfo;
|
||||||
|
|
||||||
import org.gcube.common.authorization.library.provider.CalledMethodProvider;
|
import org.gcube.common.authorization.library.provider.CalledMethodProvider;
|
||||||
import org.gcube.vremanagement.executor.ResourceInitializer;
|
import org.gcube.vremanagement.executor.ResourceInitializer;
|
||||||
import org.gcube.vremanagement.executor.annotation.PURGE;
|
import org.gcube.vremanagement.executor.annotation.PURGE;
|
||||||
import org.gcube.vremanagement.executor.api.rest.RestConstants;
|
import org.gcube.vremanagement.executor.api.rest.RestConstants;
|
||||||
import org.gcube.vremanagement.executor.api.rest.SmartExecutor;
|
|
||||||
import org.gcube.vremanagement.executor.api.types.LaunchParameter;
|
import org.gcube.vremanagement.executor.api.types.LaunchParameter;
|
||||||
import org.gcube.vremanagement.executor.exception.ExecutorException;
|
import org.gcube.vremanagement.executor.exception.ExecutorException;
|
||||||
import org.gcube.vremanagement.executor.exception.InputsNullException;
|
import org.gcube.vremanagement.executor.exception.InputsNullException;
|
||||||
|
@ -47,7 +47,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
|
||||||
@Path(RestConstants.PLUGINS_PATH_PART)
|
@Path(RestConstants.PLUGINS_PATH_PART)
|
||||||
public class RestSmartExecutor implements SmartExecutor {
|
public class RestSmartExecutor {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(RestSmartExecutor.class);
|
private static Logger logger = LoggerFactory.getLogger(RestSmartExecutor.class);
|
||||||
|
|
||||||
|
@ -73,9 +73,9 @@ public class RestSmartExecutor implements SmartExecutor {
|
||||||
@GET
|
@GET
|
||||||
@Path("")
|
@Path("")
|
||||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||||
@Override
|
|
||||||
public String getAvailablePlugins() throws ExecutorException {
|
public String getAvailablePlugins() throws ExecutorException {
|
||||||
setCalledMethod(HttpMethod.GET + " /" + RestConstants.PLUGINS_PATH_PART);
|
//setCalledMethod(HttpMethod.GET + " /" + RestConstants.PLUGINS_PATH_PART);
|
||||||
|
setCalledMethod("getAvailablePlugins");
|
||||||
try {
|
try {
|
||||||
PluginManager pluginManager = PluginManager.getInstance();
|
PluginManager pluginManager = PluginManager.getInstance();
|
||||||
Map<String, PluginDeclaration> availablePlugins = pluginManager.getAvailablePlugins();
|
Map<String, PluginDeclaration> availablePlugins = pluginManager.getAvailablePlugins();
|
||||||
|
@ -89,17 +89,16 @@ public class RestSmartExecutor implements SmartExecutor {
|
||||||
@GET
|
@GET
|
||||||
@Path("/{" + PLUGIN_NAME_PATH_PARAM + "}/" + RestConstants.EXECUTIONS_PATH_PART)
|
@Path("/{" + PLUGIN_NAME_PATH_PARAM + "}/" + RestConstants.EXECUTIONS_PATH_PART)
|
||||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||||
@Override
|
|
||||||
public String getScheduled(@PathParam(PLUGIN_NAME_PATH_PARAM) String pluginName) throws ExecutorException {
|
public String getScheduled(@PathParam(PLUGIN_NAME_PATH_PARAM) String pluginName) throws ExecutorException {
|
||||||
setCalledMethod(HttpMethod.GET + " /" + RestConstants.PLUGINS_PATH_PART + "/"
|
// setCalledMethod(HttpMethod.GET + " /" + RestConstants.PLUGINS_PATH_PART + "/" + pluginName + "/" + RestConstants.EXECUTIONS_PATH_PART);
|
||||||
+ pluginName + "/" + RestConstants.EXECUTIONS_PATH_PART);
|
setCalledMethod("getScheduledExecution");
|
||||||
try {
|
try {
|
||||||
SmartExecutorPersistenceConnector persistenceConnector = SmartExecutorPersistenceFactory
|
SmartExecutorPersistenceConnector persistenceConnector = SmartExecutorPersistenceFactory
|
||||||
.getPersistenceConnector();
|
.getPersistenceConnector();
|
||||||
|
|
||||||
List<PluginDeclaration> pluginDeclarations = new ArrayList<>();
|
List<PluginDeclaration> pluginDeclarations = new ArrayList<>();
|
||||||
|
|
||||||
if(pluginName.compareTo(ORPHAN_PATH_PARAM)!=0) {
|
if(pluginName.compareTo(RestConstants.ORPHAN_PATH_PARAM)!=0) {
|
||||||
PluginManager pluginManager = PluginManager.getInstance();
|
PluginManager pluginManager = PluginManager.getInstance();
|
||||||
Map<String, PluginDeclaration> availablePlugins = pluginManager.getAvailablePlugins();
|
Map<String, PluginDeclaration> availablePlugins = pluginManager.getAvailablePlugins();
|
||||||
PluginDeclaration pluginDeclaration = availablePlugins.get(pluginName);
|
PluginDeclaration pluginDeclaration = availablePlugins.get(pluginName);
|
||||||
|
@ -146,11 +145,10 @@ public class RestSmartExecutor implements SmartExecutor {
|
||||||
@Path("/{" + PLUGIN_NAME_PATH_PARAM + "}/" + RestConstants.EXECUTIONS_PATH_PART)
|
@Path("/{" + PLUGIN_NAME_PATH_PARAM + "}/" + RestConstants.EXECUTIONS_PATH_PART)
|
||||||
@Consumes({MediaType.TEXT_PLAIN, ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8})
|
@Consumes({MediaType.TEXT_PLAIN, ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8})
|
||||||
@Produces(MediaType.TEXT_PLAIN)
|
@Produces(MediaType.TEXT_PLAIN)
|
||||||
@Override
|
|
||||||
public String launch(@PathParam(PLUGIN_NAME_PATH_PARAM) String pluginName, String launchParameterString)
|
public String launch(@PathParam(PLUGIN_NAME_PATH_PARAM) String pluginName, String launchParameterString)
|
||||||
throws ExecutorException {
|
throws ExecutorException {
|
||||||
setCalledMethod(HttpMethod.POST + " /" + RestConstants.PLUGINS_PATH_PART + "/"
|
//setCalledMethod(HttpMethod.POST + " /" + RestConstants.PLUGINS_PATH_PART + "/" + pluginName + "/" + RestConstants.EXECUTIONS_PATH_PART);
|
||||||
+ pluginName + "/" + RestConstants.EXECUTIONS_PATH_PART);
|
setCalledMethod("execute");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
logger.info("Requested to launch {} ({})", pluginName, launchParameterString);
|
logger.info("Requested to launch {} ({})", pluginName, launchParameterString);
|
||||||
|
@ -184,13 +182,12 @@ public class RestSmartExecutor implements SmartExecutor {
|
||||||
@GET
|
@GET
|
||||||
@Path("/{" + PLUGIN_NAME_PATH_PARAM + "}/" + RestConstants.EXECUTIONS_PATH_PART + "/" + "{" + UUID_PATH_PARAM + "}")
|
@Path("/{" + PLUGIN_NAME_PATH_PARAM + "}/" + RestConstants.EXECUTIONS_PATH_PART + "/" + "{" + UUID_PATH_PARAM + "}")
|
||||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||||
@Override
|
|
||||||
public String getLaunchState(@PathParam(PLUGIN_NAME_PATH_PARAM) String pluginName,
|
public String getLaunchState(@PathParam(PLUGIN_NAME_PATH_PARAM) String pluginName,
|
||||||
@PathParam(UUID_PATH_PARAM) String executionIdentifier,
|
@PathParam(UUID_PATH_PARAM) String executionIdentifier,
|
||||||
@QueryParam(RestConstants.ITERATION_PARAM) Integer iteration) throws ExecutorException {
|
@QueryParam(RestConstants.ITERATION_PARAM) Integer iteration) throws ExecutorException {
|
||||||
|
|
||||||
setCalledMethod(HttpMethod.GET + " /" + RestConstants.PLUGINS_PATH_PART + "/"
|
// setCalledMethod(HttpMethod.GET + " /" + RestConstants.PLUGINS_PATH_PART + "/" + pluginName + "/" + RestConstants.EXECUTIONS_PATH_PART + "/{" + UUID_PATH_PARAM + "}");
|
||||||
+ pluginName + "/" + RestConstants.EXECUTIONS_PATH_PART + "/{" + UUID_PATH_PARAM + "}");
|
setCalledMethod("getState");
|
||||||
|
|
||||||
PluginStateEvolution pluginStateEvolution = null;
|
PluginStateEvolution pluginStateEvolution = null;
|
||||||
try {
|
try {
|
||||||
|
@ -222,8 +219,7 @@ public class RestSmartExecutor implements SmartExecutor {
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("/{" + PLUGIN_NAME_PATH_PARAM + "}/" + RestConstants.EXECUTIONS_PATH_PART + "/" + "{" + UUID_PATH_PARAM + "}")
|
@Path("/{" + PLUGIN_NAME_PATH_PARAM + "}/" + RestConstants.EXECUTIONS_PATH_PART + "/" + "{" + UUID_PATH_PARAM + "}")
|
||||||
@Override
|
public Response delete(@PathParam(PLUGIN_NAME_PATH_PARAM) String pluginName,
|
||||||
public boolean delete(@PathParam(PLUGIN_NAME_PATH_PARAM) String pluginName,
|
|
||||||
@PathParam(UUID_PATH_PARAM) String executionIdentifier,
|
@PathParam(UUID_PATH_PARAM) String executionIdentifier,
|
||||||
@QueryParam(RestConstants.UNSCHEDULE_PARAM) Boolean unschedule) throws ExecutorException {
|
@QueryParam(RestConstants.UNSCHEDULE_PARAM) Boolean unschedule) throws ExecutorException {
|
||||||
|
|
||||||
|
@ -232,6 +228,7 @@ public class RestSmartExecutor implements SmartExecutor {
|
||||||
unschedule = false;
|
unschedule = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if(unschedule) {
|
if(unschedule) {
|
||||||
setCalledMethod(PURGE.class.getSimpleName() + " /" + RestConstants.PLUGINS_PATH_PART + "/" + pluginName
|
setCalledMethod(PURGE.class.getSimpleName() + " /" + RestConstants.PLUGINS_PATH_PART + "/" + pluginName
|
||||||
+ "/" + RestConstants.EXECUTIONS_PATH_PART + "/{" + UUID_PATH_PARAM + "}");
|
+ "/" + RestConstants.EXECUTIONS_PATH_PART + "/{" + UUID_PATH_PARAM + "}");
|
||||||
|
@ -239,6 +236,9 @@ public class RestSmartExecutor implements SmartExecutor {
|
||||||
setCalledMethod(HttpMethod.DELETE + " /" + RestConstants.PLUGINS_PATH_PART + "/"
|
setCalledMethod(HttpMethod.DELETE + " /" + RestConstants.PLUGINS_PATH_PART + "/"
|
||||||
+ pluginName + "/" + RestConstants.EXECUTIONS_PATH_PART + "/{" + UUID_PATH_PARAM + "}");
|
+ pluginName + "/" + RestConstants.EXECUTIONS_PATH_PART + "/{" + UUID_PATH_PARAM + "}");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
setCalledMethod("stop");
|
||||||
|
|
||||||
logger.info("Requested to delete for {} with UUID {}{}", pluginName, executionIdentifier,
|
logger.info("Requested to delete for {} with UUID {}{}", pluginName, executionIdentifier,
|
||||||
unschedule ? "globally" : "");
|
unschedule ? "globally" : "");
|
||||||
|
@ -269,7 +269,11 @@ public class RestSmartExecutor implements SmartExecutor {
|
||||||
}
|
}
|
||||||
logger.info("{} with UUID {} was{} stopped successfully", pluginName, executionIdentifier,
|
logger.info("{} with UUID {} was{} stopped successfully", pluginName, executionIdentifier,
|
||||||
currentStopped ? "" : " NOT");
|
currentStopped ? "" : " NOT");
|
||||||
return currentStopped;
|
if(currentStopped) {
|
||||||
|
return Response.status(Status.NO_CONTENT).build();
|
||||||
|
}else {
|
||||||
|
throw new ExecutorException(pluginName + " with UUID " + executionIdentifier + " was NOT stopped successfully");
|
||||||
|
}
|
||||||
} catch(ExecutorException e) {
|
} catch(ExecutorException e) {
|
||||||
throw e;
|
throw e;
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
|
@ -279,8 +283,7 @@ public class RestSmartExecutor implements SmartExecutor {
|
||||||
|
|
||||||
@PURGE
|
@PURGE
|
||||||
@Path("/{" + PLUGIN_NAME_PATH_PARAM + "}/" + RestConstants.EXECUTIONS_PATH_PART + "/" + "{" + UUID_PATH_PARAM + "}")
|
@Path("/{" + PLUGIN_NAME_PATH_PARAM + "}/" + RestConstants.EXECUTIONS_PATH_PART + "/" + "{" + UUID_PATH_PARAM + "}")
|
||||||
@Override
|
public Response purge(@PathParam(PLUGIN_NAME_PATH_PARAM) String pluginName,
|
||||||
public boolean purge(@PathParam(PLUGIN_NAME_PATH_PARAM) String pluginName,
|
|
||||||
@PathParam(UUID_PATH_PARAM) String executionIdentifier) throws ExecutorException {
|
@PathParam(UUID_PATH_PARAM) String executionIdentifier) throws ExecutorException {
|
||||||
return delete(pluginName, executionIdentifier, true);
|
return delete(pluginName, executionIdentifier, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,9 @@ import java.util.UUID;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.vremanagement.executor.api.types.LaunchParameter;
|
import org.gcube.vremanagement.executor.api.types.LaunchParameter;
|
||||||
import org.gcube.vremanagement.executor.api.types.Scheduling;
|
import org.gcube.vremanagement.executor.api.types.Scheduling;
|
||||||
import org.gcube.vremanagement.executor.exception.ExecutorException;
|
|
||||||
import org.gcube.vremanagement.executor.exception.InputsNullException;
|
import org.gcube.vremanagement.executor.exception.InputsNullException;
|
||||||
import org.gcube.vremanagement.executor.exception.LaunchException;
|
import org.gcube.vremanagement.executor.exception.LaunchException;
|
||||||
|
import org.gcube.vremanagement.executor.exception.PluginInstanceNotFoundException;
|
||||||
import org.gcube.vremanagement.executor.exception.PluginNotFoundException;
|
import org.gcube.vremanagement.executor.exception.PluginNotFoundException;
|
||||||
import org.gcube.vremanagement.executor.exception.SchedulerNotFoundException;
|
import org.gcube.vremanagement.executor.exception.SchedulerNotFoundException;
|
||||||
import org.gcube.vremanagement.executor.exception.UnableToInterruptTaskException;
|
import org.gcube.vremanagement.executor.exception.UnableToInterruptTaskException;
|
||||||
|
@ -276,7 +276,7 @@ public class SmartExecutorScheduler {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new ExecutorException("No plugin with UUID " + uuid.toString() + " found.");
|
throw new PluginInstanceNotFoundException(uuid);
|
||||||
}
|
}
|
||||||
Scheduling scheduling = launchParameter.getScheduling();
|
Scheduling scheduling = launchParameter.getScheduling();
|
||||||
boolean scheduled = scheduling != null ? true : false;
|
boolean scheduled = scheduling != null ? true : false;
|
||||||
|
|
Loading…
Reference in New Issue