root / framework / branches / dev / fuseboxExecutionContext.cfc

Revision 452, 2.2 kB (checked in by scorfield, 2 years ago)

Added detection of recursive dynamic do and some logging to debug it (since it doesn't
work properly right now).

Line 
1<!---
2Copyright 2006 TeraTech, Inc. http://teratech.com/
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15--->
16<cfcomponent output="false">
17
18        <cffunction name="__executeDynamicDo" returntype="void" access="public" output="true"
19                                hint="I execute a dynamically generated do fuseaction.">
20                <cfargument name="parsedFileInfo" type="struct" required="true"
21                                        hint="I am the information about the parsed file." />
22                <cfargument name="myFusebox" type="myFusebox" required="true"
23                                        hint="I am the myFusebox data structure." />
24
25                <cfif structKeyExists(request.__fusebox.fuseactionsDone,arguments.parsedFileInfo.parsedFile)>
26                        <cfthrow type="fusebox.badGrammar.recursiveDo"
27                                        message="Recursive do is illegal"
28                                        detail="An attempt was made to execute a dynamic fuseaction '#arguments.parsedFileInfo.parsedFile#' that is already being executed, in fuseaction #arguments.myFusebox.getCurrentCircuit().getAlias()#.#arguments.myFusebox.getCurrentFuseaction().getName()#." />
29                </cfif>
30                <cfset request.__fusebox.fuseactionsDone[arguments.circuitFuseaction] = true />
31
32                <cflog text="in: #arguments.parsedFileInfo.parsedFile#" />
33                <cfset structAppend(variables,myFusebox.getTopLevelVariablesScope(),true) />
34                <cflog text="appended: #arguments.parsedFileInfo.parsedFile#" />
35               
36                <!---
37                        readonly lock protects against including the parsed file while
38                        another threading is writing it...
39                --->
40                <cflock name="#arguments.parsedFileInfo.lockName#" type="readonly" timeout="30">
41                        <cfinclude template="#arguments.parsedFileInfo.parsedFile#" />
42                </cflock>
43               
44                <cflog text="included: #arguments.parsedFileInfo.parsedFile#" />
45                <cfset structAppend(myFusebox.getTopLevelVariablesScope(),variables,true) />
46                <cflog text="out: #arguments.parsedFileInfo.parsedFile#" />
47               
48        </cffunction>
49       
50</cfcomponent>
Note: See TracBrowser for help on using the browser.