KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > verifier > app > ApplicationVerifier


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.app;
24
25 import com.sun.enterprise.deployment.Application;
26 import com.sun.enterprise.deployment.Descriptor;
27 import com.sun.enterprise.tools.verifier.BaseVerifier;
28 import com.sun.enterprise.tools.verifier.CheckMgr;
29 import com.sun.enterprise.tools.verifier.FrameworkContext;
30
31 /**
32  * @author Vikas Awasthi
33  */

34 public class ApplicationVerifier extends BaseVerifier {
35
36     private Application application = null;
37
38     public ApplicationVerifier(FrameworkContext frameworkContext,
39                                Application application) {
40         this.frameworkContext = frameworkContext;
41         this.application = application;
42     }
43
44     /**
45      * Responsible for running application based verifier tests on the the web archive.
46      * Called from runVerifier in {@link BaseVerifier} class.
47      *
48      * @throws Exception
49      */

50     public void verify() throws Exception JavaDoc {
51         if (areTestsNotRequired(frameworkContext.isApp()) &&
52                 areTestsNotRequired(frameworkContext.isPersistenceUnits()))
53             return;
54         preVerification();
55         if(frameworkContext.isPortabilityMode())
56             application.setClassLoader(context.getClassLoader());
57         CheckMgr checkMgrImpl = new AppCheckMgrImpl(frameworkContext);
58         verify(application, checkMgrImpl);
59     }
60
61     public Descriptor getDescriptor() {
62         return application;
63     }
64
65     protected ClassLoader JavaDoc createClassLoader() {
66         return application.getClassLoader();
67     }
68
69     /**
70      * @return String archive base
71      */

72     protected String JavaDoc getArchiveUri() {
73         return frameworkContext.getJarFileName();
74     }
75
76     protected String JavaDoc[] getDDString() {
77         String JavaDoc dd[] = {"META-INF/sun-application.xml", // NOI18N
78
"META-INF/application.xml"}; // NOI18N
79
return dd;
80     }
81
82     protected String JavaDoc getClassPath() {
83         return null;
84     }
85 }
86
Popular Tags