git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/branches/data-transfer/data-transfer-service/2.0@149162 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
4e2f2b54d7
commit
437cd856de
|
@ -1,35 +0,0 @@
|
|||
package org.gcube.data.transfer.service.transfers.engine.faults;
|
||||
|
||||
public class PluginExecutionException extends ManagedException {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 2681096696757651730L;
|
||||
|
||||
public PluginExecutionException() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public PluginExecutionException(String message) {
|
||||
super(message);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public PluginExecutionException(Throwable cause) {
|
||||
super(cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public PluginExecutionException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public PluginExecutionException(String message, Throwable cause, boolean enableSuppression,
|
||||
boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
|
@ -28,6 +28,7 @@ import org.gcube.data.transfer.service.transfers.engine.PersistenceProvider;
|
|||
import org.gcube.data.transfer.service.transfers.engine.PluginManager;
|
||||
import org.gcube.data.transfer.service.transfers.engine.faults.ManagedException;
|
||||
import org.gcube.data.transfer.service.transfers.engine.faults.NotSupportedMethodException;
|
||||
import org.gcube.data.transfer.service.transfers.engine.faults.PluginNotFoundException;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
@ -137,19 +138,28 @@ public abstract class AbstractTicketHandler {
|
|||
}
|
||||
|
||||
}
|
||||
log.debug("Executing invocation {} ",invocation);
|
||||
onStep("Executing invocation "+invocation.getPluginId(),1d,Status.PLUGIN_EXECUTION);
|
||||
ExecutionReport report=pluginManager.execute(invocation);
|
||||
log.debug("Adding plugin execution report {} to ticket {} ",report,ticket.getId());
|
||||
addExecutionReport(report);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
log.debug("Completed Transfer for ticket ID {} ",ticket.getId());
|
||||
onStep("Completed transfer",1d,Status.SUCCESS);
|
||||
|
||||
}catch(PluginNotFoundException e){
|
||||
log.error("Error while serving {} ",ticket,e);
|
||||
onError("Invalid plugin invocation "+e.getMessage());
|
||||
}catch(PluginException e){
|
||||
log.error("Error while serving {} ",ticket,e);
|
||||
onError("Failed Plugin Execution : "+e.getMessage());
|
||||
}catch(NotSupportedMethodException e){
|
||||
log.error("Error while serving {} ",ticket,e);
|
||||
onError(e.getMessage());
|
||||
}catch(ManagedException e){
|
||||
log.error("Error while serving {} ",ticket,e);
|
||||
onError(e.getMessage());
|
||||
}catch(Throwable t){
|
||||
onError("Unexpected error while downloading : "+t.getMessage());
|
||||
|
|
|
@ -11,11 +11,8 @@ import org.gcube.data.transfer.model.PluginDescription;
|
|||
import org.gcube.data.transfer.model.PluginInvocation;
|
||||
import org.gcube.data.transfer.plugin.AbstractPlugin;
|
||||
import org.gcube.data.transfer.plugin.AbstractPluginFactory;
|
||||
import org.gcube.data.transfer.plugin.fails.PluginCleanupException;
|
||||
import org.gcube.data.transfer.plugin.fails.PluginException;
|
||||
import org.gcube.data.transfer.plugin.fails.PluginInitializationException;
|
||||
import org.gcube.data.transfer.service.transfers.engine.PluginManager;
|
||||
import org.gcube.data.transfer.service.transfers.engine.faults.PluginExecutionException;
|
||||
import org.gcube.data.transfer.service.transfers.engine.faults.PluginNotFoundException;
|
||||
|
||||
import lombok.Synchronized;
|
||||
|
@ -72,7 +69,16 @@ public class PluginManagerImpl implements PluginManager {
|
|||
log.debug("Checking invocation {} ",invocation);
|
||||
factory.checkInvocation(invocation);
|
||||
plugin=factory.createWorker(invocation);
|
||||
return plugin.execute();
|
||||
ExecutionReport report=plugin.execute();
|
||||
log.debug("Plugin execution report is {} ",report);
|
||||
switch(report.getFlag()){
|
||||
case FAILED_EXECUTION:
|
||||
case WRONG_PARAMETER:
|
||||
case UNABLE_TO_EXECUTE: throw new PluginException("Wrong status after plugin execution. Report is "+report);
|
||||
case FAILED_CLEANUP : log.warn("Plugin failed to clean up. ");
|
||||
case SUCCESS :
|
||||
}
|
||||
return report;
|
||||
}catch(PluginException e){
|
||||
log.error("Unable to execute plguin invocation {} ",invocation,e);
|
||||
throw e;
|
||||
|
|
Loading…
Reference in New Issue