1 23 24 31 32 package com.sun.enterprise.admin.verifier.tests; 33 34 40 41 42 import java.io.File ; 43 44 import com.sun.enterprise.config.serverbeans.Server; 47 import com.sun.enterprise.config.serverbeans.*; 48 import com.sun.enterprise.config.serverbeans.Resources; 49 import com.sun.enterprise.config.serverbeans.Applications; 50 import com.sun.enterprise.config.ConfigContext; 52 import com.sun.enterprise.config.ConfigException; 53 import com.sun.enterprise.config.serverbeans.*; 54 import com.sun.enterprise.config.ConfigContextEvent; 55 56 import com.sun.enterprise.admin.verifier.*; 57 import java.util.logging.Logger ; 59 import java.util.logging.Level ; 60 import com.sun.logging.LogDomains; 61 62 public class JavaConfigTest extends ServerXmlTest implements ServerCheck { 63 64 static Logger _logger = LogDomains.getLogger(LogDomains.APPVERIFY_LOGGER); 66 67 public JavaConfigTest() { 68 } 69 70 public Result check(ConfigContext context) { 73 Result result; 74 result = super.getInitializedResult(); 75 return result; 76 } 77 78 public Result check(ConfigContextEvent ccce) { 80 Object value = ccce.getObject(); 81 ConfigContext context = ccce.getConfigContext(); 82 Result result = new Result(); 83 result.passed("Passed ** "); 84 String beanName = ccce.getBeanName(); 85 if(beanName!=null) { 86 String name = ccce.getName(); 87 result = validateAttribute(name, (String )value); 88 } 89 return result; 90 } 91 92 public Result validateAttribute(String name, String value) { 93 Result result = new Result(); 94 result.passed("Passed **"); 95 96 if( name != null && name.equals( ServerTags.JAVA_HOME ) ) { 97 98 if( value == null ) { 99 result.failed( "Java Home value is null" ); 100 return( result ); 101 } 102 103 104 String jreDir = value + File.separator + "jre"; 105 try { 106 File f = new File ( jreDir ); 107 if( ! f.isDirectory() ) { 108 result.failed( "Invalid Java Home: " 109 + "Could not find the jre directory under " 110 + value ); 111 return( result ); 112 } 113 } 114 catch( Exception e ) { 115 result.failed( e.getMessage() ); 116 return( result ); 117 } 118 119 } 120 return( result ); 121 } 122 } 123 | Popular Tags |