3 Java Projects You Should Know About
By Robert Cooper
Lately I have been tripping over some really amazingly useful open source projects that were kind of hard to find. They were difficult to find because of noise in search results, and they just don't seem to get a lot of play. BlueCove: BlueCove is a JSR-82 Java SE implementation that currently interfaces with the Mac OS X, WIDCOMM, BlueSoleil and Microsoft Bluetooth stack found in Windows XP SP2 and newer. Originally developed by Intel Research and currently maintained by volunteers. BlueCove runs on any JVM starting from version 1.1 or newer on Windows Mobile, Windows XP and Windows Vista, and Mac OS X. Linux BlueZ support was added in BlueCove version 2.0.3 as an additional GPL licensed module. The GPL license on the Linux version is unfortunate, but this is a great project. A one JAR, no muss, no fuss Bluetooth stack for the desktop. I have laughed for years that you can write Java code on a phone that talks Bluetooth, but you can't write a desktop app to talk to the phone app. This is a really exciting project. ZXing (read: Zebra Crossing): ZXing (pronounced "zebra crossing") is an open-source, multi-format 1D/2D barcode reader library implemented in Java. Their goal is to support decoding of QR Codes, Data Matrix, and the UPC family of 1D barcodes. It will provide clients for J2ME, J2SE, and Android. Why? There are several great readers out there, and there are bits of open-source code already for decoding, but not both at the same time. They want everyone to have access to some great source code to play with, so they decided they'd try an experiment, and open up our in-progress effort. Maybe some of it will be useful to you -- maybe you can help improve it. Talk about useful! Especially the idea of turning every camera enabled phone into a barcode capable device is compelling. DBMigrate: Similar to 'rake migrate' for Ruby on Rails, this library lets you manage database upgrades for your Java applications. Setup - Choose a version table name for your database. The default is db_version.
- Choose a package within which you will store all your classes and scripts for migrations.
- Create a directory within that package named after your database (in lowercase, e.g. mysql).
- Create a script in that directory named migrate0.sql and in that script create the version table and insert version 1, e.g:
- CREATE TABLE db_version (version integer not null) ENGINE=InnoDB;
INSERT INTO db_version VALUES (1);
Runtime - Before accessing your database in your programs you need to create a Migrate instance with the appropriate database configuration.
- Make sure the version is set to the version of the program accessing the database.
- Call migrate() on your Migrate instance to ensure that your client version matches the database version. If you have enabled 'auto' and don't specify a client version it will look at the database version it will scan for more recent migrations. You have a few options for defining migrations. As far as code they can be either Java, Groovy or SQL. As far as version transition they can define either 'to' or 'from' flavors. The 'from' flavor is used when you may want to skip versions while the 'to' flavor is for when you want the target database version to be the same as the version number in script and don't mind the reduced flexibility.
Until next time,
Robert Cooper
http://www.screaming-penguin.com/ |