Iterator on RIAForge, and Updates to FormUtils and ColdSpring Utils

The blog has been quiet lately, but that should be changing now that I'm finally doing some real work with ColdFusion 9! In the meantime, I've committed a few minor updates to some RIAForge projects, and added a new one.

The new project is Collection Iterator. This is simply a CFC that allows you to iterate the same way over queries, lists, structures, or arrays. The syntax is simple:

var array = ['foo', 'boo', 'zoo'];
var iterator = new Iterator( array );
var counter = 0;

while( iterator.hasNext() )
    var thisRow =;
    assertTrue( array[counter] == thisRow, "Array element not found." );    

assertTrue( counter == 3, "Iterator did not loop the correct number of times." );

The obvious benefit is that it lets you handle all four collection types in a standard way. This is a CF9-only component, as it is written using the new script-only CFC syntax (which I LOVE, but will be talking about further in future entries).

As for updates, I fixed a bug in the DynamicXMLBeanFactory, which is part of the ColdSpring Bean Utilities library. There was an issue when using ColdSpring configuration files that imported multiple other config files. The CFC was also modified to only attempt to do an ExpandPath() on the configuration file location if a file doesn't exist using the value supplied by the developer. I also updated the FormUtils CFC to make the constructor arguments optional, to make it easier to configure and use.

So, that's all for now, but look for some entries on CF9 ORM tips and techniques, as well as a full reboot of my earlier series on the Swiz framework for Flex. Swiz 1.0 alpha was just released, and as the finishing touches are added I plan to be blogging about all the excellent new capabilities that have been added by the Swiz team!

Comments Comments (5) | | Digg It! Digg It! | Linking Blogs Linking Blogs | 5864 Views

ColdSpring on

Just a quick note that an article on ColdSpring that I wrote for TheServerSide is now online.

Comments Comments (0) | | Digg It! Digg It! | Linking Blogs Linking Blogs | 5427 Views

What's New In ColdSpring 1.2?

Some folks on the list asked (understandably) for a "what's new" list for ColdSpring 1.2, so I put this together. We should get it up on the site shortly as well:

  • Bean Aliases: Allows you to define additional bean IDs for existing beans. i.e.:
    <bean id = "myBean" class="com.myBean" />
    <alias name="myBean" alias="anotherIDForMyBean" />
  • Abstract / Parent Beans: Allows you to reduce XML duplication by defining common properties and settings in a parent bean that can be used by multiple child beans. See Quickstart Guide for full details and examples.
  • Collection Factory Beans (ListFactoryBean and MapFactoryBean): Factory beans that will create collections. ListFactoryBean creates an Array, MapFactoryBean creates a structure.

    <bean id="myList" class="coldspring.beans.factory.config.ListFactoryBean">
    <property name="sourceList">
    		<value>Array Element 1</value>
    		<value>Array Element 2</value>
    		<value>Array Element 3</value>
    <bean id="myList" class="coldspring.beans.factory.config.MapFactoryBean">
    <property name="sourceMap">
    		<entry key="keyA"><value>keyA value</value></entry>
    		<entry key="keyB"><value>keyB value</value></entry>
    		<entry key="keyC"><value>keyC value</value></entry>
  • Import XML directive: Allows you to include the contents of a separate ColdSpring XML file into another ColdSpring XML file:

    	<import resource="/myotherxmlfile.xml" />
  • Bean Factory Postprocessors: Allows you to specify a component that will run after all beans have been processed and apply additional processing on the bean definitions. ColdSpring will call postProcessBeanFactory() on each postprocessor, and you can then run any additional processing you would like to. For an example, look at /beans/factory/config/PropertyPlaceholderConfigurer.cfc.
  • coldspring.cfcunit.AbstractAutowireTests and coldspring.cfcunit.AbstractAutowireTransactionalTests: Both of these allow you to provide the location of your applications bean config file and then simply define setters for any beans you want to test. The transactional version automatically rolls back database transactions. You can read Chris Scott's blog entry about both of these.
  • Numerous bug fixes and improvements: Over 30 bug or enhancement tickets have been resolved, with critical improvements in thread safety, having ColdSpring call inherited methods and constructors during autowiring and bean creation, automatic support for creating any beans marked with lazy-init="false" at bean factory creation, and many others. | Digg It! Digg It! | Linking Blogs Linking Blogs | 7893 Views

ColdSpring 1.2 Gold, and New ColdSpring Site

After a long wait, version 1.2 of the ColdSpring dependency injection framework has been released. This includes a large number of bug fixes and enhancements since the last official release.

Along with 1.2 is a new ColdSpring web site. Rachel Lehman did a great job with the new design. And of course, hats off to the others on the team (Chris Scott, Dave Ross, Adam Lehman, Kurt Wiersma, and others) for all the work on ColdSpring over the months and years!

To toot my own horn a little, in addition to fixes and enhancements, I added a new example to the ColdSpring codebase called the ColdSpring Quickstart Guide which you can see at the live site, but can also run locally if you'd like to look at the code (it's all live ColdSpring code). Since our next task is a full update of the documentation, I thought adding this would be a good interim step while we get that in place.

Anyway, what are you waiting for?! Go check out the new site and grab the latest release if you don't have it already. :-)

Comments Comments (1) | | Digg It! Digg It! | Linking Blogs Linking Blogs | 4464 Views

BeanInjector Patch from Paul Marcotte

Paul Marcotte sent me over a small test case that demonstrated an issue with the BeanInjector CFC. I went through his test and discovered a bug in the BeanInjector that stopped recursion up the inheritance hierarchy in certain cases. This has been fixed and pushed out to the ColdSpring Bean Utilities RIAForge project.

Thanks to Paul for helping me to spot this, as well as sending over a very small test case to help me reproduce the problem. I can't overstate how valuable this sort of thing is. Removing any extraneous code and just including the files that are involved in the problem really makes it easier to track down bugs.

Comments Comments (1) | | Digg It! Digg It! | Linking Blogs Linking Blogs | 4594 Views

More Entries