1 22 package org.jboss.monitor.alerts; 23 24 import java.util.Map ; 25 26 import javax.management.Notification ; 27 28 import org.jboss.monitor.JBossMonitorNotification; 29 import org.jboss.util.Strings; 30 31 38 public class ConsoleAlertListener extends JBossAlertListener implements ConsoleAlertListenerMBean 39 { 40 protected String messageTemplate; 41 42 public void handleNotification(Notification notification, 43 Object handback) 44 { 45 if (!(notification instanceof JBossMonitorNotification)) return; 46 Map substitutions = ((JBossMonitorNotification)notification).substitutionMap(); 47 String message = Strings.subst(messageTemplate, substitutions, "%(", ")"); 48 log.info(message); 49 } 50 51 public String getMessageTemplate() 52 { 53 return messageTemplate; 54 } 55 56 public void setMessageTemplate(String messageTemplate) 57 { 58 this.messageTemplate = messageTemplate; 59 } 60 61 } 62 | Popular Tags |