Re: AbstractAppEngineFlowServlet for objectify

15 views
Skip to first unread message

Jacob Moshenko

unread,
Jun 23, 2011, 9:52:34 AM6/23/11
to Kyaw Tun, google-api-...@googlegroups.com

There is more to it than just loading the credential.  The persistence manager is also responsible for tracking changes to managed objects and flushing them back out to the datastore when the servlet is done running.  If you look at the doGet method on the 1.4 library, or the service method on the newest checkin of the library, you will see that it creates a persistence manager context in which the user's code runs.  When the oauth credential is interacting with APIs, it may detect that it needs to refresh the access token using the refresh token.  When the servlet returns, the new access token will be written out to the data store.

It is important for the performance of your app that you not keep an expired access token around after it has expired and a new one has been issued.

On Wed, Jun 22, 2011 at 9:57 PM, Kyaw Tun <kyaw...@gmail.com> wrote:
Parheps you could eliminate PersistenceManager dependency in
ThreeLeggedFlow Interface and elsewhere just by using loadCredential(); It is class implementer responenbility to initialize with PM in their class instintiation.
 
Kyaw 
On Thu, Jun 23, 2011 at 9:20 AM, Kyaw Tun <kyaw...@gmail.com> wrote:
Hi Jake!
 

OAuth2ThreeLeggedFlow class have to be annotated in Objectify way: @PrimaryKey to @Id and @NotPersistent to @NotSaved

 

Kyaw


On Thu, Jun 23, 2011 at 7:50 AM, Kyaw Tun <kyaw...@gmail.com> wrote:
Hi Jake!
 
Thanks for your detail explination.
Currently I am implementing PersistenceManager interface with Objectify. Assuming you will be using a few methods in PersistenceManager, it should be OK. I will le you know how it goes.
 
BTW, three steps flow is cool!
 
I hope you Contact API come out since that is only one I am using.
 
Best wishes,
Kyaw

On Wed, Jun 22, 2011 at 9:25 PM, Jacob Moshenko <mosh...@google.com> wrote:
Hi Kyaw,

Currently we don't have a helper for anything but JDO.  I think we have a few options to get you up and running:
  1. You can use JDO for OAuth credentials persistence only.  The credential and flow objects are annotated for JDO, so even if I wrote a servlet that supports Objectify, it wouldn't know how to handle the objects themselves.  There should be nothing that prevents you from using JDO and Objectify together.  The downside to this is that it might make your servlet startup time slower. It would be better to measure the speed difference rather than speculate.
  2. You could file a feature request for a raw datastore API implementation that would add no additional overhead and should be equally as transparent to you.  There is no guarantee about when this would happen.  If you do file this please file it against the project http://code.google.com/p/google-oauth-java-client/
  3. You could write your own integration and send a code review to myself or yan...@google.com on codereview.appspot.com and we will help you get it included in the library for everyone to use.
Unfortunately the only option to get it running today is to just use the JDO implementation as is alongside your Objectify data.  If you do end up using the helpers, there is a recently committed version of the helpers which allows you to use doGet/doPost/etc without using doGetWithCredentials.  It should be much nicer for developers.  That can be found in the project which I referenced above.

Let me know if you have any more questions!

Thanks,
Jake

On Wed, Jun 22, 2011 at 1:26 AM, Kyaw Tun <kyaw...@gmail.com> wrote:
Hi!
 
Do you have implementation independent of JDO. Currently I am using Objectify for persistent manager.
 
Thanks,
Kyaw





Kyaw Tun

unread,
Jun 23, 2011, 8:32:12 PM6/23/11
to google-api-java-client
Dear Jake!



Solving three stage flow into a simple function is really cool! I love
it. However coupling with JDO is annoying. Parheps you could decouple
the framework or go low level datastore, so that JPA and Objectify
whont' freak out.



Cheers!
Kyaw

On Jun 23, 9:52 pm, Jacob Moshenko <moshe...@google.com> wrote:
> cc: google-api-...@googlegroups.com
>
> There is more to it than just loading the credential.  The persistence
> manager is also responsible for tracking changes to managed objects and
> flushing them back out to the datastore when the servlet is done running.
>  If you look at the doGet method on the 1.4 library, or the service method
> on the newest checkin of the library, you will see that it creates a
> persistence manager context in which the user's code runs.  When the oauth
> credential is interacting with APIs, it may detect that it needs to refresh
> the access token using the refresh token.  When the servlet returns, the new
> access token will be written out to the data store.
>
> It is important for the performance of your app that you not keep an expired
> access token around after it has expired and a new one has been issued.
>
>
>
> On Wed, Jun 22, 2011 at 9:57 PM, Kyaw Tun <kyawt...@gmail.com> wrote:
> > Parheps you could eliminate PersistenceManager dependency in
> > ThreeLeggedFlow Interface and elsewhere just by using loadCredential(); It
> > is class implementer responenbility to initialize with PM in their class
> > instintiation.
>
> > Kyaw
> > On Thu, Jun 23, 2011 at 9:20 AM, Kyaw Tun <kyawt...@gmail.com> wrote:
>
> >> Hi Jake!
>
> >> OAuth2ThreeLeggedFlow class have to be annotated in Objectify way:
> >> @PrimaryKey to @Id and @NotPersistent to @NotSaved
>
> >> Kyaw
>
> >>  On Thu, Jun 23, 2011 at 7:50 AM, Kyaw Tun <kyawt...@gmail.com> wrote:
>
> >>> Hi Jake!
>
> >>> Thanks for your detail explination.
> >>> Currently I am implementing PersistenceManager interface with Objectify.
> >>> Assuming you will be using a few methods in PersistenceManager, it should be
> >>> OK. I will le you know how it goes.
>
> >>> BTW, three steps flow is cool!
>
> >>> I hope you Contact API come out since that is only one I am using.
>
> >>> Best wishes,
> >>> Kyaw
>
> >>>  On Wed, Jun 22, 2011 at 9:25 PM, Jacob Moshenko <moshe...@google.com>wrote:
>
> >>>> Hi Kyaw,
>
> >>>> Currently we don't have a helper for anything but JDO.  I think we have
> >>>> a few options to get you up and running:
>
> >>>>    1. You can use JDO for OAuth credentials persistence only.  The
> >>>>    credential and flow objects are annotated for JDO, so even if I wrote a
> >>>>    servlet that supports Objectify, it wouldn't know how to handle the objects
> >>>>    themselves.  There should be nothing that prevents you from using JDO and
> >>>>    Objectify together.  The downside to this is that it might make your servlet
> >>>>    startup time slower. It would be better to measure the speed difference
> >>>>    rather than speculate.
> >>>>    2. You could file a feature request for a raw datastore API
> >>>>    implementation that would add no additional overhead and should be equally
> >>>>    as transparent to you.  There is no guarantee about when this would happen.
> >>>>     If you do file this please file it against the project
> >>>>    http://code.google.com/p/google-oauth-java-client/
> >>>>    3. You could write your own integration and send a code review to
> >>>>    myself or yan...@google.com on codereview.appspot.com and we will
> >>>>    help you get it included in the library for everyone to use.
>
> >>>> Unfortunately the only option to get it running today is to just use the
> >>>> JDO implementation as is alongside your Objectify data.  If you do end up
> >>>> using the helpers, there is a recently committed version of the helpers
> >>>> which allows you to use doGet/doPost/etc without using doGetWithCredentials.
> >>>>  It should be much nicer for developers.  That can be found in the project
> >>>> which I referenced above.
>
> >>>> Let me know if you have any more questions!
>
> >>>> Thanks,
> >>>> Jake
>
> >>>> On Wed, Jun 22, 2011 at 1:26 AM, Kyaw Tun <kyawt...@gmail.com> wrote:
>
> >>>>> Hi!
>
> >>>>> Do you have implementation independent of JDO. Currently I am using
> >>>>> Objectify for persistent manager.
>
> >>>>> Thanks,
> >>>>> Kyaw- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages