Fabio Sinibaldi 2017-10-20 14:21:47 +00:00
parent 0de7540c8c
commit d3c941ba65
2 changed files with 14 additions and 7 deletions

View File

@ -8,7 +8,7 @@
</parent>
<groupId>org.gcube.data.transfer</groupId>
<artifactId>data-transfer-service</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>2.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>DataTransferService</name>
<scm>
@ -49,7 +49,11 @@
<artifactId>decompress-archive-plugin</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.data.transfer</groupId>
<artifactId>sis-geotk-plugin</artifactId>
<version>LATEST</version>
</dependency>
<dependency>

View File

@ -87,7 +87,8 @@ public abstract class AbstractTicketHandler {
BufferedOutputStream out=null;
Boolean completedTransfer=false;
File destination=null;
File tempFile=null;
try{
if(ticket.getSettings().getOptions().getMethod().equals(TransferMethod.DirectTransfer))
throw new NotSupportedMethodException("Unable to manage request [ID "+ticket.getId()+"]. Method not supported : "+ticket.getSettings().getOptions().getMethod());
@ -110,10 +111,10 @@ public abstract class AbstractTicketHandler {
is=getInputStream();
tempFile=File.createTempFile("transfer_"+ticket.getId(), ".tmp");
try{
out=new BufferedOutputStream(new FileOutputStream(destination));
out=new BufferedOutputStream(new FileOutputStream(tempFile));
} catch (IOException e) {
log.warn("Unable to create destination file.",e);
throw new ManagedException("Cannot save file in host");
@ -123,7 +124,8 @@ public abstract class AbstractTicketHandler {
completedTransfer=true;
// IF TRANSFER FAILS, EXCEPTIONS AR THROWN
log.debug("Completed transfer to {} , moving to destination {} ",tempFile.getAbsolutePath(),destination.getAbsolutePath());
tempFile.renameTo(destination);
//Plugin execution
if(ticket.getPluginInvocations()!=null){
@ -146,7 +148,8 @@ public abstract class AbstractTicketHandler {
}
}
log.debug("Completed Transfer for ticket ID {} ",ticket.getId());
log.info("Completed Transfer for ticket ID {} ",ticket.getId());
onStep("Completed transfer",1d,Status.SUCCESS);
}catch(PluginNotFoundException e){