if (valueParser.matches())
{
final String imageReferenceName = valueParser.getImageReferenceName();
final String specification = Strings.replaceHtmlEscapeNumber(valueParser.getSpecification());
final String factoryName = valueParser.getFactoryName();
final Application application = component.getApplication();
// Do we have a reference?
if (!Strings.isEmpty(imageReferenceName))
{
// Is resource already available via the application?
if (application.getResourceReferenceRegistry().getResourceReference(
Application.class, imageReferenceName, locale, style, variation, true, false) == null)
{
// Resource not available yet, so create it with factory and
// share via Application
final IResource imageResource = getResourceFactory(application, factoryName).newResource(
specification, locale, style, variation);
ResourceReference ref = new SimpleStaticResourceReference(Application.class,
imageReferenceName, locale, style, variation, imageResource);
application.getResourceReferenceRegistry().registerResourceReference(ref);
}
// Create resource reference
resourceReference = new PackageResourceReference(Application.class,
imageReferenceName, locale, style, variation);