Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
String beanCache = null;
String maxCacheSize = null;
try
{
beanCache = getXPathValue("/sun-ejb-jar/enterprise-beans/ejb[ejb-name=\""+descriptor.getName()+"\"]/bean-cache");
if(beanCache!=null)
{
maxCacheSize=getXPathValue("/sun-ejb-jar/enterprise-beans/ejb[ejb-name=\""+descriptor.getName()+"\"]/bean-cache/max-cache-size");
if(maxCacheSize!=null)
{
maxCacheSize=maxCacheSize.trim();
if(maxCacheSize.length()==0)
{
addErrorDetails(result, compName);
result.failed(smh.getLocalString(getClass().getName()+".failed1",
"FAILED [AS-EJB bean-pool] : max-cache-size cannot be empty"));
}else
{
try{
int cacheValue=new Integer(maxCacheSize).intValue();
if(cacheValue <= 1 || cacheValue > Integer.MAX_VALUE)
{
addErrorDetails(result, compName);
result.failed(smh.getLocalString(getClass().getName()+".failed",
"FAILED [AS-EJB bean-cache] : max-cache-size should be greater than 1 and less than MAX_INT"));
}
else
{
addGoodDetails(result, compName);
result.passed(smh.getLocalString(getClass().getName()+".passed",
"PASSED [AS-EJB bean-cache] : max-cache-size is {0}",new Object[]{(new Integer(maxCacheSize))}));
}
}catch(NumberFormatException nfex)
{
Verifier.debug(nfex);
addErrorDetails(result, compName);
result.failed(smh.getLocalString(getClass().getName()+".failed2",
"FAILED [AS-EJB bean-pool] : The value {0} for max-pool-size is not a valid Integer number",new Object[]{maxCacheSize}));
}
}
}else //max-cache-size not defined
{
addNaDetails(result, compName);
result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable",
"NOT APPLICABLE [AS-EJB bean-cache] : max-cache-size is element not defined"));
}
}else //bean-cache element is not present
{
addNaDetails(result, compName);
result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable1",
"NOT APPLICABLE [AS-EJB] : bean-cache element not defined"));
}
}catch(Exception ex){
addErrorDetails(result, compName);
result.addErrorDetails(smh.getLocalString
(getClass().getName() + ".notRun",
"NOT RUN [AS-EJB] : Could not create the descriptor object"));
}
return result;