| Package: MachII.framework |
| Manages defined properties for the framework. |
| Method Summary | |
|---|---|
| public void | init(string configXML, AppManager appManager) |
| public void | configure() |
| public AppManager | getAppManager() |
| public struct | getProperties() |
| public any | getProperty(string propertyName) |
| public boolean | hasProperty(string propertyName) |
| public boolean | isPropertyDefined(string propertyName) |
| public void | setAppManager(AppManager appManager) |
| public void | setProperty(string propertyName, any propertyValue) |
| Method Detail |
|---|
| configure |
|---|
public void configure( )
Parameters:
Code:
<cffunction name="configure" access="public" returntype="void"> </cffunction>
| getAppManager |
|---|
public AppManager getAppManager( )
Parameters:
Code:
<cffunction name="getAppManager" access="public" returntype="MachII.framework.AppManager" output="false"> <cfreturn variables.appManager /> </cffunction>
| getProperties |
|---|
public struct getProperties( )
Parameters:
Code:
<cffunction name="getProperties" access="public" returntype="struct" output="false"> <cfreturn variables.properties /> </cffunction>
| getProperty |
|---|
public any getProperty( string propertyName )
Parameters:
| string propertyName |
Code:
<cffunction name="getProperty" access="public" returntype="any" output="false"> <cfargument name="propertyName" required="true" type="string" /> <cfif isPropertyDefined(arguments.propertyName)> <cfreturn variables.properties[arguments.propertyName] /> <cfelse> <cfreturn "" /> </cfif> </cffunction>
| hasProperty |
|---|
public boolean hasProperty( string propertyName )
Parameters:
| string propertyName |
Code:
<cffunction name="hasProperty" access="public" returntype="boolean" output="false"> <cfargument name="propertyName" required="true" type="string" /> <cfreturn StructKeyExists(variables.properties, arguments.propertyName) /> </cffunction>
| init |
|---|
public void init( string configXML, AppManager appManager )
Parameters:
| string configXML |
| AppManager appManager |
Code:
<cffunction name="init" access="public" returntype="void" output="false">
<cfargument name="configXML" type="string" required="true" />
<cfargument name="appManager" type="MachII.framework.AppManager" required="true" />
<cfset var xnProperties = 0 />
<cfset var i = 0 />
<cfset setAppManager(arguments.appManager) />
<cfset xnProperties = XMLsearch(configXML,'//property') />
<cfloop from="1" to="#ArrayLen(xnProperties)#" index="i">
<cfset setProperty(xnProperties[i].xmlAttributes.name, xnProperties[i].xmlAttributes.value) />
</cfloop>
<cfif NOT hasProperty('defaultEvent')>
<cfset setProperty('defaultEvent', 'defaultEvent') />
</cfif>
<cfif NOT hasProperty('exceptionEvent')>
<cfset setProperty('exceptionEvent', 'exceptionEvent') />
</cfif>
<cfif NOT hasProperty('applicationRoot')>
<cfset setProperty('applicationRoot', '') />
</cfif>
<cfif NOT hasProperty('eventParameter')>
<cfset setProperty('eventParameter', 'event') />
</cfif>
<cfif NOT hasProperty('parameterPrecedence')>
<cfset setProperty('parameterPrecedence', 'form') />
</cfif>
<cfif NOT hasProperty('maxEvents')>
<cfset setProperty('maxEvents', 10) />
</cfif>
</cffunction>
| isPropertyDefined |
|---|
public boolean isPropertyDefined( string propertyName )
Parameters:
| string propertyName |
Code:
<cffunction name="isPropertyDefined" access="public" returntype="boolean" output="false"> <cfargument name="propertyName" required="true" type="string" /> <cfreturn StructKeyExists(variables.properties, arguments.propertyName) /> </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>
| setProperty |
|---|
public void setProperty( string propertyName, any propertyValue )
Parameters:
| string propertyName |
| any propertyValue |
Code:
<cffunction name="setProperty" access="public" returntype="void" output="false"> <cfargument name="propertyName" required="true" type="string" /> <cfargument name="propertyValue" required="true" /> <cfset variables.properties[arguments.propertyName] = arguments.propertyValue /> </cffunction>