FileDocCategorySizeDatePackage
EJBEndpointIsSLSBCheck.javaAPI DocGlassfish v2 API6126Fri May 04 22:34:16 BST 2007com.sun.enterprise.tools.verifier.tests.webservices

EJBEndpointIsSLSBCheck

public class EJBEndpointIsSLSBCheck extends WSTest implements WSCheck

Fields Summary
Constructors Summary
Methods Summary
public Resultcheck(WebServiceEndpoint wsdescriptor)

param
descriptor the WebServices descriptor
return
Result the results for this assertion


	Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();

        if (wsdescriptor.implementedByEjbComponent()) {
            EjbDescriptor ejbdesc = wsdescriptor.getEjbComponentImpl();

            if (ejbdesc == null) {

               result.addErrorDetails(smh.getLocalString
                                  ("tests.componentNameConstructor",
                                   "For [ {0} ]",
                                   new Object[] {compName.toString()}));
                 result.failed(smh.getLocalString
                   (getClass().getName() + ".failed1",
                    "Service Implementation bean Could Not be Resolved from the ejb-link specified"));
               return result;
             }

            if (ejbdesc instanceof EjbSessionDescriptor) {
               EjbSessionDescriptor session = (EjbSessionDescriptor)ejbdesc;
               if (EjbSessionDescriptor.STATELESS.equals(session.getSessionType())) {
                   result.addGoodDetails(smh.getLocalString
                                  ("tests.componentNameConstructor",
                                   "For [ {0} ]",
                                   new Object[] {compName.toString()}));
                   result.passed(smh.getLocalString
                   (getClass().getName() + ".passed",
                   "Service Implementation bean defined in ejb-jar.xml using {0} session element",                   new Object[] {"stateless"}));
               }
               else {
                 // result.fail, endpoint can be a stateful session bean
                 result.addErrorDetails(smh.getLocalString
                                  ("tests.componentNameConstructor",
                                   "For [ {0} ]",
                                   new Object[] {compName.toString()}));
                 result.failed(smh.getLocalString
                   (getClass().getName() + ".failed",
                    "Service Implementation bean cannot be Stateful Session Bean"));
               }
            }
            else {
              // result.fail, service endpoint should be Session Bean
              result.addErrorDetails(smh.getLocalString
                     ("tests.componentNameConstructor", "For [ {0} ]",
                      new Object[] {compName.toString()}));
              result.failed(smh.getLocalString
                 (getClass().getName() + ".failed2",
                 "Service Implementation bean Should be a Session Bean"));
            }
  
        }
        else {

          // result.notapp
          result.addNaDetails(smh.getLocalString
                     ("tests.componentNameConstructor", "For [ {0} ]",
                      new Object[] {compName.toString()}));
          result.notApplicable(smh.getLocalString
                 (getClass().getName() + ".notapp",
                 "This is a JAX-RPC Service Endpoint"));
        }

        return result;