I don't believe that the generated Reactor components have an init() method.
So writing your own won't matter because nothing will automatically call it.

I'm not sure why ColdSpring doesn't attempt to use setter injection to
autowire the gateway if you have a setter method that matches up with
another bean. I speculate it has something to do with the fact that this is
done with a factory method call and not a direct instantiation by
ColdSpring.

I think what you'll need to do is write a custom setter for your
ModelUtilities in your custom gateway, then use ColdSpring in the typical
way to get the Gateway from the Reactor factory and inject it into your
Manager component (or Service, ORMAdapter, etc.). You'd also use ColdSpring
to create an instance of your ModelUtilities and inject that into the same
component. Finally, you'd have to manually have some code in your Manager
(or whichever) component to call the setter on your custom gateway and pass
the ModelUtilities into it. Something like this maybe in your Manager:

   <cffunction name="setModelUtilities" returntype="void" access="public"
output="false">
       <cfargument name="modelUtilities" type="any" required="true" />
       <cfset getMyTableGateway().setUtility(arguments.modelUtilities) />
   </cffunction>

The only thing that worries me there is that this seems to depend on
ColdSpring injecting the gateway before it injects the utility. It worked
when I tested it locally but I'd double check to make sure. Anyway, hope
that helps.


On 12/29/06, Bryan S <[EMAIL PROTECTED]> wrote:

O.K. I have more information on this now that I'm hoping this will turn a
light bulb on for someone.

I'm trying to call variables.instance.ModelUtilities.myFunctionName() from
within my extended gateway
extends="reactor.project.AppManager.Gateway.MyTableGateway"


If I put the code below at the top of my extended Gateway I am able to
access the function in my object, however, it won't work automatically out
of ColdSpring the way the rest of my objects do. I tried putting this same
code in an init in my extended gateway but the init never gets called. I am
wondering why the init doesn't get called and if it's supposed to be that
way how do I accomplish this correctly.

<cfset variables.instance.ColdSpringBeanFactory =
createObject("component","coldspring.beans.DefaultXmlBeanFactory").init()
/>

<cfset 
variables.instance.ColdSpringBeanFactory.loadBeansFromXmlFile("D:\Inetpub\wwwroot\AppManager\config\ColdSpring.xml",true)
 />

<cfset variables.instance.ModelUtilities =
variables.instance.ColdSpringBeanFactory.getBean("ModelUtilities") />


On 12/28/06, Bryan S <[EMAIL PROTECTED]> wrote:
>
> If I call my function getModelUtilities().setQuerySortCriteria() from my
> model glue controller there is no problem.
>
> However, if I call it from my extended Gateway I get the error message
> below. I went into my autowire.cfm and if I call a different getter in
> there variables.instance has a modelutilities in it. However, when I
> dump variables.instance inside of getModelUtilities it doesn't exist.
> What am I missing?
>
>  *Message* Element INSTANCE.MODELUTILITIES is undefined in VARIABLES.  *
> Detail*
>  *Extended Info*
>  *Tag Context* D:\Inetpub\wwwroot\AppManager\includes\autowire.cfm (47)
> D:\Inetpub\wwwroot\AppManager\model\data\Gateway\GROUP_USERGateway.cfc
> (57)
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> -- -- --
> Reactor for ColdFusion Mailing List
> [email protected]
> Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> -- -- --



-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --



-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Reply via email to