简体   繁体   English

使用GPE将Cloud SDK添加到Eclipse

[英]Add Cloud SDK to Eclipse with GPE

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: 我试图在带有Google插件的Eclipse Mars上使用具有低级API的Cloud Datastore,但我意识到我缺少Google教程中使用的一些库:

//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 因此,在找到本指南之后: https : //developers.google.com/eclipse/docs/using_sdks ,我安装了适用于Mac OS X的Google Cloud SDK(google-cloud-sdk-130.0.0-darwin-x86_64.tar),但是当我尝试添加sdk,但出现错误:无法在/Users/../google-cloud-sdk 2初始化App Engine SDK

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? 这是我打开下载文件并运行bin / gcloud init的目录,所以我猜sdk应该安装在该目录中吗? 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? 当我将数据存储部署到应用程序引擎时,我认为该数据存储已在云中。是否有两种类型的数据存储?

The old GPE (Google Plugin for Eclipse) is based on the App Engine Java SDK (appcfg), not the Cloud SDK (gcloud). 旧版GPE(适用于Eclipse的Google插件)基于App Engine Java SDK(appcfg),而非Cloud SDK(gcloud)。 The page you cite was written before the Cloud SDK existed. 您引用的页面是在Cloud SDK存在之前编写的。 I'll have to update it to make that a little clearer. 我将不得不对其进行更新以使其更加清晰。

A new open source GCloud-based Eclipse plugin is in development. 一个新的基于GCloud的开源Eclipse插件正在开发中。 You can try it out at this early stage if you like, but please be prepared to file bugs. 如果愿意,您可以在早期阶段尝试一下,但请准备提交bug。

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. 我从您的问题中注意到了一些其他内容:“实体”是一个相当通用的名称,它出现在许多API中,并且并非所有的Entity类都是相同的。 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. 在这种情况下,com.google.appengine.api.datastore.Entity和com.google.cloud.datastore.Entity均指App Engine Cloud Datastore (NoSQL数据库)中的基本BLOB存储。 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.appengine.api.datastore由servlet和在Google App Engine上运行的其他程序用来与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. 在您自己的非App Engine计算机上运行的程序使用com.google.cloud.datastore来通过后台使用HTTP与Cloud Datastore进行通信。

That is, you only use com.google.appengine.api.datastore if you're writing an App Engine application that needs to store data. 也就是说,只有在编写需要存储数据的App Engine应用程序时,才使用com.google.appengine.api.datastore。 You can use com.google.cloud.datastore for any application whether it runs on App Engine or not. 您可以将com.google.cloud.datastore用于任何应用程序,无论它是否在App Engine上运行。 They may both read and write from the same database. 它们可能都从同一数据库读取和写入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM