KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > verifier > tests > ejb > homeintf > remotehomeintf > RemoteHomeInterfaceRmiIIOPReturn


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.homeintf.remotehomeintf;
24
25 import com.sun.enterprise.tools.verifier.tests.ejb.homeintf.HomeMethodTest;
26 import com.sun.enterprise.tools.verifier.tests.ejb.RmiIIOPUtils;
27 import com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor;
28 import com.sun.enterprise.tools.verifier.Result;
29 import com.sun.enterprise.deployment.EjbDescriptor;
30
31 import java.lang.reflect.Method JavaDoc;
32
33 /**
34  * Enterprise beans home interface methods return type RMI-IIOP test.
35  *
36  * The following are the requirements for the enterprise Bean's home interface
37  * signature:
38  *
39  * The methods defined in this interface must follow the rules for RMI-IIOP.
40  * This means that their return values must be of valid types for RMI-IIOP.
41  *
42  */

43 public class RemoteHomeInterfaceRmiIIOPReturn extends HomeMethodTest {
44     
45     /**
46      * <p>
47      * run an individual verifier test against a declared method of the
48      * remote interface.
49      * </p>
50      *
51      * @param descriptor the deployment descriptor for the bean
52      * @param method the method to run the test on
53      */

54     protected void runIndividualHomeMethodTest( Method JavaDoc method,EjbDescriptor descriptor, Result result) {
55         ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
56         Class JavaDoc methodReturnType = method.getReturnType();
57         
58         // The methods arguments types must be legal types for
59
// RMI-IIOP. This means that their return values must
60
// be of valid types for RMI-IIOP,
61
if (RmiIIOPUtils.isValidRmiIIOPReturnType(methodReturnType)) {
62             addGoodDetails(result, compName);
63             result.passed(smh.getLocalString
64                     (getClass().getName() + ".passed",
65                     "[ {0} ] properly declares method with valid RMI-IIOP return type.",
66                     new Object JavaDoc[] {method.getDeclaringClass().getName()}));
67         } else {
68             addErrorDetails(result, compName);
69             result.failed(smh.getLocalString
70                     (getClass().getName() + ".failed",
71                     "Error: [ {0} ] method was found, but does not have valid " +
72                     "RMI-IIOP return type.",
73                     new Object JavaDoc[] {method.getName()}));
74         }
75     }
76     
77     protected String JavaDoc getHomeInterfaceName(EjbDescriptor descriptor) {
78         return descriptor.getRemoteClassName();
79     }
80     
81     protected String JavaDoc getInterfaceType() {
82         return "remote";
83     }
84     
85     protected String JavaDoc getSuperInterface() {
86         return "javax.ejb.EJBHome";
87     }
88 }
89
Popular Tags