NetBeans Platform: For Simple Applications Too!
Geertjan has said this many times before: the NetBeans Platform is not only suitable for complex, enterprise-oriented desktop applications, but for simple ones too. It's not "too heavy", as one might think, and works better than the Swing Application Framework (SAF). Just giving you yet another example in this article.
SolidBlue: Verifying File Integrity
SolidBlue is my latest (small) project, and it's a tool for verifying the integrity of a folder of files. It solves a problem with my photos: more than 350GB of files. How to back them up? Two pronged approach: rsync that periodically syncs files to an external disk (an external disk when I'm on the move, a RAID 6 NAS when I'm at home), and burning to DVD (two copies). rsync is good, but the question is: how do you know that you're not erroneously syncing a corrupted file, to the external disk, destroying the backed up copy (actually, rsync supports archival of change files, but when you run out of disk space you start deleting archives). And DVDs are very robust, but not eternal: you have to periodically check that they didn't get broken.
The simple solution is to periodically compute a fingerprint, e.g., a MD5, on your files. So far I've used a simple command line script to do that (using openssl md5), and diff to compare data in order to find changes. It works and it's fast, but I need to better integrate this function with my workflow. This means, the function must work within blueMarine.
In the first iteration, I've written SolidBlue (the link won't work until the project is made public by java.net), a simple desktop application which does only this simple task. The initial version just generates a flat file with all the data in the same format as the output of openssl; it will be further developed (e.g., using a database to keep the data and providing better diagnostics) and later integrated into blueMarine.
The NetBeans Platform proved to be fine even for a very simple application like SolidBlue. The ZIP file with all the executables is about 7MB, so it's not large. I presume it could be even trimmed down by giving up to some Platform APIs, but I'm going to use them soon, so the size is perfectly acceptable.
Here are two screenshots of the app:
As you can see in the first screenshot, the NetBeans Platform can be integrated with Quaqua, thus providing a better compliance with the Mac OS X look and feel, including the native file chooser. As always with the Java desktop, you need to do some work in order to match your needs for the Look & Feel. In particular, I had to tweak some things to remove an annoying dark gray border around the desktop pane (if you're picky, you'll also see that the toolbar doesn't merge with the title bar; I've just upgraded to Lion and I have to check everything about Java with the latest Mac OS X).
I will use SolidBlue for some future posts, as it's a small and perfect example to explain some design hints with the NetBeans Platform (and Java in general). In particular, I'm experimenting with agent-like design and the NetBeans Platform. But that's a story for another post!
Sources can be browsed and cloned here:
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)