1 23 24 31 32 package com.sun.enterprise.admin.verifier.tests; 33 34 37 38 39 import com.sun.enterprise.config.serverbeans.Server; 42 import com.sun.enterprise.config.serverbeans.*; 43 import com.sun.enterprise.config.serverbeans.Resources; 44 import com.sun.enterprise.config.serverbeans.Applications; 45 import com.sun.enterprise.config.ConfigContext; 46 import com.sun.enterprise.config.ConfigException; 47 import com.sun.enterprise.config.serverbeans.*; 48 import com.sun.enterprise.config.ConfigContextEvent; 49 50 import com.sun.enterprise.admin.verifier.*; 51 52 import java.util.logging.Logger ; 54 import java.util.logging.Level ; 55 import com.sun.logging.LogDomains; 56 57 58 public class ApplicationsTest extends ServerXmlTest implements ServerCheck { 59 60 static Logger _logger = LogDomains.getLogger(LogDomains.APPVERIFY_LOGGER); 62 63 public ApplicationsTest() { 64 } 65 66 public Result check(ConfigContext context) { 68 Result result; 69 result = super.getInitializedResult(); 70 91 return result; 92 } 93 94 public Result check(ConfigContextEvent ccce) { 96 Object value = ccce.getObject(); 97 ConfigContext context = ccce.getConfigContext(); 98 Result result = new Result(); 99 result.passed("Passed ** "); 100 String beanName = ccce.getBeanName(); 101 if(beanName!=null) { 102 String name = ccce.getName(); 103 if(name != null && value != null) 104 result = validateAttribute(name, (String )value); 105 return result; 106 } 107 108 return result; 109 } 110 111 public Result validateAttribute(String name, String value) { 112 boolean failed = false; 113 Result result = new Result(); 114 result.passed("Passed **"); 115 if(name.equals(ServerTags.DYNAMIC_RELOAD_POLL_INTERVAL_IN_SECONDS)) { 116 try { 117 if(Integer.parseInt(value) < 0) { 118 result.failed(smh.getLocalString(getClass().getName()+ ".reloadNegative","Reload Poll Interval cannot be negative number")); 120 failed = true; 121 } 122 else 123 result.passed("passed ***"); 124 } catch(NumberFormatException e) { 125 result.failed(smh.getLocalString(getClass().getName()+".reloadInvalid","Reload Poll Interval : invalid number")); 127 failed = true; 128 } 129 } 130 if(failed) 131 result.setStatus(Result.FAILED); 132 return result; 133 } 134 135 } 136 | Popular Tags |