KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > verifier > tests > ejb > elements > UncheckedMethodsExist


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.ejb.elements;
24
25 import com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck;
26 import com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor;
27 import com.sun.enterprise.tools.verifier.Result;
28 import com.sun.enterprise.deployment.EjbDescriptor;
29 import com.sun.enterprise.deployment.MethodDescriptor;
30 import com.sun.enterprise.deployment.EjbSessionDescriptor;
31 import com.sun.enterprise.deployment.EjbEntityDescriptor;
32
33 import java.util.Set JavaDoc;
34
35 /**
36  * Methods used in unchecked element of the deployment descriptor
37  * must be methods defined in the enterprise bean's component and/or home
38  * interface.
39  * @author Vikas Awasthi
40  */

41 public class UncheckedMethodsExist extends MethodsExist implements EjbCheck {
42
43     /**
44      * Methods used in unchecked element of the deployment descriptor
45      * must be methods defined in the enterprise bean's component and/or home
46      * interface.
47      *
48      * @param descriptor the Enterprise Java Bean deployment descriptor
49      * @return <code>Result</code> the results for this assertion
50      */

51     public Result check(EjbDescriptor descriptor) {
52
53         result = getInitializedResult();
54         compName = getVerifierContext().getComponentNameConstructor();
55
56         if ((descriptor instanceof EjbSessionDescriptor) ||
57                 (descriptor instanceof EjbEntityDescriptor)) {
58             Set JavaDoc<MethodDescriptor> permissionedMethods = descriptor.getUncheckedMethodDescriptors();
59             if (permissionedMethods!=null && permissionedMethods.size() >0) {
60             
61                 for (MethodDescriptor methodDescriptor : permissionedMethods)
62                     checkMethodStyles(methodDescriptor, descriptor);
63             }
64         }
65
66         if(result.getStatus() != Result.FAILED) {
67             addGoodDetails(result, compName);
68             result.passed(smh.getLocalString
69                     (getClass().getName() + ".passed",
70                     "Valid unchecked method(s) found."));
71         }
72         return result;
73     }
74 }
75
76
Popular Tags