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

ProfilerTest

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

Fields Summary
Constructors Summary
public ProfilerTest(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.VALIDATE)) {
            Profiler profiler = (Profiler) cce.getObject();
            validateAttribute(ServerTags.CLASSPATH, profiler.getClasspath(), result);
            JvmOptionsTest.validateJvmOptions(profiler.getJvmOptions(), result);
        }
        
        if(cce.getChoice().equals(StaticTest.UPDATE))  {
            validateAttribute(cce.getName(), (String) cce.getObject(), result);
        }
        else if(cce.getChoice().equals(StaticTest.SET))  {
           final String name = cce.getName();
           /*
            * JvmOptions is an element in domain xml. Hence for JvmOptions we
            * need to use camelized name even thouth it is treated as an 
            * attribute.
            */
            if (name.equals("JvmOptions")) {
                JvmOptionsTest.validateJvmOptions((String[])cce.getObject(), result);
            }
        }
        return result;
    
public voidvalidateAttribute(java.lang.String name, java.lang.String value, com.sun.enterprise.config.serverbeans.validation.Result result)

        
        if(value == null || value.equals(""))
            return;
        if(name.equals(ServerTags.CLASSPATH)) {
            if(!StaticTest.isClassPathValid(value)) {
                result.failed(smh.getLocalString(getClass().getName() + ".invalidProfilerClasspath",
                   "Attribute:(classpath={0}), Invalid path in classpath", new Object[]{value}));
            }
        }