Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
EjbDescriptor descriptor = wsdescriptor.getEjbComponentImpl();
if (descriptor != null) {
// get hold of the ServiceImplBean Class
String beanClass = descriptor.getEjbClassName();
// since non-empty ness is enforced by schema, this is an internal error
if ((beanClass == null) || ((beanClass != null) && (beanClass.length() == 0))) {
// internal error
result.addErrorDetails(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.webservices.Error",
"Error: Unexpected error occurred [ {0} ]",
new Object[] {"Service Implementation Bean Class Name Null"}));
}
Class<?> bean = null;
try {
bean = Class.forName(beanClass, false, getVerifierContext().getClassLoader());
} catch (ClassNotFoundException e) {
result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor",
"For [ {0} ]", new Object[] {compName.toString()}));
result.failed(smh.getLocalString
(getClass().getName() + ".failed",
"The [{0}] Class [{1}] could not be Loaded",new Object[] {"Service Impl Bean", beanClass}));
}
// get hold of the SEI Class
String s = descriptor.getWebServiceEndpointInterfaceName();
if ((s == null) || (s.length() == 0)){
// internal error, should never happen
result.addErrorDetails(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.webservices.Error",
"Error: Unexpected error occurred [ {0} ]",
new Object[] {"Service Endpoint Interface Class Name Null"}));
}
Class<?> sei = null;
try {
sei = Class.forName(s, false, getVerifierContext().getClassLoader());
}catch(ClassNotFoundException e) {
result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor",
"For [ {0} ]", new Object[] {compName.toString()}));
result.failed(smh.getLocalString
(getClass().getName() + ".failed",
"The [{0}] Class [{1}] could not be Loaded",new Object[] {"SEI", s}));
}
// it should be a stateless session bean
boolean isSLSB = (javax.ejb.SessionBean.class).isAssignableFrom(bean);
boolean implementsSEI = sei.isAssignableFrom(bean);
if (!isSLSB) {
//result.fail does not implement javax.ejb.SessionBean interface
result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor",
"For [ {0} ]", new Object[] {compName.toString()}));
result.failed(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.webservices.failed", "[{0}]",
new Object[] {"The Service Implementation Bean Does not Implement SessionBean Interface"}));
}
else {
// result.passed
result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor",
"For [ {0} ]", new Object[] {compName.toString()}));
result.passed(smh.getLocalString (
"com.sun.enterprise.tools.verifier.tests.webservices.passed", "[{0}]",
new Object[] {"The Service Impl Bean implements SessionBean Interface"}));
}
EndPointImplBeanClassChecker checker = new EndPointImplBeanClassChecker(sei,bean,result,getVerifierContext().getSchemaVersion());
if (implementsSEI) {
// result.passed
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.passed(smh.getLocalString (
"com.sun.enterprise.tools.verifier.tests.webservices.passed", "[{0}]",
new Object[] {"The Service Impl Bean implements SEI"}));
}
else {
// business methods of the bean should be public, not final and not static
// This check will happen as part of this call
Vector notImpl = checker.getSEIMethodsNotImplemented();
if (notImpl.size() > 0) {
// result.fail, Set the not implemented methods into the result info??
result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor",
"For [ {0} ]", new Object[] {compName.toString()}));
result.failed(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.webservices.failed", "[{0}]",
new Object[] {"The Service Implementation Bean Does not Implement ALL SEI Methods"}));
}
else {
// result.pass :All SEI methods implemented
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.passed(smh.getLocalString (
"com.sun.enterprise.tools.verifier.tests.webservices.passed", "[{0}]",
new Object[] {"The Service Impl Bean implements all Methods of the SEI"}));
}
}
// class should be public, not final and not abstract
// should not define finalize()
if (checker.check(compName)) {
// result.passed stuff done inside the check() method nothing todo here
result.setStatus(Result.PASSED);
}
else {
// result.fail : stuff done inside the check() method nothing todo here
result.setStatus(Result.FAILED);
}
}
else {
// result.notapplicable
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor", "For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.webservices.notapp",
"[{0}]", new Object[] {"Not Applicable since this is a JAX-RPC Service Endpoint"}));
}
return result;