Removing OLD SOAP APIs which causes conflicts

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/vre-management/smart-executor-api@177261 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2019-02-25 17:28:49 +00:00
parent df60538d39
commit a03dab6d42
16 changed files with 25 additions and 562 deletions

View File

@ -9,7 +9,7 @@
<groupId>org.gcube.vremanagement</groupId> <groupId>org.gcube.vremanagement</groupId>
<artifactId>smart-executor-api</artifactId> <artifactId>smart-executor-api</artifactId>
<version>1.8.0-SNAPSHOT</version> <version>2.0.0-SNAPSHOT</version>
<description>Smart Executor Service API Library</description> <description>Smart Executor Service API Library</description>
<packaging>jar</packaging> <packaging>jar</packaging>

View File

@ -1,145 +0,0 @@
package org.gcube.vremanagement.executor.api;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.ParameterStyle;
import javax.jws.soap.SOAPBinding.Style;
import javax.jws.soap.SOAPBinding.Use;
import org.gcube.vremanagement.executor.api.types.LaunchParameter;
import org.gcube.vremanagement.executor.exception.ExecutorException;
import org.gcube.vremanagement.executor.exception.InputsNullException;
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.plugin.PluginState;
import org.gcube.vremanagement.executor.plugin.PluginStateEvolution;
/**
* Service Endpoint Interface
* @author Luca Frosini (ISTI - CNR)
*/
@WebService(serviceName = SmartExecutor.WEB_SERVICE_SERVICE_NAME, targetNamespace=SmartExecutor.TARGET_NAMESPACE)
@SOAPBinding(style = Style.DOCUMENT, use=Use.LITERAL)
public interface SmartExecutor {
public static final String TARGET_NAMESPACE = "http://gcube-system.org/";
public static final String WEB_SERVICE_SERVICE_NAME =
"gcube/vremanagement/smart-executor";
/**
* Launch the plugin identified by the name provided as parameters
* with the provided inputs. Inputs cannot be null. If you need to launch
* an execution with no inputs provide an empty Map.
* This method return as soon as the plugin has been launched.
* The execution is made in a separated Thread.
* @param launchParameter which contains the name of the plugin to launch
* and the input to be provided to plugin to run and the scheduling
* strategy.
* @return the UUID execution identifier as String which identify the
* execution of the plugin.
* @throws InputsNullException if {@link LaunchParameter} contains null
* inputs.
* @throws PluginNotFoundException if {@link LaunchParameter} contains a
* name of a plugin which is not available on classpath
* @throws LaunchException if an error occurs trying to instantiate and/or
* launch the plugin execution
* @throws ExecutorException if any other undefined error occur
*/
@SOAPBinding(parameterStyle=ParameterStyle.WRAPPED)
public String launch(LaunchParameter launchParameter) throws
InputsNullException, PluginNotFoundException,
LaunchException, ExecutorException;
/**
* The method use the provided UUID execution identifier as String to
* stop the last running execution of a Task (if any).
* If the Task is a scheduled Task the current execution is stopped but the
* next one will occur. To remove the
* @param executionIdentifier UUID as String which identify the execution
* @return return true if the current execution has been correctly
* stopped. False otherwise.
* @throws Exception if there is no Task identified by the
* provided UUID execution identifier as String
*/
@SOAPBinding(parameterStyle=ParameterStyle.WRAPPED)
public boolean stop(String executionIdentifier) throws ExecutorException;
/**
* The method use the provided UUID execution identifier as String to
* stop the last running execution of a Task (if any) and release the
* the scheduling if the Task is a Scheduled Task.
* If the identified Task is not a Scheduled Task, the only effect is
* stopping the current execution. In other word has the same side effect
* of invoking {@link SmartExecutor#stop(String)} method.
* @param executionIdentifier UUID as String which identify the execution
* @param globally a boolean which when true indicate if releasing the
* Scheduled Task globally, so that no other SmartExecutor instance will
* take in charge the scheduling. When false this invocation has the same
* side effect of invoking {@link SmartExecutor#unSchedule(String, boolean)}.
* @return return true if the current execution has been correctly
* stopped and the Task was unscheduled. False otherwise.
* @throws Exception if there is no Task identified by the
* provided UUID execution identifier as String
*/
@SOAPBinding(parameterStyle=ParameterStyle.WRAPPED)
public boolean unSchedule(String executionIdentifier, boolean globally)
throws ExecutorException;
/**
* Deprecated Use {@link SmartExecutor#getStateEvolution(String)} instead
* The method use the provided UUID as String to retrieve the status of the
* associated execution
* @param executionIdentifier UUID as String which identify the execution
* @return {@link PluginState} which contains the state of the execution
* @throws Exception if there is no execution identified by the provided
* UUID execution identifier as String
*/
@SOAPBinding(parameterStyle=ParameterStyle.WRAPPED)
@Deprecated
public PluginState getState(String executionIdentifier)
throws PluginInstanceNotFoundException, ExecutorException;
/**
* The method use the provided UUID as String to retrieve the status of the
* associated execution
* @param executionIdentifier UUID as String which identify the execution
* @return {@link PluginState} which contains the state of the execution
* @throws Exception if there is no execution identified by the provided
* UUID execution identifier as String
*/
@SOAPBinding(parameterStyle=ParameterStyle.WRAPPED)
public PluginStateEvolution getStateEvolution(String executionIdentifier)
throws PluginInstanceNotFoundException, ExecutorException;
/**
* Deprecated Use {@link SmartExecutor#getIterationStateEvolution(String, int)} instead
* The method use the provided UUID as String and the iteration number
* to retrieve the status of the associated execution
* @param executionIdentifier UUID as String which identify the execution
* @param iterationNumber iteration number
* @return {@link PluginState} which contains the state of the execution
* @throws Exception if there is no execution identified by the provided
* UUID execution identifier as String
*/
@Deprecated
@SOAPBinding(parameterStyle=ParameterStyle.WRAPPED)
public PluginState getIterationState(
String executionIdentifier, int iterationNumber)
throws PluginInstanceNotFoundException, ExecutorException;
/**
* The method use the provided UUID as String and the iteration number
* to retrieve the status of the associated execution
* @param executionIdentifier UUID as String which identify the execution
* @param iterationNumber iteration number
* @return {@link PluginStateEvolution} which contains the state of the execution
* @throws Exception if there is no execution identified by the provided
* UUID execution identifier as String
*/
@SOAPBinding(parameterStyle=ParameterStyle.WRAPPED)
public PluginStateEvolution getIterationStateEvolution(
String executionIdentifier, int iterationNumber)
throws PluginInstanceNotFoundException, ExecutorException;
}

View File

@ -2,10 +2,6 @@ package org.gcube.vremanagement.executor.api.rest;
public class RestConstants { public class RestConstants {
public static final String REST_PATH_PART = "rest";
public static final String PLUGINS_PATH_PART = "plugins"; public static final String PLUGINS_PATH_PART = "plugins";
public static final String SCHEDULED_PATH_PART = "scheduled"; public static final String SCHEDULED_PATH_PART = "scheduled";

View File

@ -6,13 +6,6 @@ package org.gcube.vremanagement.executor.api.types;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.gcube.vremanagement.executor.api.types.adapter.MapAdapter;
import org.gcube.vremanagement.executor.json.SEMapper; import org.gcube.vremanagement.executor.json.SEMapper;
import org.gcube.vremanagement.executor.plugin.PluginStateNotification; import org.gcube.vremanagement.executor.plugin.PluginStateNotification;
import org.gcube.vremanagement.executor.utils.MapCompare; import org.gcube.vremanagement.executor.utils.MapCompare;
@ -24,8 +17,6 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@XmlRootElement()
@XmlAccessorType(XmlAccessType.FIELD)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property=SEMapper.CLASS_PROPERTY) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property=SEMapper.CLASS_PROPERTY)
public class LaunchParameter implements Comparable<LaunchParameter> { public class LaunchParameter implements Comparable<LaunchParameter> {
@ -35,7 +26,6 @@ public class LaunchParameter implements Comparable<LaunchParameter> {
/** /**
* The name of the plugin to launch * The name of the plugin to launch
*/ */
@XmlElement
@JsonProperty(value=PLUGIN_NAME) @JsonProperty(value=PLUGIN_NAME)
protected String pluginName; protected String pluginName;
@ -45,7 +35,6 @@ public class LaunchParameter implements Comparable<LaunchParameter> {
* that no specific version is required. In other words, null means any * that no specific version is required. In other words, null means any
* version. * version.
*/ */
@XmlElement
@JsonProperty(value=PLUGIN_VERSION) @JsonProperty(value=PLUGIN_VERSION)
protected String pluginVersion; protected String pluginVersion;
@ -59,26 +48,22 @@ public class LaunchParameter implements Comparable<LaunchParameter> {
* be satisfied. In other words, null means that no constraint are required * be satisfied. In other words, null means that no constraint are required
* to launch the execution * to launch the execution
*/ */
@XmlJavaTypeAdapter(MapAdapter.class)
protected Map<String, String> pluginCapabilities; protected Map<String, String> pluginCapabilities;
/** /**
* Inputs to provide to the plugin instance which have to be executed. * Inputs to provide to the plugin instance which have to be executed.
*/ */
@XmlJavaTypeAdapter(MapAdapter.class)
protected Map<String, Object> inputs; protected Map<String, Object> inputs;
/** /**
* Plugin State Notification to be used and inputs to be provided * Plugin State Notification to be used and inputs to be provided
* when instantiated * when instantiated
*/ */
@XmlJavaTypeAdapter(MapAdapter.class)
protected Map<String, Map<String, String>> pluginStateNotifications; protected Map<String, Map<String, String>> pluginStateNotifications;
/** /**
* Scheduling parameters. See {#Scheduling} for further details * Scheduling parameters. See {#Scheduling} for further details
*/ */
@XmlElement
protected Scheduling scheduling; protected Scheduling scheduling;
protected LaunchParameter(){} protected LaunchParameter(){}

View File

@ -1,26 +0,0 @@
package org.gcube.vremanagement.executor.api.types.adapter;
import java.util.Map;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import com.thoughtworks.xstream.XStream;
/**
* @author Lucio Leii (ISTI - CNR)
*/
public class MapAdapter extends XmlAdapter<String, Map<String, Object>>{
private static XStream xstream = new XStream();
@Override
public String marshal(Map<String, Object> oi) throws Exception {
return xstream.toXML(oi);
}
@SuppressWarnings("unchecked")
@Override
public Map<String, Object> unmarshal(String oi) throws Exception {
return (Map<String, Object>) xstream.fromXML(oi);
}
}

View File

@ -1,36 +0,0 @@
package org.gcube.vremanagement.executor.api.types.adapter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
import javax.xml.bind.annotation.adapters.XmlAdapter;
/**
* @author Lucio Lelii (ISTI - CNR)
*/
public class ThrowableAdapter extends XmlAdapter<String, Throwable> {
private HexBinaryAdapter hexAdapter = new HexBinaryAdapter();
@Override
public String marshal(Throwable v) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(v);
oos.close();
byte[] serializedBytes = baos.toByteArray();
return hexAdapter.marshal(serializedBytes);
}
@Override
public Throwable unmarshal(String v) throws Exception {
byte[] serializedBytes = hexAdapter.unmarshal(v);
ByteArrayInputStream bais = new ByteArrayInputStream(serializedBytes);
ObjectInputStream ois = new ObjectInputStream(bais);
Throwable result = (Throwable) ois.readObject();
return result;
}
}

View File

@ -3,19 +3,14 @@
*/ */
package org.gcube.vremanagement.executor.exception; package org.gcube.vremanagement.executor.exception;
import javax.xml.ws.WebFault;
import org.gcube.vremanagement.executor.exception.beans.ExceptionBean;
import org.gcube.vremanagement.executor.json.SEMapper; import org.gcube.vremanagement.executor.json.SEMapper;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
* *
*/ */
@WebFault
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = SEMapper.CLASS_PROPERTY) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = SEMapper.CLASS_PROPERTY)
public class ExecutorException extends Exception { public class ExecutorException extends Exception {
@ -26,11 +21,8 @@ public class ExecutorException extends Exception {
private static final String DEFAULT_MESSAGE = "Executor Exception"; private static final String DEFAULT_MESSAGE = "Executor Exception";
protected ExceptionBean faultInfo;
public ExecutorException() { public ExecutorException() {
super(DEFAULT_MESSAGE); super(DEFAULT_MESSAGE);
this.faultInfo = new ExceptionBean(DEFAULT_MESSAGE);
} }
public ExecutorException(Throwable cause) { public ExecutorException(Throwable cause) {
@ -39,32 +31,10 @@ public class ExecutorException extends Exception {
public ExecutorException(String message) { public ExecutorException(String message) {
super(message); super(message);
this.faultInfo = new ExceptionBean(message);
}
public ExecutorException(ExceptionBean faultInfo){
super(faultInfo.getMessage(), faultInfo.getCause());
this.faultInfo = faultInfo;
} }
public ExecutorException(String message, Throwable cause){ public ExecutorException(String message, Throwable cause){
super(message, cause); super(message, cause);
this.faultInfo = new ExceptionBean(message, cause);
}
public ExecutorException(String message, ExceptionBean faultInfo){
super(message);
this.faultInfo = faultInfo;
}
public ExecutorException(String message, ExceptionBean faultInfo, Throwable cause){
super(message, cause);
this.faultInfo = faultInfo;
}
@JsonIgnore
public ExceptionBean getFaultInfo(){
return faultInfo;
} }
} }

View File

@ -3,16 +3,9 @@
*/ */
package org.gcube.vremanagement.executor.exception; package org.gcube.vremanagement.executor.exception;
import javax.xml.ws.WebFault;
import org.gcube.vremanagement.executor.exception.beans.ExceptionBean;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*
*/ */
@WebFault
public class InputsNullException extends ExecutorException { public class InputsNullException extends ExecutorException {
/** /**
@ -22,39 +15,21 @@ public class InputsNullException extends ExecutorException {
private static final String DEFAULT_MESSAGE = "Inputs cannot be null. Use an Empty Map instead."; private static final String DEFAULT_MESSAGE = "Inputs cannot be null. Use an Empty Map instead.";
public InputsNullException(){
super(DEFAULT_MESSAGE);
this.faultInfo = new ExceptionBean(DEFAULT_MESSAGE);
}
public InputsNullException(String message) { public InputsNullException() {
super(message); super(DEFAULT_MESSAGE);
} }
public InputsNullException(Throwable cause) { public InputsNullException(Throwable cause) {
this(DEFAULT_MESSAGE, cause); this(DEFAULT_MESSAGE, cause);
} }
public InputsNullException(ExceptionBean faultInfo){ public InputsNullException(String message) {
super(faultInfo); super(message);
} }
public InputsNullException(String message, Throwable cause){ public InputsNullException(String message, Throwable cause){
super(message, cause); super(message, cause);
} }
public InputsNullException(String message, ExceptionBean faultInfo){
super(message, faultInfo);
}
public InputsNullException(String message, ExceptionBean faultInfo, Throwable cause){
super(message, faultInfo, cause);
}
@Override
public ExceptionBean getFaultInfo(){
return faultInfo;
}
} }

View File

@ -3,16 +3,9 @@
*/ */
package org.gcube.vremanagement.executor.exception; package org.gcube.vremanagement.executor.exception;
import javax.xml.ws.WebFault;
import org.gcube.vremanagement.executor.exception.beans.ExceptionBean;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*
*/ */
@WebFault
public class InvalidInputsException extends ExecutorException { public class InvalidInputsException extends ExecutorException {
/** /**
@ -22,39 +15,20 @@ public class InvalidInputsException extends ExecutorException {
private static final String DEFAULT_MESSAGE = "Inputs cannot be null. Use an Empty Map instead."; private static final String DEFAULT_MESSAGE = "Inputs cannot be null. Use an Empty Map instead.";
public InvalidInputsException(){ public InvalidInputsException() {
super(DEFAULT_MESSAGE); super(DEFAULT_MESSAGE);
this.faultInfo = new ExceptionBean(DEFAULT_MESSAGE);
}
public InvalidInputsException(String message) {
super(message);
} }
public InvalidInputsException(Throwable cause) { public InvalidInputsException(Throwable cause) {
this(DEFAULT_MESSAGE, cause); this(DEFAULT_MESSAGE, cause);
} }
public InvalidInputsException(ExceptionBean faultInfo){ public InvalidInputsException(String message) {
super(faultInfo); super(message);
} }
public InvalidInputsException(String message, Throwable cause){ public InvalidInputsException(String message, Throwable cause){
super(message, cause); super(message, cause);
} }
public InvalidInputsException(String message, ExceptionBean faultInfo){
super(message, faultInfo);
}
public InvalidInputsException(String message, ExceptionBean faultInfo, Throwable cause){
super(message, faultInfo, cause);
}
@Override
public ExceptionBean getFaultInfo(){
return faultInfo;
}
} }

View File

@ -3,16 +3,9 @@
*/ */
package org.gcube.vremanagement.executor.exception; package org.gcube.vremanagement.executor.exception;
import javax.xml.ws.WebFault;
import org.gcube.vremanagement.executor.exception.beans.ExceptionBean;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*
*/ */
@WebFault
public class LaunchException extends ExecutorException { public class LaunchException extends ExecutorException {
/** /**
@ -22,38 +15,20 @@ public class LaunchException extends ExecutorException {
private static final String DEFAULT_MESSAGE = "Error trying to launch the plugin execution"; private static final String DEFAULT_MESSAGE = "Error trying to launch the plugin execution";
public LaunchException(){ public LaunchException() {
super(DEFAULT_MESSAGE); super(DEFAULT_MESSAGE);
this.faultInfo = new ExceptionBean(DEFAULT_MESSAGE);
}
public LaunchException(String message) {
super(message);
} }
public LaunchException(Throwable cause) { public LaunchException(Throwable cause) {
this(DEFAULT_MESSAGE, cause); this(DEFAULT_MESSAGE, cause);
} }
public LaunchException(ExceptionBean faultInfo){ public LaunchException(String message) {
super(faultInfo); super(message);
} }
public LaunchException(String message, Throwable cause){ public LaunchException(String message, Throwable cause){
super(message, cause); super(message, cause);
} }
public LaunchException(String message, ExceptionBean faultInfo){
super(message, faultInfo);
}
public LaunchException(String message, ExceptionBean faultInfo, Throwable cause){
super(message, faultInfo, cause);
}
@Override
public ExceptionBean getFaultInfo(){
return faultInfo;
}
} }

View File

@ -3,16 +3,9 @@
*/ */
package org.gcube.vremanagement.executor.exception; package org.gcube.vremanagement.executor.exception;
import javax.xml.ws.WebFault;
import org.gcube.vremanagement.executor.exception.beans.ExceptionBean;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*
*/ */
@WebFault
public class PluginInstanceNotFoundException extends ExecutorException { public class PluginInstanceNotFoundException extends ExecutorException {
/** /**
@ -22,39 +15,20 @@ public class PluginInstanceNotFoundException extends ExecutorException {
private static final String DEFAULT_MESSAGE = "The requested plugin instance does not exists"; private static final String DEFAULT_MESSAGE = "The requested plugin instance does not exists";
public PluginInstanceNotFoundException(){ public PluginInstanceNotFoundException() {
super(DEFAULT_MESSAGE); super(DEFAULT_MESSAGE);
this.faultInfo = new ExceptionBean(DEFAULT_MESSAGE);
}
public PluginInstanceNotFoundException(String message) {
super(message);
} }
public PluginInstanceNotFoundException(Throwable cause) { public PluginInstanceNotFoundException(Throwable cause) {
this(DEFAULT_MESSAGE, cause); this(DEFAULT_MESSAGE, cause);
} }
public PluginInstanceNotFoundException(ExceptionBean faultInfo){ public PluginInstanceNotFoundException(String message) {
super(faultInfo); super(message);
} }
public PluginInstanceNotFoundException(String message, Throwable cause){ public PluginInstanceNotFoundException(String message, Throwable cause){
super(message, cause); super(message, cause);
} }
public PluginInstanceNotFoundException(String message, ExceptionBean faultInfo){
super(message, faultInfo);
}
public PluginInstanceNotFoundException(String message, ExceptionBean faultInfo, Throwable cause){
super(message, faultInfo, cause);
}
@Override
public ExceptionBean getFaultInfo(){
return faultInfo;
}
} }

View File

@ -3,16 +3,9 @@
*/ */
package org.gcube.vremanagement.executor.exception; package org.gcube.vremanagement.executor.exception;
import javax.xml.ws.WebFault;
import org.gcube.vremanagement.executor.exception.beans.ExceptionBean;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*
*/ */
@WebFault
public class PluginNotFoundException extends ExecutorException { public class PluginNotFoundException extends ExecutorException {
/** /**
@ -22,39 +15,20 @@ public class PluginNotFoundException extends ExecutorException {
private static final String DEFAULT_MESSAGE = "The requested plugin does not exist on container"; private static final String DEFAULT_MESSAGE = "The requested plugin does not exist on container";
public PluginNotFoundException(){ public PluginNotFoundException() {
super(DEFAULT_MESSAGE); super(DEFAULT_MESSAGE);
this.faultInfo = new ExceptionBean(DEFAULT_MESSAGE);
}
public PluginNotFoundException(String message) {
super(message);
} }
public PluginNotFoundException(Throwable cause) { public PluginNotFoundException(Throwable cause) {
this(DEFAULT_MESSAGE, cause); this(DEFAULT_MESSAGE, cause);
} }
public PluginNotFoundException(ExceptionBean faultInfo){ public PluginNotFoundException(String message) {
super(faultInfo); super(message);
} }
public PluginNotFoundException(String message, Throwable cause){ public PluginNotFoundException(String message, Throwable cause){
super(message, cause); super(message, cause);
} }
public PluginNotFoundException(String message, ExceptionBean faultInfo){
super(message, faultInfo);
}
public PluginNotFoundException(String message, ExceptionBean faultInfo, Throwable cause){
super(message, faultInfo, cause);
}
@Override
public ExceptionBean getFaultInfo(){
return faultInfo;
}
} }

View File

@ -3,18 +3,9 @@
*/ */
package org.gcube.vremanagement.executor.exception; package org.gcube.vremanagement.executor.exception;
import java.util.UUID;
import javax.xml.ws.WebFault;
import org.gcube.vremanagement.executor.exception.beans.ExceptionBean;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*
*/ */
@WebFault
public class SchedulerRemoveException extends ExecutorException { public class SchedulerRemoveException extends ExecutorException {
/** /**
@ -24,55 +15,20 @@ public class SchedulerRemoveException extends ExecutorException {
private static final String DEFAULT_MESSAGE = "Unable to delete SmartExecutor Scheduled Task"; private static final String DEFAULT_MESSAGE = "Unable to delete SmartExecutor Scheduled Task";
public SchedulerRemoveException(){ public SchedulerRemoveException() {
super(DEFAULT_MESSAGE); super(DEFAULT_MESSAGE);
this.faultInfo = new ExceptionBean(DEFAULT_MESSAGE);
}
public SchedulerRemoveException(UUID taskUUID) {
super(DEFAULT_MESSAGE + " " + taskUUID.toString());
}
public SchedulerRemoveException(String message) {
super(message);
} }
public SchedulerRemoveException(Throwable cause) { public SchedulerRemoveException(Throwable cause) {
this(DEFAULT_MESSAGE, cause); this(DEFAULT_MESSAGE, cause);
} }
public SchedulerRemoveException(ExceptionBean faultInfo){ public SchedulerRemoveException(String message) {
super(faultInfo); super(message);
}
public SchedulerRemoveException(UUID taskUUID, Throwable cause) {
this(DEFAULT_MESSAGE + " " + taskUUID.toString(), cause);
} }
public SchedulerRemoveException(String message, Throwable cause){ public SchedulerRemoveException(String message, Throwable cause){
super(message, cause); super(message, cause);
} }
public SchedulerRemoveException(UUID taskUUID, ExceptionBean faultInfo) {
this(DEFAULT_MESSAGE + " " + taskUUID.toString(), faultInfo);
}
public SchedulerRemoveException(String message, ExceptionBean faultInfo){
super(message, faultInfo);
}
public SchedulerRemoveException(UUID taskUUID, ExceptionBean faultInfo, Throwable cause) {
this(DEFAULT_MESSAGE + " " + taskUUID.toString(), faultInfo, cause);
}
public SchedulerRemoveException(String message, ExceptionBean faultInfo, Throwable cause){
super(message, faultInfo, cause);
}
@Override
public ExceptionBean getFaultInfo(){
return faultInfo;
}
} }

View File

@ -5,16 +5,9 @@ package org.gcube.vremanagement.executor.exception;
import java.util.UUID; import java.util.UUID;
import javax.xml.ws.WebFault;
import org.gcube.vremanagement.executor.exception.beans.ExceptionBean;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*
*/ */
@WebFault
public class UnableToInterruptTaskException extends ExecutorException { public class UnableToInterruptTaskException extends ExecutorException {
/** /**
@ -24,55 +17,23 @@ public class UnableToInterruptTaskException extends ExecutorException {
private static final String DEFAULT_MESSAGE = "Unable to interrupt SmartExecutor Task"; private static final String DEFAULT_MESSAGE = "Unable to interrupt SmartExecutor Task";
public UnableToInterruptTaskException(){ public UnableToInterruptTaskException() {
super(DEFAULT_MESSAGE); super(DEFAULT_MESSAGE);
this.faultInfo = new ExceptionBean(DEFAULT_MESSAGE);
}
public UnableToInterruptTaskException(UUID taskUUID) {
super(DEFAULT_MESSAGE + " " + taskUUID.toString());
}
public UnableToInterruptTaskException(String message) {
super(message);
} }
public UnableToInterruptTaskException(Throwable cause) { public UnableToInterruptTaskException(Throwable cause) {
this(DEFAULT_MESSAGE, cause); this(DEFAULT_MESSAGE, cause);
} }
public UnableToInterruptTaskException(ExceptionBean faultInfo){ public UnableToInterruptTaskException(String message) {
super(faultInfo); super(message);
}
public UnableToInterruptTaskException(UUID taskUUID, Throwable cause) {
this(DEFAULT_MESSAGE + " " + taskUUID.toString(), cause);
} }
public UnableToInterruptTaskException(String message, Throwable cause){ public UnableToInterruptTaskException(String message, Throwable cause){
super(message, cause); super(message, cause);
} }
public UnableToInterruptTaskException(UUID taskUUID, ExceptionBean faultInfo) { public UnableToInterruptTaskException(UUID taskUUID, Throwable cause) {
this(DEFAULT_MESSAGE + " " + taskUUID.toString(), faultInfo); this(DEFAULT_MESSAGE + " with UUID " + taskUUID.toString(), cause);
} }
public UnableToInterruptTaskException(String message, ExceptionBean faultInfo){
super(message, faultInfo);
}
public UnableToInterruptTaskException(UUID taskUUID, ExceptionBean faultInfo, Throwable cause) {
this(DEFAULT_MESSAGE + " " + taskUUID.toString(), faultInfo, cause);
}
public UnableToInterruptTaskException(String message, ExceptionBean faultInfo, Throwable cause){
super(message, faultInfo, cause);
}
@Override
public ExceptionBean getFaultInfo(){
return faultInfo;
}
} }

View File

@ -1,48 +0,0 @@
package org.gcube.vremanagement.executor.exception.beans;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.gcube.vremanagement.executor.api.types.adapter.ThrowableAdapter;
/**
* @author Lucio Leii (ISTI - CNR)
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class ExceptionBean {
protected String message;
@XmlJavaTypeAdapter(ThrowableAdapter.class)
protected Throwable cause;
protected ExceptionBean(){}
public ExceptionBean(String message){
this.message = message;
}
public ExceptionBean(String message, Throwable cause){
this.message = message;
this.cause = cause;
}
/**
* @return the message
*/
public String getMessage() {
return message;
}
/**
* @return the cause
*/
public Throwable getCause() {
return cause;
}
}

View File

@ -5,13 +5,6 @@ package org.gcube.vremanagement.executor.plugin;
import java.util.Map; import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.gcube.vremanagement.executor.api.types.adapter.MapAdapter;
import org.gcube.vremanagement.executor.json.SEMapper; import org.gcube.vremanagement.executor.json.SEMapper;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
@ -23,8 +16,6 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
* *
*/ */
@XmlRootElement()
@XmlAccessorType(XmlAccessType.FIELD)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property=SEMapper.CLASS_PROPERTY) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property=SEMapper.CLASS_PROPERTY)
@JsonDeserialize(as=PluginDeclarationImpl.class) @JsonDeserialize(as=PluginDeclarationImpl.class)
@JsonTypeName(value="PluginDeclaration") @JsonTypeName(value="PluginDeclaration")
@ -42,7 +33,6 @@ public interface PluginDeclaration {
* @return the name of the plugin used by the Executor to refer to the * @return the name of the plugin used by the Executor to refer to the
* plugin implementation class. * plugin implementation class.
*/ */
@XmlElement
public String getName(); public String getName();
/** /**
@ -50,7 +40,6 @@ public interface PluginDeclaration {
* and it will be published on the ServiceEndpoint created by the executor * and it will be published on the ServiceEndpoint created by the executor
* @return the plugin description. * @return the plugin description.
*/ */
@XmlElement
public String getDescription(); public String getDescription();
/** /**
@ -58,7 +47,6 @@ public interface PluginDeclaration {
* It will be published on the ServiceEndpoint created by the executor * It will be published on the ServiceEndpoint created by the executor
* @return the plugin version * @return the plugin version
*/ */
@XmlElement
public String getVersion(); public String getVersion();
/** /**
@ -68,7 +56,6 @@ public interface PluginDeclaration {
* Resource in the proper way to obtain its own filtered list. * Resource in the proper way to obtain its own filtered list.
* @return the {@link Map} with the supported capabilities * @return the {@link Map} with the supported capabilities
*/ */
@XmlJavaTypeAdapter(MapAdapter.class)
public Map<String,String> getSupportedCapabilities(); public Map<String,String> getSupportedCapabilities();
/** /**
@ -78,13 +65,4 @@ public interface PluginDeclaration {
@JsonIgnore @JsonIgnore
public Class<? extends Plugin<? extends PluginDeclaration>> getPluginImplementation(); public Class<? extends Plugin<? extends PluginDeclaration>> getPluginImplementation();
/* Waiting for Java 8 where this method should be declarable
public String toString(){
return String.format("%s : %s - %s - %s - %s - %s",
this.getClass().getSimpleName(),
getName(), getVersion(), getDescription(),
getSupportedCapabilities(),
getPluginImplementation().getClass().getSimpleName());
}
*/
} }