FileDocCategorySizeDatePackage
ASEjbBCMaxCacheSize.javaAPI DocGlassfish v2 API6352Fri May 04 22:34:06 BST 2007com.sun.enterprise.tools.verifier.tests.ejb.runtime.beancache

ASEjbBCMaxCacheSize

public class ASEjbBCMaxCacheSize extends ASEjbBeanCache
ejb [0,n] bean-cache ? max-cache-size ? [String] is-cache-overflow-allowed ? [String] cache-idle-timout-in-seconds ? [String] removal-timeout-in-seconds ? [String] victim-selection-policy ? [String] The max-cache-size specifies the maximum number of beans in the cache. Valid values are between 1 and MAX_INT
author
Irfan Ahmed

Fields Summary
Constructors Summary
Methods Summary
public com.sun.enterprise.tools.verifier.Resultcheck(com.sun.enterprise.deployment.EjbDescriptor descriptor)


	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;