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

80 lines
2.1 KiB
Java
Raw Normal View History

package org.gcube.dataanalysis.dataminer.poolmanager.util;
2023-01-18 17:56:48 +01:00
//import scala.actors.threadpool.Arrays;
2023-01-18 17:56:48 +01:00
public abstract class NotificationHelper {
private String subjectHeader;
protected NotificationHelper (String subjectHeader)
2023-01-18 17:56:48 +01:00
{
this.subjectHeader = subjectHeader;
2023-01-18 17:56:48 +01:00
}
2023-01-18 17:56:48 +01:00
// private Exception executionException;
2023-01-18 17:56:48 +01:00
// private boolean isError() {
// return this.executionException!=null;
// }
2023-01-18 17:56:48 +01:00
// public void setExecutionException(Exception executionException) {
// this.executionException = executionException;
// }
2023-01-18 17:56:48 +01:00
public String getSuccessSubject() {
return this.subjectHeader+" is SUCCESS";
2023-01-18 17:56:48 +01:00
}
2023-01-18 17:56:48 +01:00
public String getFailedSubject() {
return String.format(this.subjectHeader+" is FAILED");
2023-01-18 17:56:48 +01:00
}
2023-01-18 17:56:48 +01:00
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;
2023-01-18 17:56:48 +01:00
}
2023-01-18 17:56:48 +01:00
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;
2023-01-18 17:56:48 +01:00
}
2023-01-18 17:56:48 +01:00
// 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;
// }
2023-01-18 17:56:48 +01:00
// 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();
// }
// }
2023-01-18 17:56:48 +01:00
}