An Architect's View

CFML, Clojure, Software Design, Frameworks and more...

An Architect's View

Model-Glue, ColdSpring, Reactor - autowiring

March 7, 2006 · 10 Comments

As an example of how to hook these together, here are two bean definitions (from the ColdSpring XML config file) that show how to have ColdSpring create and inject a Reactor gateway into your Model-Glue controllers:
<bean id="reactorFactory" class="reactor.reactorFactory">
      <constructor-arg name="configuration">
         <value>/ggcc10/config/reactor.xml</value>
      </constructor-arg>
   </bean>
   
   <bean id="taskGateway" factory-bean="reactorFactory"
      factory-method="createGateway">

      <constructor-arg name="objectAlias">
         <value>task</value>
      </constructor-arg>
   </bean>
Kurt Wiersma recently updated ColdSpring so you can define a factory and specify that other beans are obtained from that factory instead of directly from ColdSpring. In the ModelGlue.xml file, specify the ColdSpring loader and that you want autowiring:
<setting name="beanFactoryLoader"
         value="ModelGlue.Core.ColdSpringLoader" />

       <setting name="autowireControllers" value="true" />
Finally the controller has a setter for the task gateway:
<cffunction name="setTaskGateway" returntype="void" access="public" output="false">
      <cfargument name="gw" required="true" />
      
      <cfset variables.taskGateway = arguments.gw />
      
   </cffunction>
ColdSpring will create the Reactor factory bean and then use it to create the task gateway and will then inject it into the controller for you. Magic!

Tags: coldfusion · coldspring · modelglue · orm

10 responses so far ↓

  • 1 Damon Gentry // Mar 7, 2006 at 6:35 AM

    I've been working with Reactor and Fusebox lately with some limited success. Your recent postings on MG, ColdSpring, and Reactor have provided just enough motivation for me to look into those frameworks for my current project.

    BTW: Got Sleep? I've noticed your last few blogs have been posted at oh-dark-30 in the morning. Are these frameworks THAT interesting to work with?
  • 2 Sean Corfield // Mar 7, 2006 at 7:38 AM

    Damon, yes, these frameworks are THAT interesting! :)
  • 3 Matt Williams // Mar 7, 2006 at 9:32 AM

    Which version of ColdSpring allows for the reactorFactory bean definition?

    I'm hoping to do the same thing with Mach-II.
  • 4 Erik-Jan // Mar 7, 2006 at 10:55 AM

    Hi all,

    I am very interested to see the example! When will it be available in the zip-file?
  • 5 Sean Corfield // Mar 7, 2006 at 1:03 PM

    Matt, the BER version (i.e., what's in the CVS repository). These changes will be part of the 1.0 release when it comes (soon) if you don't want to download the latest CVS version.

    Erik-Jan, I'm focusing on two things this week: Reactor performance and ColdSpring support for Reactor-generated objects. I expect to make the example available next week, after cf.Objective(), but it will require the BER of Model-Glue, ColdSpring and Reactor since there are changes in all three frameworks that allow them to really work smoothly together.
  • 6 John Allen // Mar 15, 2006 at 10:53 AM

    I agree they are that interesting.

    Thanks Sean for getting my spaghetti code neatly rolled up and into fun little boxes.

    Cant wait to see the performance tweeks for CS.

  • 7 Chris Tilley // Apr 3, 2006 at 11:34 AM

    How much longer before you can release ggcc10?
  • 8 Sean Corfield // Apr 3, 2006 at 1:48 PM

    It will all depend on when the ColdSpring team fix the issues I uncovered as I developed that example... Chris Scott is working on part of the issue right now.

    I will post a new blog entry as soon as the example is running!
  • 9 Joshua Scott // Jun 8, 2006 at 1:22 PM

    Sean,

    When I try your example in MG 1.1 I get an error that a class is required for the gateway bean I am defining.

    Any ideas?

    - JS
  • 10 Sean Corfield // Jun 8, 2006 at 7:57 PM

    Joshua, no idea - sounds like you made a typo? Better to ask on the Model-Glue and/or ColdSpring mailing lists. Blog comments are not a good medium for interactive debugging and support...

Leave a Comment

Leave this field empty: