Changeset 1587
- Timestamp:
- 06/25/08 10:53:10 (2 months ago)
- Files:
-
- coldbox/trunk/system/beans/interceptorState.cfc (modified) (3 diffs)
- coldbox/trunk/system/interceptor.cfc (modified) (14 diffs)
- coldbox/trunk/system/util/ThreadWrapper.cfc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
coldbox/trunk/system/beans/interceptorState.cfc
r1586 r1587 77 77 <cfscript> 78 78 var key = ""; 79 var stopChain = ""; 79 80 80 81 /* Loop and execute each interceptor as registered in order */ 81 82 for( key in getInterceptors()){ 82 83 /* Invoke the execution point */ 83 invoker( getInterceptors().get(key), arguments.event, arguments.interceptData ); 84 /* Check for _stopchain */ 85 if( arguments.event.valueExists('_stopchain') ){ 86 break; 87 } 84 stopChain = invoker( getInterceptors().get(key), arguments.event, arguments.interceptData ); 85 /* Check for results */ 86 if( stopChain ){ break; } 88 87 } 89 88 </cfscript> … … 115 114 116 115 <!--- Interceptor Invoker ---> 117 <cffunction name="invoker" access="private" returntype=" void" hint="Execute an interceptor execution point" output="false" >116 <cffunction name="invoker" access="private" returntype="any" hint="Execute an interceptor execution point" output="false" > 118 117 <!--- ************************************************************* ---> 119 118 <cfargument name="interceptor" required="true" type="any" hint="The interceptor reference from cache"> … … 121 120 <cfargument name="interceptData" required="true" type="any" hint="A metadata structure used to pass intercepted information."> 122 121 <!--- ************************************************************* ---> 123 <cfinvoke component="#arguments.interceptor#" method="#getstate()#"> 122 <cfset var results = false> 123 124 <!--- Invoke the interceptor ---> 125 <cfinvoke component="#arguments.interceptor#" method="#getstate()#" returnvariable="results"> 124 126 <cfinvokeargument name="event" value="#arguments.event#"> 125 127 <cfinvokeargument name="interceptData" value="#arguments.interceptData#"> 126 </cfinvoke> 128 </cfinvoke> 129 130 <!--- Check if we have results ---> 131 <cfif isDefined("results") and isBoolean(results)> 132 <cfreturn results> 133 <cfelse> 134 <cfreturn false> 135 </cfif> 127 136 </cffunction> 128 137 coldbox/trunk/system/interceptor.cfc
r1549 r1587 80 80 81 81 <!--- After Configuration Load ---> 82 <cffunction name="afterConfigurationLoad" access="public" returntype=" void" hint="Executes after the framework and application configuration loads, but before the aspects get configured. " output="false" >82 <cffunction name="afterConfigurationLoad" access="public" returntype="boolean" hint="Executes after the framework and application configuration loads, but before the aspects get configured. " output="false" > 83 83 <cfargument name="event" required="true" type="any" hint="The event object : coldbox.system.beans.requestContext"> 84 84 <cfargument name="interceptData" required="true" type="struct" hint="A structure containing intercepted information. NONE BY DEFAULT HERE"> … … 87 87 88 88 <!--- After Aspects Load ---> 89 <cffunction name="afterAspectsLoad" access="public" returntype=" void" hint="Executes after the application aspects get configured." output="false" >89 <cffunction name="afterAspectsLoad" access="public" returntype="boolean" hint="Executes after the application aspects get configured." output="false" > 90 90 <cfargument name="event" required="true" type="any" hint="The event object : coldbox.system.beans.requestContext"> 91 91 <cfargument name="interceptData" required="true" type="struct" hint="A structure containing intercepted information. NONE BY DEFAULT HERE"> … … 94 94 95 95 <!--- After Handler Creation ---> 96 <cffunction name="afterHandlerCreation" access="public" returntype=" void" output="false" hint="Executes after any handler gets created." >96 <cffunction name="afterHandlerCreation" access="public" returntype="boolean" output="false" hint="Executes after any handler gets created." > 97 97 <!--- ************************************************************* ---> 98 98 <cfargument name="event" required="true" type="any" hint="The event object : coldbox.system.beans.requestContext"> … … 103 103 104 104 <!--- After Plugin Creation ---> 105 <cffunction name="afterPluginCreation" access="public" returntype=" void" output="false" hint="Executes after any plugin gets created." >105 <cffunction name="afterPluginCreation" access="public" returntype="boolean" output="false" hint="Executes after any plugin gets created." > 106 106 <!--- ************************************************************* ---> 107 107 <cfargument name="event" required="true" type="any" hint="The event object : coldbox.system.beans.requestContext"> … … 112 112 113 113 <!--- Session Start ---> 114 <cffunction name="sessionStart" access="public" returntype=" void" hint="Executes on Session start" output="false" >114 <cffunction name="sessionStart" access="public" returntype="boolean" hint="Executes on Session start" output="false" > 115 115 <cfargument name="event" required="true" type="any" hint="The event object : coldbox.system.beans.requestContext"> 116 116 <cfargument name="interceptData" required="true" type="struct" hint="A structure containing intercepted information. THE SESSION SCOPE"> … … 119 119 120 120 <!--- Session End ---> 121 <cffunction name="sessionEnd" access="public" returntype=" void" hint="Executes on Session end." output="false" >121 <cffunction name="sessionEnd" access="public" returntype="boolean" hint="Executes on Session end." output="false" > 122 122 <cfargument name="event" required="true" type="any" hint="The event object : coldbox.system.beans.requestContext"> 123 123 <cfargument name="interceptData" required="true" type="struct" hint="A structure containing intercepted information. THE SESSION SCOPE"> … … 126 126 127 127 <!--- Pre execution process ---> 128 <cffunction name="preProcess" access="public" returntype=" void" hint="Executes before any event execution occurs" output="false" >128 <cffunction name="preProcess" access="public" returntype="boolean" hint="Executes before any event execution occurs" output="false" > 129 129 <cfargument name="event" required="true" type="any" hint="The event object : coldbox.system.beans.requestContext"> 130 130 <cfargument name="interceptData" required="true" type="struct" hint="A structure containing intercepted information. NONE BY DEFAULT HERE"> … … 133 133 134 134 <!--- Pre Event execution ---> 135 <cffunction name="preEvent" access="public" returntype=" void" hint="Executes right before any run event is executed." output="false" >135 <cffunction name="preEvent" access="public" returntype="boolean" hint="Executes right before any run event is executed." output="false" > 136 136 <cfargument name="event" required="true" type="any" hint="The event object : coldbox.system.beans.requestContext"> 137 137 <cfargument name="interceptData" required="true" type="struct" hint="A structure containing intercepted information = [processedEvent]"> … … 140 140 141 141 <!--- Post Event Execution ---> 142 <cffunction name="postEvent" access="public" returntype=" void" hint="Executes after a run event is executed" output="false" >142 <cffunction name="postEvent" access="public" returntype="boolean" hint="Executes after a run event is executed" output="false" > 143 143 <cfargument name="event" required="true" type="any" hint="The event object : coldbox.system.beans.requestContext"> 144 144 <cfargument name="interceptData" required="true" type="struct" hint="A structure containing intercepted information = [processedEvent]"> … … 147 147 148 148 <!--- Pre Render Execution ---> 149 <cffunction name="preRender" access="public" returntype=" void" hint="Executes before the framework starts the rendering cycle." output="false" >149 <cffunction name="preRender" access="public" returntype="boolean" hint="Executes before the framework starts the rendering cycle." output="false" > 150 150 <cfargument name="event" required="true" type="any" hint="The event object : coldbox.system.beans.requestContext"> 151 151 <cfargument name="interceptData" required="true" type="struct" hint="A structure containing intercepted information. NONE BY DEFAULT HERE"> … … 154 154 155 155 <!--- Post Rendering Cycle ---> 156 <cffunction name="postRender" access="public" returntype=" void" hint="Executes after the rendering cycle." output="false" >156 <cffunction name="postRender" access="public" returntype="boolean" hint="Executes after the rendering cycle." output="false" > 157 157 <cfargument name="event" required="true" type="any" hint="The event object : coldbox.system.beans.requestContext"> 158 158 <cfargument name="interceptData" required="true" type="struct" hint="A structure containing intercepted information. NONE BY DEFAULT HERE"> … … 161 161 162 162 <!--- Post Process ---> 163 <cffunction name="postProcess" access="public" returntype=" void" hint="Executes after executions and renderings." output="false" >163 <cffunction name="postProcess" access="public" returntype="boolean" hint="Executes after executions and renderings." output="false" > 164 164 <cfargument name="event" required="true" type="any" hint="The event object : coldbox.system.beans.requestContext"> 165 165 <cfargument name="interceptData" required="true" type="struct" hint="A structure containing intercepted information. NONE BY DEFAULT HERE"> … … 168 168 169 169 <!--- After an Elemente is inserted in the cache ---> 170 <cffunction name="afterCacheElementInsert" access="public" returntype=" void" hint="Executes after an object is inserted into the cache." output="false" >170 <cffunction name="afterCacheElementInsert" access="public" returntype="boolean" hint="Executes after an object is inserted into the cache." output="false" > 171 171 <cfargument name="event" required="true" type="any" hint="The event object : coldbox.system.beans.requestContext"> 172 172 <cfargument name="interceptData" required="true" type="struct" hint="A structure containing intercepted information = [cacheObjectKey,cacheObjectTimeout]"> … … 175 175 176 176 <!--- After an Element is removed from the cache ---> 177 <cffunction name="afterCacheElementRemoved" access="public" returntype=" void" hint="Executes after an object is removed from the cache." output="false" >177 <cffunction name="afterCacheElementRemoved" access="public" returntype="boolean" hint="Executes after an object is removed from the cache." output="false" > 178 178 <cfargument name="event" required="true" type="any" hint="The event object : coldbox.system.beans.requestContext"> 179 179 <cfargument name="interceptData" required="true" type="struct" hint="A structure containing intercepted information = [cacheObjectKey]"> coldbox/trunk/system/util/ThreadWrapper.cfc
r1586 r1587 25 25 /* Save Wrapper */ 26 26 setTarget(arguments.target); 27 //return instance. 27 setThread(createObject("java", "java.lang.Thread")); 28 /* return instance. */ 28 29 return this; 29 30 </cfscript> … … 36 37 <!--- ************************************************************* ---> 37 38 <cfargument name="method" type="string" required="Yes" hint="Name of the method to invoke"> 38 <cfargument name="argCollection" type="struct" required="No" hint="Called with an argument collection struct">39 <cfargument name="argCollection" type="struct" required="No" default="#structnew()#" hint="Called with an argument collection struct"> 39 40 <!--- ************************************************************* ---> 40 41 <cfset var ThreadName = "coldbox.util.ThreadWrapper_#replace(createUUID(),"-","","all")#"> 41 42 <cfset var ResponseToken = createUUID()> 42 43 43 <!--- Thread it. ---> 44 <cfthread name="#ThreadName#" attribs="#arguments.argCollection#"> 44 <!--- Validate if inside thread ---> 45 <cfif isInsideCFThread()> 46 47 <!--- Invoke the method sync ---> 45 48 <cfinvoke component="#getTarget()#" 46 49 method="#attributes.method#" 47 argumentcollection="#attributes.attribs#" /> 48 </cfthread> 50 argumentcollection="#attributes.args#" /> 51 52 <cfelse> 53 54 <!--- Thread it. ---> 55 <cfthread name="#ThreadName#" args="#arguments.argCollection#"> 56 57 <!--- Invoke the method async ---> 58 <cfinvoke component="#getTarget()#" 59 method="#attributes.method#" 60 argumentcollection="#attributes.args#" /> 61 62 </cfthread> 63 64 </cfif> 49 65 50 66 <cfreturn ResponseToken> … … 59 75 <cfset instance.target = arguments.target/> 60 76 </cffunction> 77 78 <!------------------------------------------- PRIVATE -------------------------------------------> 79 80 <!--- Check if inside cfthread ---> 81 <cffunction name="isInsideCFThread" access="private" returntype="boolean" hint="See if the running thread is inside a cfthread." output="false" > 82 <cfscript> 83 try{ 84 if ( findNoCase("cfthread", getThread().currentThread().getThreadGroup().getName() ) ){ 85 return true; 86 } 87 else{ 88 return false; 89 } 90 } 91 catch(Any e){ 92 return true; 93 } 94 </cfscript> 95 </cffunction> 96 97 <!--- Get/set thread object ---> 98 <cffunction name="getThread" access="private" returntype="any" output="false"> 99 <cfreturn instance.Thread /> 100 </cffunction> 101 <cffunction name="setThread" access="private" returntype="void" output="false"> 102 <cfargument name="Thread" type="any" required="true"> 103 <cfset instance.Thread = arguments.Thread /> 104 </cffunction> 61 105 62 106 </cfcomponent>
