| Package: MachII.framework |
| Factory class for creating instances of AppManager. |
<!--- License: Copyright 2006 Mach-II Corporation 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: Mach-II Corporation $Id: AppFactory.cfc 4352 2006-08-29 20:35:15Z pfarrell $ Created version: 1.0.0 Updated version: 1.1.1 Notes: - Added optimal XML configuration file validation. {bedwards) ---> |
| Method Summary | |
|---|---|
| public AppFactory |
init()
Used by the framework for initialization. Do not override. |
| public AppManager |
createAppManager(string configXmlPath, string configDtdPath, [boolean validateXml="false"], [string version="Unknown BER"])
Creates the AppManager and reads (and optionally validates) the XML configuration file. |
| Method Detail |
|---|
| createAppManager |
|---|
public AppManager createAppManager( string configXmlPath, string configDtdPath, [boolean validateXml="false"], [string version="Unknown BER"] )
Creates the AppManager and reads (and optionally validates) the XML configuration file.
Parameters:
| string configXmlPath |
| string configDtdPath |
| [boolean validateXml="false"] |
| [string version="Unknown BER"] |
Code:
<cffunction name="createAppManager" access="public" returntype="MachII.framework.AppManager" output="false"
hint="Creates the AppManager and reads (and optionally validates) the XML configuration file.">
<cfargument name="configXmlPath" type="string" required="true"
hint="The full path to the configuration XML file." />
<cfargument name="configDtdPath" type="string" required="true"
hint="The full path to the configuration DTD file." />
<cfargument name="validateXml" type="boolean" required="false" default="false"
hint="Should the XML be validated before parsing." />
<cfargument name="version" type="string" required="false" default="Unknown BER"
hint="The version number of Mach-II." />
<cfset var appManager = "" />
<cfset var propertyManager = "" />
<cfset var listenerManager = "" />
<cfset var filterManager = "" />
<cfset var eventManager = "" />
<cfset var viewManager = "" />
<cfset var pluginManager = "" />
<cfset var configXML = "" />
<cfset var configXmlFile = "" />
<cfset var validationResult = "" />
<cfset var validationException = "" />
<cftry>
<cffile
action="READ"
file="#arguments.configXmlPath#"
variable="configXmlFile" />
<cfif arguments.validateXml AND ListFirst(server.ColdFusion.ProductVersion) GTE 7>
<cfset validationResult = XmlValidate(arguments.configXmlPath, arguments.configDtdPath)>
<cfif NOT validationResult.Status>
<cfset validationException = CreateObject('component','MachII.util.XmlValidationException') />
<cfset validationException.wrapValidationResult(validationResult, arguments.configXmlpath, arguments.configDtdPath) />
<cfthrow type="MachII.framework.XmlValidationException"
message="#validationException.getFormattedMessage()#" />
</cfif>
</cfif>
<cfset configXML = XmlParse(configXmlFile) />
<cfcatch type="Any">
<cfrethrow />
</cfcatch>
</cftry>
<cfset appManager = CreateObject('component', 'MachII.framework.AppManager') />
<cfset appManager.init() />
<cfset propertyManager = CreateObject('component', 'MachII.framework.PropertyManager') />
<cfset propertyManager.init(configXML, appManager, arguments.version) />
<cfset appManager.setPropertyManager(propertyManager) />
<cfset listenerManager = CreateObject('component', 'MachII.framework.ListenerManager') />
<cfset listenerManager.init(configXML, appManager) />
<cfset appManager.setListenerManager(listenerManager) />
<cfset filterManager = CreateObject('component', 'MachII.framework.FilterManager') />
<cfset filterManager.init(configXML, appManager) />
<cfset appManager.setFilterManager(filterManager) />
<cfset eventManager = CreateObject('component', 'MachII.framework.EventManager') />
<cfset eventManager.init(configXML, appManager) />
<cfset appManager.setEventManager(eventManager) />
<cfset viewManager = CreateObject('component', 'MachII.framework.ViewManager') />
<cfset viewManager.init(configXML, appManager) />
<cfset appManager.setViewManager(viewManager) />
<cfset pluginManager = CreateObject('component', 'MachII.framework.PluginManager') />
<cfset pluginManager.init(configXML, appManager) />
<cfset appManager.setPluginManager(pluginManager) />
<cfset appManager.configure() />
<cfreturn appManager />
</cffunction>
| init |
|---|
public AppFactory init( )
Used by the framework for initialization. Do not override.
Parameters:
Code:
<cffunction name="init" access="public" returntype="AppFactory" output="false" hint="Used by the framework for initialization. Do not override."> <cfreturn this /> </cffunction>