boolean resolved = false;
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
if( desc.implementedByEjbComponent()) {
EjbBundleDescriptor ejbBundle = (EjbBundleDescriptor)desc.getBundleDescriptor();
if( ejbBundle.hasEjbByName(desc.getEjbLink())) {
EjbDescriptor ejb = ejbBundle.getEjbByName(desc.getEjbLink());
if (ejb != null) {
resolved = true;
//result.pass , ejb-link resolved
result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor",
"For [ {0} ]", new Object[] {compName.toString()}));
result.passed(smh.getLocalString (getClass().getName() + ".passed",
"[{0}] link of service-impl-bean element resolved successfully.",
new Object[] {desc.getEjbLink()}));
}
else {
//result.fail, ejb-link could not be resolved
result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor",
"For [ {0} ]", new Object[] {compName.toString()}));
result.failed(smh.getLocalString (getClass().getName() + ".failed",
"Could not resolve [{0}] link of service-impl-bean element.",
new Object[] {desc.getEjbLink()}));
}
}
} else if( desc.implementedByWebComponent()) {
WebBundleDescriptor webBundle = (WebBundleDescriptor)desc.getBundleDescriptor();
WebComponentDescriptor webComponent =
(WebComponentDescriptor) webBundle.
getWebComponentByCanonicalName(desc.getWebComponentLink());
if( webComponent != null && webComponent.isServlet()) {
resolved = true;
//result.pass servlet-link resolved
result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor",
"For [ {0} ]", new Object[] {compName.toString()}));
result.passed(smh.getLocalString (getClass().getName() + ".passed",
"[{0}] link of service-impl-bean element resolved successfully.",
new Object[] {desc.getWebComponentLink()}));
}
else {
//result.fail, servlet-link could not be resolved
result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor",
"For [ {0} ]", new Object[] {compName.toString()}));
result.failed(smh.getLocalString (getClass().getName() + ".failed",
"Could not resolve [{0}] link of service-impl-bean element.",
new Object[] {desc.getWebComponentLink()}));
}
}
return resolved;