1<!---
2Copyright 2006-2007 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 hint="I represent a fuseaction as a file within an implicit circuit.">
18 19 <cffunction name="init" returntype="any" access="public" output="false"
20 hint="I am the constructor.">
21 <cfargument name="circuit" type="any" required="false"
22 hint="I am the circuit to which this fuseaction belongs. I am required but it's faster to specify that I am not required." />
23 <cfargument name="name" type="any" required="false"
24 hint="I am the name of the fuseaction. I am required but it's faster to specify that I am not required." />
25 26 <cfset variables.circuit = arguments.circuit />
27 <cfset variables.name = arguments.name />
28 29 <!--- implicit circuit fuseactions are public by default --->
30 <cfset this.access = "public" />
31 <cfset this.permissions = "" />
32 33 <cfreturn this />
34 35 </cffunction>
36 37 <cffunction name="compile" returntype="void" access="public" output="false"
38 hint="I compile this fuseaction.">
39 <cfargument name="writer" type="any" required="false"
40 hint="I am the writer object to which the compiled code should be written. I am required but it's faster to specify that I am not required." />
41 42 <cfset var circuitPath = getCircuit().getApplication().parseRootPath & getCircuit().getRelativePath() />
43 <cfset var rootCircuitPath = getCircuit().getApplication().appRootDirectory & getCircuit().getApplication().parsePath & circuitPath />
44 45 <!--- implicit prefuseaction --->
46 <cfset arguments.writer.println('<' &
47 'cfif fileExists("#rootCircuitPath#prefuseaction.cfm")><' &
48 'cfoutput><cfinclude ' &
49 'template="#circuitPath#prefuseaction.cfm" /><' &
50 '/cfoutput><' &
51 '/cfif>') />
52 <!--- main fuseaction --->
53 <cfset arguments.writer.println('<' &
54 'cfif fileExists("#rootCircuitPath##getName()#.cfm")><' &
55 'cfoutput><cfinclude ' &
56 'template="#circuitPath##getName()#.cfm" /><' &
57 '/cfoutput><' &
58 'cfelse><' &
59 'cfthrow type="fusebox.undefinedFuseaction" ' &
60 'message="undefined Fuseaction" ' &
61 'detail="You specified a Fuseaction of #getName()# which is not defined in Circuit #getCircuit().getAlias()#."><' &
62 '/cfif>') />
63 <!--- implicit postfuseaction --->
64 <cfset arguments.writer.println('<' &
65 'cfif fileExists("#rootCircuitPath#postfuseaction.cfm")><' &
66 'cfoutput><cfinclude ' &
67 'template="#circuitPath#postfuseaction.cfm" /><' &
68 '/cfoutput><' &
69 '/cfif>') />
70 71 </cffunction>
72 73 <cffunction name="getName" returntype="string" access="public" output="false"
74 hint="I return the name of the fuseaction.">
75 76 <cfreturn variables.name />
77 78 </cffunction>
79 80 <cffunction name="getCircuit" returntype="any" access="public" output="false"
81 hint="I return the enclosing circuit object.">
82 83 <cfreturn variables.circuit />
84 85 </cffunction>
86 87 <cffunction name="getAccess" returntype="string" access="public" output="false"
88 hint="I am a convenience method to return this fuseaction's access attribute value.">
89 90 <cfreturn this.access />
91 92 </cffunction>
93 94 <cffunction name="getPermissions" returntype="string" access="public" output="false"
95 hint="I return the aggregated permissions for this fuseaction.">
96 97 <cfreturn this.permissions />
98 99 </cffunction>
100 101 <cffunction name="getCustomAttributes" returntype="struct" access="public" output="false"
102 hint="I return the custom (namespace-qualified) attributes for this fuseaction tag.">
103 <cfargument name="ns" type="string" required="true"
104 hint="I am the namespace prefix whose attributes should be returned." />
105 106 <cfreturn structNew() />
107 108 </cffunction>
109 110</cfcomponent>