0
votes

I am trying to use the Cloud Datastore with low level API on Eclipse Mars with Google plugin but I realised I was missing some libraries used in Google tutorials:

//I was using this
com.google.appengine.api.datastore.Entity;
Entity a = Entity.builder(..) // method does not exist I presume
//and the tutorials use this instead
com.google.cloud.datastore.Entity;

So after finding this guide: https://developers.google.com/eclipse/docs/using_sdks, I installed Google Cloud SDK for Mac OS X(google-cloud-sdk-130.0.0-darwin-x86_64.tar) but when I try to add the sdk, I get the error: Failed to initialize App Engine SDK at /Users/../google-cloud-sdk 2

It is the directory where I opened the downloaded file and ran the bin/gcloud init so I guess the sdk should be installed there or is it not? How do I find the path to it? Should I try a different version? I am terrible with the terminal..

And can you explain the difference between the classes? I thought that the datastore is in the cloud already when I deploy it to the app engine.. Are there two types of the datastore?

1

1 Answers

0
votes

The old GPE (Google Plugin for Eclipse) is based on the App Engine Java SDK (appcfg), not the Cloud SDK (gcloud). The page you cite was written before the Cloud SDK existed. I'll have to update it to make that a little clearer.

A new open source GCloud-based Eclipse plugin is in development. You can try it out at this early stage if you like, but please be prepared to file bugs.

Some other things I note from your question: "Entity" is a fairly generic name that shows up in a lot of APIs, and not all Entity classes are the same thing. In this case though both com.google.appengine.api.datastore.Entity and com.google.cloud.datastore.Entity refer to the basic BLOB storage in App Engine, Cloud Datastore, a NoSQL database. However:

  • com.google.appengine.api.datastore is used by servlets and other programs running on Google App Engine to communicate with Cloud Datastore.

  • com.google.cloud.datastore is used by programs that run on your own non-App Engine computers to communicate with Cloud Datastore using HTTP under the hood.

That is, you only use com.google.appengine.api.datastore if you're writing an App Engine application that needs to store data. You can use com.google.cloud.datastore for any application whether it runs on App Engine or not. They may both read and write from the same database.