Results 1 to 10 of 11

Thread: What is the UsersConnectionRepository for in Spring Social Facebook?

Hybrid View

  1. #1
    Join Date
    Feb 2008
    Posts
    169

    Question What is the UsersConnectionRepository for in Spring Social Facebook?

    I'm following the directions here and elsewhere:
    https://github.com/SpringSource/spri...ki/Quick-Start

    Why do we need to specify a dataSource and UsersConnectionRepository to use Spring Social Facebook? What gets written to our database? Am I supposed to create special tables or modify my Users table?

  2. #2
    Join Date
    Aug 2004
    Posts
    1,073

    Default

    To be clear, you don't need a data source or UsersConnectionRepository to use Spring Social Facebook. If you want to obtain the access token through other means, you can certainly create an instance of FacebookTemplate and go from there.

    You do need a UsersConnectionRepository, however, if you want to use Spring Social's connection support. A UsersConnectionRepository can be used to create a ConnectionRepository, which ConnectController will use to persist connections for long-term use (so that you don't have to go back and ask the user to authorize your app every time). And, in Spring Social 1.0, the only implementation of UsersConnectionRepository is JDBC-based--so it needs a data source to be able to access the database.

    If you've not done so already, check out http://static.springsource.org/sprin...eprovider.html, specifically section 2.3 will clear up the purpose of the connection repository.
    Craig Walls
    Spring Social Project Lead

  3. #3
    Join Date
    Feb 2008
    Posts
    169

    Default

    That's what I was looking for Craig! Thanks.

  4. #4
    Join Date
    Mar 2012
    Posts
    2

    Default

    Sorry for digging this thread after all these months. But I have a little question since I'm beginning to use spring social.
    Our main database is not a RDBMS, but Cassandra . Then the JdbcUsersConnectionRepostory is useless.Does it mean I have to implement the full ConnectionRepository interface with all the methods in order to make it work. And then do I still need the UsersConnectionRepository to be implemented?
    Sorry if theses are so beginner minded.

  5. #5
    Join Date
    Aug 2004
    Posts
    1,073

    Default

    In short, the answers to all of your questions are "yes".

    We set out to provide a JDBC-based set of templates, as we figured that would be the one most commonly used. But knowing that other implementations would prove useful, it's all based on interfaces from which you can implement whatever kind of connection repository you want. Some work has been done in the community already to provide JPA-based, Mongo-based, and SQLite-based implementations. If you decide to implement a Cassandra-based implementation, then it'd be awesome if you could share your work with the community.

    And yes, you'd need to implement both ConnectionRepository and UsersConnectionRepository. The UsersConnectionRepository is one that deals with connections across all users, while ConnectionRepository focuses on connections for a specific user.

    At first glance, it may seem that ConnectionRepository is the most useful of the two. In fact, it's the ConnectionRepository that ConnectController uses to manage connections for the current user. And in an application that only cares about creating connections between its users and some provider, then UsersConnectionRepository is only a means to an end...that is, it only exists to create a ConnectionRepository for the current user.

    But if the app offers a sign-in-with-provider option, then UsersConnectionRepository is useful for more than just being a ConnectionRepository factory. In that scenario, there isn't a notion of a "current user" yet...they're still signing in. Therefore, ConnectionRepository is useless for helping a user sign in. UsersConnectionRepository, having the ability to deal with all connections for all users is able to help ProviderSignInController find a user who has a connection that matches the connection details obtained while signing in with Facebook/Twitter/etc.
    Craig Walls
    Spring Social Project Lead

  6. #6
    Join Date
    Mar 2012
    Posts
    2

    Default

    Thanks it's all clear now.
    Thanks for the great job.

  7. #7
    Join Date
    Aug 2012
    Posts
    3

    Default

    Hello,

    Can somebody specify any useful link where I can find out status of Mongo-based implementation of the interfaces please?

    Thanks

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •