package org.jboss.web.loadbalancer.monitor;
import org.apache.commons.httpclient.HttpMethod;
import gnu.regexp.RE;
import gnu.regexp.REException;
public class ECVMonitorService
extends AbstractMonitor
implements ECVMonitorServiceMBean
{
protected RE regExp;
protected boolean checkHostStatus(HttpMethod method)
{
return matchRegExp(method.getResponseBodyAsString());
}
protected boolean matchRegExp(String string)
{
if (regExp.getMatch(string) == null)
{
log.error("RegExp \"" + regExp + "\" does not match server output");
return false;
}
return true;
}
public void setRegExp(String regExp) throws REException
{
this.regExp = new RE(regExp);
}
public String getRegExp()
{
return regExp.toString();
}
}