[MGNLUI-2753] Review ImageProvider component mappings so that it can be injected Created: 18/Mar/14  Updated: 02/Jun/14  Resolved: 27/May/14

Status: Closed
Project: Magnolia UI
Component/s: image provider
Affects Version/s: 5.3
Fix Version/s: 5.3

Type: Bug Priority: Neutral
Reporter: Mikaël Geljić Assignee: Mikaël Geljić
Resolution: Fixed Votes: 0
Labels: cleanup, ioc, quickwin
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Epic Link: JCR-agnostic content apps
Sprint: 5.3 Sprint 4, 5.3 Sprint 5, 5.3 Sprint 6

 Description   

Currently ImageProvider has:

  • a type-mapping for ImageProviderDefinition (for n2b)
  • an 'admincentral' component mapping for ImageProvider to DefaultImageProvider
  • an 'admincentral' component mapping for an ImageProviderDefinition

BrowserPresenter is then creating a separate instance of imageProvider based on the ImageProviderDefinition#imageProviderClass configured under the subApp.
WorkbenchPresenter is yet even creating another imageProvider instance to pass along with instantiation of content presenters!

There are two issues with this:

  • One cannot inject current ImageProvider in another subapp component (e.g. thumbnail view) because then we get the 'admincentral' imageProvider, which has null definition and contentConnector.
  • One cannot reuse the imageProvider configured for this subApp.

We should use a Guice Provider here, similarly as for ContentConnector:

  • we keep the definition type-mapping but replace component mappings with a provider mapping, under 'subapp' container, not 'admincentral'.
  • we inject it directly in BrowserPresenter - we can then even remove injection of componentProvider from there.
  • we drop DefaultImageProvider's no-arg constructor and annotate the other one with @Inject


 Comments   
Comment by Mikaël Geljić [ 18/Mar/14 ]

went a bit too fast regarding apps that do not configure an imageProvider

Comment by Mikaël Geljić [ 19/Mar/14 ]

Apparently missing commits in Jira, please take a look at https://git.magnolia-cms.com/gitweb/?p=magnolia_ui.git;a=shortlog;h=refs/heads/MGNLUI-2753

Comment by Mikaël Geljić [ 15/Apr/14 ]

Guice provider is instantiated for any subapp even when no ContentConnector dependency can be satisfied (ContentConnectorProvider may return null currently). Commit was reverted for now to allow time for a clear solution (e.g. providers as lazy singletons, always return null object or nullable annotation).

Comment by Mikaël Geljić [ 23/May/14 ]

Propagated null object pattern to ContentConnectorProvider, so that dependencies to ContentConnector can always be satisfied, in particular in ImageProviderProvider, when no subapp actually configures one.

Comment by Mikaël Geljić [ 26/May/14 ]

No binding for ImageProvider within 'choosedialog' container, hence ThumbnailPresenter from the choose dialog cannot be instantiated and throws error

Generated at Mon Feb 12 08:59:49 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.