if(choice.equals(StaticTest.ADD) || choice.equals(StaticTest.VALIDATE)) {
final HttpListener h = (HttpListener)cce.getObject();
String vsId = h.getDefaultVirtualServer();
try {
Config config = (Config) ((HttpService) cce.getClassObject()).parent();
if( config!=null ) {
boolean exists = checkVSExists(vsId, config);
if(!exists) {
result.failed(smh.getLocalString(getClass().getName() + ".virtualserverNotFound",
"Attribute(default-virtual-server={0}) : Virtual Server not found", new Object[]{vsId}));
} else if (h.isEnabled()){
// When the listener is enabled then the virtual
// server must be on.
if (! isVirtualServerOn(h, config, result)){
result.failed(smh.getLocalString(getClass().getName() + ".cannotAddVsNotOn",
"Cannot add this HttpListener \"{0}\" because it is enabled but its virtual server \"{1}\" has a state other than \"on\" ({2})",
new Object[]{h.getId(), vsId, getDefaultVirtualServer(vsId, config).getState()}));
}
}
}
}
catch(Exception e){
_logger.log(Level.FINE, "domainxmlverifier.error", e);
}
} else if (choice.equals(StaticTest.UPDATE)) {
if (cce.getName().equals("enabled") && ConfigBean.toBoolean((String) cce.getObject())){
final HttpListener h = (HttpListener) cce.getClassObject();
final Config c = (Config) ((HttpService) h.parent()).parent();
final VirtualServer vs = getDefaultVirtualServer(h.getDefaultVirtualServer(), c);
if (null != vs && !vs.getState().equals("on")){
result.failed(smh.getLocalString(getClass().getName() + ".cannotUpdateVSNotOn",
"Cannot enable this HttpListener \"{0}\" because its virtual server \"{1}\" has a state other than \"on\" ({2})",
new Object[]{h.getId(), vs.getId(), vs.getState()}));