private static final String END_OF_INPUT = "\\Z";
//note the user of a logger attached to a public class
private static final Logger fLogger = Util.getLogger(PerformanceMonitor.class);
private void validateState(){
ModelCtorException ex = new ModelCtorException();
if ( FAILS == Check.required(fTargetURL, Check.pattern(HTTP_TARGET)) ) {
ex.add("Target URL is required, must start with 'http://'.");
}
if( Util.textHasContent(fTargetURL)) {
try {
URL testUrl = new URL(fTargetURL);
}
catch(MalformedURLException exception){
ex.add("Target URL is malformed.");
}
}
if ( FAILS == Check.required(fPingFrequency, Check.range(1,60))) {
ex.add("Ping Frequency is required, must be in range 1..60 minutes.");
}
if ( FAILS == Check.required(fTimeout, Check.range(1,60))) {
ex.add("Timeout is required, must be in range 1..60 seconds.");
}
if ( ! ex.isEmpty() ) {
throw new IllegalArgumentException("Cannot construct BadResponseDetector : " + ex.toString(), ex);
}
}