| Package: machii_info_sample.plugins |
| Inherits from: MachII.framework.Plugin |
| Method Summary | |
|---|---|
| public void | configure() |
| public void |
handleException(EventContext eventContext, Exception exception)
Plugin point called when an exception occurs (before exception event is handled). Override to provide custom functionality. |
| private any | logToFile(string text) |
| public void |
postEvent(EventContext eventContext)
Plugin point called after each event is processed. Override to provide custom functionality. |
| public void |
postProcess(EventContext eventContext)
Plugin point called after event processing finishes. Override to provide custom functionality. |
| public void |
postView(EventContext eventContext)
Plugin point called after each view is processed. Override to provide custom functionality. |
| public void |
preEvent(EventContext eventContext)
Plugin point called before each event is processed. Override to provide custom functionality. |
| public void |
preProcess(EventContext eventContext)
Plugin point called before event processing begins. Override to provide custom functionality. |
| public void |
preView(EventContext eventContext)
Plugin point called before each view is processed. Override to provide custom functionality. |
| private any | trace(string method, EventContext eventContext) |
| private any | traceit(string text) |
| Method Detail |
|---|
| configure |
|---|
public void configure( )
Parameters:
Code:
<cffunction name="configure" access="public" returntype="void" output="false">
<cfset var params = getParameters() />
<cfscript>
if ( structKeyExists(params, "file") ) {
variables.filename = params.file;
}
</cfscript>
</cffunction>
| handleException |
|---|
public void handleException( EventContext eventContext, Exception exception )
Plugin point called when an exception occurs (before exception event is handled). Override to provide custom functionality.
Parameters:
| EventContext eventContext |
| Exception exception |
Code:
<cffunction name="handleException" access="public" returntype="void" output="true" hint="Plugin point called when an exception occurs (before exception event is handled). Override to provide custom functionality."> <cfargument name="eventContext" type="MachII.framework.EventContext" required="true" /> <cfargument name="exception" type="MachII.util.Exception" required="true" /> <cfset trace(method="handleException", eventContext=arguments.eventContext) /> <cfset logToFile(text="- Exception: msg: #arguments.exception.getMessage()#, detail: #arguments.exception.getDetail()#") /> </cffunction>
| logToFile |
|---|
private any logToFile( string text )
Parameters:
| string text |
Code:
<cffunction name="logToFile" access="private"> <cfargument name="text" type="string" required="true" /> <cflog file="#variables.filename#" text="#arguments.text#" /> </cffunction>
| postEvent |
|---|
public void postEvent( EventContext eventContext )
Plugin point called after each event is processed. Override to provide custom functionality.
Parameters:
| EventContext eventContext |
Code:
<cffunction name="postEvent" access="public" returntype="void" output="true" hint="Plugin point called after each event is processed. Override to provide custom functionality."> <cfargument name="eventContext" type="MachII.framework.EventContext" required="true" /> <cfset trace(method="postEvent", eventContext=arguments.eventContext) /> </cffunction>
| postProcess |
|---|
public void postProcess( EventContext eventContext )
Plugin point called after event processing finishes. Override to provide custom functionality.
Parameters:
| EventContext eventContext |
Code:
<cffunction name="postProcess" access="public" returntype="void" output="true" hint="Plugin point called after event processing finishes. Override to provide custom functionality."> <cfargument name="eventContext" type="MachII.framework.EventContext" required="true" /> <cfset trace(method="postProcess", eventContext=arguments.eventContext) /> <cfset logToFile(text="Total since preProcess: #request.tick - request.tickStart#") /> </cffunction>
| postView |
|---|
public void postView( EventContext eventContext )
Plugin point called after each view is processed. Override to provide custom functionality.
Parameters:
| EventContext eventContext |
Code:
<cffunction name="postView" access="public" returntype="void" output="true" hint="Plugin point called after each view is processed. Override to provide custom functionality."> <cfargument name="eventContext" type="MachII.framework.EventContext" required="true" /> <cfset trace(method="postView", eventContext=arguments.eventContext) /> </cffunction>
| preEvent |
|---|
public void preEvent( EventContext eventContext )
Plugin point called before each event is processed. Override to provide custom functionality.
Parameters:
| EventContext eventContext |
Code:
<cffunction name="preEvent" access="public" returntype="void" output="true" hint="Plugin point called before each event is processed. Override to provide custom functionality."> <cfargument name="eventContext" type="MachII.framework.EventContext" required="true" /> <cfset trace(method="preEvent", eventContext=arguments.eventContext) /> </cffunction>
| preProcess |
|---|
public void preProcess( EventContext eventContext )
Plugin point called before event processing begins. Override to provide custom functionality.
Parameters:
| EventContext eventContext |
Code:
<cffunction name="preProcess" access="public" returntype="void" output="true" hint="Plugin point called before event processing begins. Override to provide custom functionality."> <cfargument name="eventContext" type="MachII.framework.EventContext" required="true" /> <cfset trace(method="preProcess", eventContext=arguments.eventContext) /> <cfset request.tickStart = request.tick /> </cffunction>
| preView |
|---|
public void preView( EventContext eventContext )
Plugin point called before each view is processed. Override to provide custom functionality.
Parameters:
| EventContext eventContext |
Code:
<cffunction name="preView" access="public" returntype="void" output="true" hint="Plugin point called before each view is processed. Override to provide custom functionality."> <cfargument name="eventContext" type="MachII.framework.EventContext" required="true" /> <cfset trace(method="preView", eventContext=arguments.eventContext) /> </cffunction>
| trace |
|---|
private any trace( string method, EventContext eventContext )
Parameters:
| string method |
| EventContext eventContext |
Code:
<cffunction name="trace" access="private"> <cfargument name="method" type="string" required="true" /> <cfargument name="eventContext" type="MachII.framework.EventContext" required="true" /> <cfif arguments.eventContext.hasCurrentEvent()> <cfset traceit(text="#arguments.method# :: #arguments.eventContext.getCurrentEvent().getName()#") /> <cfelse> <cfset traceit(text="#arguments.method# :: no event") /> </cfif> </cffunction>
| traceit |
|---|
private any traceit( string text )
Parameters:
| string text |
Code:
<cffunction name="traceit" access="private"> <cfargument name="text" type="string" required="true" /> <cfset var tc = getTickCount() /> <cfif structkeyExists(request, "tick")> <cfset logToFile(text="[#tc# ms (#tc - request.tick#)] - #arguments.text#") /> <cfset request.tick = tc /> <cfelse> <cfset logToFile(text="[#tc# ms (1st trace)] - #arguments.text#") /> <cfset request.tick = tc /> </cfif> </cffunction>