Engine的模块之间共享实体

Engine的模块之间共享实体

本文介绍了App Engine的模块之间共享实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从Eclipse的移植到Android Studio和有一个Android应用程序连接到AppEngine上。
我已经在服务器端分成两个模块(端点默认模块和用户面临的请求)和后端的东西管理模块。
现在,这两个模块都需要使用的实体。 (后端模块通常是负责保存这些实体为DB,而前端默认模块是谁使用这些实体回数据返回到Android的)。

I am migrating from Eclipse to Android Studio and have a Android App connected to AppEngine.I have split the Server side into two modules (default module for Endpoints and user facing requests) and "admin" module for backend stuff.Now both these modules need to use the Entities. (backend module usually is responsible for saving these entities to DB, while the frontend default module is the one who returns data back to Android using these Entities).

什么是Android Studio中共享这两个模块之间的这些实体类的最佳方式?(也确保这些课程获得增强等)。我不希望有重复的课程,无论是在默认模块以及管理员。
也许之间有一个共同的java模块两(但不能确定类增强会的工作)。还是应该在管理模块不能使用的实体,而是使用持久性的其他方式?

What is the best way to share these Entity classes between these two modules in Android Studio? (also making sure these classes get enhanced etc). I do not wish to have duplicate classes, both in the default module as well as admin.Maybe have a common "java" module shared between the two (but not sure class enhancing would work). Or should the admin module NOT use the Entities and instead use other ways of persistence?

鸭preciate你的看法。

Appreciate your thoughts.

推荐答案

虽然有可能是不共享code的原因,我个人preFER干燥。

While there may be reasons for not sharing the code, personally I prefer DRY.

我通过将模型定义文件中的应用程序目录解决了问题DRY精神,在的Python 后端应用程序/ models.yaml 和符号联入每个模块子目录应用程序/ module_blah / models.yaml ,从而保证所有模块都看到了同款的定义。在部署时的符号链接会自动与该文件的实际内容被符号链接取代。可能需要照顾到所有的模块在同一时间部署。

I solved the issue in DRY spirit with the Python backend by placing the models definition file in the app dir app/models.yaml and sym-linking it into each of the modules subdirs app/module_blah/models.yaml, thus ensuring all modules see the same models definitions. At deployment time the symlinks are automatically replaced with the actual content of the file being symlinked. Care may be needed to deploy all modules at the same time.

我用同样的技术也分享跨模块共同code,整个库由符号链接应用程序/ lib中/ libx中的子目录到所需的应用程序/ module_blah / lib目录/ libx中的需要。

I used the same technique to also share entire libraries with common code across modules, by symlinking app/lib/libX subdirs into the desired app/module_blah/lib/libX as needed.

不知道这种技术是在Java中使用,寿。

Not sure if this technique is usable in Java, tho.

这篇关于App Engine的模块之间共享实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 07:12