// The @default attribute of a <sca:reference/> subelement of a <beans/>
// element MUST have the value of the @name attribute of one of the <bean/>
// subelements of the <beans/> element.
Iterator<SpringSCAReferenceElement> itr = references.iterator();
while (itr.hasNext()) {
SpringSCAReferenceElement referenceElement = itr.next();
boolean defaultBeanExists = false;
boolean isUniqueReferenceName = true;
Iterator<SpringBeanElement> itb = beans.iterator();
while (itb.hasNext()) {
SpringBeanElement beanElement = itb.next();
if (referenceElement.getDefaultBean() != null)
if (referenceElement.getDefaultBean().equals(beanElement.getId()))
defaultBeanExists = true;
if (referenceElement.getName().equals(beanElement.getId()))
isUniqueReferenceName = false;
}
Iterator<SpringSCAPropertyElement> itp = scaproperties.iterator();
while (itp.hasNext()) {
SpringSCAPropertyElement propertyElement = itp.next();
if (referenceElement.getName().equals(propertyElement.getName()))
isUniqueReferenceName = false;
}
if (!defaultBeanExists && referenceElement.getDefaultBean() != null)
error(monitor, "DefaultBeanDoesNotExist", beans);
if (!isUniqueReferenceName)
error(monitor, "ScaReferenceNameNotUnique", beans);
} // end while
// The value of the @name attribute of an <sca:property/> subelement of a <beans/>
// element MUST be unique amongst the @name attributes of the <sca:reference/>
// subelements and the <bean/> subelements of the <beans/> element.
Iterator<SpringSCAPropertyElement> itp = scaproperties.iterator();
while (itp.hasNext()) {
SpringSCAPropertyElement propertyElement = itp.next();
boolean isUniquePropertyName = true;
Iterator<SpringBeanElement> itb = beans.iterator();
while (itb.hasNext()) {
SpringBeanElement beanElement = itb.next();
if (propertyElement.getName().equals(beanElement.getId()))
isUniquePropertyName = false;
}
Iterator<SpringSCAReferenceElement> itrp = references.iterator();
while (itrp.hasNext()) {
SpringSCAReferenceElement referenceElement = itrp.next();
if (propertyElement.getName().equals(referenceElement.getName()))
isUniquePropertyName = false;
}
if (!isUniquePropertyName)
error(monitor, "ScaPropertyNameNotUnique", beans);
} // end while