public Result validate(ConfigContextEvent cce) {
Result result = super.validate(cce); // Before doing custom validation do basic validation
try{
if(cce.getChoice().equals(StaticTest.ADD) || cce.getChoice().equals(StaticTest.VALIDATE)) {
ConfigContext context = cce.getConfigContext();
VirtualServer virtual = (VirtualServer) cce.getValidationTarget();
// For an ADD operation the virtual server is being
// added to an http-service, which is the
// configcontextevents class object. Therefore the config is
// the parent of the class object:
final Config config = (Config) ((HttpService) cce.getClassObject()).parent();
validateAttribute(ServerTags.HTTP_LISTENERS,virtual.getHttpListeners(),config, result);
//validateAttribute(ServerTags.HOSTS,virtual.getHosts(),config, result);
} else if(cce.getChoice().equals("UPDATE")) {
// For an UPDATE operation the class object is the
// virtual server whose attributes are being
// updated. Therefore the config is the parent of the
// parent of this object:
final VirtualServer vs = (VirtualServer) cce.getClassObject();
final Config config = (Config) vs.parent().parent();
String name = cce.getName();
String value = (String) cce.getObject();
validateAttribute(name,value,config, result);
// IF the state is being turned off then this can only
// occur if there's no http-listener which has this