KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > verifier > Context


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
24 package com.sun.enterprise.tools.verifier;
25
26
27 import com.sun.enterprise.tools.verifier.web.FacesConfigDescriptor;
28 import org.w3c.dom.Document JavaDoc;
29
30 import com.sun.enterprise.deployment.deploy.shared.AbstractArchive;
31 import com.sun.enterprise.deployment.deploy.shared.Archive;
32 import com.sun.enterprise.deployment.EjbDescriptor;
33 import com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompiler;
34 import com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor;
35 import com.sun.jdo.spi.persistence.support.ejb.ejbc.JDOCodeGenerator;
36
37 import java.io.File JavaDoc;
38
39 /**
40  * <p/>
41  * This class provides the classloader to all the tests.
42  * </p>
43  *
44  * @author Sheetal Vartak
45  */

46 public class Context {
47
48     private ClassLoader JavaDoc classLoader = null;
49
50     private ClassLoader JavaDoc altClassLoader = null;
51
52     //start IASRI 4725528
53
private boolean isAppserverMode = false;
54     //end IASRI 4725528
55

56     // provides the abstract archive for use by tests which cannot get the
57
// physical EAR file
58
private AbstractArchive archive = null;
59
60     // this represents the archive that represents the module jar/war/rar.
61
private Archive moduleArchive;
62
63     // added for webservice clients to store current ejbdescriptor
64
// which contains the service-ref
65
private EjbDescriptor ejbdesc = null;
66
67     private boolean isXMLBasedOnSchema = false;
68     private String JavaDoc stdAloneUri = null;
69     private Document JavaDoc runtimeDoc = null;
70     private Document JavaDoc doc = null;
71     private Document JavaDoc webservicedoc = null;
72     private Throwable JavaDoc JDOExceptionObject = null;
73     private TagLibDescriptor[] taglibDescriptors = null;
74     private FacesConfigDescriptor facesConfigDescriptor = null;
75 // private Verifier verifier;
76
// the JDO codegenerator instance to be used by tests
77
// set from EJBCheckMgr
78
private JDOCodeGenerator jdc = null;
79     private ClosureCompiler cc;
80     private String JavaDoc classPath;//used by JspC. See AllJSPsMustBeCompilable test
81
private File JavaDoc outDir;//used by AllJSPsMustBeCompilable & WebArchiveClassesLoadable
82
// This represent's component's schema version.
83
private String JavaDoc schemaVersion="";
84
85     // this denotes the corresponding Java EE version.
86
private String JavaDoc javaEEVersion;
87
88     // denotes the name of the component. Used in each test for reporting
89
private ComponentNameConstructor compName;
90
91     public Context() {
92         classLoader = null;
93     }
94
95     public Context(ClassLoader JavaDoc classLoader) {
96         this.classLoader = classLoader;
97     }
98
99     public ClassLoader JavaDoc getClassLoader() {
100         return classLoader;
101     }
102
103     public void setClassLoader(ClassLoader JavaDoc classLoader) {
104         this.classLoader = classLoader;
105     }
106
107     public ClassLoader JavaDoc getRarClassLoader() {
108         return classLoader;
109     }
110
111     public void setRarClassLoader(ClassLoader JavaDoc classLoader) {
112         this.classLoader = classLoader;
113     }
114
115     //start IASRI 4725528
116
public void setAppserverMode(boolean isBackend) {
117         this.isAppserverMode = isBackend;
118     }
119
120     public boolean isAppserverMode() {
121         return isAppserverMode;
122     }
123     //end IASRI 4725528
124

125     public void setAbstractArchive(AbstractArchive arch) {
126         archive = arch;
127     }
128
129     /**
130      * Retrieve the Abstract Archive file in test
131      *
132      * @return <code>String</code> handle to current application .ear file
133      */

134     public AbstractArchive getAbstractArchive() {
135         return archive;
136     }
137
138     /**
139      * Added for WebServices Client verification
140      *
141      * @return The <code>EjbDescriptor</code> for the current ServiceReferenceDescriptor
142      * being validated by tests
143      */

144     public EjbDescriptor getEjbDescriptorForServiceRef() {
145         return ejbdesc;
146     }
147
148     /**
149      * Added for WebServices Client verification
150      * SET The <code>EjbDescriptor</code> for the current ServiceReferenceDescriptor
151      * being validated by tests
152      */

153     public void setEjbDescriptorForServiceRef(EjbDescriptor desc) {
154         ejbdesc = desc;
155     }
156
157     public void setAlternateClassLoader(ClassLoader JavaDoc l) {
158         altClassLoader = l;
159     }
160
161     public ClassLoader JavaDoc getAlternateClassLoader() {
162         return altClassLoader;
163     }
164
165     public boolean getisXMLBasedOnSchema() {
166         return isXMLBasedOnSchema;
167     }
168 //
169
// public void setisXMLBasedOnSchema(boolean value) {
170
// isXMLBasedOnSchema = value;
171
// }
172

173     /*
174      *getRuntimeDocument()
175      * returns the document object created for runtime descriptor
176      */

177     public Document JavaDoc getRuntimeDocument() {
178         return runtimeDoc;
179     }
180
181     /*
182      *setRuntimeDocement(Document value)
183      */

184     public void setRuntimeDocument(Document JavaDoc value) {
185         runtimeDoc = value;
186     }
187
188     /*
189      *getDocument()
190      * returns the document object created for runtime descriptor
191      */

192     public Document JavaDoc getDocument() {
193         return doc;
194     }
195
196     /*
197      *setDocement(Document value)
198      */

199     public void setDocument(Document JavaDoc value) {
200         doc = value;
201     }
202
203     /* get the document object for webservices.xml
204      * setWebServiceDocement(Document value)
205      */

206
207     public Document JavaDoc getWebServiceDocument() {
208         return webservicedoc;
209     }
210
211     /*Set the document object of webservices.xml
212      *setWebServiceDocement(Document value)
213      */

214     public void setWebServiceDocument(Document JavaDoc value) {
215         webservicedoc = value;
216     }
217
218     public String JavaDoc getStdAloneArchiveURI() {
219         return stdAloneUri;
220
221     }
222
223     public void setStdAloneArchiveURI(String JavaDoc uri) {
224         stdAloneUri = uri;
225     }
226
227     public void setJDOCodeGenerator(JDOCodeGenerator gen) {
228         jdc = gen;
229     }
230
231     public JDOCodeGenerator getJDOCodeGenerator() {
232         return jdc;
233     }
234
235     public void setJDOException(Throwable JavaDoc ex) {
236         JDOExceptionObject = ex;
237     }
238
239     public Throwable JavaDoc getJDOException() {
240         return JDOExceptionObject;
241     }
242
243     public void setTagLibDescriptors(TagLibDescriptor[] tld) {
244         taglibDescriptors = tld;
245     }
246
247     public TagLibDescriptor[] getTagLibDescriptors() {
248         return taglibDescriptors;
249     }
250
251     public void setFacesConfigDescriptor(FacesConfigDescriptor d) {
252         facesConfigDescriptor = d;
253     }
254
255     public FacesConfigDescriptor getFacesConfigDescriptor() {
256         return facesConfigDescriptor;
257     }
258     
259 // public Verifier getVerifier () {
260
// return verifier;
261
// }
262
//
263
// public void setVerifier(Verifier verifier) {
264
// this.verifier = verifier;
265
// }
266

267     public void setClosureCompiler(ClosureCompiler cc) {
268         this.cc = cc;
269     }
270
271     public ClosureCompiler getClosureCompiler() {
272         return cc;
273     }
274
275     public String JavaDoc getClassPath() {
276         return classPath;
277     }
278
279     public void setClassPath(String JavaDoc cp) {
280         classPath = cp;
281     }
282
283     public File JavaDoc getOutDir() {
284         return outDir;
285     }
286
287     public void setOutDir(File JavaDoc outDir) {
288         this.outDir = outDir;
289     }
290     
291     public void setSchemaVersion(String JavaDoc ver) {
292         this.schemaVersion = ver;
293     }
294
295     public String JavaDoc getSchemaVersion() {
296         return schemaVersion;
297     }
298
299     public ComponentNameConstructor getComponentNameConstructor(){
300         return compName;
301     }
302
303     public void setComponentNameConstructor(ComponentNameConstructor compName){
304         this.compName = compName;
305     }
306
307     public String JavaDoc getJavaEEVersion(){
308         return javaEEVersion;
309     }
310
311     public void setJavaEEVersion(String JavaDoc v){
312         javaEEVersion = v;
313     }
314
315     /**
316      * This method returns the module archive while
317      * {@link #getAbstractArchive()} returns an Archive representing the
318      * application that this module is embedded in.
319      * For standalone jar/war they will return same archive
320      * The caller MUST close the archive.
321      * @return the archive for the module archive.
322      */

323     public Archive getModuleArchive() {
324         return moduleArchive;
325     }
326
327     public void setModuleArchive(Archive a) {
328         moduleArchive = a;
329     }
330 }
331
Popular Tags