FileDocCategorySizeDatePackage
DomainTest.javaAPI DocGlassfish v2 API5311Fri May 04 22:24:38 BST 2007com.sun.enterprise.config.serverbeans.validation.tests

DomainTest

public class DomainTest extends com.sun.enterprise.config.serverbeans.validation.GenericValidator
Custom Test for Domain Test which calls the Generic Validation before performing custom tests
author
Srinivas Krishnan
version
2.0

Fields Summary
Constructors Summary
public DomainTest(com.sun.enterprise.config.serverbeans.validation.ValidationDescriptor desc)

        super(desc);
    
Methods Summary
public com.sun.enterprise.config.serverbeans.validation.Resultvalidate(com.sun.enterprise.config.ConfigContextEvent cce)

        Result result = super.validate(cce); // Before doing custom validation do basic validation
        
        if(cce.getChoice().equals(StaticTest.ADD) || cce.getChoice().equals(StaticTest.VALIDATE)) {
             Domain domain = (Domain)cce.getObject();
/*
             String locale = domain.getLocale();
             validateAttribute(ServerTags.LOCALE, locale, result);
 */            
             // check for existence of elements groups, node-controllers, lb-configurations, load-balancers
//             if(domain.getClusters() != null)
//                 result.failed(smh.getLocalString(getClass().getName() + ".invalidGroupsElement", 
//                 "Clusters in domain not allowed in PE"));
             
//             if(domain.getLbConfigs() != null)
//                 result.failed(smh.getLocalString(getClass().getName() + ".invalidLoadbalancersElement", 
//                 "Loadbalancers in domain not allowed in PE"));
        }
        
        if(cce.getChoice().equals(StaticTest.UPDATE))
            validateAttribute(cce.getName(), (String)cce.getObject(), result); 
        
        return result;
    
public voidvalidateAttribute(java.lang.String name, java.lang.String value, com.sun.enterprise.config.serverbeans.validation.Result result)


        boolean checked = false;
        if(value == null || value.equals(""))
            return;
        // commented because of performance problem - JDK problem Filed a bug 4908648
        /*if(name.equals(ServerTags.LOCALE)) {
            try {
                Locale[] mLocale = Locale.getAvailableLocales(); 
                for(int i=0;i<mLocale.length;i++) {
                    if(value.equals(mLocale[i].toString())) {
                        checked = true;
                        break;
                    }
                }
            } catch(Exception e) {
                _logger.log(Level.FINE, "domainxmlverifier.error_getting_locale", e);
            }

            if(!checked)
                result.failed(smh.getLocalString(getClass().getName() + ".invalidLocale", 
                "Attribute(locale= {0}) Invalid Locale : {0}", new Object[]{value}));
        }*/