KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > verifier > tests > web > Taglib


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23 package com.sun.enterprise.tools.verifier.tests.web;
24
25 import com.sun.enterprise.deployment.*;
26 import java.io.*;
27 import com.sun.enterprise.tools.verifier.Result;
28 import com.sun.enterprise.tools.verifier.tests.*;
29
30 /**
31  * @author Arun Jain
32  *
33  */

34 public abstract class Taglib extends WebTest {
35     
36     
37     /**
38      * @param descriptor the Web deployment descriptor
39      * @return <code>Result</code> the results for this assertion
40      */

41     public boolean check(WebBundleDescriptor descriptor, String JavaDoc taglibEntry, Result result) {
42         
43         ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
44         String JavaDoc uri = getAbstractArchiveUri(descriptor);
45         
46         if (taglibEntry.startsWith("/"))
47             taglibEntry = taglibEntry.substring(1);
48         else taglibEntry = "WEB-INF/" + taglibEntry;
49         File tlf = new File(uri + File.separator + taglibEntry);
50         if (tlf.exists()) {
51             result.addGoodDetails(smh.getLocalString
52                     ("tests.componentNameConstructor",
53                             "For [ {0} ]",
54                             new Object JavaDoc[] {compName.toString()}));
55             result.addGoodDetails(smh.getLocalString
56                     (getClass().getName() + ".passed",
57                             "Tag library/.tld file exist in web application."));
58             return true;
59         }
60         result.addErrorDetails(smh.getLocalString
61                 ("tests.componentNameConstructor",
62                         "For [ {0} ]",
63                         new Object JavaDoc[] {compName.toString()}));
64         result.addErrorDetails(smh.getLocalString
65                 (getClass().getName() + ".failed",
66                         "[ {0} ] is not a valid tld location.", new Object JavaDoc[] {taglibEntry}));
67         return false;
68     }
69 }
70
Popular Tags