Result result = getInitializedResult();
ComponentNameConstructor compName = new ComponentNameConstructor(descriptor);
SunEjbJar ejbJar = descriptor.getEjbBundleDescriptor().getIasEjbObject();
boolean oneWarning = false;
boolean oneFailed = false;
if(ejbJar!=null)
{
Ejb testCase = getEjb(descriptor.getName(), ejbJar);
String refreshPeriod = testCase.getRefreshPeriodInSeconds();
boolean isReadOnly = false;
String beanType = testCase.getIsReadOnlyBean();
if(beanType!=null && beanType.equals("true"))
isReadOnly = true;
else
isReadOnly=false;
if(refreshPeriod!=null)
{
if(refreshPeriod.length()==0)
{
oneFailed = true;
result.failed(smh.getLocalString(getClass().getName()+".failed3",
"FAILED [AS-EJB ejb] : refresh-period-in-seconds is invalid. It shoud be between 0 and " + Integer.MAX_VALUE));
}
else
{
if(!(descriptor instanceof EjbEntityDescriptor
&& isReadOnly))
{
oneWarning = true;
result.warning(smh.getLocalString(getClass().getName()+".warning",
"WARNING [AS-EJB ejb] : refresh-period-in-seconds should be defined for Read Only Beans."));
}
try
{
int refValue = Integer.parseInt(refreshPeriod);
if(refValue<0 || refValue>Integer.MAX_VALUE)
{
oneFailed = true;
result.failed(smh.getLocalString(getClass().getName()+".failed4",
"FAILED [AS-EJB ejb] : refresh-period-in-seconds cannot be greater than " + Integer.MAX_VALUE +
" or less than 0"));
}
else
result.passed(smh.getLocalString(getClass().getName()+".passed4",
"PASSED [AS-EJB ejb] : refresh-period-in-seconds is {0}",new Object[]{new Integer(refValue)}));
}
catch(NumberFormatException nfex)
{
oneFailed = true;
Verifier.debug(nfex);
result.failed(smh.getLocalString(getClass().getName()+".failed5",
"FAILED [AS-EJB ejb] : refresh-period-in-seconds is invalid. It should be between 0 and "+Integer.MAX_VALUE ));
}
}
}
else
{
if((descriptor instanceof EjbEntityDescriptor)
&& (isReadOnly))
{
result.warning(smh.getLocalString(getClass().getName()+".warning1",
"WARNING [AS-EJB ejb] : refresh-period-in-seconds should be defined for Read Only Beans"));
}
else
{
result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable",
"NOT APPLICABLE [AS-EJB ejb] : refresh-period-in-seconds is not defined"));
}
}
if(oneWarning)
result.setStatus(Result.WARNING);
if(oneFailed)
result.setStatus(Result.FAILED);
}
else
{
result.addErrorDetails(smh.getLocalString
(getClass().getName() + ".notRun",
"NOT RUN [AS-EJB] : Could not create an SunEjbJar object"));
}
return result;