Hey all (and particularly @lryan),

I spent a lot of yesturday migrating our code to comply with the new Shindig annotations based handler and handler registry. I really like this way of organising things, but I did have quite a few problems while itegrating which I hope you can help us with.

*1. Registering a new Handler*

Up until yesturday we've been including the SocialApiGuiceModule in our web.xml and test-bootstraps. This is generally a good idea as we don't have to manually keep the bindings up-to-date.

Now that SocialApiGuiceModule registers a list of handlers:
bind(List.class).annotatedWith(Names.named("org.apache.shindig.handlers"))
.toInstance(Lists.immutableList(ActivityHandler.class, AppDataHandler.class,
           PersonHandler.class, SampleContainerHandler.class));

And we extend the PersonHandler with, say, SuperAwesomeBBCPersonHandler, we now have to copy and paste all of SocialApiGuiceModule, so we can change that one registration. Even if we bind PersonHandler.class to SuperAwesomeBBCPersonHandler.class, it's PersonHandler that gets registered as a handler (unless I did something wrong when I tried this.. which is likely).

There's probably some way of achieving this that I missed yesturday, but as it stands this will increase our maintenance / tracking overhead.

*2. Modularising the Actions*

The major advantage to this system can be seen in the /@supportedFields as you can modularise the actions and not have to stuff them all in to one long function.

The problem I am having is creating seperate functions with paths that only change at the end.

Say I've got an operation that creates a Person:
@Operation(httpMethods = "POST")
public Future<?> create(RequestItem request) throws SocialSpiException {

And an operation that creates a person's Igloos:
@Operation(httpMethods = "POST", path = "/{userId}+/@self/igloos")
public Future<?> createIgloo(RequestItem request) throws SocialSpiException {

The paths aren't different enough for the DefaultHandlerRegistry and the two functions conflict. Am I doing something wrong or does the Hash for Rest operations in the DefaultHandlerRegistry need to create cleverer keys for this to work?


Hope you can help me with this. Overall, nice work, it could be made just a bit easier for extending parties.

Cheers,
Ben Smith
BBC

Reply via email to