Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
String beanCache = null;
String victimPolicy = null;
try{
beanCache = getXPathValue("/sun-ejb-jar/enterprise-beans/ejb[ejb-name=\""+descriptor.getName()+"\"]/bean-cache");
if(beanCache!=null)
{
victimPolicy = getXPathValue("/sun-ejb-jar/enterprise-beans/ejb[ejb-name=\""+descriptor.getName()+"\"]/bean-cache/victim-selection-policy");
if(victimPolicy!=null)
{
victimPolicy = victimPolicy.trim();
if(victimPolicy.length()==0)
{
addErrorDetails(result, compName);
result.failed(smh.getLocalString(getClass().getName()+".failed",
"FAILED [AS-EJB bean-cache] : victim-selection-policy cannot be empty. It has to be either FIFO, NRU or LRU"));
}else
{
if(!victimPolicy.equalsIgnoreCase("FIFO") && !victimPolicy.equalsIgnoreCase("NRU")
&& !victimPolicy.equalsIgnoreCase("LRU"))
{
addErrorDetails(result, compName);
result.failed(smh.getLocalString(getClass().getName()+".failed1",
"FAILED [AS-EJB bean-cache] : victim-selection-policy cannot be [{0}]. It should be either FIFO, NRU or LRU [case insensitive]",
new Object[]{victimPolicy}));
}
else
{
addGoodDetails(result, compName);
result.passed(smh.getLocalString(getClass().getName()+".passed",
"PASSED [AS-EJB bean-cache] : victim-selection-policy is {0}",
new Object[]{victimPolicy}));
}
}
}else //victim-selection-policy not defined
{
addNaDetails(result, compName);
result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable",
"NOT APPLICABLE [AS-EJB bean-cache] : victim-selection-policy element not defined"));
}
}else //bean-cache is not defined
{
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;