How to access GAE datastore with Objectify and service account credentials?
Asked Answered
D

2

0

Is it possible for one GAE application to access the datastore of another GAE application (both applications are hosted under the same Google account) using Objectify? If so, how can I pass service account credentials to Objectify (which API calls)?

Dday answered 5/5, 2014 at 9:32 Comment(0)
G
0

It is not possible. Objectify is a very simple and convenient lightweight ORM that sits on top of a GAE Datastore, thus shielding the developer from most of the complexities of using JDO/JPA.

Nowhere in the documentation have I seen the scenario you describe mentioned because that is not the problem it is trying to solve.

I suspect what you will probably need to do is create a Web Service that exposes your GAE application (whose data you want) through an API. Then have your other GAE application call those service methods to obtain the data it needs.

Alternatively, you can use something called remote_api. It allows you to access and manipulate a GAE Datastore remotely.

Below are some links I just found to similar questions after posting my answer:

Can I access Datastore entities of my other Google App Engine Applications

Can one application access other applications data querying the key in Google App Engine?

Gyrate answered 5/5, 2014 at 12:51 Comment(2)
I now assume JDO/JPA would not allow me to do that either. Can you confirm?Dday
Objectify can be used with the Remote API. See developers.google.com/appengine/docs/java/tools/remoteapi Be somewhat careful because you need to manage the work of the ObjectifyFilter yourself (basically, call ObjectifyFilter.complete() at the end of each logical remote request).Crosseyed
U
0

A solution is to have only one "GAE application" but to make different Modules in your application. The Datastore will be shared between the modules.

Another solution is to use the Remote API (https://developers.google.com/appengine/docs/java/tools/remoteapi), but you won't be able to use Objectify, I think...

Undry answered 5/5, 2014 at 12:31 Comment(0)
G
0

It is not possible. Objectify is a very simple and convenient lightweight ORM that sits on top of a GAE Datastore, thus shielding the developer from most of the complexities of using JDO/JPA.

Nowhere in the documentation have I seen the scenario you describe mentioned because that is not the problem it is trying to solve.

I suspect what you will probably need to do is create a Web Service that exposes your GAE application (whose data you want) through an API. Then have your other GAE application call those service methods to obtain the data it needs.

Alternatively, you can use something called remote_api. It allows you to access and manipulate a GAE Datastore remotely.

Below are some links I just found to similar questions after posting my answer:

Can I access Datastore entities of my other Google App Engine Applications

Can one application access other applications data querying the key in Google App Engine?

Gyrate answered 5/5, 2014 at 12:51 Comment(2)
I now assume JDO/JPA would not allow me to do that either. Can you confirm?Dday
Objectify can be used with the Remote API. See developers.google.com/appengine/docs/java/tools/remoteapi Be somewhat careful because you need to manage the work of the ObjectifyFilter yourself (basically, call ObjectifyFilter.complete() at the end of each logical remote request).Crosseyed

© 2022 - 2024 — McMap. All rights reserved.