| Package: MachII.framework |
| Holds configuration and cache data. |
<!--- License: Copyright 2008 GreatBizTools, LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Copyright: GreatBizTools, LLC Author: Kurt Wiersma (kurt@mach-ii.com) $Id: CacheHandler.cfc 595 2007-12-17 02:39:01Z kurtwiersma $ Created version: 1.6.0 Updated version: 1.6.0 Notes: ---> |
| Method Summary | |
|---|---|
| public CacheHandler |
init([string id=""], [string aliases=""], [string strategyName=""], [string criteria=""], [string parentHandlerName=""], [string parentHandlerType=""])
Initializes the handler. |
| public void |
addCommand(Command command)
Adds a Command. |
| public void |
clearCache(Event event, [string criteria=""])
Clears the cache. |
| private struct |
computeDataToCache(struct preCommandDataSnapshot, struct postCommandDataSnapshot)
Computes event data to cache based on the pre-command and post-command event data snapshots. |
| private string |
createHandlerId()
Creates a random handler id. Does not use UUID for performance reasons. |
| private struct | executeCommands(Event event, EventContext eventContext) |
| public string | getAliases() |
| public AppManager | getAppManager() |
| public AbstractCacheStrategy | getCacheStrategy() |
| public string |
getCriteria()
Returns an uppercase and sorted criteria list. |
| public string |
getHandlerId()
Returns the handler id. |
| private string |
getKeyWithCriteria(Event event, [string criteria="#getCriteria()#"])
Build a key with the cache handler criteria based off the data from the event object. |
| private Log |
getLog()
Gets the log. |
| private array |
getObservedHTMLHeadElements()
Gets observed HTML head elements. |
| private array |
getObservedHTTPHeaders()
Gets observed HTTP headers. |
| public string | getParentHandlerName() |
| public string | getParentHandlerType() |
| public string | getStrategyName() |
| public boolean |
handleCache(Event event, EventContext eventContext)
Handles a cache. |
| private array |
mergeStructKeys(struct struct1, struct struct2)
Returns an array of struct keys with duplicates deleted. |
| public void |
observeHTMLHeadElement()
Observes a HTML head element. |
| public void |
observeHTTPHeader()
Adds a HTTP header. You must use named arguments or addHTTPHeaderByName/addHTTPHeaderByStatus helper methods. |
| private void |
replayHTMLHeadElements(array HTMLHeadElements, EventContext eventContext)
Replays cached HTML head elements. |
| private void |
replayHTTPHeaders(array HTTPHeaders, EventContext eventContext)
Replays cached HTTP header. |
| private void | setAliases(string aliases) |
| public void | setAppManager(AppManager appManager) |
| public void | setCacheStrategy(AbstractCacheStrategy cacheStrategy) |
| private void |
setCriteria(string criteria)
Automatically converts to uppercase and sorts the criteria list. |
| private void |
setHandlerId(string handlerId)
Sets the hanlder id and creates an unique id if handler id is NOT len. |
| public void |
setLog(LogFactory logFactory)
Uses the log factory to create a log. |
| private void | setParentHandlerName(string parentHandlerName) |
| private void | setParentHandlerType(string parentHandlerType) |
| private void | setStrategyName(string strategyName) |
| Method Detail |
|---|
| addCommand |
|---|
public void addCommand( Command command )
Adds a Command.
Parameters:
| Command command |
Code:
<cffunction name="addCommand" access="public" returntype="void" output="false" hint="Adds a Command."> <cfargument name="command" type="MachII.framework.Command" required="true" /> <cfset ArrayAppend(variables.commands, arguments.command) /> </cffunction>
| clearCache |
|---|
public void clearCache( Event event, [string criteria=""] )
Clears the cache.
Parameters:
| Event event |
| [string criteria=""] |
Code:
<cffunction name="clearCache" access="public" returntype="void" output="false"
hint="Clears the cache.">
<cfargument name="event" type="MachII.framework.Event" required="true" />
<cfargument name="criteria" type="string" required="false" default="" />
<cfset var key = getKeyWithCriteria(arguments.event, arguments.criteria) />
<cfset var keyIds = "" />
<cfset var i = 0 />
<cfif Len(arguments.criteria)>
<cfif log.isDebugEnabled()>
<cfset log.debug("Cache-handler clearing data from cache using key '#key#' with criteria '#arguments.criteria#'") />
</cfif>
<cfset getCacheStrategy().remove(key) />
<cfset variables.keySet.remove(key) />
<cfelse>
<cfif log.isDebugEnabled()>
<cfset log.debug("Cache-handler clearing all data from cache that start with id '#getHandlerId()#'") />
</cfif>
<cfset keyIds = variables.keySet.toArray() />
<cfset variables.keySet.clear() />
<cfloop from="1" to="#ArrayLen(keyIds)#" index="i">
<cfset getCacheStrategy().remove(keyIds[i]) />
</cfloop>
</cfif>
</cffunction>
| computeDataToCache |
|---|
private struct computeDataToCache( struct preCommandDataSnapshot, struct postCommandDataSnapshot )
Computes event data to cache based on the pre-command and post-command event data snapshots.
Parameters:
| struct preCommandDataSnapshot |
| struct postCommandDataSnapshot |
Code:
<cffunction name="computeDataToCache" access="private" returntype="struct" output="false" hint="Computes event data to cache based on the pre-command and post-command event data snapshots."> <cfargument name="preCommandDataSnapshot" type="struct" required="true" /> <cfargument name="postCommandDataSnapshot" type="struct" required="true" /> <cfset var keys = mergeStructKeys(arguments.preCommandDataSnapshot, arguments.postCommandDataSnapshot) /> <cfset var dataToCache = StructNew() /> <cfset var pre = "" /> <cfset var post = "" /> <cfset var keyName = "" /> <cfset var i = "" /> <cfloop from="1" to="#ArrayLen(keys)#" index="i"> <cfset keyName = keys[i] /> <cfif NOT StructKeyExists(arguments.preCommandDataSnapshot, keyName) AND StructKeyExists(arguments.postCommandDataSnapshot , keyName)> <cfset dataToCache[keyName] = arguments.postCommandDataSnapshot[keyName] /> <cfelseif StructKeyExists(arguments.preCommandDataSnapshot, keyName) AND StructKeyExists(arguments.postCommandDataSnapshot , keyName)> <cfset pre = arguments.preCommandDataSnapshot[keyName] /> <cfset post = arguments.postCommandDataSnapshot[keyName] /> <cfif IsObject(pre) AND IsObject(post)> <cfif NOT getAppManager().getUtils().assertSame(pre, post)> <cfset dataToCache[keyName] = post /> </cfif> <cfelseif IsQuery(pre) AND IsQuery(post) OR (IsStruct(pre) AND IsStruct(post)) OR (IsArray(pre) AND IsArray(post))> <cfif pre.hashCode() NEQ post.hashCode()> <cfset dataToCache[keyName] = post /> </cfif> <cfelseif (IsSimpleValue(pre) AND IsSimpleValue(post))> <cfif NOT pre.equals(post)> <cfset dataToCache[keyName] = post /> </cfif> <cfelse> <cfset dataToCache[keyName] = post /> </cfif> </cfif> </cfloop> <cfreturn dataToCache /> </cffunction>
| createHandlerId |
|---|
private string createHandlerId( )
Creates a random handler id. Does not use UUID for performance reasons.
Parameters:
Code:
<cffunction name="createHandlerId" access="private" returntype="string" output="false" hint="Creates a random handler id. Does not use UUID for performance reasons."> <cfreturn Hash(getTickCount() & RandRange(0, 100000) & RandRange(0, 100000)) /> </cffunction>
| executeCommands |
|---|
private struct executeCommands( Event event, EventContext eventContext )
Parameters:
| Event event |
| EventContext eventContext |
Code:
<cffunction name="executeCommands" access="private" returntype="struct" output="false" hints="Executes a block of commands and returns any output and continue status."> <cfargument name="event" type="MachII.framework.Event" required="true" /> <cfargument name="eventContext" type="MachII.framework.EventContext" required="true" /> <cfset var result = StructNew() /> <cfset var command = "" /> <cfset var i = 0 /> <cfset result.continue = true /> <cfset result.output = "" /> <cfsavecontent variable="result.output"> <cfloop from="1" to="#ArrayLen(variables.commands)#" index="i"> <cfset command = variables.commands[i] /> <cfset result.continue = command.execute(arguments.event, arguments.eventContext) /> <cfif result.continue IS false> <cfbreak /> </cfif> </cfloop> </cfsavecontent> <cfreturn result /> </cffunction>
| getAliases |
|---|
public string getAliases( )
Parameters:
Code:
<cffunction name="getAliases" access="public" returntype="string" output="false"> <cfreturn variables.aliases /> </cffunction>
| getAppManager |
|---|
public AppManager getAppManager( )
Parameters:
Code:
<cffunction name="getAppManager" access="public" returntype="MachII.framework.AppManager" output="false"> <cfreturn variables.appManager /> </cffunction>
| getCacheStrategy |
|---|
public AbstractCacheStrategy getCacheStrategy( )
Parameters:
Code:
<cffunction name="getCacheStrategy" access="public" returntype="MachII.caching.strategies.AbstractCacheStrategy" output="false"> <cfreturn variables.cacheStrategy /> </cffunction>
| getCriteria |
|---|
public string getCriteria( )
Returns an uppercase and sorted criteria list.
Parameters:
Code:
<cffunction name="getCriteria" access="public" returntype="string" output="false" hint="Returns an uppercase and sorted criteria list."> <cfreturn variables.criteria /> </cffunction>
| getHandlerId |
|---|
public string getHandlerId( )
Returns the handler id.
Parameters:
Code:
<cffunction name="getHandlerId" access="public" returntype="string" output="false" hint="Returns the handler id."> <cfreturn variables.handlerId /> </cffunction>
| getKeyWithCriteria |
|---|
private string getKeyWithCriteria( Event event, [string criteria="#getCriteria()#"] )
Build a key with the cache handler criteria based off the data from the event object.
Parameters:
| Event event |
| [string criteria="#getCriteria()#"] |
Code:
<cffunction name="getKeyWithCriteria" access="private" returntype="string" output="false" hint="Build a key with the cache handler criteria based off the data from the event object."> <cfargument name="event" type="MachII.framework.Event" required="true" /> <cfargument name="criteria" type="string" required="false" default="#getCriteria()#" hint="If criteria is not passed in, the criteria from the cache handler will be used." /> <cfset var item = "" /> <cfset var element = "" /> <cfset var key = "HANDLERID=" & getHandlerId() /> <cfset var arg = "" /> <cfset var expressionEvaluator = getAppManager().getExpressionEvaluator() /> <cfloop list="#arguments.criteria#" index="item"> <cfif ListLen(item, "=") eq 2> <cfset element = ListGetAt(item, 2, "=") /> <cfset item = ListGetAt(item, 1, "=") /> <cfif expressionEvaluator.isExpression(element)> <cfset arg = expressionEvaluator.evaluateExpression(element, arguments.event, getAppManager().getPropertyManager()) /> <cfelse> <cfset arg = element /> </cfif> <cfelse> <cfif expressionEvaluator.isExpression(item)> <cfset arg = expressionEvaluator.evaluateExpression(item, arguments.event, getAppManager().getPropertyManager()) /> <cfelse> <cfset arg = arguments.event.getArg(item, "") /> </cfif> </cfif> <cfif IsSimpleValue(arg)> <cfset key = ListAppend(key, item & "=" & arg, "&") /> <cfelse> <cfset key = ListAppend(key, item & "=", "&") /> </cfif> </cfloop> <cfreturn key /> </cffunction>
| getLog |
|---|
private Log getLog( )
Gets the log.
Parameters:
Code:
<cffunction name="getLog" access="private" returntype="MachII.logging.Log" output="false" hint="Gets the log."> <cfreturn variables.log /> </cffunction>
| getObservedHTMLHeadElements |
|---|
private array getObservedHTMLHeadElements( )
Gets observed HTML head elements.
Parameters:
Code:
<cffunction name="getObservedHTMLHeadElements" access="private" returntype="array" output="false"
hint="Gets observed HTML head elements.">
<cfif IsDefined("request._MachIICacheHandler_#getHandlerId()#_HTMLHeadElements")>
<cfreturn request["_MachIICacheHandler_#getHandlerId()#_HTMLHeadElements"] />
<cfelse>
<cfreturn ArrayNew(1) />
</cfif>
</cffunction>
| getObservedHTTPHeaders |
|---|
private array getObservedHTTPHeaders( )
Gets observed HTTP headers.
Parameters:
Code:
<cffunction name="getObservedHTTPHeaders" access="private" returntype="array" output="false"
hint="Gets observed HTTP headers.">
<cfif IsDefined("request._MachIICacheHandler_#getHandlerId()#_HTTPHeaders")>
<cfreturn request["_MachIICacheHandler_#getHandlerId()#_HTTPHeaders"] />
<cfelse>
<cfreturn ArrayNew(1) />
</cfif>
</cffunction>
| getParentHandlerName |
|---|
public string getParentHandlerName( )
Parameters:
Code:
<cffunction name="getParentHandlerName" access="public" returntype="string" output="false"> <cfreturn variables.parentHandlerName /> </cffunction>
| getParentHandlerType |
|---|
public string getParentHandlerType( )
Parameters:
Code:
<cffunction name="getParentHandlerType" access="public" returntype="string" output="false"> <cfreturn variables.parentHandlerType /> </cffunction>
| getStrategyName |
|---|
public string getStrategyName( )
Parameters:
Code:
<cffunction name="getStrategyName" access="public" returntype="string" output="false"> <cfreturn variables.strategyName /> </cffunction>
| handleCache |
|---|
public boolean handleCache( Event event, EventContext eventContext )
Handles a cache.
Parameters:
| Event event |
| EventContext eventContext |
Code:
<cffunction name="handleCache" access="public" returntype="boolean" output="true"
hint="Handles a cache.">
<cfargument name="event" type="MachII.framework.Event" required="true" />
<cfargument name="eventContext" type="MachII.framework.EventContext" required="true" />
<cfset var preCommandEventDataSnapshot = StructNew() />
<cfset var dataToCache = StructNew() />
<cfset var key = getKeyWithCriteria(arguments.event) />
<cfset var dataFromCache = "" />
<cfset var commandResult = StructNew() />
<cfset var log = getLog() />
<cfif getCacheStrategy().isCacheEnabled()>
<cfif log.isDebugEnabled()>
<cfset log.debug("Looking for data in the cache for key '#key#'") />
</cfif>
<cflock name="#key#" type="readonly" timeout="120">
<cfset dataFromCache = getCacheStrategy().get(key) />
</cflock>
<cfif NOT IsDefined("dataFromCache")>
<cflock name="#key#" type="exclusive" timeout="120">
<cfset StructAppend(preCommandEventDataSnapshot, arguments.event.getArgs()) />
<cfset arguments.eventContext.addHTMLHeadElementCallback(this, "observeHTMLHeadElement") />
<cfset arguments.eventContext.addHTTPHeaderCallback(this, "observeHTTPHeader") />
<cftry>
<cfset commandResult = executeCommands(arguments.event, arguments.eventContext) />
<cfcatch type="any">
<cfset arguments.eventContext.removeHTMLHeadElementCallback(this) />
<cfset arguments.eventContext.removeHTTPHeaderCallback(this) />
<cfset getCacheStrategy().getCacheStats().decrementCacheMisses() />
<cfrethrow />
</cfcatch>
</cftry>
<cfoutput>#commandResult.output#</cfoutput>
<cfset arguments.eventContext.removeHTMLHeadElementCallback(this) />
<cfset arguments.eventContext.removeHTTPHeaderCallback(this) />
<cfset dataToCache.output = commandResult.output />
<cfset dataToCache.data = computeDataToCache(preCommandEventDataSnapshot, arguments.event.getArgs()) />
<cfset dataToCache.HTMLHeadElements = getObservedHTMLHeadElements() />
<cfset dataToCache.HTTPHeaders = getObservedHTTPHeaders() />
<cfset getCacheStrategy().put(key, dataToCache) />
<cfset variables.keySet.add(key) />
<cfif log.isDebugEnabled()>
<cfset log.debug("Created cache with key '#key#'.") />
<cfset log.debug("Cached data contained key names of '#StructKeyList(dataToCache.data)#'.") />
</cfif>
<cfif log.isTraceEnabled()>
<cfset log.trace("Cached #ArrayLen(dataToCache.HTMLHeadElements)# HTML head elements.") />
<cfset log.trace("Cached #ArrayLen(dataToCache.HTTPHeaders)# HTTP headers.") />
</cfif>
</cflock>
<cfreturn commandResult.continue />
<cfelse>
<cfoutput>#dataFromCache.output#</cfoutput>
<cfset arguments.event.setArgs(dataFromCache.data) />
<cfset replayHTMLHeadElements(dataFromCache.HTMLHeadElements, arguments.eventContext) />
<cfset replayHTTPHeaders(dataFromCache.HTTPHeaders, arguments.eventContext) />
<cfif log.isDebugEnabled()>
<cfset log.debug("Replayed data and output from cache with key '#key#'.") />
<cfset log.debug("Cached data contained key names of '#StructKeyList(dataFromCache.data)#'.") />
</cfif>
<cfif log.isTraceEnabled()>
<cfset log.trace("Replayed #ArrayLen(dataFromCache.HTMLHeadElements)# cached HTML head elements.") />
<cfset log.trace("Replayed #ArrayLen(dataFromCache.HTTPHeaders)# cached HTTP headers.") />
</cfif>
<cfreturn true />
</cfif>
<cfelse>
<cfif log.isDebugEnabled()>
<cfset log.debug("Caching is curently disabled for this cache-handler.") />
</cfif>
<cfset commandResult = executeCommands(arguments.event, arguments.eventContext) />
<cfoutput>#commandResult.output#</cfoutput>
<cfreturn commandResult.continue />
</cfif>
</cffunction>
| init |
|---|
public CacheHandler init( [string id=""], [string aliases=""], [string strategyName=""], [string criteria=""], [string parentHandlerName=""], [string parentHandlerType=""] )
Initializes the handler.
Parameters:
| [string id=""] |
| [string aliases=""] |
| [string strategyName=""] |
| [string criteria=""] |
| [string parentHandlerName=""] |
| [string parentHandlerType=""] |
Code:
<cffunction name="init" access="public" returntype="CacheHandler" output="false" hint="Initializes the handler."> <cfargument name="id" type="string" required="false" default="" /> <cfargument name="aliases" type="string" required="false" default="" /> <cfargument name="strategyName" type="string" required="false" default="" /> <cfargument name="criteria" type="string" required="false" default="" /> <cfargument name="parentHandlerName" type="string" required="false" default="" /> <cfargument name="parentHandlerType" type="string" required="false" default="" /> <cfset var currentAlias = "" /> <cfset setHandlerId(arguments.id) /> <cfset setAliases(arguments.aliases) /> <cfset setStrategyName(arguments.strategyName) /> <cfset setCriteria(arguments.criteria) /> <cfset setParentHandlerName(arguments.parentHandlerName) /> <cfset setParentHandlerType(arguments.parentHandlerType) /> <cfreturn this /> </cffunction>
| mergeStructKeys |
|---|
private array mergeStructKeys( struct struct1, struct struct2 )
Returns an array of struct keys with duplicates deleted.
Parameters:
| struct struct1 |
| struct struct2 |
Code:
<cffunction name="mergeStructKeys" access="private" returntype="array" output="false" hint="Returns an array of struct keys with duplicates deleted."> <cfargument name="struct1" type="struct" required="true" /> <cfargument name="struct2" type="struct" required="true" /> <cfset var mergedKeys = StructKeyList(arguments.struct1) & "," & StructKeyList(arguments.struct2) /> <cfset var cleanedKeys = "" /> <cfset var item = "" /> <cfloop list="#mergedKeys#" index="item"> <cfif NOT ListFindNoCase(cleanedKeys, item)> <cfset cleanedKeys = ListAppend(cleanedKeys, item) /> </cfif> </cfloop> <cfreturn ListToArray(cleanedKeys) /> </cffunction>
| observeHTMLHeadElement |
|---|
public void observeHTMLHeadElement( )
Observes a HTML head element.
Parameters:
Code:
<cffunction name="observeHTMLHeadElement" access="public" returntype="void" output="false"
hint="Observes a HTML head element.">
<cfif NOT IsDefined("request._MachIICacheHandler_#getHandlerId()#_HTMLHeadElements")>
<cfset request["_MachIICacheHandler_#getHandlerId()#_HTMLHeadElements"] = ArrayNew(1) />
</cfif>
<cfset ArrayAppend(request["_MachIICacheHandler_#getHandlerId()#_HTMLHeadElements"], arguments) />
</cffunction>
| observeHTTPHeader |
|---|
public void observeHTTPHeader( )
Adds a HTTP header. You must use named arguments or addHTTPHeaderByName/addHTTPHeaderByStatus helper methods.
Parameters:
Code:
<cffunction name="observeHTTPHeader" access="public" returntype="void" output="false"
hint="Adds a HTTP header. You must use named arguments or addHTTPHeaderByName/addHTTPHeaderByStatus helper methods.">
<cfif NOT IsDefined("request._MachIICacheHandler_#getHandlerId()#_HTTPHeaders")>
<cfset request["_MachIICacheHandler_#getHandlerId()#_HTTPHeaders"] = ArrayNew(1) />
</cfif>
<cfset ArrayAppend(request["_MachIICacheHandler_#getHandlerId()#_HTTPHeaders"], arguments) />
</cffunction>
| replayHTMLHeadElements |
|---|
private void replayHTMLHeadElements( array HTMLHeadElements, EventContext eventContext )
Replays cached HTML head elements.
Parameters:
| array HTMLHeadElements |
| EventContext eventContext |
Code:
<cffunction name="replayHTMLHeadElements" access="private" returntype="void" output="false" hint="Replays cached HTML head elements."> <cfargument name="HTMLHeadElements" type="array" required="true" /> <cfargument name="eventContext" type="MachII.framework.EventContext" required="true" /> <cfset var i = 0 /> <cfloop from="1" to="#ArrayLen(arguments.HTMLHeadElements)#" index="i"> <cfset arguments.eventContext.addHTMLHeadElement(argumentcollection=arguments.HTMLHeadElements[i]) /> </cfloop> </cffunction>
| replayHTTPHeaders |
|---|
private void replayHTTPHeaders( array HTTPHeaders, EventContext eventContext )
Replays cached HTTP header.
Parameters:
| array HTTPHeaders |
| EventContext eventContext |
Code:
<cffunction name="replayHTTPHeaders" access="private" returntype="void" output="false" hint="Replays cached HTTP header."> <cfargument name="HTTPHeaders" type="array" required="true" /> <cfargument name="eventContext" type="MachII.framework.EventContext" required="true" /> <cfset var i = 0 /> <cfloop from="1" to="#ArrayLen(arguments.HTTPHeaders)#" index="i"> <cfset arguments.eventContext.addHTTPHeader(argumentcollection=arguments.HTTPHeaders[i]) /> </cfloop> </cffunction>
| setAliases |
|---|
private void setAliases( string aliases )
Parameters:
| string aliases |
Code:
<cffunction name="setAliases" access="private" returntype="void" output="false"> <cfargument name="aliases" type="string" required="true" /> <cfset variables.aliases = arguments.aliases /> </cffunction>
| setAppManager |
|---|
public void setAppManager( AppManager appManager )
Parameters:
| AppManager appManager |
Code:
<cffunction name="setAppManager" access="public" returntype="void" output="false"> <cfargument name="appManager" type="MachII.framework.AppManager" required="true" /> <cfset variables.appManager = arguments.appManager /> </cffunction>
| setCacheStrategy |
|---|
public void setCacheStrategy( AbstractCacheStrategy cacheStrategy )
Parameters:
| AbstractCacheStrategy cacheStrategy |
Code:
<cffunction name="setCacheStrategy" access="public" returntype="void" output="false"> <cfargument name="cacheStrategy" type="MachII.caching.strategies.AbstractCacheStrategy" required="true" /> <cfset variables.cacheStrategy = arguments.cacheStrategy /> </cffunction>
| setCriteria |
|---|
private void setCriteria( string criteria )
Automatically converts to uppercase and sorts the criteria list.
Parameters:
| string criteria |
Code:
<cffunction name="setCriteria" access="private" returntype="void" output="false" hint="Automatically converts to uppercase and sorts the criteria list."> <cfargument name="criteria" type="string" required="true" /> <cfset variables.criteria = ListSort(UCase(arguments.criteria), "text") /> </cffunction>
| setHandlerId |
|---|
private void setHandlerId( string handlerId )
Sets the hanlder id and creates an unique id if handler id is NOT len.
Parameters:
| string handlerId |
Code:
<cffunction name="setHandlerId" access="private" returntype="void" output="false" hint="Sets the hanlder id and creates an unique id if handler id is NOT len."> <cfargument name="handlerId" type="string" required="true" /> <cfif Len(arguments.handlerId)> <cfset variables.handlerId = arguments.handlerId /> <cfelse> <cfset variables.handlerId = createHandlerId() /> </cfif> </cffunction>
| setLog |
|---|
public void setLog( LogFactory logFactory )
Uses the log factory to create a log.
Parameters:
| LogFactory logFactory |
Code:
<cffunction name="setLog" access="public" returntype="void" output="false" hint="Uses the log factory to create a log."> <cfargument name="logFactory" type="MachII.logging.LogFactory" required="true" /> <cfset variables.log = arguments.logFactory.getLog(getMetadata(this).name) /> </cffunction>
| setParentHandlerName |
|---|
private void setParentHandlerName( string parentHandlerName )
Parameters:
| string parentHandlerName |
Code:
<cffunction name="setParentHandlerName" access="private" returntype="void" output="false"> <cfargument name="parentHandlerName" type="string" required="true" /> <cfset variables.parentHandlerName = arguments.parentHandlerName /> </cffunction>
| setParentHandlerType |
|---|
private void setParentHandlerType( string parentHandlerType )
Parameters:
| string parentHandlerType |
Code:
<cffunction name="setParentHandlerType" access="private" returntype="void" output="false"> <cfargument name="parentHandlerType" type="string" required="true" /> <cfset variables.parentHandlerType = arguments.parentHandlerType /> </cffunction>
| setStrategyName |
|---|
private void setStrategyName( string strategyName )
Parameters:
| string strategyName |
Code:
<cffunction name="setStrategyName" access="private" returntype="void" output="false"> <cfargument name="strategyName" type="string" required="true" /> <cfset variables.strategyName = arguments.strategyName /> </cffunction>