1 7 package org.jboss.web.loadbalancer.monitor; 8 9 import org.apache.commons.httpclient.HttpMethod; 10 import gnu.regexp.RE; 11 import gnu.regexp.REException; 12 13 21 public class ECVMonitorService 22 extends AbstractMonitor 23 implements ECVMonitorServiceMBean 24 { 25 protected RE regExp; 26 27 protected boolean checkHostStatus(HttpMethod method) 28 { 29 return matchRegExp(method.getResponseBodyAsString()); 30 } 31 32 protected boolean matchRegExp(String string) 33 { 34 if (regExp.getMatch(string) == null) 36 { 37 log.error("RegExp \"" + regExp + "\" does not match server output"); 38 return false; 39 } 40 return true; 41 } 42 43 46 public void setRegExp(String regExp) throws REException 47 { 48 this.regExp = new RE(regExp); 49 } 50 51 54 public String getRegExp() 55 { 56 return regExp.toString(); 57 } 58 } | Popular Tags |