The ejb-name must be unique amoung the names of the enterprise beans within
the same ejb-jar file.
Result result = getInitializedResult();
String ejbName = descriptor.getName();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
// initialize needed by ejb loop
int found = 0;
// The ejb-name must be unique amoung the names of the enterprise beans
// within the same ejb-jar file.
// i.e. need to loop through all ejb's within this jar and get their
// respective ejbName's, then do a string compare and make sure their are
// no duplicates.
for (Iterator itr =descriptor.getEjbBundleDescriptor().getEjbs().iterator();
itr.hasNext();) {
EjbDescriptor ejbDescriptor = (EjbDescriptor) itr.next();
if (ejbDescriptor.getName().equals(ejbName)) {
found++;
if (found > 1) {
addErrorDetails(result, compName);
result.failed(smh.getLocalString
(getClass().getName() + ".failed",
"Error: [ {0} ] has found [ {1} ] duplicate ejb name(s) within the same jar.",
new Object[] {ejbName, new Integer((found - 1))}));
}
}
}
if (result.getStatus() != Result.FAILED) {
addGoodDetails(result, compName);
result.passed(smh.getLocalString
(getClass().getName() + ".passed",
"Valid: [ {0} ] was found once within jar, ejb-name is unique.",
new Object[] {ejbName}));
}
return result;