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

ClusterTest

public class ClusterTest extends com.sun.enterprise.config.serverbeans.validation.GenericValidator

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

        super(desc);
    
Methods Summary
private final voidcheckConfigRefValidity(com.sun.enterprise.config.ConfigContextEvent cce, com.sun.enterprise.config.serverbeans.validation.Result result)

        checkConfigRefValidity(getCluster(cce).getConfigRef(), result);
    
private voidcheckConfigRefValidity(java.lang.String config_ref, com.sun.enterprise.config.serverbeans.validation.Result result)

        if (config_ref.equals(StaticTest.DAS_CONFIG_NAME)){
            result.failed(smh.getLocalString(getClass().getName()+".cannotHaveDASasConfig",
                                             "The configuration of the Domain Administration Server (named {0}) cannot be referenced by a cluster",
                                             new Object[]{StaticTest.DAS_CONFIG_NAME}));
        } else if (config_ref.equals(StaticTest.CONFIG_TEMPLATE_NAME)){
            result.failed(smh.getLocalString(getClass().getName()+".cannotHaveTemplateConfig",
                                             "The default configuration template (named {0}) cannot be referenced by a cluster",
                                             new Object[]{StaticTest.CONFIG_TEMPLATE_NAME}));

        }
    
voidcheckNameNotDomain(com.sun.enterprise.config.ConfigContextEvent cce, com.sun.enterprise.config.serverbeans.validation.Result result)

        final Cluster c = getCluster(cce);
        if ("domain".equals(c.getName())){
            result.failed(smh.getLocalString(getClass().getName() + ".illegalClusterName", 
                                             "Illegal Cluster Name: {0}", new Object[]{c.getName()}));
        }
    
private com.sun.enterprise.config.serverbeans.ClustergetCluster(com.sun.enterprise.config.ConfigContextEvent cce)

        return (Cluster) cce.getValidationTarget();
    
private final voidpreventInvalidConfigRef(com.sun.enterprise.config.ConfigContextEvent cce, com.sun.enterprise.config.serverbeans.validation.Result result)

        if (cce.getName().equals(ServerTags.CONFIG_REF)){
            checkConfigRefValidity((String) cce.getObject(), result);
        }
    
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
        boolean flag = false;
        String choice = cce.getChoice();
        try {
            if (choice.equals(StaticTest.UPDATE)){
                validateUpdate(cce, result);
            } else if (choice.equals(StaticTest.ADD)){
                validateAdd(cce, result);
            }
        }
        catch (ConfigException ce){
            _logger.log(Level.WARNING, "domainxmlverifier.exception", ce);
        }
            
        return result;
    
voidvalidateAdd(com.sun.enterprise.config.ConfigContextEvent cce, com.sun.enterprise.config.serverbeans.validation.Result result)

        checkNameNotDomain(cce, result);
        checkConfigRefValidity(cce, result);
    
voidvalidateUpdate(com.sun.enterprise.config.ConfigContextEvent cce, com.sun.enterprise.config.serverbeans.validation.Result result)

        checkNameNotDomain(cce, result);
        preventInvalidConfigRef(cce, result);