Blog

Category Filtering: 'Coldspring'

Remove Filter


Free ColdFusion dependency injection training

Posted by Luis Majano
05 Dec 2011 06:37 PM
We just released a free chapter of our DI training course so the entire ColdFusion community can benefit, so check it out: http://bit.ly/v7Igda!

IECFug Meeting: Blackberry Playbook+Air+JMeter Load Testing

Posted by Luis Majano
11 Apr 2011 01:32 PM
Come and join us at the Inland Empire User Group meeting this Thursday as we have two great speakers, two great topics, pizza, networking and fun!

http://iecfug.org/post.cfm/april-meeting-flex-air-blackberry-loadtesting

BlackBerry Playbook + Adobe Air by Kalen Gibbons
Kalen

will be speaking about mobile application development with Adobe AIR.

He'll discuss how Adobe AIR makes it easy to develop a single

application for multiple platforms, including Android and iOS. In

particular, he will talk about his recent experience with developing an

application for the BlackBerry playbook. There will be a short

demonstration of the application and a Q & A period.

See you at Adobe Max!

Posted by Luis Majano
18 Oct 2010 10:30 AM
Just a quick note that I will be at Adobe Max from Sunday onwards.  I am really excited to be able to participate in this year's Max.  Last year I was only able to be there for one day, but this time I will be able to do the majority of the event.  Also, I will be presenting in the Unconference on MockBox, a new way to unit test with mocks!

Mocking and testing are dear to my heart, so I am very excited to be promoting testing and mocking practices.  So if you are  unit testing novice or guru, be sure to stop by.  This presentation will require your participation!

So if you will be at Max, hope to see you there!

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

Posted by Luis Majano
24 Jul 2008 12:00 AM

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.

TDOBeanInjectorObserver

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).

beanFactory

true or false

onDIComplete

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.

Coldspring usage question, please help?

Posted by Luis Majano
15 Mar 2007 12:00 AM
I have a question concerning setting up a service via coldspring. Let's say I have object A already instantiated in the application scope and I want it to be injected into every service ColdSpring creates for me. However, I don't want object A to be created by ColdSpring.

I want to be able to define in my service definition that for example my UserService will receive this instantiated object as a dependency. How do I define this? Is this possible? Am I totally deranged for trying to do this? Any thoughts? Do you understand my dilema?

I know I can inject it later by hand coding it, but I don't want to do that, I want Coldspring to do this for me. Is this possible?

Site Updates

Entries Search