Visit the ColdFusionProNews Directory
Beginners
Installation, Coding Techniques, Data Structures...
CF Powered Sites
Stores, Directories, Universities...
Developers
Developers, Designers, Experts...
E-commerce
Shoes, Food, Music...
Education
Books, Online Resource, Languages...
Expert
LiveChat , CFX XMLParser , User Defined Function Library...
Hosting
Dedicated Servers, Virtual Server, Multi-user...
Intermediate
AutoResize , DataSource Encryption, Guestbook...

Submit your site for FREE

Kotek’s Transfer Decorator Bean Injector


Sean Corfield By: Sean Corfield

Brian Kotek has released his Transfer decorator bean injector observer which I’m very excited about because I just needed this functionality for a client’s project and had to write a version myself.

Brian’s is more sophisticated and, hopefully, will be integrated into ColdSpring in due course.

Now I can use his version instead of mine and know that I’m using a community-supported resource.

I know Brian Ghidinelli also ran into this issue and had started to write his own as well.

I expect he’ll switch to Brian Kotek’s version now.

So what does it do?

Well, as you build complex domain objects by writing decorators for Transfer objects, you find you need access to services that you are managing with ColdSpring.

Transfer provides an event model so you can add a listener (observer) for the afterNew event and use that to inject dependencies into your domain objects.

It’s a fairly manual process. What Brian’s CFC does is completely automate the process.

You declare the injector in your ColdSpring file and pass in Transfer to its constructor.

When ColdSpring initializes the injector, the injector registers itself as an observer for that event and then it automatically injects any matching services, based on setters in the decorator.

Very slick!

Comments

About The Author

Sean is currently Senior Computer Scientist and Team Lead in the Hosted Services group at Adobe Systems Incorporated. He has worked in the IT industry for nearly twenty-five years, first in database systems and compilers (serving eight years on the ANSI C++ Standards Committee), then in mobile telecoms, and finally in web development. Sean is a staunch advocate of software standards and best practices, and is a well-known and respected speaker on these subjects. Sean has championed and contributed to a number of ColdFusion frameworks, and is a frequent publisher on his blog, http://corfield.org/

Leave a Reply