Category Filtering: 'Transfer'

Remove Filter

New ColdBox Addons - Transfer Config Factory and Transfer Decorator Injector Observer

Posted by Luis Majano
Jul 24, 2008 00:00:00 UTC

I am releasing today a set of addons for ColdBox-Transfer interactivity:

  1. TransferConfigFactory.cfc : A factory cfc that produces transfer configuration objects based on ColdBox Datasource configurations. This is thanks to Tom de Manincor
  2. TDOBeanInjectorObserver.cfc : A transfer observer based on Brian Kotek's amazing TDOBeanInjectorObserver in his Coldspring Utilities project, used to create rich decorators by injecting them with dependencies from Coldspring and Lightwire. However, we had to take it a step further, so it can even inject dependencies from the ColdBox Cache.

You can download these tools from here. All you need to do to install them is drop them in the /coldbox/system/extras folder. This will create a transfer folder that holds these cfc's inside of the extras folder. That's it. Then you need to configure them via a coldspring.xml or a lightwire configuration object or manually (ohh brave one). The tools have also been added to the SVN and I will be adding a link to them from the extra downloads section of the website.

Transfer Config Factory

This object is used to create a transfer configuration object based on the datasource information found in the ColdBox configuration file. This idea is thanks to Tom de Manincor and his musings in ColdBox-ColdSpring-Transfer. This let's you maintain all of your application's configuration in one single location and not create a datasource.xml. It is meant to be used alongside coldspring but it can be used as a separate object too (You will have to do the wiring). Anyways, here is a sample coldspring declaration for this usage:

${Setting: TransferDSNAlias not found}

${Setting: TransferConfigPath not found}

${Setting: TransferDefinitionsPath not found}

As you can see, we first define the coldbox factory element and construct a datasource bean element with it. We then setup the transferConfigFactory.cfc as a coldspring factory bean. The last step is configuring the transfer factory. We send in a configuration bean and set it up as a call to our transfer config factory with the same parameters we are used to, except that for datasource we use the dsnBean element and have it referenced to the datasource that we want to use, in our case MyDSN, that we defined at the beginning. If you need a refresher on how the ColdBox Factory for IoC works, please read the following IoC Integration Guide. That's it. Simple as that, now you can define all your configurations via the coldbox configuration file and let coldspring do the heavy lifting.


This handy tools is based on Brian Kotek's original observer. I want to say thank you to Brian for his contributions and incredible code. Thanks Brian.

However, we have modified it to use ColdBox beanFactory plugin to do the autowiring for us. For those familiar with the ColdBox autowiring conventions, you can do autowiring via annotations using the cfproperty tag or via setter injection. Not only that, but you can use ColdSpring or Lightwire seamlessly, and to top it off, you can autowire objects from the ColdBox cache. Here is a sample of some cool autowire annotations:

As you can see from the code we have two dependencies marked by their types: ioc and ocm. The type of ioc means that this dependency must be injected from the ioc plugin (coldspring/lighwire) and the type of ocm means that the dependency must be injected from the ColdBox Cache. The scope attribute is also useful as you can define in which scope or pathed scope you would like this dependency injected. The default value is variables.

The theory behind this tool is to be able to very easily create rich decorators that can be injected with dependencies from the IoC container or the ColdBox Cache. It is a great way to have your objects be composed of other objects and utilities. So let's see the coldspring.xml, but first, please note that the instructions below are for ColdSpring 1.2 that enables the usage of the lazy-init property. For Coldpsring 1.0, you will have to do some more manual work. (More instructions found in the cfc's themselves).


true or false


true or false

We first define the ColdBox Factory, then the beanFactory plugin we will use. We then define our Observer with some cool parameters:

  • Transfer : The transfer bean reference
  • ColdBoxBeanFactory : The beanFactory plugin we just defined
  • useSetterInjection : A boolean variable that enables or disabled setter injection in preference of annotations via cfproperty. If enabled, it will do cfproperty annotations first and then look for setters.
  • onDICompleteUDF : The name of the UDF to call in your decorators once they have been injected with their dependencies. The default value used is onDIComplete. This means that you create a method in your decorators called onDIComplete or whatever you like and when the bean factory injects the dependencies, it will call this method afterwards. You can use this to do configuration or object setup.
  • debugMode : This boolean variable is part of the bean factory plugin. If set to true, it will log to the logging facilities all the interactions when trying to autowire the objects.

That's it folks. Once application starts up, coldspring will create and register this observer for you. So when transfer objects are created and have autowire dependencies, they will be wired up.

Josh Highland on Transfer ORM Presso!!

Posted by Luis Majano
Nov 07, 2007 00:00:00 UTC
My friend Josh Highland has a great entry about our Transfer presentation last week at our CFUG. I have the privilege to work with him at ESRI, so check his blog out, he has some insaaaanee!! stuff out there.

Transfer Gotcha when using IN and lists!!

Posted by Luis Majano
Sep 11, 2007 00:00:00 UTC
First of all, I am a big advocate of Transfer, it is totally awesome and TQL totally rocks. I came up today to almost pulling my hair out on a very simple TQL query and thought I should share this so people have a grasp on details.

When using a query with the IN modifier and a list, you cannot just map a parameter with a value, you have to specify that its a list. (Reading the docs might help!!). Adventurous Luis, went ahead without fully reading Mr. Mandel's excellent docs and of course, fell in a cavernous pit of despair.

Here is my sample:

Transfer Docs hosted on my site for your needs.

Posted by Luis Majano
Jun 26, 2007 00:00:00 UTC
I love Transfer!! I have been using it to the max in all my projects and now I found it an undisspensable tool for my software development. If you have not checked out this incredible ORM, please do. Since I am using it so much, I decided to host the docs on my site for easy access, hope this is ok with you Mark?

Just point your browser to: and you can read to your eyes content.

ColdBox: New Transfer Sample Application! Transfer Rocks!!

Posted by Luis Majano
Mar 21, 2007 00:00:00 UTC
I have just been delving into Transfer this past few weeks and I must say I am really impressed by its design and usage. The way the ORM is layed out is impressive and even more with its TSQL addition. So I decided to create another sample application dedicated to Transfer. It will be on the next beta or RC coming for 2.0.0, but if you do not want to wait, then get it from the Repository by Clicking here

Kudos to Mark Mandel for this amazing tool

The sample application is a very simple CRUD and Listing application and shows you how to instantiate the Transfer factory into the ColdBox cache also. I will be posting a tutorial on it pretty soon at the usual documentation depot :)

Have fun and thanks Mark for this awesome project.

Need to Refactor Transfer to meet your server layout? Here you go!

Posted by Luis Majano
Mar 21, 2007 00:00:00 UTC
As you all now, the best and easiest way to install Transfer is just by droping it in your web root and boom, you are ready to roll. However, sometimes you need the flexibility to change the path and things just work. Well, I just created this ANT task to do that. It will ask you for a new base path and a new relative path, then it will refactor the entire Transfer codebase to meet your directory layout. This similar Task is included with ColdBox in the install directory, so you can refactor the ColdBox codebase to your layout.


I have my frameworks under a directory called: 'frameworks' and I usually create a version to them, say: frameworks.coldbox2_00 or frameworks.transfer0_63

Everybody has their own naming conventions and ideas. Anyways, here is the ANT Task.

This ant task will rebuild colspring using a prefix of choice

The prefix choosen is: ${Setting: transfer.newprefix not found}

Refactoring: ${Setting: basedir not found}


You just need to place this as build.xml or refactor.xml in the root of your Transfer directory, where the TransferFactory.cfc is. Then just run it, it will ask you for the first path, type "frameworks.transfer0_63" then the relative path, type "/frameworks/transfer0_63" and then you are ready to roll.

Just make sure when you instantiate the factory it will now be: "frameworks.transfer0_63.TransferFactory"

There you go. Make sure you make a backup, just in case, or if you are a real geek, then keep it, so you can run it multiple times.

Have fun!!

Site Updates


Entries Search