handleException("The 'key' attribute is required for a local registry entry");
return null;
} else {
Entry entry = new Entry(key.getAttributeValue());
OMElement descriptionElem = elem.getFirstChildWithName(DESCRIPTION_Q);
if (descriptionElem != null) {
entry.setDescription(descriptionElem.getText());
descriptionElem.detach();
}
String src = elem.getAttributeValue(
new QName(XMLConfigConstants.NULL_NAMESPACE, "src"));
// if a src attribute is present, this is a URL source resource,
// it would now be loaded from the URL source, as all static properties
// are initialized at startup
if (src != null) {
try {
entry.setSrc(new URL(src.trim()));
entry.setType(Entry.URL_SRC);
entry.setValue(SynapseConfigUtils.getObject(entry.getSrc(), properties));
} catch (MalformedURLException e) {
handleException("The entry with key : " + key + " refers to an invalid URL");
}
} else {
OMNode nodeValue = elem.getFirstOMChild();
OMElement elemValue = elem.getFirstElement();
if (elemValue != null) {
entry.setType(Entry.INLINE_XML);
entry.setValue(elemValue);
} else if (nodeValue != null && nodeValue instanceof OMText) {
entry.setType(Entry.INLINE_TEXT);
entry.setValue(elem.getText());
}
}
return entry;
}