KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > verifier > wsclient > WebServiceClientCheckMgrImpl


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.wsclient;
25
26 import javax.enterprise.deploy.shared.ModuleType JavaDoc;
27
28 import com.sun.enterprise.deployment.Descriptor;
29 import com.sun.enterprise.deployment.ServiceReferenceDescriptor;
30 import com.sun.enterprise.deployment.BundleDescriptor;
31 import com.sun.enterprise.tools.verifier.*;
32 import com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor;
33
34 /**
35  * WebServices harness
36  */

37 public class WebServiceClientCheckMgrImpl extends CheckMgr implements JarCheck {
38
39     /**
40      * name of the file containing the list of tests for the webservice client
41      * architecture
42      */

43     private static final String JavaDoc testsListFileName = "TestNamesWebServicesClient.xml"; // NOI18N
44
private static final String JavaDoc sunONETestsListFileName = getSunPrefix()
45             .concat(testsListFileName);
46     private String JavaDoc moduleName;
47
48     public WebServiceClientCheckMgrImpl(FrameworkContext frameworkContext) {
49         this.frameworkContext = frameworkContext;
50     }
51
52     /**
53      * Check Ejb for spec. conformance
54      *
55      * @param descriptor WebServices descriptor
56      */

57     public void check(Descriptor descriptor) throws Exception JavaDoc {
58         ServiceReferenceDescriptor rootDescriptor = (ServiceReferenceDescriptor) descriptor;
59         ModuleType JavaDoc moduleType = rootDescriptor.getBundleDescriptor()
60                 .getModuleType();
61         if (moduleType == ModuleType.EJB)
62             moduleName = Result.EJB;
63         else if (moduleType == ModuleType.WAR)
64             moduleName = Result.WEB;
65         else if (moduleType == ModuleType.CAR)
66             moduleName = Result.APPCLIENT;
67         super.check(rootDescriptor);
68     }
69
70     /**
71      * return the configuration file name for the list of tests pertinent to the
72      * connector architecture
73      *
74      * @return <code>String</code> filename containing the list of tests
75      */

76     protected String JavaDoc getTestsListFileName() {
77         return testsListFileName;
78     }
79
80     /**
81      * @return <code>String</code> filename containing sunone tests
82      */

83     protected String JavaDoc getSunONETestsListFileName() {
84         return sunONETestsListFileName;
85     }
86
87     /**
88      * A webservices client can be an application client or an ejb or a web component
89      * For a j2ee1.4 specific webservices client the version of client descriptor
90      * is 1.1. For jee 5.0 this version is 1.0
91      * @param descriptor
92      * @return webservices client descriptor version
93      */

94     protected String JavaDoc getSchemaVersion(Descriptor descriptor) {
95         String JavaDoc wsclientVersion = null;
96         String JavaDoc version = ((ServiceReferenceDescriptor) descriptor).getBundleDescriptor()
97                 .getSpecVersion();
98         if(moduleName.equals(Result.EJB)){
99             if("2.1".equals(version)) wsclientVersion = "1.1"; // NOI18N
100
else if("3.0".equals(version)) wsclientVersion = "1.2"; // NOI18N
101
} else if(moduleName.equals(Result.WEB)){
102             if("2.4".equals(version)) wsclientVersion = "1.1"; // NOI18N
103
else if("2.5".equals(version)) wsclientVersion = "1.2"; // NOI18N
104
} else if(moduleName.equals(Result.APPCLIENT)){
105             if("1.4".equals(version)) wsclientVersion = "1.1"; // NOI18N
106
else if("5".equals(version)) wsclientVersion = "1.2"; // NOI18N
107
}
108         if(wsclientVersion==null) {
109             wsclientVersion = ""; // should we not throw exception?
110
}
111         return wsclientVersion;
112     }
113
114     protected void setModuleName(Result r) {
115         r.setModuleName(moduleName);
116     }
117     
118     protected BundleDescriptor getBundleDescriptor(Descriptor descriptor) {
119         return ((ServiceReferenceDescriptor)descriptor).getBundleDescriptor();
120     }
121     protected ComponentNameConstructor getComponentNameConstructor(
122             Descriptor descriptor) {
123         return new ComponentNameConstructor((ServiceReferenceDescriptor)descriptor);
124     }
125
126 }
127
Popular Tags