Metro 0.6 Released

2009 February 24
by Paul Marcotte

When developing OSS software, one should endeavour to maintain backward compatibility with each new release while adding improvements and new features (and fixing bugs). The current Metro release (0.6) is a significant departure from previous releases. While it maintains backward compatibility for service and gateway methods, it also provides improved support for validation rules and contexts thanks to a huge contribution from Matt Quackenbush. The changes are designed to promote building rich business objects. I removed some of the setup dependencies which I was unhappy with, and now use "import" for ColdSpring and "include" for Transfer to simplify configuration. Lastly, I have also re-organized sample code and support documents. Here is breakdown of the items requiring modification to use Metro 0.6.

Package, Configuration and Support Documents Reorganization and Updates

I moved several files around and created new directories to try and better organize items. The config directory now contains configuration documents (ColdSpring and Transfer). I also created a new docs directory to house the SQL scripts and any other forthcoming support documents. Another important change is that the security, user, and work sample packages are located in the "model" directory. Here's the laundry list.

ColdSpring Configuration

Since Metro as a base library to build upon, it makes sense to leverage ColdSpring's <import /> tag to ease configuration. This should simplify the upgrade to Metro 0.6. Instead of specifying the Metro factory beans, transfer beans, beanInjector, TDOBeanInjectorObserver and other sundry dependencies, just use import to add those configurations.

<!-- import common configurations -->
<import resource="/metro/config/coldspring/util.coldspring.xml" />
<import resource="/metro/config/coldspring/lib.coldspring.xml" />
<import resource="/metro/config/coldspring/transfer.coldspring.xml" />
<import resource="/metro/config/coldspring/factory.coldspring.xml" />

<!-- define service beans -->
<bean id="WorkService" factory-bean="ServiceFactory" factory-method="getService">
<constructor-arg name="packageName"><value>work</value></constructor-arg>

<bean id="UserService" factory-bean="ServiceFactory" factory-method="getService">
<constructor-arg name="packageName"><value>user</value></constructor-arg>

<bean id="SecurityService" factory-bean="ServiceFactory" factory-method="getService">
<constructor-arg name="packageName"><value>security</value></constructor-arg>
<property name="UserService">
<ref bean="UserService" />

Transfer Configuration

The transfer object definition files now reside under "metro/config/transfer" rather than in the package that they pertain to. Here's a snippet from the updated Transfer.xml file located in "tests/config".

<?xml version="1.0" encoding="UTF-8"?>
<transfer xsi:noNamespaceSchemaLocation="transfer.xsd" xmlns:xsi="">
<include path="/metro/config/transfer/user.xml" />
<include path="/metro/config/transfer/security.xml" />
<include path="/metro/config/transfer/work.xml" />

SQL Scripts

Everyone has their pet way of writing SQL DDL. During the course of this refactoring, I decided (don't ask why) that using an lower case field name convention would support the possible inclusion ofPostgres scripts in the future. Therefore the user and security scripts are updated to use that convention and now reside in "docs/sql". There is a sub folder for bothMSSQL and MySQL scripts.

Sample Packages

Previous versions of Metro included sample security, user and work packages at the metro root directory. They are now located in a model directory and as mentioned above, the Transfer configuration and SQL scripts are re-located, leaving only model components in those packages.

I do not anticipate changes of this magnitude in future releases and I hope that the benefits of upgrading to 0.6 outweigh any difficulties encountered.