<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Marek,<div><br></div><div>That's nearly what you wrote. This session manager is not yet in the API. The SocialClient class in the Webapp example is a start for it.</div><div>First I have Injected lazily all the OAuthService beans :</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(119, 119, 119); "><span style="color: #000000">&nbsp;&nbsp; &nbsp;</span>@Inject</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; <span style="color: #777777">@Any</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; <span style="color: #941965">private</span> Instance&lt;OAuthService&gt; <span style="color: #102bc3">serviceHandlerInstances</span>;</div></div><div><br></div><div>Then I can dynamically instantiate a new bean for a given service in a method called from the UI :</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp;&nbsp; &nbsp;&nbsp;OAuthService newService=<span style="color: #102bc3">serviceHandlerInstances</span>.select(<span style="color: #941965">new</span> <span style="color: #777777">RelatedTo</span>.RelatedToLiteral(Service.<span style="color: #102bc3">Twitter</span>)).get();</div></div><div><br></div><div>I only have to parameterize the Service.Twitter enum value and then add newService to a Set of managed Service in my sessionManager. With a Set I can avoid doubloon account by implementing equals() and hashcode() in my services based on userid for instance.</div><div><br></div><div>What I need to do now to finish :</div><div><br></div><div>1) create a clean separation between OAuthServiceSettings (OAuth Application config for a given service), OAuthService (bean managing calls to service) and OAuthUserSettings (user access token and probably a link to userid). The two last are still mixed so OAuthUserSetting doesn't exist right now</div><div><br></div><div>2) create this Session manager where I'll be able to gather and mashup sessions to any service (even multiple session to the same service).</div><div><br></div><div>3) Writes tests, tests, tests (I know you like this one)&nbsp;</div><div><br></div><div>4) Write doc, doc, doc...&nbsp;</div><div><br></div><div>5) create an extension to allow registration of an Oauth service bean with a qualifier like in Seam Rest</div><div><br></div><div>6) import S***g Social model classes an call methods to map JSon and XML value returned by services</div><div><br></div><div>7) Write more tests and more doc :-).</div><div><br></div><div>Regarding the point 1) the idea is to have simple settings beans that could be extended later to become JPA entity or be loaded/written from/to a config file or being easily injected for tests. I just want to avoid having a Spring like (stateless) OAuthService with all the config parameter in each method signature...</div><div><br></div><div>Thanks for your feedback on this tasks list.<br><div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div><div><div><br class="Apple-interchange-newline">Antoine SABOT-DURAND<br></div></div></div></div></div></span></div></div>
</div>
<br><div><div>Le 17 mai 2011 à 17:48, Marek Schmidt a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>----- Original Message -----<br><blockquote type="cite">From: "Antoine Sabot-Durand" &lt;<a href="mailto:antoine@sabot-durand.net">antoine@sabot-durand.net</a>&gt;<br></blockquote><blockquote type="cite">To: <a href="mailto:seam-dev@lists.jboss.org">seam-dev@lists.jboss.org</a><br></blockquote><blockquote type="cite">Sent: Monday, May 16, 2011 6:25:23 PM<br></blockquote><blockquote type="cite">Subject: [seam-dev] Seam social API stabilisation is near.<br></blockquote><blockquote type="cite">Hi Team,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">After some pain, suffering and knots in my brain, I found a clean<br></blockquote><blockquote type="cite">answer to my multi-account issue (thanks to dependent scope, @Any<br></blockquote><blockquote type="cite">qualifier and Instance&lt;&gt; class).<br></blockquote><blockquote type="cite">I created a qualifier to distinguish different services beans in a<br></blockquote><blockquote type="cite">polymorphic context. The purpose of this qualifier is only to bind<br></blockquote><blockquote type="cite">some beans (settings, controller) to a given social service. To be as<br></blockquote><blockquote type="cite">generic as possible it takes a binding (in opposition to @Nonbinding)<br></blockquote><blockquote type="cite">parameter which is an enum related to service name. So<br></blockquote><blockquote type="cite">@RelatedTo(Service.Twitter) qualifies a bean in relation to Twitter.<br></blockquote><blockquote type="cite">I'm not very happy with this name "RelatedTo" but didn't found<br></blockquote><blockquote type="cite">something short and eloquent (I avoided @InRelationTo :-) ).<br></blockquote><blockquote type="cite">Suggestion and commentaries are welcome. (the source is in<br></blockquote><blockquote type="cite">multi_account feature branch)<br></blockquote><br><br>Hi Antoine!<br><br>I am not exactly sure I understand correctly what is a multi-account issue, so let me just write how I see it and correct me afterwards :) These new qualifiers will allow me to create, let's say, multiple Twitter OAuthServiceSettingsImpl beans, right? I understand that is useful when I want to configure different service providers that have the same implementation (such as generic OAuth providers).<br><br>From reading SEAMSOCIAL-12, what I thought was a multi-account issue, is that you want a single user (session) be tied to several accounts (that could or could not be from the same service, so I can have two twitter accounts and one facebook account). I see this issue as orthogonal to the one with multiple services, because I still don't see how I would accomplish this using the new multi_account API. To do that I would imagine I would need something like a session scoped account manager, which would manage my OAuthServices and let me list them, authorize them, create new ones from configured OAuthServiceSettings, etc... <br><br>Cheers,<br><br>Marek Schmidt<br><br><blockquote type="cite"><br></blockquote><blockquote type="cite">thxs<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Antoine SABOT-DURAND<br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">seam-dev mailing list<br></blockquote><blockquote type="cite"><a href="mailto:seam-dev@lists.jboss.org">seam-dev@lists.jboss.org</a><br></blockquote><blockquote type="cite"><a href="https://lists.jboss.org/mailman/listinfo/seam-dev">https://lists.jboss.org/mailman/listinfo/seam-dev</a><br></blockquote><br>--<br></div></blockquote></div><br></div></body></html>