KickJava   Java API By Example, From Geeks To Geeks.

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


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 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 arguments must be of valid types for RMI-IIOP
41  *
42  */

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

53  protected void runIndividualHomeMethodTest(Method JavaDoc method,EjbDescriptor descriptor, Result result) {
54      
55      Class JavaDoc[] methodParameterTypes = method.getParameterTypes();
56      ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
57      // The methods arguments types must be legal types for
58
// RMI-IIOP. This means that their arguments
59
// must be of valid types for RMI-IIOP,
60
if (RmiIIOPUtils.isValidRmiIIOPParameters(methodParameterTypes)) {
61          // these method parameters are valid, continue
62
addGoodDetails(result, compName);
63          result.passed(smh.getLocalString
64                  (getClass().getName() + ".passed",
65                  "[ {0} ] properly declares method with valid RMI-IIOP parameter.",
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 RMI-IIOP " +
72                  "method parameters.",
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