1 14 package org.jmanage.core.config; 15 16 24 public class AlertSourceConfig { 25 26 public static final String SOURCE_TYPE_NOTIFICATION = "notification"; 27 public static final String SOURCE_TYPE_GAUGE_MONITOR = "gauge"; 28 public static final String SOURCE_TYPE_COUNTER_MONITOR = "counter"; 29 public static final String SOURCE_TYPE_STRING_MONITOR = "string"; 30 31 private static final String SOURCE_TYPE_NOTIFICATION_DESC = "MBean Notification"; 32 private static final String SOURCE_TYPE_GAUGE_MONITOR_DESC = "MBean Attribute Value Thresholds"; 33 private static final String SOURCE_TYPE_STRING_MONITOR_DESC = "MBean Attribute String Value Match"; 34 35 private String sourceType; 36 private ApplicationConfig appConfig; 37 private String objectName; 38 39 40 private String notificationType; 41 42 43 private String attributeName; 45 private Number lowThreshold; 46 private Number highThreshold; 47 private String stringAttributeValue; 48 private String attributeDataTYpe; 49 50 public AlertSourceConfig(String objectName, String notificationType){ 51 this.sourceType = SOURCE_TYPE_NOTIFICATION; 52 this.objectName = objectName; 53 this.notificationType = notificationType; 54 } 55 56 public AlertSourceConfig(String objectName, String attributeName, 57 Number minValue, Number maxValue, 58 String attributeDataType){ 59 this.sourceType = SOURCE_TYPE_GAUGE_MONITOR; 60 this.objectName = objectName; 61 this.attributeName = attributeName; 62 this.lowThreshold = minValue; 63 this.highThreshold = maxValue; 64 this.attributeDataTYpe = attributeDataType; 65 } 66 67 public AlertSourceConfig(String objectName, String attributeName, 68 String stringAttributeValue){ 69 this.sourceType = SOURCE_TYPE_STRING_MONITOR; 70 this.objectName = objectName; 71 this.attributeName = attributeName; 72 this.stringAttributeValue = stringAttributeValue; 73 } 74 75 88 89 public String getSourceType() { 90 return sourceType; 91 } 92 93 public String getSourceTypeDesc(){ 94 return getSourceTypeDescription(sourceType); 95 } 96 97 public String getObjectName() { 98 return objectName; 99 } 100 101 public String getNotificationType() { 102 return notificationType; 103 } 104 105 public String getAttributeName() { 106 return attributeName; 107 } 108 109 public Number getLowThreshold() { 110 return lowThreshold; 111 } 112 113 public Number getHighThreshold() { 114 return highThreshold; 115 } 116 117 public String getStringAttributeValue(){ 118 return stringAttributeValue; 119 } 120 121 public void setApplicationConfig(ApplicationConfig appConfig) { 122 this.appConfig = appConfig; 123 } 124 125 public ApplicationConfig getApplicationConfig(){ 126 return appConfig; 127 } 128 public String getAttributeDataTYpe() { 129 return attributeDataTYpe; 130 } 131 132 public static String getSourceTypeDescription(String sourceType){ 133 if (sourceType.equals(SOURCE_TYPE_NOTIFICATION)){ 134 return SOURCE_TYPE_NOTIFICATION_DESC; 135 } 136 if(sourceType.equals(SOURCE_TYPE_GAUGE_MONITOR)){ 137 return SOURCE_TYPE_GAUGE_MONITOR_DESC; 138 } 139 if(sourceType.equals(SOURCE_TYPE_STRING_MONITOR)){ 140 return SOURCE_TYPE_STRING_MONITOR_DESC; 141 } 142 return null; 143 } 144 145 } 146 | Popular Tags |