1 14 package org.jmanage.core.alert; 15 16 import org.jmanage.core.config.AlertSourceConfig; 17 import org.jmanage.core.alert.source.NotificationAlertSource; 18 import org.jmanage.core.alert.source.GaugeAlertSource; 19 import org.jmanage.core.alert.source.StringAlertSource; 20 21 26 public class AlertSourceFactory { 27 28 public static AlertSource getAlertSource(AlertSourceConfig sourceConfig) { 29 final String sourceType = sourceConfig.getSourceType(); 30 if(sourceType.equals(AlertSourceConfig.SOURCE_TYPE_NOTIFICATION)){ 31 return new NotificationAlertSource(sourceConfig); 32 }else if(sourceType.equals(AlertSourceConfig.SOURCE_TYPE_GAUGE_MONITOR)){ 33 return new GaugeAlertSource(sourceConfig); 34 }else if(sourceType.equals(AlertSourceConfig.SOURCE_TYPE_STRING_MONITOR)){ 35 return new StringAlertSource(sourceConfig); 36 } 37 assert false:"Unknown alert source type: " + sourceType; 38 return null; 39 } 40 } 41 | Popular Tags |