The snippet needs to be recreated when the application reinitializes,
so that any new configuration values are in the new config bean when
the snippet gets parsed. I guess I was hoping for something like:

<bean id="EnvironmentService"
class="environmentConfig.models.EnvironmentService">
    <method_to_execute name="configureEnvironment">
      <arg name="sECDefinitionFilePath">
        <value>/config/environment.xml.cfm</value>
      </arg>
  </method_to_execute>
</bean>

denstar raises a good point about being able to manage error settings
and the like for the MG framework itself if EC is invoked in
Application.cfc.

Mike.


On Dec 7, 4:17 pm, [email protected] wrote:
> Coldspring creates beans before model-glue runs onApplicationStart, that much 
> is true.
>
> I'm a little confused after your last email. Remind me, If you have a 
> ColdSpring snippet to create the config bean, what do you need model glue to 
> do again?
>
> DW
>
> Sent from my Verizon Wireless BlackBerry
>
>
>
> -----Original Message-----
> From: Mike C <[email protected]>
> Date: Mon, 7 Dec 2009 15:48:43
> To: model-glue<[email protected]>
> Subject: [Model-Glue] Re: Invoking EnvironmentConfig within MG/ColdSpring
>
> Hi Dan,
>
> That all makes perfect sense, thank you!
>
> However, I see a possible issue with the order in which things get
> executed with this approach. EC can be set to create a ColdSpring.xml
> stub file for inclusion in the main ColdSpring.xml file, this stub
> creating a config bean based on the configuration data set in the
> environment.xml.cfm file. I'm thinking that the beans will already
> have been instantiated from ColdSpring.xml by the time
> onApplicationStart gets called, since we'd be using the
> EnvironmentService bean within the onApplicationStart function. So
> this would execute, and the stub file would get generated, but it's
> too late at that point to get ColdSpring to instantiate the config
> bean defined in the stub.
>
> Does that make any sense?
>
> Mike.
>
> On Dec 7, 3:31 pm, Dan Wilson <[email protected]> wrote:
> > There are a few ways to get this done.
>
> > You can have a controller listen for the onApplicationStart message
> > (automatically broadcast by the Model-Glue framework) and perform whatever
> > you want in your controller.
>
> > *ColdSpring.xml*
> > <bean id="EnvironmentManager"
> > class="environmentConfig.models.EnvironmentService" />
>
> > *Model-Glue.xml*
> > <controller name="Whatever"
> > type="Somewhere.over.the.rainbow.WhateverController">
> >   <message-listener message="onApplicationStart" />
> >   ....
> > </controller>
>
> > *WhateverController.cfc*
> > <component beans="EnvironmentService">
>
> > <cffunction name="onApplicationStart" returntype="void">
> >   <cfargument name="Event" type="any" required="true" >
> >   <cfset beans.EnvironmentService.configureEnvironment(
> > '/config/environment.xml.cfm' ) />
> >  ....
> > </cffunction>
>
> > </cfcomponent>
>
> > *Big Picture:*
>
> > Your application will start up and initialize (calling init) all the beans
> > in ColdSpring, including your EnvironmentService.
> > Model-Glue will fully create itself, then broadcast onApplicationStart.
> > Your controller will catch this message, then run the function called
> > onApplicationStart (because we didn't specify another function name, it
> > assumed the function is the same name as the message)
> > Your application specific code inside the
> > WhateverController.onApplicationStart method runs, grabbing the reference to
> > EnvironmentService from ColdSpring (using the beans scope) and running
> > configureEnvironment thus completing the requirements.
>
> > That is the way to get this done without rewriting/extending any of the
> > environmentService code.
>
> > Make sense?
>
> > DW
>
> > On Mon, Dec 7, 2009 at 5:39 PM, Mike C <[email protected]> wrote:
> > > Hi,
>
> > > I am attempting to utilize Rolando Lopez's excellent EnvironmentConfig
> > > (http://environmentconfig.riaforge.org/) within a MG application. I
> > > have this up and running outside of MG, but I am unsure as to if,
> > > where and how I can invoke EC within MG/ColdSpring at application
> > > startup time.
>
> > > I'm aware that a ColdSpring bean definition file can be created by
> > > setting the EC property bCreateColdSpringFile=true, and this can be
> > > included in the main ColdSpring.xml file. This is precisely the
> > > mechanism I want to use. My question however, is if, and if so, how
> > > can I invoke EC itself from within MG so the dynamically generated CFC
> > > and the ColdSpring file stub get recreated each time the application
> > > is reinitialized.
>
> > > In the example provided in the EC download, EC is invoked in
> > > Application.cfc thus:
>
> > > oEnvironmentService = createObject( 'component',
> > > 'environmentConfig.models.EnvironmentService' ).init();
> > > stResults = stl.oEnvironmentService.configureEnvironment( '/config/
> > > environment.xml.cfm' );
>
> > > I'm thinking there must be a much more elegant solution to this
> > > utilizing ColdSpring, and I would like to invoke and execute this
> > > within the MG application initialization process, so that the newly-
> > > generated stub gets included. Does anyone have any pointers that could
> > > help me in the right direction? I'm hoping I'm not the first to come
> > > across this issue!
>
> > > I'm very new to MG/ColdSpring, and any assistance would be very
> > > gratefully received by this framework newbie!
>
> > > Many thanks,
>
> > > Mike.
>
> --
> Model-Glue Sites:
> Home Page:http://www.model-glue.com
> Documentation:http://docs.model-glue.com
> Bug Tracker:http://bugs.model-glue.com
> Blog:http://www.model-glue.com/blog
>
> You received this message because you are subscribed to the Google
> Groups "model-glue" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group 
> athttp://groups.google.com/group/model-glue?hl=en- Hide quoted text -
>
> - Show quoted text -

-- 
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en

Reply via email to