}
if (source.charAt(0) == '$') {
String name = source.substring(1, index);
Property<?> compositeProp = parent.getProperties().get(name);
if (compositeProp == null) {
InvalidValueException ex =
new InvalidValueException(
"The 'source' cannot be resolved to a composite property");
ex.addContextName(source);
throw ex;
}
Document document = compositeProp.getDefaultValue();
// Adding /value because the document root is "value"
String path = source.substring(index);
String xpath = null;
if ("/".equals(path)) {
// trailing / is not legal for xpath
xpath = "/value";
} else {
xpath = "/value" + path;
}
// FIXME: How to deal with namespaces?
node = evaluate(null, document, xpath);
propValue.setValue(node);
Property<?> prop =
(Property<?>)componentDefinition.getImplementation().getComponentType()
.getProperties().get(propValue.getName());
propValue
.setValueFactory(new SimplePropertyObjectFactory(prop, propValue.getValue()));
} else {
InvalidValueException ex =
new InvalidValueException("The 'source' has an invalid value");
ex.addContextName(source);
throw ex;
}
} catch (Exception e) {
throw new LoaderException(e);
}