dataminer-pool-manager/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/NotificationHelper.java

80 lines
2.1 KiB
Java
Executable File

package org.gcube.dataanalysis.dataminer.poolmanager.util;
//import scala.actors.threadpool.Arrays;
public abstract class NotificationHelper {
private String subjectHeader;
protected NotificationHelper (String subjectHeader)
{
this.subjectHeader = subjectHeader;
}
// private Exception executionException;
// private boolean isError() {
// return this.executionException!=null;
// }
// public void setExecutionException(Exception executionException) {
// this.executionException = executionException;
// }
public String getSuccessSubject() {
return this.subjectHeader+" is SUCCESS";
}
public String getFailedSubject() {
return String.format(this.subjectHeader+" is FAILED");
}
public static String getSuccessBody(String info) {
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;
}
public static String getFailedBody(String message) {
String body = String.format("An error occurred while deploying your algorithm");
body+= "\n\nHere are the error details:\n\n" + message;
return body;
}
// public String getSuccessBodyRelease(String info) {
// String message = String.format("SVN REPOSITORY CORRECTLY UPDATED.");
// message+="\n\n The CRON job will install the algorithm in the target VRE \n\n"+ info;
// return message;
// }
//
// public String getFailedBodyRelease(String info) {
// String message = String.format("SVN REPOSITORY UPDATE FAILED.");
// message+="\n\n The CRON job will NOT be able to install the algorithm in the target VRE \n\n"+ info;
// return message;
// }
// public String getSubject() {
// if(this.isError()) {
// return this.getFailedSubject();
// } else {
// return this.getSuccessSubject();
// }
// }
//
// public String getBody() {
// if(this.isError()) {
// return this.getFailedBody();
// } else {
// return this.getSuccessBody();
// }
// }
}