1 23 package com.sun.enterprise.tools.verifier.tests.ejb.homeintf.remotehomeintf; 24 25 import com.sun.enterprise.tools.verifier.tests.ejb.EjbTest; 26 import com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck; 27 import com.sun.enterprise.tools.verifier.tests.ejb.RmiIIOPUtils; 28 import com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor; 29 import com.sun.enterprise.tools.verifier.Result; 30 import com.sun.enterprise.tools.verifier.Verifier; 31 import com.sun.enterprise.deployment.EjbDescriptor; 32 import com.sun.enterprise.deployment.EjbEntityDescriptor; 33 import com.sun.enterprise.deployment.EjbSessionDescriptor; 34 35 42 public class RemoteHomeInterfaceRmiIIOP extends EjbTest implements EjbCheck { 43 44 45 56 public Result check(EjbDescriptor descriptor) { 57 58 Result result = getInitializedResult(); 59 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 60 61 if(descriptor.getHomeClassName() == null || "".equals(descriptor.getHomeClassName())) { 62 addNaDetails(result, compName); 63 result.notApplicable(smh.getLocalString 64 ("com.sun.enterprise.tools.verifier.tests.ejb.localinterfaceonly.notapp", 65 "Not Applicable because, EJB [ {0} ] has Local Interfaces only.", 66 new Object [] {descriptor.getEjbClassName()})); 67 68 return result; 69 } 70 71 if ((descriptor instanceof EjbSessionDescriptor) || 72 (descriptor instanceof EjbEntityDescriptor)) { 73 74 try { 75 ClassLoader jcl = getVerifierContext().getClassLoader(); 76 Class c = Class.forName(descriptor.getHomeClassName(), false, jcl); 77 78 boolean isValidRmiIIOPInterface = false; 80 if (RmiIIOPUtils.isValidRmiIIOPInterface(c) && RmiIIOPUtils.isValidRmiIIOPInterfaceMethods(c)) { 81 isValidRmiIIOPInterface = true; 82 } 83 84 if (!isValidRmiIIOPInterface){ 86 addErrorDetails(result, compName); 87 result.failed(smh.getLocalString 88 (getClass().getName() + ".failed", 89 "Error: [ {0} ] is not defined as valid RMI-IIOP remote interface. All enterprise beans home interfaces must be defined as valid RMI-IIOP remote interface. [ {1} ] is not a valid remote home interface.", 90 new Object [] {descriptor.getHomeClassName(),descriptor.getHomeClassName()})); 91 } else { 92 addGoodDetails(result, compName); 93 result.passed(smh.getLocalString 94 (getClass().getName() + ".passed", 95 "[ {0} ] properly declares the home interface as valid RMI-IIOP remote interface.", 96 new Object [] {descriptor.getHomeClassName()})); 97 } 98 } catch (ClassNotFoundException e) { 99 Verifier.debug(e); 100 addErrorDetails(result, compName); 101 result.failed(smh.getLocalString 102 (getClass().getName() + ".failedException", 103 "Error: [ {0} ] class not found.", 104 new Object [] {descriptor.getHomeClassName()})); 105 } 106 return result; 107 108 } else { 109 addNaDetails(result, compName); 110 result.notApplicable(smh.getLocalString 111 (getClass().getName() + ".notApplicable", 112 "[ {0} ] expected {1} bean or {2} bean, but called with {3}.", 113 new Object [] {getClass(),"Session","Entity",descriptor.getName()})); 114 return result; 115 } 116 } 117 } 118 | Popular Tags |