FileDocCategorySizeDatePackage
RemoteHomeInterfaceRmiIIOP.javaAPI DocGlassfish v2 API5851Fri May 04 22:33:52 BST 2007com.sun.enterprise.tools.verifier.tests.ejb.homeintf.remotehomeintf

RemoteHomeInterfaceRmiIIOP

public class RemoteHomeInterfaceRmiIIOP extends com.sun.enterprise.tools.verifier.tests.ejb.EjbTest implements com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck
Home Interface follows the standard rules for RMI-IIOP remote interfaces test. All enterprise beans home interface's must follow the standard rules for RMI-IIOP remote interfaces.

Fields Summary
Constructors Summary
Methods Summary
public com.sun.enterprise.tools.verifier.Resultcheck(com.sun.enterprise.deployment.EjbDescriptor descriptor)
Home Interface follows the standard rules for RMI-IIOP remote interfaces test. All enterprise beans home interface's must follow the standard rules for RMI-IIOP remote interfaces.

param
descriptor the Enterprise Java Bean deployment descriptor
return
Result the results for this assertion


	Result result = getInitializedResult();
	ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
	
	if(descriptor.getHomeClassName() == null || "".equals(descriptor.getHomeClassName())) {
            addNaDetails(result, compName);
            result.notApplicable(smh.getLocalString
                       ("com.sun.enterprise.tools.verifier.tests.ejb.localinterfaceonly.notapp",
                        "Not Applicable because, EJB [ {0} ] has Local Interfaces only.",
                                          new Object[] {descriptor.getEjbClassName()}));

	    return result;
	}
	
	if ((descriptor instanceof EjbSessionDescriptor) ||
	    (descriptor instanceof EjbEntityDescriptor)) {
 
	    try {
		ClassLoader jcl = getVerifierContext().getClassLoader();
		Class c = Class.forName(descriptor.getHomeClassName(), false, jcl);

		// remote interface must be defined as valid Rmi-IIOP remote interface
		boolean isValidRmiIIOPInterface = false;
		if (RmiIIOPUtils.isValidRmiIIOPInterface(c) && RmiIIOPUtils.isValidRmiIIOPInterfaceMethods(c)) {
		    isValidRmiIIOPInterface = true;
		}
 
		// remote interface must be defined as valid Rmi-IIOP remote interface
		if (!isValidRmiIIOPInterface){
		    addErrorDetails(result, compName);
		    result.failed(smh.getLocalString
				  (getClass().getName() + ".failed",
				   "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.",
				   new Object[] {descriptor.getHomeClassName(),descriptor.getHomeClassName()}));
		} else {
		    addGoodDetails(result, compName);
		    result.passed(smh.getLocalString
				  (getClass().getName() + ".passed",
				   "[ {0} ] properly declares the home interface as valid RMI-IIOP remote interface.",
				   new Object[] {descriptor.getHomeClassName()}));
		}
	    } catch (ClassNotFoundException e) {
		Verifier.debug(e);
		addErrorDetails(result, compName);
		result.failed(smh.getLocalString
			      (getClass().getName() + ".failedException",
			       "Error: [ {0} ] class not found.",
			       new Object[] {descriptor.getHomeClassName()}));
	    }  
	    return result;
 
	} else {
	    addNaDetails(result, compName);
	    result.notApplicable(smh.getLocalString
				 (getClass().getName() + ".notApplicable",
				  "[ {0} ] expected {1} bean or {2} bean, but called with {3}.",
				  new Object[] {getClass(),"Session","Entity",descriptor.getName()}));
	    return result;
	}