protected void notifyEngines(String subject, String text) { for (NotifierEngine engine : this.engines) { engine.notify(subject, text); } }
public static List<NotifierEngine> initNotifierEngines(Logger logger) { List<NotifierEngine> notifierEngines = new ArrayList<>(); RepairnatorConfig config = RepairnatorConfig.getInstance(); if (config.getSmtpServer() != null && config.getNotifyTo() != null) { logger.info("The email notifier engine will be used."); notifierEngines.add(new EmailNotifierEngine(config.getNotifyTo(), config.getSmtpServer(), config.getSmtpPort(), config.isSmtpTLS(), config.getSmtpUsername(), config.getSmtpPassword())); } else { logger.info("The email notifier engine won't be used."); } return notifierEngines; }
/** * Use the notifier engine to send an email to all addressess specified in the engine. * @param subject the subject line of the message * @param text the actual message */ protected void notifyEngines(String subject, String text) { for (NotifierEngine engine : this.engines) { engine.notify(subject, text); } }
public static List<NotifierEngine> initEmailSummaryEngines(Logger logger) { List<NotifierEngine> summaryEngines = new ArrayList<>(); RepairnatorConfig config = RepairnatorConfig.getInstance(); if(config.getSmtpServer() != null && config.getSummaryFrequency() != null && config.getNotifySummary() != null) { logger.info("The summary email engine will be used."); summaryEngines.add(new EmailNotifierEngine(config.getNotifySummary(), config.getSmtpServer(), config.getSmtpPort(), config.isSmtpTLS(), config.getSmtpUsername(), config.getSmtpPassword())); } else { logger.info("The summary email engine will not be used."); } return summaryEngines; }
public void notifyEnd() { String subject = "Process "+processName+" on "+Utils.getHostname()+" finished"; Date endDate = new Date(); String message = "The following process: "+ processName +" launched on "+ Utils.getHostname()+ " the "+ this.launchDate.toString()+" and finished "+endDate.toString()+". " + "It ran for a total time of "+Utils.getDuration(this.launchDate, endDate); for (NotifierEngine engine : this.engines) { engine.notify(subject, message); } } }
engine.notify(subject, text);