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

SslTest

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

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

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

        _logger.log(Level.CONFIG, "SsltTest performing set check");
        _logger.log(Level.FINER, "SsltTest set - parent's class is \""+cce.getClassObject().getClass().getName()+"\"");
        _logger.log(Level.FINER, "SsltTest set - ssl objects ssl2enabled attribute is set: \""+((Ssl) cce.getObject()).isSsl2Enabled()+"\"");
        if (cce.getClassObject() instanceof IiopListener
            && ((Ssl) cce.getObject()).isSsl2Enabled()){
            _logger.log(Level.FINER, "SsltTest set check - parent is an iiop-listener, and ssl2enabled attribute is being set to true");
            ssl2NotAllowed(result);
        }
        return result;
    
private com.sun.enterprise.config.serverbeans.validation.ResultperformUpdateChecks(com.sun.enterprise.config.serverbeans.validation.Result result, com.sun.enterprise.config.ConfigContextEvent cce)

        final ConfigBean co = (ConfigBean) cce.getClassObject();
        final String parentsDtdName = ((ConfigBean) co.parent()).dtdName();
        _logger.log(Level.FINEST, "SslTest update - parent's DTD name is \""+parentsDtdName+"\"");

        _logger.log(Level.FINEST, "SslTest update - attribute name is \""+cce.getName()+"\"");
        _logger.log(Level.FINEST, "SslTest update - attribute value is \""+cce.getObject()+"\"");

        if (parentsDtdName.equals(ServerTags.IIOP_LISTENER)
            && cce.getName().equals(ServerTags.SSL2_ENABLED)
            && ((String) cce.getObject()).equalsIgnoreCase("true")){
            _logger.log(Level.FINER, "SslTest update check - parent is an iiop-listener, and ssl2enabled attribute is being set to true");
            ssl2NotAllowed(result);
        }
        return result;
    
private voidssl2NotAllowed(com.sun.enterprise.config.serverbeans.validation.Result result)

        _logger.log(Level.CONFIG, "SslTest - an invalid attempt to enable ssl2 has been found. Returning an error");
        result.failed(smh.getLocalString(getClass().getName()+".ssl2NotAllowed",
                                         "ssl2 cannot be enabled for an iiop-listener"));
    
public com.sun.enterprise.config.serverbeans.validation.Resultvalidate(com.sun.enterprise.config.ConfigContextEvent cce)

        _logger.log(Level.CONFIG, "SslTest validation");
        
        final Result result = super.validate(cce); // Before doing custom validation do basic validation
        
        final String choice = cce.getChoice();
        if(choice.equals(StaticTest.UPDATE)) {
            return performUpdateChecks(result, cce);
        } else if (choice.equals(StaticTest.SET)) {
            return performSetChecks(result,cce);
        }
        return result;