I'll answer my own question for those that read this thread :)

I incorrectly defined the impl, when in fact I should be using the key. 
 When I'm also using several different implementations distinguished by an 
Annotation, I also need to include this annotation in my key.  Here is the 
gist demonstrating this.

https://gist.github.com/tnine/d5b569c6641808488eb6#file-graphmodule-java-L104

In case it gets lost, here is the code snippit as well.

  //do multibindings for migrations
        Multibinder<Migration> migrationBinding = Multibinder.newSetBinder( 
binder(), Migration.class );
        migrationBinding.addBinding().to( Key.get( NodeSerialization.class ) );
        migrationBinding.addBinding().to( Key.get( 
EdgeMetadataSerialization.class ) );
 
        //bind each singleton to the multi set.  Otherwise we won't migrate 
properly
        migrationBinding.addBinding().to( Key.get( EdgeSerialization.class, 
PermanentStorage.class ) );
        migrationBinding.addBinding().to( Key.get( EdgeSerialization.class, 
CommitLog.class ) );


On Thursday, April 17, 2014 8:17:59 AM UTC-7, Todd Nine wrote:
>
> Hey Fred,
>   Thanks for the reply.  I've just tried your suggestion.  I've made my 
> Serialization interfaces extend Migration temporarily so that the set 
> inclusion compiles.
>
>
> https://gist.github.com/tnine/d5b569c6641808488eb6#file-graphmodule-java-L98
>
> The providers aren't getting invoked when I do it like this, am I doing 
> something incorrectly?  Feel free to edit the gist to correct my impl.
>
> Thanks,
> Todd
>
>
>
> On Wednesday, April 16, 2014 5:36:13 PM UTC-7, Fred Faber wrote:
>>
>> I see and injection of 'Set<Migration>' where the elements of this set 
>> are EdgeMetadataSerializationImpl and NodeSerializationImpl
>>
>> To trigger the provider methods that return instances of these types, 
>>  Guice needs to recognize the binding chain. In this case, you'd contribute 
>> EdgeMetadataSerialization to the set, which itself is bound to 
>> EdgeMetadataSerializationImpl, and that will trigger the provider method.
>>
>> For (2), not really. But it's generally good to be explicit, and that is 
>> an underlying benefit.
>>
>>
>> On Wed, Apr 16, 2014 at 7:49 PM, Todd Nine <[email protected]> wrote:
>>
>>> Hi all,
>>>   I'm creating an application that has some complex binding, and I'm 
>>> running into an issue I could use a hand with.  Here is my module.
>>>
>>>
>>>
>>> https://github.com/usergrid/usergrid/blob/99fd1e50cdb523ac463e3949e99a7f8103f37a56/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java#L98
>>>
>>> Several of my serialization classes implement 2 interfaces.  The first 
>>> is their associated serialization interface, the other is the interface 
>>> "Migration".  I then have a MigrationManagerImpl that takes a set of these 
>>> Migration interfaces in it's constructor.  When an administrator triggers 
>>> an update, each Migration is invoked by the MigrationManager in the correct 
>>> order.  What I have above worked previously.  However, now I have two 
>>> instances of serialization for the edges.  One is used as commit log for 
>>> fast writes, the other is used in post processing to compact edges into 
>>> shards based on the shard size for long term storage and faster seeks.
>>>
>>>
>>> https://github.com/usergrid/usergrid/blob/99fd1e50cdb523ac463e3949e99a7f8103f37a56/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java#L146
>>>
>>>
>>> https://github.com/usergrid/usergrid/blob/99fd1e50cdb523ac463e3949e99a7f8103f37a56/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java#L172
>>>
>>>
>>> I'm facing 2 issues now.
>>>
>>> 1) The provider methods in my module are never invoked, so the multi 
>>> binding never seems to occur.
>>>
>>>
>>> 2) Rather than have 2 instances of each of these serializers (one for 
>>> the use in DI and one in the Multibinding), is there a way I can get a list 
>>> of existing singleton instances that implement the Migration interface, and 
>>> inject them in my MigrationManagerImpl without having to do duplicate 
>>> bindings?
>>>
>>> Thanks,
>>> Todd
>>>
>>>
>>>  -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "google-guice" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/google-guice.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/d/optout.

Reply via email to