All articles
Contents

    CUBA Platform - The New Java Enterprise Applications Framework

    Update: CUBA Platform made an impressive progress since when this article was published. To get the most up-to-date information, I recommend reading it's new version, published recently in our blog.

    So... hello world! Our English website is finally live and now everyone can download the platform and start creating business applications faster than ever before, honestly. It took us six years of permanent evolution and occasional revolutions to get CUBA to the level of maturity before we decided it is good enough to share with the international Java community, including a couple of years to create extensive documentation, video tutorials and live applications with code samples. Since 2009 the framework has been battle-proven in numerous projects by Haulmont and other IT companies, ranging from a simple website backend to end-to-end enterprise automation solutions running 24x7 or serving thousands of concurrent users.

    As mentioned above, CUBA is aimed at business applications. We assume that such applications will often require complex data models, hundreds of screens, support for running various business processes, strong security requirements and multiple integrations. Alongside all this, they should be scalable and ready for permanent changes as the business evolves.

    So what is CUBA and how is it different from tools and frameworks already available out there? In short, it is a full stack Java framework based on a number of technologies: Spring, Vaadin, EclipseLink, Lucene, Activiti, Gradle, etc. However, using these (or similar) technologies separately still requires too much effort to develop complex applications, so CUBA introduces tight integration between them.

    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 ORM - defining the graph of objects which should be loaded or updated. The same applies to the security subsystem, report generator and other parts of the platform.

    The UI is declarative: you define screens layout in XML or in a visual editor 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. A rich web client is used by default - which obviously means you do not need to worry about installing anything to end user PCs. In addition, the same UI can be displayed in a desktop Java client, and you can even use both simultaneously in your application.

    text

    An important part of the UI 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.

    text

    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 different pieces of data - for example users from Department A will only see documents from Department A. Of course, everything is configured at runtime in UI. Finally, all changes to the data are logged, so you will see who changed what and when, with the ability to revert - handy for debriefing when something went wrong.

    In addition to the above, CUBA provides many features out of the box, including:

    • Business process management with an integrated visual designer
    • Reports generation
    • Full text search
    • Universal REST API to integrate with external systems
    • Credit card payments support
    • Reliable asynchronous email sending
    • Scheduled tasks execution support
    • Soft deletion

    … and many more, covering most of the needs of a typical enterprise application.

    When it comes to deployment 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. CUBA supports PostgreSQL, Oracle Database, Microsoft SQL Server and HSQL (typically used for prototyping) out of the box, and you can switch from one to another as your project grows. If you want to use another DBMS - not a problem, you can add support for it with a little effort. It is also important that CUBA applications can be deployed to any Java EE Web Profile server, such as Tomcat, Glassfish, etc.

    Finally, a few words about how you actually develop applications on CUBA. All you need is Java SE, XML and JPQL - which makes your application code more uniform and easier to maintain. This also reduces requirements to your development team - you don’t really need a subteam of Web developers or Java EE gurus.

    text

    You create your business logic in a standard IDE like IntelliJ IDEA or Eclipse, but CUBA also features Studio - a supplementary tool which enables visual screens layout design, helps to create a data model and generate standard screens for it, generates, runs, and keeps up-to-date DB update scripts, creates and configures your project and build files and automates a variety of other routine work (which few people enjoy doing manually). All changes between Studio and the IDE are synchronized, so you have a choice of where to make them.

    And to boost developer performance even further, CUBA supports hot deploy for all your code except the data model. So for instance, if you changed a screen or a method, you don’t need to restart the server anymore. Imagine how many hours you spend waiting for the stop-compile-deploy-start process (though this has been a good excuse for one more cup of coffee!). With CUBA, you just reopen the screen or invoke the method again and you will see your changes. Hot deploy can be invoked by a Gradle task, but it is easier to let CUBA Studio do it automatically in background as soon as it detects any changes.

    There is still a lot of things I’m tempted to talk about, but hopefully this gives enough flavour to give CUBA a try. And in case something does not work - don’t hesitate to ask for help via our support forum!

    Jmix is an open-source platform for building enterprise applications in Java