FileDocCategorySizeDatePackage
TaglibLocation.javaAPI DocGlassfish v2 API4346Fri May 04 22:34:10 BST 2007com.sun.enterprise.tools.verifier.tests.web

TaglibLocation

public class TaglibLocation extends Taglib implements WebCheck
Must check for the existence of the tld file.
author
Arun Jain

Fields Summary
Constructors Summary
Methods Summary
public Resultcheck(WebBundleDescriptor descriptor)
.tld file exists test.

param
descriptor the Web deployment descriptor
return
Result the results for this assertion


	Result result = getInitializedResult();
	ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        boolean passed = true;
        TagLibConfigurationDescriptor taglibDescriptor;
        String taglibLocation;  
        Enumeration taglibConfig = (new Vector()).elements();
        if (descriptor.getJspConfigDescriptor() != null) {
            taglibConfig = descriptor.getJspConfigDescriptor().getTagLibs();
        }

        if (taglibConfig.hasMoreElements()){
            while (taglibConfig.hasMoreElements()) {           
                // test all the Tag lib descriptors.
                taglibDescriptor =  (TagLibConfigurationDescriptor) taglibConfig.nextElement();
                taglibLocation = taglibDescriptor.getTagLibLocation();
                if(passed == false)
                    check(descriptor, taglibLocation, result);
                else
                    passed = check(descriptor, taglibLocation, result);         
            }
        } else {
	    result.addNaDetails(smh.getLocalString
				       ("tests.componentNameConstructor",
					"For [ {0} ]",
					new Object[] {compName.toString()}));
            result.notApplicable(smh.getLocalString
                                 (getClass().getName() + ".notApplicable",
                                  "There are no TagLibConfigurationDescriptors within the web archive [ {0} ]",
                                  new Object[] {descriptor.getName()}));
            result.setStatus(Result.NOT_APPLICABLE);       
            return result;
            
        } 
        
        if ( passed) {
            result.setStatus(Result.PASSED);       
        }  else {
            result.setStatus(Result.FAILED);
         }
        
        return result;