Metro 0.2 Released
Posted by Paul Marcotte | Tags: Metro , Transfer
The latest release (0.2) of Metro eliminates a convention on naming object Ids (or your database table Primary Key). Like a lot of developers, I tend to name my table PK as table name plus "Id" - UserId, AddressId, etc. I used this convention within the core Service for Metro, but I was unsatisfied with that limitation. Using Metro should not force one to adopt another developers convention(s). So I re-factored the core Service and Gateway to use Transfer metadata instead. Object retrieval in the Service save() method which looked like this:<cfset var obj = get(arguments.objectName,arguments.input[arguments.objectName&"Id"])>
Is now this:
<cfset var pkName = getGateway(arguments.objectName).getPrimaryKey()>
<cfset var obj = get(arguments.objectName,arguments.input[pkName])>
And the core Gateway has this new method.
<cffunction name="getPrimaryKey" access="public" output="false" returntype="string">
<cfreturn getTransfer().getTransferMetadata(getClassName()).getPrimaryKey().getName()>
</cffunction>
These are small but important changes to the Metro library.
Introducing Metro - A Transfer ORM Service Factory and More...
Posted by Paul Marcotte | Tags: ColdFusion , ColdSpring , Ideas , Metro , Transfer
Metro is a library of components to support rapid development of applications that use ColdSpring and Transfer ORM.Using the Eclipse MXUnit Plugin with Apache Virtual Hosts Revisited
Posted by Paul Marcotte | Tags: MXUnit , cfeclipse , Apache
In a previous post on the topic of using the MXUnit eclipse plugin with virtual hosts, I described how I setup my eclipse project and Apache virtual host for testing. Although that setup worked, I would get periodic errors that necessitated disabling and re-enabling the MXUnit plugin. Until recently, I was still running eclipse 3.2, so when I got the opportunity to configure a new machine from the ground up, I decided to go with a fresh install of the latest eclipse (3.4) and essential plugins, CFEclipse (1.3.1.6), Subclipse (1.4.5) and MXUnit (1.0.7).
Working With Transfer ORM - Transfer Transaction Advice
Posted by Paul Marcotte | Tags: ColdSpring , Database , Transfer
Maintaining referential integrity in your database is a good thing. Any decent RDBMS will include ACID (Atomicity, Consistency, Isolation, Durability) transaction support for ensuring consistency and recoverability of your database. With the Transfer ORM Transaction object, one can apply transactions easily to a Service or Gateway. Here's how one can use it to wrap all "save" and "delete" methods for a Service.
A Simple onMissingTemplate Example
Posted by Paul Marcotte | Tags: ColdFusion
For the migration to Mango Blog, I wanted to preserve my previous RSS feed location (/rss.cfm). The new location is feeds/rss.cfm. With the availability of onMissingTemplate event handler for ColdFusion 8, making sure my RSS didn't break was a snap. Here's the snippet of code I added to Application.cfc.
<cffunction name="onMissingTemplate" returntype="void">
<cfargument name="thePage" type="string" required="true">
<cfif arguments.thePage is "/blog/rss.cfm">
<cflocation url="/blog/feeds/rss.cfm" addtoken="false" />
</cfif>
</cffunction>
Not the most elegant solution I've ever developed, but it keeps the RSS feed alive until I decide how I want to manage it the future...