CUBA Platform: An Open-Source Java Framework for Rapid Application Development
This article looks at the CUBA Platform – an open-source framework combining solid architecture, "must-have" features for enterprise applications, and rapid application development tools.
Join the DZone community and get the full member experience.
Join For FreeTraditionally, since the very beginning of the computing era, enterprise software development has faced one challenge when, naturally, it is supposed to be focused on solving real business problems, but at the same time developers have to spend significant time and effort on the technical side of the solution, such as architecture and generic functionality implementation.
In response to this disbalance between technical focused and problem-oriented programming, a number of frameworks emerged, which were intended to raise the abstraction level and release developers from low-level routine. Also, to increase development efficiency, development tools have become smarter and smarter over years. One of the best examples of the early 2000s is Borland Delphi, which hugely increased development speed of desktop applications.
In the past decade, enterprise software has evolved a lot, raising the need for a new generation of high productivity frameworks and development tools. So, in this article we will have a look at the CUBA Platform – an open source framework, combining solid architecture, ‘must have’ features of any enterprise application, and rapid application development tools, aimed to boost development productivity.
How Is CUBA Platform Different From Other Frameworks?
The main differentiator from most other Java frameworks is that CUBA Platform is a high-level framework. This means that it abstracts developers from underlying technologies - such as Vaadin, Spring, and EclipseLink - so they can focus on the business tasks, empowered by a rich set of features and development tools. At the same time, CUBA does not restrict access to low-level code, providing the confidence that the framework can be adapted to the needs of a project.
CUBA Platform brings most value when developing enterprise applications, which typically require complex data models, tens or hundreds of screens, support for running various business processes, strong security requirements and so on.
What’s Under the Hood?
CUBA applications have a standard three-tier architecture. The nexus is metadata — the knowledge of the application data model. First, it makes all visual components data-aware. So, for instance, a table knows it is displaying certain attributes of a driver entity, and a label knows that it is displaying a date. Similarly, metadata helps visual components to talk to the data layer via ORM — defining the graph of objects which should be uploaded or updated. The same applies to the security subsystem, report generator and other parts of the platform.
The rich web UI is declarative: you define screens layout in a visual editor or XML choosing from 70+ visual components ranging from all sorts of buttons to Google Maps and dynamic charts. Then you add the initialization and event handling logic in Java controllers. Considering data-aware components, you can create a sophisticated UI very quickly and it will remain easy to maintain, thanks to clear separation between code and layout. If the choice of available components is not enough, there is a facility to integrate external JavaScript, GWT or Vaadin components.
An important part of CUBA user interface is the Generic Filter — a component which allows users to create their own search conditions. A developer just needs to drop the component to a browser screen (a screen showing a list of entities) and forget about it. Users or administrators will define conditions they want to search on themselves.
All user actions are controlled by the security subsystem. The role-based model controls CRUD access down to entity attributes, and even certain screen components or custom tokens which you can use in your code. Row level security helps to control access to certain data records — for example, users from a regional department will only see documents created by this department. The security settings are configured at runtime in the UI of your application, so all changes can be done by system administrators on the fly. Finally, all changes to the data are logged, so you will see who changed what and when — handy for debriefing when something went wrong!
In addition to the above, CUBA provides many features out of the box, including:
- User management and administration tools
- Report management
- Business process management with an integrated visual designer
- Multilanguage interface and multiple timezones support
- Full-text search
- Generic REST API
Where Can I Deploy My Application?
When it comes to the deployment stage and environment options, you have a lot of freedom here. CUBA applications can be deployed in a variety of configurations, starting from a single server running everything, to highly available configurations with separate middleware and web clusters. The platform supports PostgreSQL, Oracle Database, Microsoft SQL Server, MySQL and HSQL (typically used for prototyping) out of the box, and you can switch from one to another as your project grows. It is also important that CUBA applications can be deployed to any Java EE Web Profile server, such as Jetty, Tomcat, Glassfish or Websphere. Of course, you can encapsulate your application in Docker and/or run it in popular PaaS clouds like CloudFoundry, OpenShift or Jelastic.
Sounds Good, so How Do I Develop CUBA Applications?
All you need to develop applications with CUBA Platform is Java SE, XML, and JPQL — which makes your application code more uniform and easier to maintain. This also makes your development team more flexible — you don’t really need a subteam of Web developers or Java EE gurus.
You create your business logic in an IDE of your choice, like IntelliJ IDEA or Eclipse, but CUBA also features Studio — a supplementary visual tool which automates the whole range of CUBA-specific tasks:
- sets up project infrastructure
- enables visual design of UI and data model
- scaffolds CRUD screens with multiple layout options
- keeps DB up-to-date by automatically generating and running update scripts
- generates stubs for handlers, services, etc.
All changes between Studio and the IDE are synchronized, so you have full freedom to choose where to make them. And to boost developer performance even further, Studio automatically hot deploys all your code except for the data model. Thus, Studio eliminates a lot of routine work and boilerplate code without restricting the tools you use to write code.
If you think of upgrading your legacy system to a modern stack, CUBA has an answer for this too. The studio features a migration tool, which will convert a legacy database to CUBA-compliant and automatically generates screens based on the DB schema. Thus, you will only need to add custom screens and migrate business logic.
OK I’m Almost Convinced... What About Licensing?
As stated in the title, the core framework is open source, licensed under Apache 2.0 with its source code available on GitHub. This means that there are no license limitations on the software you develop on CUBA. CUBA Studio is available in free and commercial editions. The free version of CUBA Studio is fully functional, but limits the size of the application’s data model. It is ideal to bootstrap a project and explore platform features. Further development may be continued free of any charges purely in a Java IDE, or you can purchase a commercial license subscription, which also includes access to Premium Add-ons: Reporting, Charts and Maps, Full-text Search and BPM. The price of annual per developer subscription starts from just $311 p.a.
Hopefully, this overview gives you a good idea of what CUBA Platform is and makes it tempting to try. If so, simply go to the website, download free Studio, pass the Quick Start and have your first CUBA application running in a matter of minutes!
Published at DZone with permission of Aleksey Stukalov, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments