Vojtech Szocs has posted comments on this change.

Change subject: userportal: Dynamic guide link
......................................................................


Patch Set 3:

Aha! I think I found the problem. Quote from Google Guice docs at 
http://code.google.com/p/google-guice/wiki/Scopes

"
In linked bindings, scopes apply to the binding source, not the binding target. 
Suppose we have a class Applebees that implements both Bar and Grill 
interfaces. These bindings allow for two instances of that type, one for Bars 
and another for Grills:

  bind(Bar.class).to(Applebees.class).in(Singleton.class);
  bind(Grill.class).to(Applebees.class).in(Singleton.class);

This is because the scopes apply to the bound type (Bar, Grill), not the type 
that satisfies that binding (Applebees).
"

So if we bind place manager component like this:

  bind(PlaceManager.class).to(UserPortalPlaceManager.class).in(Singleton.class);

we should always @Inject PlaceManager (binding source) and NOT 
UserPortalPlaceManager (binding target).

This explains the extra UserPortalPlaceManager binding within GIN-generated 
fragment: UserPortalConfigurator does @Inject UserPortalConfigurator, there is 
no binding for UserPortalConfigurator type (only for PlaceManager), so 
Just-In-Time binding semantics apply to UserPortalConfigurator [1]:

  bind(UserPortalConfigurator.class); // implicit Just-In-Time binding

[1] http://code.google.com/p/google-guice/wiki/JustInTimeBindings

There are two possible solutions to this problem:

1. @Inject PlaceManager and cast it to UserPortalPlaceManager (simple)

2. use @Provides mechanism as presented in the current patch set (more complex)

-- 
To view, visit http://gerrit.ovirt.org/19298
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: If6374df0da70fa6f6edf044d4ebadafc7fb1a105
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alexander Wels <[email protected]>
Gerrit-Reviewer: Alexander Wels <[email protected]>
Gerrit-Reviewer: Einav Cohen <[email protected]>
Gerrit-Reviewer: Greg Sheremeta <[email protected]>
Gerrit-Reviewer: Vojtech Szocs <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: No
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to