Announcement Announcement Module
No announcement yet.
UsersConnectionRespository and ConnectionRepository - why not combine? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • UsersConnectionRespository and ConnectionRepository - why not combine?

    Working on understanding the Spring Social Showcase and started digging into the JdbcUsersConnectionRespository and JdbcConnectionRepository classes and was just curious why they aren't combined.

    Both implementations act upon the same datastore (table UserConnection), so I'm curious of what purpose and/or OO clarity is achieved by having UsersConnectionRepository implemenatinos act as a factory to create instances ConnectionRepository?

    If I'm understanding things correctly each HomeController in the Showcase will have its own JdbcConnectionRepository per that user for the Request (created via the JdbcUsersConnectionRepository factory method) defined in SocialConfig. Seems like just reusing a single JdbcUsersConnectionRepository class would work just as well (assuming the ConnectionRepo methods were moved to it.) ?

    I was also confused for a bit in the ProviderSignInAttempt class due to the property name:

    private final UsersConnectionRepository connectionRepository;

    Which I think would be better named:

    private final UsersConnectionRepository usersConnectionRepository;

    Since "connectionRepository" instances would seem to apply more to a "ConnectionRepository" instance (vs UsersConnectionRepository.)

  • #2
    Not all environments are multi-user e.g Android. There is a functional usefulness in having both. It's also convenient to be able to work against a ConnectionRepository in the context of a single request and have the user id encapsulated from callers.

    Last edited by Keith Donald; Jul 31st, 2011, 03:56 PM.