1 23 24 package com.sun.enterprise.tools.verifier.tests.ejb.runtime.beanpool; 25 26 import com.sun.enterprise.deployment.EjbDescriptor; 27 import com.sun.enterprise.tools.verifier.Result; 28 import com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor; 29 import com.sun.enterprise.tools.verifier.Verifier; 30 31 47 48 public class ASEjbBPPoolIdleTime extends ASEjbBeanPool 49 { 50 51 public Result check(EjbDescriptor descriptor) 52 { 53 Result result = getInitializedResult(); 54 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 55 String pool = null; 56 String poolIdleTimeout = null; 57 try 58 { 59 pool = getXPathValue("/sun-ejb-jar/enterprise-beans/ejb[ejb-name=\""+descriptor.getName()+"\"]/bean-pool"); 60 if (pool!=null) 61 { 62 poolIdleTimeout = getXPathValue("/sun-ejb-jar/enterprise-beans/ejb[ejb-name=\""+descriptor.getName()+"\"]/bean-pool/pool-idle-timeout-in-seconds"); 63 try{ 64 if (poolIdleTimeout!=null) 65 { 66 poolIdleTimeout = poolIdleTimeout.trim(); 67 if (poolIdleTimeout.length()==0) 68 { 69 addErrorDetails(result, compName); 70 result.failed(smh.getLocalString(getClass().getName()+".failed", 71 "FAILED [AS-EJB bean-pool] : pool-idle-timeout-in-seconds cannot be empty")); 72 73 }else 74 { 75 long value = new Integer (poolIdleTimeout).longValue(); 76 if(value < 0 || value > Long.MAX_VALUE) 77 { 78 addErrorDetails(result, compName); 79 result.failed(smh.getLocalString(getClass().getName()+".failed1", 80 "FAILED [AS-EJB bean-pool] : pool-idle-timeout-in-seconds cannot be {0}. It should be between 0 and {1}", 81 new Object []{new Long (value),new Long (Long.MAX_VALUE)})); 82 } 83 else 84 { 85 addGoodDetails(result, compName); 86 result.passed(smh.getLocalString(getClass().getName()+".passed", 87 "PASSED [AS-EJB bean-pool] : pool-idle-timeout-in-seconds is {0}", 88 new Object []{new Long (value)})); 89 } 90 } 91 }else { 93 addNaDetails(result, compName); 94 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable", 95 "NOT APPLICABLE [AS-EJB bean-pool] : pool-idle-timeout-in-seconds element not defined")); 96 } 97 }catch(NumberFormatException nfex){ 98 Verifier.debug(nfex); 99 addErrorDetails(result, compName); 100 result.failed(smh.getLocalString(getClass().getName()+".failed2", 101 "FAILED [AS-EJB bean-pool] : The value [ {0} ] for pool-idle-timeout-in-seconds is not a valid Integer number",new Object []{poolIdleTimeout})); 102 103 104 } 105 106 }else { 108 addNaDetails(result, compName); 109 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable1", 110 "NOT APPLICABLE [AS-EJB] : bean-pool element not defined")); 111 } 112 113 }catch (Exception ex){ 114 addErrorDetails(result, compName); 115 result.addErrorDetails(smh.getLocalString 116 (getClass().getName() + ".notRun", 117 "NOT RUN [AS-EJB] : Could not create the descriptor object")); 118 } 119 return result; 120 } 121 } | Popular Tags |