FileDocCategorySizeDatePackage
JavaConfigTest.javaAPI DocGlassfish v2 API5031Fri May 04 22:34:10 BST 2007com.sun.enterprise.admin.verifier.tests

JavaConfigTest

public class JavaConfigTest extends ServerXmlTest implements ServerCheck
Test case to check the validity of the JavaConfig fields
author
Venky TV
version
$Revision: 1.4 $

Fields Summary
static Logger
_logger
Constructors Summary
public JavaConfigTest()

    
      
    
Methods Summary
public Resultcheck(com.sun.enterprise.config.ConfigContext context)

            Result result;
            result = super.getInitializedResult();
            return result;
    
public Resultcheck(com.sun.enterprise.config.ConfigContextEvent ccce)

        Object value = ccce.getObject();
        ConfigContext context = ccce.getConfigContext();
        Result result = new Result();
        result.passed("Passed ** ");
        String beanName = ccce.getBeanName();
        if(beanName!=null) {
            String name = ccce.getName();
            result = validateAttribute(name, (String)value);
        }
        return result;
    
public ResultvalidateAttribute(java.lang.String name, java.lang.String value)

        Result result = new Result();
        result.passed("Passed **");

        if( name != null && name.equals( ServerTags.JAVA_HOME ) ) {

            if( value == null ) {
                result.failed( "Java Home value is null" );
                return( result );
            }

            /* Check if <java-home>/jre is a valid directory */
            String jreDir = value + File.separator + "jre";
            try {
                File f = new File( jreDir );
                if( ! f.isDirectory() ) {
                    result.failed( "Invalid Java Home: "
                            + "Could not find the jre directory under "
                            + value  );
                    return( result );
                }
            }
            catch( Exception e ) {
                result.failed( e.getMessage() );
                return( result );
            }

        }
        return( result );