PropertyPersistenceStrategy findStrategy(IComponent component, String propertyName)
{
// So much for Law of Demeter!
IPropertySpecification propertySpecification = component.getSpecification()
.getPropertySpecification(propertyName);
if (propertySpecification == null)
{
_log.error(
RecordMessages.missingPropertySpecification(propertyName, component),
null,
null);
return null;
}
String name = propertySpecification.getPersistence();
// Should check for nulls, but the architecture of the framework pretty much
// ensures that we won't get here unless there is a property
// and a persistence value for the property.
try
{
return _strategySource.getStrategy(name);
}
catch (ApplicationRuntimeException ex)
{
_log.error(ex.getMessage(), propertySpecification.getLocation(), ex);
return null;
}
}