do {
Collection tags = currentClass.getDoc().getTags("ejb.ejb-ref");
for (Iterator i = tags.iterator(); i.hasNext(); ) {
XTag tag = (XTag) i.next();
setCurrentClassTag(tag);
storeReferringClassId();
String ejbNameAttribute = tag.getAttributeValue("ejb-name");
if (ejbNameAttribute == null || ejbNameAttribute.length() < 1) {
mandatoryParamNotFound(tag.getDoc(), "ejb-name", "ejb.ejb-ref");
}
XClass refedEJBClass = findEjb(ejbNameAttribute);
setCurrentClass(refedEJBClass);
String refName = EjbTagsHandler.ejbRefName();
if (!already.containsKey(refName)) {
already.put(refName, tag);
pushCurrentClass(refedEJBClass);
generate(template);
popCurrentClass();
}
else {
XTag previousTag = (XTag) already.get(refName);
if (!previousTag.getAttributeValue("ejb-name").equals(tag.getAttributeValue("ejb-name")) ||
!previousTag.getAttributeValue("jndi-name").equals(tag.getAttributeValue("jndi-name"))) {
log.error("Duplicate @ejb.ejb-ref found with different parameters!");
log.error("Previous tag: @ejb.ejb-ref ref-name=\"" +
previousTag.getAttributeValue("ref-name") + "\" ejb-name=\"" +
previousTag.getAttributeValue("ejb-name") + "\" view-type=\"" +
previousTag.getAttributeValue("view-type") + "\"");
log.error("Current tag: @ejb.ejb-ref ref-name=\"" +
tag.getAttributeValue("ref-name") + "\" ejb-name=\"" +
tag.getAttributeValue("ejb-name") + "\" view-type=\"" +
tag.getAttributeValue("view-type") + "\"");
throw new XDocletException("Duplicate @ejb.ejb-ref with different parameters");