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

TaglibListenerClassExists

public class TaglibListenerClassExists extends WebTest implements WebCheck
Listener class exists tests. Verify that the Listener class exists inside the .tld file and is loadable.
author
Sudipto Ghosh

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

        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        Context context = getVerifierContext();
        Result result = getInitializedResult();
        TagLibDescriptor tlds[] = context.getTagLibDescriptors();
        ClassLoader cl = context.getClassLoader();

        if (tlds == null) {
            addGoodDetails(result, compName);
            result.passed(smh.getLocalString
                    (getClass().getName() + ".passed",
                            "No tag lib files are specified"));
            return result;
        }

        for (TagLibDescriptor tld:tlds) {
            String[] classes = tld.getListenerClasses();
            if(classes != null) {
                for ( String s : classes ) {
                    Class c = null;
                    try {
                        c = Class.forName(s, false, cl);
                    } catch (ClassNotFoundException e) {
                        addErrorDetails(result, compName);
                        result.failed(smh.getLocalString
                                (getClass().getName() + ".failed",
                                        "Taglib listener class [ {0} ] found in " +
                                "[ {1} ] is not loadable ",
                                        new Object[] {s, tld.getUri()}));
                    }
                }
            }
        }
        if (result.getStatus()!=Result.FAILED) {
            addGoodDetails(result, compName);
            result.passed(smh.getLocalString
                    (getClass().getName() + ".passed1",
                            "taglib listener classes, if any, specified in tlds are loadable"));
        }
        return result;