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

TaglibUri

public class TaglibUri extends Taglib implements WebCheck
Must check for the existence of the tag library relative to the web.xml.
author
Arun Jain

Fields Summary
Constructors Summary
Methods Summary
public Resultcheck(WebBundleDescriptor descriptor)
Tag library existence test.

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


	Result result = getInitializedResult();
	ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        boolean failed = false;
        TagLibConfigurationDescriptor taglibDescriptor;
        String taglibUri;
        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();
                taglibUri = taglibDescriptor.getTagLibURI();
		if (taglibUri.equals("")) {
		    failed = true;
		    result.addErrorDetails(smh.getLocalString
				       ("tests.componentNameConstructor",
					"For [ {0} ]",
					new Object[] {compName.toString()}));
		    result.addErrorDetails(smh.getLocalString
					   (getClass().getName() + ".failed",
					    "Error:  taglib-uri should not be an empty string."));
		    result.setStatus(Result.FAILED);
		    return result;         
		}
            }
	    if (failed == false) {
		result.addGoodDetails(smh.getLocalString
				       ("tests.componentNameConstructor",
					"For [ {0} ]",
					new Object[] {compName.toString()}));
		result.addGoodDetails(smh.getLocalString
                                      (getClass().getName() + ".passed",
                                       "taglib-uri element is a non-empty string."));
		result.setStatus(Result.PASSED);
	    } else {
		result.setStatus(Result.FAILED);
	    }
	    return 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;
                
        }