Sorcerer's IsleCode QueryParam Scanner / files

     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 compile a lexicon verb. I am created for each verb that needs to be compiled and I provide the thread-safe context in which that verb is compiled. That includes the various fb_* methods used to write to the parsed file.">
    18
    19	<cffunction name="init" returntype="any" access="public" output="false" 
    20				hint="I am the constructor.">
    21		<cfargument name="writer" type="any" required="false" 
    22					hint="I am the parsed file writer object. I am required but it's faster to specify that I am not required." />
    23		<cfargument name="verbInfo" type="any" required="false" 
    24					hint="I am the verb compilation context. I am required but it's faster to specify that I am not required." />
    25		<cfargument name="lexiconInfo" type="any" required="false" 
    26					hint="I am the lexicon definition that supports this verb. I am required but it's faster to specify that I am not required." />
    27		
    28		<cfset variables.fb_writer = arguments.writer />
    29		<cfset variables.fb_ = structNew() />
    30		<cfset variables.fb_.verbInfo = arguments.verbInfo />
    31		<cfset variables.lexiconInfo = arguments.lexiconInfo />
    32		
    33		<cfreturn this />
    34		
    35	</cffunction>
    36	
    37	<cffunction name="compile" returntype="void" access="public" output="false" 
    38				hint="I compile a lexicon verb by including its implementation file.">
    39
    40		<cfset var info = variables.lexiconInfo />
    41		<cfset var lexiconFile = info.lexicon.path />
    42		
    43		<cfset lexiconFile = lexiconFile & info.verb />
    44		<cfset lexiconFile = lexiconFile & "." & "cfm" />
    45		
    46		<cftry>
    47			<cfinclude template="#lexiconFile#" />
    48			<cfcatch type="missingInclude">
    49				<cfset fb_throw("fusebox.badGrammar.missingImplementationException",
    50								"Bad Grammar verb in circuit file",
    51								"The implementation file for the '#info.verb#' verb from the '#info.lexicon.namespace#'" &
    52									" custom lexicon could not be found.  It is used in the '#variables.fb_.verbInfo.circuit#.#variables.fb_.verbInfo.fuseaction#' fuseaction.") />
    53			</cfcatch>
    54		</cftry>
    55		
    56	</cffunction>
    57	
    58	<!---
    59		FB55: added this to workaround path issues when a verb needs a component
    60		this was specifically added to support <include ... circuit= ... /> when
    61		implicit circuits are allowed and the named circuit does not already exist
    62	--->
    63	<cffunction name="__makeImplicitCircuit" returntype="any" access="private" output="false"
    64				hint="I return an implicit circuit for any verb that has a circuit= attribute.">
    65		
    66		<cfreturn createObject("component","fuseboxImplicitCircuit")
    67					.init(variables.fb_.app,
    68						variables.fb_.verbInfo.attributes.circuit,
    69						variables.fb_writer.getMyFusebox()) />
    70		
    71	</cffunction>
    72	
    73	<cffunction name="fb_appendLine" output="false" returntype="void" 
    74				hint="I append a line to the parsed file.">
    75		<cfargument name="lineContent" type="string" required="true" 
    76					hint="I am the line of text to append." />
    77		<cfset variables.fb_writer.println(arguments.lineContent) />
    78	</cffunction>
    79	
    80	<cffunction name="fb_appendIndent" output="false" returntype="void" 
    81				hint="I am a no-op provided for backward compatibility.">
    82	</cffunction>
    83	
    84	<cffunction name="fb_appendSegment" output="false" returntype="void" 
    85				hint="I append a segment of text to the parsed file.">
    86		<cfargument name="segmentContent" type="string" required="true" 
    87					hint="I am the segment of text to append." />
    88		<cfset variables.fb_writer.print(segmentContent) />
    89	</cffunction>
    90	
    91	<cffunction name="fb_appendNewline" output="false" returntype="void" 
    92				hint="I append a newline to the parsed file.">
    93		<cfset variables.fb_writer.println("") />
    94	</cffunction>
    95	
    96	<cffunction name="fb_increaseIndent" output="false" returntype="void" 
    97				hint="I am a no-op provided for backward compatibility.">
    98	</cffunction>
    99	
   100	<cffunction name="fb_decreaseIndent" output="false" returntype="void" 
   101				hint="I am a no-op provided for backward compatibility.">
   102	</cffunction>
   103	
   104	<cffunction name="fb_throw" output="false" returntype="void" 
   105				hint="I throw the specified exception.">
   106		<cfargument name="type" type="string" required="true" 
   107					hint="I am the type of exception to throw." />
   108		<cfargument name="message" type="string" required="true" 
   109					hint="I am the message to include in the thrown exception." />
   110		<cfargument name="detail" type="string" required="true" 
   111					hint="I am the detail to include in the thrown exception." />
   112		
   113		<cfthrow type="#arguments.type#" message="#arguments.message#" detail="#arguments.detail#" />
   114
   115	</cffunction>
   116	
   117</cfcomponent>