If extending the Download component, it doesnt seem possible to effectively add the asset data for the linked file into the data layer.
There is a AssetDataBuilder in WCM Core, but it is only ever used from the ImageComponentDataBuilder. This requires the data layer to be rendered .asImageComponent() labeling the asset as "image" in the data layer output.
I considered making a new AssetComponentDataBuilder in my project, but to appropriately hook into and reuse the WCM Core data layer supplier capabilities I'd need to reference internal classes like com.adobe.cq.wcm.core.components.internal.models.v1.datalayer.builder.DataLayerSupplierImpl
That said, maybe I'm looking at the issue incorrectly - admittedly the data layer builder framework in WCM Core is very confusing to me - it seems extremely abstract with a lot of loose coupling that would appear to be in support of extension by client code, but then some of the most critical classes are buried in internal packages preventing them from being used in client extensions. The data layer works well enough for anything already supported in the WCM Core data layer implementation, it just seems very hard to expand upon it in a client project.
If extending the
Download
component, it doesnt seem possible to effectively add the asset data for the linked file into the data layer.There is a
AssetDataBuilder
in WCM Core, but it is only ever used from theImageComponentDataBuilder
. This requires the data layer to be rendered.asImageComponent()
labeling the asset as "image" in the data layer output.I considered making a new
AssetComponentDataBuilder
in my project, but to appropriately hook into and reuse the WCM Core data layer supplier capabilities I'd need to reference internal classes likecom.adobe.cq.wcm.core.components.internal.models.v1.datalayer.builder.DataLayerSupplierImpl
That said, maybe I'm looking at the issue incorrectly - admittedly the data layer builder framework in WCM Core is very confusing to me - it seems extremely abstract with a lot of loose coupling that would appear to be in support of extension by client code, but then some of the most critical classes are buried in
internal
packages preventing them from being used in client extensions. The data layer works well enough for anything already supported in the WCM Core data layer implementation, it just seems very hard to expand upon it in a client project.