oh i see what you are saying. so currently the users of UserId don't care and shouldn't care what the userId.type is. All the impls just call userId.getUserId(token) which gives them the right string value.
however, if someone did want to treat @me differently than @viewer.. and also just to simplify the parsing code i don't think it is bad to have both enums. if you feel very strongly we could of course change the fromJson method to just convert to @viewer... - Cassie On Wed, Aug 6, 2008 at 11:43 AM, Adam Winer <[EMAIL PROTECTED]> wrote: > Sure, @me makes perfect sense from an URL perspective. I'm talking > about the Service Java API - why not map @me to UserId.Type.Viewer? > Or map @viewer to UserId.Type.Me? Service code shouldn't have to know > the difference between security token requests and third party > requests. > > On Wed, Aug 6, 2008 at 11:18 AM, Cassie <[EMAIL PROTECTED]> wrote: > > when using the security token @viewer and @owner make sense. however, the > > spec, and all third party servers don't know about the security token. > all > > they know about is oauth. in oauth, there is only one user - and that is > > @me. the spec could have called it @viewer i suppose.. but it didn't... > > > > - Cassie > > > > > > On Wed, Aug 6, 2008 at 11:05 AM, Adam Winer <[EMAIL PROTECTED]> wrote: > > > >> If @me is the current viewer, why do we need both UserId.Type "viewer" > >> and "me" constants? Will any service implementation ever treat these > >> differently? > >> > >> -- Adam Winer > >> > >> > >> On Tue, Aug 5, 2008 at 5:59 PM, <[EMAIL PROTECTED]> wrote: > >> > Author: doll > >> > Date: Tue Aug 5 17:59:45 2008 > >> > New Revision: 683070 > >> > > >> > URL: http://svn.apache.org/viewvc?rev=683070&view=rev > >> > Log: > >> > @me is now a supported userId type. it translates into the current > >> viewer. > >> > > >> > > >> > Modified: > >> > > >> > > incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/UserId.java > >> > > >> > > incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/spi/UserIdTest.java > >> > > >> > Modified: > >> > incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/UserId.java > >> > URL: > >> > http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/UserId.java?rev=683070&r1=683069&r2=683070&view=diff > >> > > >> > ============================================================================== > >> > --- > >> > incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/UserId.java > >> (original) > >> > +++ > >> > incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/UserId.java > >> Tue Aug 5 17:59:45 2008 > >> > @@ -23,7 +23,7 @@ > >> > > >> > public class UserId { > >> > public enum Type { > >> > - viewer, owner, userId > >> > + me, viewer, owner, userId > >> > } > >> > > >> > private Type type; > >> > @@ -47,6 +47,7 @@ > >> > case owner: > >> > return token.getOwnerId(); > >> > case viewer: > >> > + case me: > >> > return token.getViewerId(); > >> > case userId: > >> > return userId; > >> > > >> > Modified: > >> > incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/spi/UserIdTest.java > >> > URL: > >> > http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/spi/UserIdTest.java?rev=683070&r1=683069&r2=683070&view=diff > >> > > >> > ============================================================================== > >> > --- > >> > incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/spi/UserIdTest.java > >> (original) > >> > +++ > >> > incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/spi/UserIdTest.java > >> Tue Aug 5 17:59:45 2008 > >> > @@ -18,7 +18,6 @@ > >> > package org.apache.shindig.social.opensocial.spi; > >> > > >> > import org.apache.shindig.common.testing.FakeGadgetToken; > >> > -import org.apache.shindig.social.opensocial.spi.UserId; > >> > > >> > import junit.framework.TestCase; > >> > > >> > @@ -31,6 +30,9 @@ > >> > UserId viewer = new UserId(UserId.Type.viewer, "hello"); > >> > assertEquals("viewer", viewer.getUserId(new > >> FakeGadgetToken().setViewerId("viewer"))); > >> > > >> > + UserId me = new UserId(UserId.Type.me, "hello"); > >> > + assertEquals("viewer", me.getUserId(new > >> FakeGadgetToken().setViewerId("viewer"))); > >> > + > >> > UserId user = new UserId(UserId.Type.userId, "hello"); > >> > assertEquals("hello", user.getUserId(new FakeGadgetToken())); > >> > } > >> > @@ -42,6 +44,9 @@ > >> > UserId viewer = UserId.fromJson("@viewer"); > >> > assertEquals(UserId.Type.viewer, viewer.getType()); > >> > > >> > + UserId me = UserId.fromJson("@me"); > >> > + assertEquals(UserId.Type.me, me.getType()); > >> > + > >> > UserId user = UserId.fromJson("john.doe"); > >> > assertEquals(UserId.Type.userId, user.getType()); > >> > assertEquals("john.doe", user.getUserId()); > >> > > >> > > >> > > >> > > >

