Liferay ServiceBuilder 与其他代码生成工具(如 AndroMDA)的比较

发布于 2024-10-19 09:35:33 字数 764 浏览 1 评论 0原文

我开始深入研究 liferay 6.x ServiceBuilder 框架,并且非常喜欢它的代码生成方法。一个简单的 service.xml 文件可以生成随时可用的强大服务,甚至无需编写一行代码。

我还尝试研究 AndroMDA,它可以从 UML 模型生成类似的服务,这听起来更有趣,因为它将直接链接我的业务模型,而我

现在 不需要学习 service.xml 的新 xml 配置(在 liferay ServiceBuilder 的情况下)我正在决定应该使用哪个工具。根据您使用这些工具的经验,请让我知道使用这个库的优点/缺点是什么,

我有兴趣了解这些方面,以及您自己的想法,

  1. 从长远来看,哪种方法可以更好地保持我的开发更加高效。
  2. 如果我使用 ServiceBuilder,我将能够使用门户环境之外的服务(假设从非门户应用程序服务器运行相同的服务。UML
  3. 驱动的方法总是好的还是有一些实际的缺点/挑战。
  4. Do对于 liferay 6.x 开发,您知道还有比这两个更好的其他代码生成库吗?我也检查了这些 SO 线程

I started digging into the liferay 6.x ServiceBuilder framework and really liked its code generation approach. A simple service.xml file can generate ready to use powerful services without even writing a single line of code.

I also tried looking into AndroMDA which can generate similar services from the UML model, which sounds even more interesting since it will link my business model directly without me needing to learn a new xml config for service.xml (in case of liferay ServiceBuilder)

now I am in the process of deciding which tool should I use. Based on your experience with any of these tools Please let me know what are Pros/Cons of using any of this library,

I am interested to know these aspects, along with your own thoughts

  1. Which is better to keep my development more productive in long term.
  2. If I use ServiceBuilder will I be able to use the services outside portal env (lets say running same service from a non-portal app server.
  3. Is UML driven approach always good or there are some practical cons/challenges of it.
  4. Do you know of any other code generation library which is better than these two for liferay 6.x development? I also checked these SO Threads

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

北风几吹夏 2024-10-26 09:35:33

我在使用 Servicebuilder 时遇到了以下几个问题(我使用 liferay 5.2.3):

  1. 无法使用 ORM 框架。没有办法生成
    对象之间的关系。因此我正在有效地工作
    只是对象映射器。它不会生成一对一的关系
  2. 不能使用基本的面向对象的东西,例如域或服务的继承
  3. 编写单元测试用例非常困难
  4. 我仍然不明白复杂的域结构需要什么
  5. 我觉得代码就是这样生成可以使用 IDE 快速编写,

但它肯定有自己的好处,就像 Egar 所说的那样,它是专门为 Liferay 制作的。所以它可以快速生成liferay所需的一切。我听说在最新版本的 liferay 中,上述问题很少得到解决。

总的来说,这取决于您的要求。如果您需要对 ORM 层进行更多控制,并且您有复杂的业务逻辑,需要大量的单元测试,请选择普通的 Spring 服务,这些服务可以作为 Web 服务或 REST 服务公开给您的 Portlet。

另外,服务生成器也适用于简单的 portlet。其他方法可以同时使用两者。所有复杂的服务作为单独的项目,简单的服务则使用服务构建器。

Following few problems I have experienced with Servicebuilder (I am using liferay 5.2.3) :

  1. Not able to make use ORM framework. There is no way to generate
    relations among objects. Because of this I am effectively working
    just object mapper. It is not generating onetomany kind of relations
  2. Can not use basic object oriented things like inheritance with domain or services
  3. It is quite hard to write unit test cases
  4. I still didn't understand what is the need of complex domain structure
  5. I feel the code it is generating can be quickly written using an IDE

But definitely it has its own benefits like Egar said, it is specifically made for Liferay. So it can quickly generate everything that is needed for liferay. I heard in latest versions of liferay few of above problems are fixed.

Overall it depends on your requirement. If you need more control over your ORM layer and you have complex business logic which needs quite a lot of unit testing, go for normal spring services which can be exposed as webservices or REST services to your portlets.

Otherwise service builder is also good for simple portlets. Other approach could be using both. All complex services as a separate project and simple ones with service builder.

枯叶蝶 2024-10-26 09:35:33

您应该注意一个重要的事实。 ServiceBuilder 已用于帮助构建门户本身,并且与门户紧密集成。你不能在 Liferay 之外使用它......我的意思是它可能可以被采取和修改以供一般用途,但我怀疑它是否有意义。

最重要的是,因为 Portal 和您正在开发的每个插件在 servlet 容器中都有自己的 Web 应用程序上下文 - 每个都有自己的类加载器。插件使用Portal类加载器和门户服务等。

简单地说,ServiceBuilder生成的代码和spring上下文只有在有webapp/ROOT/(即Liferay Portal和门户类加载器等)的情况下才能存在。AndroMDA

是一个通用的MDA框架。我不太了解,所以不做比较。 ServiceBuilder的强大之处在于它不是一个通用的框架——它对于liferay插件开发来说更强大。

There is an important fact that you should be aware of. ServiceBuilder has been used to help building the portal itself and it is tightly integrated into it. You cannot use it outside of Liferay...I mean it probably could be taken and modified for general usage, but I doubt it would make sense.

Most importantly because Portal and each plugin that you are developing have their own web application context in a servlet container - each has its own classloader. Plugins are using Portal classloader and portal services, etc. etc.

Simply put, ServiceBuilder generated code and spring context can exist only if there is a webapp/ROOT/ which is Liferay Portal with portal classloader etc.

AndroMDA is a MDA framework for general usage. I don't know it much, so that I'm rather not going to make comparisons. The power of ServiceBuilder is that it is not a framework for general usage - the more powerful it is for liferay plugin development.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文