A few years ago we had a FedEx day day project in mind when we had an idea: “We’ve been using Liquibase at our company for a while but until now changelog files were edited manually. It would be good to support the maintenance of changelog files by a graphical interface. And if we’re already using NetBeans, it is convenient to have this graphical interface accessed from within NetBeans.”
What is Liquibase?
Liquibase is a database version tracking tool. In principle: “You never develop code without version control, why do you develop your database without it?” Liquibase was developed in Java with an open-source code. Database modifications are registered in xml (changelog) files. The database itself stores which changes have already been run on it. Liquibase on the one hand is a program that can be run to apply the changes on a selected database, while on the other hand it also provides a Java API to manage database modifications. Currently it does not have a graphic interface, and that is exactly what we are working on right now.
What is NetBeans?
NetBeans is an integrated development environment (IDE) primarily for Java, HTML5, PHP, C/C++ developments. Its modular structure makes it easy to expand it with plugins, which allows us to get a Liquibase GUI integrated in it as a plugin.
Why is it called Liquiface?
If it is a GUI (Graphical User InterFace) to Liquibase, i.e. the “face of Liquibase”, what else could we call it?
What obstacles we had to overcome?
Liquibase Java API
Previously we’ve only used Liquibase as a runnable program. Now we had to become familiar with its API side as well:
- How can we run a changelog from a code?
- How can we save the structure of a database (DDL) from a program into a changelog?
- How can we construct various Change-s from the code?
- How to organize Change-s into ChangeSet-s?
NetBeans Module Development with Maven
None of us has developed a NetBeans module before. What was new to us were:
- How can we create a NetBeans module within NetBeans, and how can we do that by Maven at that?
- What is an nbm file?
- How and for what can we use the NetBeans API?
- How can we access the database connections of NetBeans?
During the compilation of the Maven NetBeans module, this description turned out to be very useful.
NetBeans surfaces work well with the Java Swing components. For example the panels of a wizard can be easily put together from Swing building blocks. Until now we had rather limited experiences in Swing, so now we had the opportunity to dig into it a bit deeper. We wished to display database tables and relations graphically, so it was useful when Tamás came across this example explaining something similar with the help of the NetBeans Visual Library. Little did we know at that time how many difficulties the Visual Library would pose – we’ll write about these in a later post.
Prototype Completed on FedEx Day
Within the available 24 hour time frame we could compile a NetBeans module, which was suitable for the “clicking together” of Liquibase Change-s as CREATE TABLE. The editing interface appeared in a Swing table as follows:
The changelog generated from this could be saved in a file:
What happened to Liquiface after FedEx day?
We felt, there were more possibilities in this project than what we could make out of it in 24 hours. Luckily, our company management also found the project useful so we got further resources for its realization. That is how we arrived at version 1.0, offering many useful functions indeed already:
- Support for most Change types we use;
- Wizard-type user interface;
- Use of NetBeans database connections;
- Running ChangeSet-s on a selected database;
- Displaying database tables and their connections;
- Functions accessible from popup (context) menus;
- Multiple filtering options for database tables;
- Loading a model from a database or a changelog file;
- Saving changes into a new changelog file;
- Joining changes to an existing changelog file.
We deal with the use of the program and the technical issues in further posts.
For now, here’s a little teaser of the current interfaces: