3
votes

I am trying to use Google Objectify for Datastore (https://github.com/objectify/objectify). My app is not hosted on GAE, but I still make use of Datastore, so I need to use the remote API. Right now, I use the low level API and connect successfully like this :

DatastoreOptions options = DatastoreOptions.builder()
                .projectId("PROJECT_NAME")
                .authCredentials(AuthCredentials.createApplicationDefaults()).build();
Datastore client = options.service();

And the library used is http://googlecloudplatform.github.io/gcloud-java/0.2.0/index.html. My application defaults for "AuthCredentials.createApplicationDefaults()" is in my home folder in development as well as on the server.

In the doc I saw for Objectify, I did not see anyway of specifying the connection like above, thus no way of telling to use the credentials file in our home folder. The code I see for Objectify is mostly like this Objectify.ofy(). So I see no way with this method of telling to use the auth credentials defaults.

Thank you very much.

2
I have the exact same problem. Did you find a workaround ? - Flo354
Hello, I decided to have my server hosted on Google Cloud. So I used the even more default way to connect : DatastoreOptions.defaultInstance().service(); Sorry I cannot be of anymore help as I did not find a way to connect remotely... But good luck!! - madube94
I found a workaround. I use the RemoteApi cloud.google.com/appengine/docs/java/tools/remoteapi to install a context of a google app engine instance which I created only to do remote queries from my outside app. It's the solution of @stickfigure by the way - Flo354
Ok thanks for the info, I'll mark his answer as accepted and try it again on another project. - madube94

2 Answers

0
votes

You could try gcloud-java datastore module.

http://googlecloudplatform.github.io/gcloud-java/0.2.0/index.html

But I encounter some performance issues on outside of Google Sandbox (GAE-Compute Engine)