Dear Kettle developers,

For the Pentaho Metadata project we needed the ability to make sure that the
items in a list are always uniquely identified.
This is not as trivial as it might seem at first glance. The problem is
simple: each model element has a unique identifier.
In PMD this is the ID, in Kettle this is the name of the step, database,
etc.
Now before you insert a new object in the list, you can check if one with
the same name exists, but you need to do it all over the place.

To facilitate this, we created a new List replacement called UniqueList
(Interface) and an ArrayList replacement called UniqueArrayList.
The idea is to throw an exception (ObjectAlreadyExistsException) when an
item gets added to the list with a unique identifier (Name, ID, etc) that
already exists.

That is a good start, but it still allows you to rename an ID already in the
list.
That's why we created the listener (IDChangedListener) not unlike the many
listeners in use in Eclipse SWT.

This allows you to hook one or more listeners to a class and execute the
IDChanged() method in that interface.
It also allows you to have the setId(), setName() method(s) throw the same
ObjectAlreadyExistsException.

The net result and advantage is that you get a clear list of errors in your
project with unhandled exceptions and that you need to cover all these
possibilities in the GUI.
In the end you're certain that no duplicates can exist in the list. This is
certainly something that we've been in need of in Kettle for some time.
We do indeed check for uniqueness but you can still sneak in doubles in a
lot of situations: steps, database connections, slave servers, job entries,
etc.
The more lists there are, the higher the chance that something can go wrong.
At least with this system we'll be sure that we have all our bases covered.

If someone wants to get started on building this in or has even better ideas
on how to do it, just let us know. In the mean time this system certainly
seems to work fine for the PMD project.
By the way, that project has just migrated to the open source subversion
repository over here:
svn://source.pentaho.org/svnroot/pentaho-metadata/trunk

All the best,

Matt
____________________________________________
Matt Casters, Chief Data Integration
Pentaho, Open Source Business Intelligence
http://www.pentaho.org <http://www.pentaho.org/> -- mcasters (AT) pentaho (DOT) org
Tel. +32 (0) 486 97 29 37



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "kettle-developers" group.
To post to this group, send email to kettle-developers (AT) googlegroups (DOT) com
To unsubscribe from this group, send email to kettle-developers-unsubscribe (AT) g...oups (DOT) com
For more options, visit this group at http://groups.google.com/group/kettle-developers?hl=en
-~----------~----~----~----~------~----~------~--~---