1 23 24 package com.sun.enterprise.admin.verifier.tests; 25 26 33 34 import java.net.*; 35 36 39 40 import com.sun.enterprise.config.serverbeans.Server; 43 import com.sun.enterprise.config.serverbeans.*; 44 import com.sun.enterprise.config.serverbeans.Resources; 45 import com.sun.enterprise.config.serverbeans.Applications; 46 import com.sun.enterprise.config.ConfigContext; 47 import com.sun.enterprise.config.ConfigContextEvent; 48 import com.sun.enterprise.config.ConfigException; 49 import com.sun.enterprise.config.serverbeans.*; 50 51 import com.sun.enterprise.admin.verifier.*; 52 import java.util.logging.Logger ; 54 import java.util.logging.Level ; 55 import com.sun.logging.LogDomains; 56 57 58 public class OrbTest extends ServerXmlTest implements ServerCheck { 59 static Logger _logger = LogDomains.getLogger(LogDomains.APPVERIFY_LOGGER); 61 62 public static final String ERROR_MSG = "Message Fragment Size can be only 1024, 2048, 4096, 8192, 16284 or 32568"; 63 64 public OrbTest() { 65 } 66 67 public Result check(ConfigContext context) 69 { 70 Result result; 71 String msgFragmentSize = null; 72 73 result = super.getInitializedResult(); 74 131 135 return result; 136 } 137 138 public Result check(ConfigContextEvent ccce) { 140 Result result = new Result(); 141 result.passed("Passed **"); 142 143 Object value = ccce.getObject(); 144 String choice = ccce.getChoice(); 145 ConfigContext context = ccce.getConfigContext(); 146 String beanName = ccce.getBeanName(); 147 String msgFragmentSize = null; 148 149 if(beanName!=null) 150 return validateAttribute(ccce.getName(), ccce.getObject()); 151 152 return result; 153 } 154 155 public Result validateAttribute(String name, Object value) { 156 Result result = new Result(); 157 result.passed("Passed **"); 158 String msgFragmentSize = null; 159 160 if(name.equals(ServerTags.MESSAGE_FRAGMENT_SIZE)) { 161 try { 162 msgFragmentSize = (String ) value; 163 int size = Integer.parseInt(msgFragmentSize); 164 165 int kSize = size/1024; 166 int remainder = size%1024; 167 168 if (remainder != 0) { 169 result.failed(ERROR_MSG); 170 } 171 else if (!((kSize == 1) || (kSize == 2) || (kSize == 4) || (kSize == 8) || (kSize == 16) || (kSize == 32))) { 172 result.failed(ERROR_MSG); 173 } else result.passed("Vaild Message Fragment Size"); 174 } catch (NumberFormatException nfe) { 175 result.failed("Message Fragment Size - " + msgFragmentSize + " : Invalid"); 176 } 177 } 178 if(name.equals(ServerTags.MAX_CONNECTIONS)) { 179 try { 180 if(value != null) { 181 String conn = (String ) value; 182 if(Integer.parseInt(conn) < 0) { 183 result.failed(smh.getLocalString(getClass().getName()+".maxConnNegative","Max Connections cannot be negative number")); 184 } 185 else 186 result.passed("Passed ***"); 187 188 } 189 } catch(NumberFormatException e) { 190 result.failed(smh.getLocalString(getClass().getName()+".maxConnInvalid","Max Connections : invalid number")); 191 } 192 } 193 return result; 195 } 196 } 197 | Popular Tags |