KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > verifier > webservices > WebServiceCheckMgrImpl


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.webservices;
25
26 import javax.enterprise.deploy.shared.ModuleType JavaDoc;
27 import java.util.Iterator JavaDoc;
28
29 import com.sun.enterprise.deployment.*;
30 import com.sun.enterprise.tools.verifier.CheckMgr;
31 import com.sun.enterprise.tools.verifier.FrameworkContext;
32 import com.sun.enterprise.tools.verifier.JarCheck;
33 import com.sun.enterprise.tools.verifier.Result;
34 import com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor;
35
36 /**
37  * WebServices harness
38  */

39 public class WebServiceCheckMgrImpl extends CheckMgr implements JarCheck {
40
41     /**
42      * name of the file containing the list of tests for the webservice
43      * architecture
44      */

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

59     public void check(Descriptor descriptor) throws Exception JavaDoc {
60         WebServicesDescriptor rootDescriptor = (WebServicesDescriptor) descriptor;
61         ModuleType JavaDoc moduleType = rootDescriptor.getBundleDescriptor()
62                 .getModuleType();
63         if (moduleType == ModuleType.EJB)
64             moduleName = Result.EJB;
65         else if (moduleType == ModuleType.WAR)
66             moduleName = Result.WEB;
67         for (Iterator JavaDoc itr = rootDescriptor.getWebServices().iterator();
68              itr.hasNext();) {
69             WebService wsDescriptor = (WebService) itr.next();
70             // need to pass WebServiceEndpoint's to check
71
for (Iterator JavaDoc endPtItr = wsDescriptor.getEndpoints().iterator();
72                  endPtItr.hasNext();) {
73                 super.check((WebServiceEndpoint) endPtItr.next());
74             }
75         }
76     }
77
78     /**
79      * return the configuration file name for the list of tests pertinent to the
80      * connector architecture
81      *
82      * @return <code>String</code> filename containing the list of tests
83      */

84     protected String JavaDoc getTestsListFileName() {
85         return testsListFileName;
86     }
87
88     /**
89      * @return <code>String</code> filename containing sunone tests
90      */

91     protected String JavaDoc getSunONETestsListFileName() {
92         return sunONETestsListFileName;
93     }
94
95     protected String JavaDoc getSchemaVersion(Descriptor descriptor) {
96         return ((WebServiceEndpoint) descriptor).getWebService().
97                 getWebServicesDescriptor().getSpecVersion();
98     }
99
100     protected void setModuleName(Result r) {
101         r.setModuleName(moduleName);
102     }
103     
104     protected BundleDescriptor getBundleDescriptor(Descriptor descriptor) {
105         return ((WebServiceEndpoint) descriptor).getBundleDescriptor();
106     }
107
108     protected ComponentNameConstructor getComponentNameConstructor(
109             Descriptor descriptor) {
110         return new ComponentNameConstructor((WebServiceEndpoint)descriptor);
111     }
112
113 }
114
Popular Tags