Thanks Peter. Right now the app in dev is not set to cache anything. I could load the property from the xml file, but I thought setProperty did the same thing? Likewise the BrandManager component extends MachII.framework.Property per the documentation and has a configure method rather than init for instantiation. Neither of these explains why it only exists for a certain time period and then its gone. I'm not sure who responded above Peter, but what "additional steps" are you referring to?
Thank again... On Jun 17, 1:07 pm, "Peter J. Farrell" <pe...@mach-ii.com> wrote: > Well, first off what is happening is because of a couple of problems. > > Check out our FAQ about scopes and what the best practice in using them > in Mach-II: > > http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/wiki/UsingScopesInMa... > > You should also check out the wiki entry on needing to create data > onApplicationStart: > > http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/wiki/FAQLoadingAppli... > > MercuryNewt said the following on 06/17/2009 10:36 AM: > > > > > I'm back with another issue (obviously you guys have figured out that > > this is my first Mach-II experience). > > > I've got an application that was loosely developed in Mach-II version > > 1.1 and I'm in the process of enhancing the app, as well as making it > > more Mach-II 1.6 compliant. The bulk of my task has been changing > > variables that were previously defined in the application scope, to be > > defined via setProperty or the <property> tag as I understand that to > > be the preferred method in Mach-II. One particularly frustrating > > issue that I'm dealing with is when I've defined a component in my > > onApplicationStart method via the setProperty method and it seems to > > work fine until some point in the future when the actual component's > > methods get referenced using the getProperty > > ("myComponent").componentsMethod() and they are undefined. I try to > > do a dumpt to see what the problem is and restart the instance so that > > my changes to the CFC take effect and then... no error! It would > > appear to be an issue with the application scope variables (those > > created using Mach-II's setProperty method) timing out or somehow > > being lost minutes or hours later. Any advice? Here's a snippet of > > the code I use to set the component: > > > <cfcomponent displayname="Authentication" output="false" hint="Two- > > Factor Consumer Authentication." extends="MachII.mach-ii"> > > > <cfscript> > > this.name = "Authentication"; > > this.applicationTimeout = CreateTimeSpan( 2,0,0,0 ); > > this.sessionTimeOut = CreateTimeSpan(0,0,20,0); > > this.sessionManagement = true; > > this.setClientCookies = false; > > this.MACHII_CONFIG_PATH = ExpandPath("./config/mach-ii.xml"); > > this.MACHII_CONFIG_MODE = 1; > > this.MACHII_APP_KEY = GetFileFromPath(ExpandPath(".")); > > </cfscript> > > > <!--- Define the page request properties. ---> > > <cfsetting requesttimeout="20" showdebugoutput="false" > > enablecfoutputonly="false"/> > > > <cffunction name="onApplicationStart" access="public" > > returntype="void" output="false" hint="Fires when the application is > > first created."> > > > <cfscript> > > super.onApplicationStart(); > > setProperty("brandManager",createObject > > ("component","model.BrandManager").configure()); > > </cfscript> > > Is there a specific reason why you are manually creating a Mach-II > property can sticking it into Mach-II in your Application.cfc? Your > super.onApplicationStart() is calling loadFramework() which in turn will > load up the entire framework including any property.cfcs you define in > your config file. I'd suggest that you define it in your XML file and > the framework do it for you (plus you're missing a few additional steps > the property needs such as the init() method in which the framework > passes in a few extra things): > > http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/wiki/NewPropertyData... > > > > > > > Here's a snippet from the simple BrandManager component: > > > <cfcomponent extends="MachII.framework.Property"> > > > <cffunction name="configure" access="public" output="true" > > returntype="model.BrandManager"> > > <cfset variables.brands = structNew() /> > > <cfreturn this/> > > </cffunction> > > ........ > > <cffunction name="isValidReferrerID" access="public" output="false" > > returntype="boolean" > > > <cfargument name="referrerID" type="string" required="yes" /> > > <cfreturn StructKeyExists(variables.brands,arguments.referrerID) > > /> > > </cffunction> > > </cfcomponent> > > > Finally, deeper in my code, but one of the first steps executed by my > > default Mach-II event, this method call throws an error after a > > certain amount of time that the application has been running: > > > if (getProperty("brandManager").isValidReferrerID(local.clientID)) { > > > Now, when I try to dump getProperty("brandManager"), I have to restart > > the server for my changes to the CFC to take effect, but at that point > > the dump works, I see the BrandManager component, the isValidReferrer > > () method exists and the application no longer throws an error. Do I > > need to change the way that Mach-II is being invoked or the > > application timeout settings or something? I'm really chasing my tail > > on this one and it is the only property that I'm having trouble with > > (at least that I know of). > > > Thanks in advance... > > onApplicationStart() is only called by your CFML engine when the > application starts up. What are your settings in your CFML engine > administrator for caching? In Adobe CF8, CFCs are cached if you have > have "save class files" and "template cache" turned on. I also set the > cache size to 0. If you have any of this stuff on, any changes will not > be found when you reload the framework because your CFML engine will use > cached version. > > Also, remember that Mach-II loads up and caches things for performance. > If you make a change to your config file or CFCs, you'll have to reload > the framework -- I recommend using the Mach-II dashboard. > > .Peter- Hide quoted text - > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to Mach-II for CFML list. To post to this group, send email to mach-ii-for-coldfusion@googlegroups.com To unsubscribe from this group, send email to mach-ii-for-coldfusion-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/mach-ii-for-coldfusion?hl=en SVN: http://greatbiztoolsllc.svn.cvsdude.com/mach-ii/ Wiki / Documentation / Tickets: http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/ -~----------~----~----~----~------~----~------~--~---