Liferay ServiceBuilder 与其他代码生成工具(如 AndroMDA)的比较
我开始深入研究 liferay 6.x ServiceBuilder 框架,并且非常喜欢它的代码生成方法。一个简单的 service.xml 文件可以生成随时可用的强大服务,甚至无需编写一行代码。
我还尝试研究 AndroMDA,它可以从 UML 模型生成类似的服务,这听起来更有趣,因为它将直接链接我的业务模型,而我
现在 不需要学习 service.xml 的新 xml 配置(在 liferay ServiceBuilder 的情况下)我正在决定应该使用哪个工具。根据您使用这些工具的经验,请让我知道使用这个库的优点/缺点是什么,
我有兴趣了解这些方面,以及您自己的想法,
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
- Which is better to keep my development more productive in long term.
- 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.
- Is UML driven approach always good or there are some practical cons/challenges of it.
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在使用 Servicebuilder 时遇到了以下几个问题(我使用 liferay 5.2.3):
对象之间的关系。因此我正在有效地工作
只是对象映射器。它不会生成一对一的关系
但它肯定有自己的好处,就像 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) :
relations among objects. Because of this I am effectively working
just object mapper. It is not generating onetomany kind of relations
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.
您应该注意一个重要的事实。 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.