public static RegistryConfig populateRegistryConfig(OMElement resourcesElement) {
if (resourcesElement == null) {
return null;
}
RegistryConfig regConfig = new RegistryConfig();
// read Item elements under Resources
Iterator itemItr = resourcesElement.getChildrenWithLocalName(RegistryConfig.ITEM);
while (itemItr.hasNext()) {
OMElement itemElement = (OMElement) itemItr.next();
regConfig.addResource(readChildText(itemElement, RegistryConfig.PATH),
readChildText(itemElement, RegistryConfig.FILE),
readChildText(itemElement, RegistryConfig.REGISTRY_TYPE));
}
// read Collection elements under Resources
Iterator collectionItr = resourcesElement.getChildrenWithLocalName(RegistryConfig.COLLECTION);
while (collectionItr.hasNext()) {
OMElement collElement = (OMElement) collectionItr.next();
regConfig.addCollection(readChildText(collElement, RegistryConfig.PATH),
readChildText(collElement, RegistryConfig.DIRECTORY),
readChildText(collElement, RegistryConfig.REGISTRY_TYPE));
}
// read Association elements under Resources
Iterator associationItr = resourcesElement.getChildrenWithLocalName(RegistryConfig.ASSOCIATION);
while (associationItr.hasNext()) {
OMElement assoElement = (OMElement) associationItr.next();
regConfig.addAssociation(readChildText(assoElement, RegistryConfig.SOURCE_PATH),
readChildText(assoElement, RegistryConfig.TARGET_PATH),
readChildText(assoElement, RegistryConfig.TYPE),
readChildText(assoElement, RegistryConfig.REGISTRY_TYPE));
}
return regConfig;