80 lines
2.9 KiB
Java
Executable File
80 lines
2.9 KiB
Java
Executable File
package org.gcube.dataanalysis.dataminer.poolmanager.util;
|
|
|
|
***REMOVED***import scala.actors.threadpool.Arrays;
|
|
|
|
public abstract class NotificationHelper ***REMOVED***
|
|
|
|
private String subjectHeader;
|
|
|
|
protected NotificationHelper (String subjectHeader)
|
|
***REMOVED***
|
|
this.subjectHeader = subjectHeader;
|
|
***REMOVED***
|
|
|
|
***REMOVED*** private Exception executionException;
|
|
|
|
|
|
|
|
|
|
***REMOVED*** private boolean isError() ***REMOVED***
|
|
***REMOVED*** return this.executionException!=null;
|
|
***REMOVED*** ***REMOVED***
|
|
|
|
***REMOVED*** public void setExecutionException(Exception executionException) ***REMOVED***
|
|
***REMOVED*** this.executionException = executionException;
|
|
***REMOVED*** ***REMOVED***
|
|
|
|
public String getSuccessSubject() ***REMOVED***
|
|
return this.subjectHeader+" is SUCCESS";
|
|
***REMOVED***
|
|
|
|
|
|
|
|
|
|
public String getFailedSubject() ***REMOVED***
|
|
return String.format(this.subjectHeader+" is FAILED");
|
|
***REMOVED***
|
|
|
|
|
|
public static String getSuccessBody(String info) ***REMOVED***
|
|
String message = String.format("The installation of the algorithm is completed successfully.");
|
|
message+="\n\nYou can retrieve experiment results under the '/DataMiner' e-Infrastructure Workspace folder or from the DataMiner interface.\n\n"+ info;
|
|
return message;
|
|
***REMOVED***
|
|
|
|
public static String getFailedBody(String message) ***REMOVED***
|
|
String body = String.format("An error occurred while deploying your algorithm");
|
|
body+= "\n\nHere are the error details:\n\n" + message;
|
|
return body;
|
|
***REMOVED***
|
|
|
|
***REMOVED*** public String getSuccessBodyRelease(String info) ***REMOVED***
|
|
***REMOVED*** String message = String.format("SVN REPOSITORY CORRECTLY UPDATED.");
|
|
***REMOVED*** message+="\n\n The CRON job will install the algorithm in the target VRE \n\n"+ info;
|
|
***REMOVED*** return message;
|
|
***REMOVED*** ***REMOVED***
|
|
***REMOVED***
|
|
***REMOVED*** public String getFailedBodyRelease(String info) ***REMOVED***
|
|
***REMOVED*** String message = String.format("SVN REPOSITORY UPDATE FAILED.");
|
|
***REMOVED*** message+="\n\n The CRON job will NOT be able to install the algorithm in the target VRE \n\n"+ info;
|
|
***REMOVED*** return message;
|
|
***REMOVED*** ***REMOVED***
|
|
|
|
***REMOVED*** public String getSubject() ***REMOVED***
|
|
***REMOVED*** if(this.isError()) ***REMOVED***
|
|
***REMOVED*** return this.getFailedSubject();
|
|
***REMOVED*** ***REMOVED*** else ***REMOVED***
|
|
***REMOVED*** return this.getSuccessSubject();
|
|
***REMOVED*** ***REMOVED***
|
|
***REMOVED*** ***REMOVED***
|
|
***REMOVED***
|
|
***REMOVED*** public String getBody() ***REMOVED***
|
|
***REMOVED*** if(this.isError()) ***REMOVED***
|
|
***REMOVED*** return this.getFailedBody();
|
|
***REMOVED*** ***REMOVED*** else ***REMOVED***
|
|
***REMOVED*** return this.getSuccessBody();
|
|
***REMOVED*** ***REMOVED***
|
|
***REMOVED*** ***REMOVED***
|
|
|
|
***REMOVED***
|