| Package: MachII.framework |
| Base Command component. |
<!--- 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: Ben Edwards (ben@ben-edwards.com) $Id: Command.cfc 625 2008-01-29 21:45:06Z peterfarrell $ Created version: 1.0.0 Updated version: 1.5.0 Notes: ---> |
| Method Summary | |
|---|---|
| public Command |
init()
Used by the framework for initialization. |
| public boolean |
execute(Event event, EventContext eventContext)
Overridden by the command that extends this component. |
| public Log |
getLog()
Gets the log. |
| public any | getParameter(string name) |
| public void |
setLog(LogFactory logFactory)
Uses the log factory to create a log. |
| public void | setParameter(string name, any value) |
| public void |
setParameters(struct parameters)
Sets a struct of parameters to this command. |
| Method Detail |
|---|
| execute |
|---|
public boolean execute( Event event, EventContext eventContext )
Overridden by the command that extends this component.
Parameters:
| Event event |
| EventContext eventContext |
Code:
<cffunction name="execute" access="public" returntype="boolean" output="true" hint="Overridden by the command that extends this component."> <cfargument name="event" type="MachII.framework.Event" required="true" /> <cfargument name="eventContext" type="MachII.framework.EventContext" required="true" /> <cfreturn true /> </cffunction>
| getLog |
|---|
public Log getLog( )
Gets the log.
Parameters:
Code:
<cffunction name="getLog" access="public" returntype="MachII.logging.Log" output="false" hint="Gets the log."> <cfreturn variables.log /> </cffunction>
| getParameter |
|---|
public any getParameter( string name )
Parameters:
| string name |
Code:
<cffunction name="getParameter" access="public" returntype="any" output="false"> <cfargument name="name" type="string" required="true" /> <cfreturn variables.parameters[arguments.name] /> </cffunction>
| init |
|---|
public Command init( )
Used by the framework for initialization.
Parameters:
Code:
<cffunction name="init" access="public" returntype="Command" output="false" hint="Used by the framework for initialization."> <cfreturn this /> </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>
| setParameter |
|---|
public void setParameter( string name, any value )
Parameters:
| string name |
| any value |
Code:
<cffunction name="setParameter" access="public" returntype="void" output="false"> <cfargument name="name" type="string" required="true" /> <cfargument name="value" type="any" required="true" /> <cfset variables.parameters[arguments.name] = arguments.value /> </cffunction>
| setParameters |
|---|
public void setParameters( struct parameters )
Sets a struct of parameters to this command.
Parameters:
| struct parameters |
Code:
<cffunction name="setParameters" access="public" returntype="void" output="false" hint="Sets a struct of parameters to this command."> <cfargument name="parameters" type="struct" required="true" /> <cfset var key = "" /> <cfloop collection="#arguments.parameters#" item="key"> <cfset setParameter(key, parameters[key]) /> </cfloop> </cffunction>