| 1 | <cfcomponent> |
|---|
| 2 | <cfset variables.ObjectFactory = 0 /> |
|---|
| 3 | <cfset variables.BeanFactory = 0 /> |
|---|
| 4 | |
|---|
| 5 | <cffunction name="init" access="public" hint="I configure this object factory" returntype="any" _returntype="reactorFactory"> |
|---|
| 6 | <cfargument name="configuration" hint="I am either a relative or absolute path to the config XML file or an instance of a reactor.config.config component" required="yes" type="any" _type="any" /> |
|---|
| 7 | |
|---|
| 8 | <!--- if the config was not passed in, load the XML file ---> |
|---|
| 9 | <cfif NOT IsObject(arguments.configuration)> |
|---|
| 10 | <cfset arguments.configuration = CreateObject("Component", "reactor.config.config").init(arguments.configuration) /> |
|---|
| 11 | </cfif> |
|---|
| 12 | |
|---|
| 13 | <!--- pass the configuration into the objectFactory ---> |
|---|
| 14 | <cfset setObjectFactory(CreateObject("Component", "reactor.core.objectFactory").init(arguments.configuration, this)) /> |
|---|
| 15 | |
|---|
| 16 | <!--- give the objectfactory the beanfactory ---> |
|---|
| 17 | <cfset getObjectFactory().setBeanFactory(getBeanFactory()) /> |
|---|
| 18 | |
|---|
| 19 | <cfreturn this /> |
|---|
| 20 | </cffunction> |
|---|
| 21 | |
|---|
| 22 | <cffunction name="createRecord" access="public" hint="I return a record object." output="false" returntype="any" _returntype="reactor.base.abstractRecord"> |
|---|
| 23 | <cfargument name="objectAlias" hint="I am the alias of the record to return. I corrispond to the name of a object in the DB." required="yes" type="any" _type="string" /> |
|---|
| 24 | <cfset var Record = 0 /> |
|---|
| 25 | |
|---|
| 26 | <cfset Record = getObjectFactory().create(arguments.objectAlias, "Record") /> |
|---|
| 27 | |
|---|
| 28 | <cfreturn Record /> |
|---|
| 29 | </cffunction> |
|---|
| 30 | |
|---|
| 31 | <cffunction name="createDao" access="public" hint="I return a Dao object." output="false" returntype="any" _returntype="reactor.base.abstractDao"> |
|---|
| 32 | <cfargument name="objectAlias" hint="I am the alias of the Dao to return. I corrispond to the name of a object in the DB." required="yes" type="any" _type="string" /> |
|---|
| 33 | <cfset var Dao = 0 /> |
|---|
| 34 | |
|---|
| 35 | <cfset Dao = getObjectFactory().create(arguments.objectAlias, "Dao") /> |
|---|
| 36 | |
|---|
| 37 | <cfreturn Dao /> |
|---|
| 38 | </cffunction> |
|---|
| 39 | |
|---|
| 40 | <cffunction name="createTo" access="public" hint="I return a To object." output="false" returntype="any" _returntype="reactor.base.abstractTo"> |
|---|
| 41 | <cfargument name="objectAlias" hint="I am the alias of the TO to return. I corrispond to the name of a object in the DB." required="yes" type="any" _type="string" /> |
|---|
| 42 | <cfset var To = 0 /> |
|---|
| 43 | |
|---|
| 44 | <cfset To = getObjectFactory().create(arguments.objectAlias, "To") /> |
|---|
| 45 | |
|---|
| 46 | <cfreturn To /> |
|---|
| 47 | </cffunction> |
|---|
| 48 | |
|---|
| 49 | <cffunction name="createGateway" access="public" hint="I return a gateway object." output="false" returntype="any" _returntype="reactor.base.abstractGateway"> |
|---|
| 50 | <cfargument name="objectAlias" hint="I am the alias of the record to return. I corrispond to the name of a object in the DB." required="yes" type="any" _type="string" /> |
|---|
| 51 | <cfset var Gateway = 0 /> |
|---|
| 52 | |
|---|
| 53 | <cfset Gateway = getObjectFactory().create(arguments.objectAlias, "Gateway") /> |
|---|
| 54 | |
|---|
| 55 | <cfreturn Gateway /> |
|---|
| 56 | </cffunction> |
|---|
| 57 | |
|---|
| 58 | <cffunction name="createMetadata" access="public" hint="I return a metadata object." output="false" returntype="any" _returntype="reactor.base.abstractMetadata"> |
|---|
| 59 | <cfargument name="objectAlias" hint="I am the alias of the metadata to return. I corrispond to the name of a object in the DB." required="yes" type="any" _type="string" /> |
|---|
| 60 | <cfset var Metadata = 0 /> |
|---|
| 61 | |
|---|
| 62 | <cfset Metadata = getObjectFactory().create(arguments.objectAlias, "Metadata") /> |
|---|
| 63 | |
|---|
| 64 | <cfreturn Metadata /> |
|---|
| 65 | </cffunction> |
|---|
| 66 | |
|---|
| 67 | <cffunction name="createIterator" access="public" hint="I return an iterator object." output="false" returntype="any" _returntype="reactor.iterator.iterator"> |
|---|
| 68 | <cfargument name="objectAlias" hint="I am the alias of the object the iterator is being created for. I corrispond to the name of a object in the DB." required="yes" type="any" _type="string" /> |
|---|
| 69 | <cfset var Iterator = 0 /> |
|---|
| 70 | |
|---|
| 71 | <cfset Iterator = createobject("Component", "reactor.iterator.iterator").init(this, arguments.objectAlias) /> |
|---|
| 72 | |
|---|
| 73 | <cfreturn Iterator /> |
|---|
| 74 | </cffunction> |
|---|
| 75 | |
|---|
| 76 | <cffunction name="createDictionary" access="public" hint="I return a dictionary object." output="false" returntype="any" _returntype="reactor.dictionary.dictionary"> |
|---|
| 77 | <cfargument name="objectAlias" hint="I am the alias of the object the dictionary is being created for. I corrispond to the name of a object in the DB." required="yes" type="any" _type="string" /> |
|---|
| 78 | <cfset var Dictionary = 0 /> |
|---|
| 79 | |
|---|
| 80 | <cfset Dictionary = getObjectFactory().createDictionary(arguments.objectAlias) /> |
|---|
| 81 | |
|---|
| 82 | <cfreturn Dictionary /> |
|---|
| 83 | </cffunction> |
|---|
| 84 | |
|---|
| 85 | <cffunction name="createValidator" access="public" hint="I return a validator object." output="false" returntype="any" _returntype="reactor.base.abstractValidator"> |
|---|
| 86 | <cfargument name="objectAlias" hint="I am the alias of the object the validator is being created for. I corrispond to the name of a object in the DB." required="yes" type="any" _type="string" /> |
|---|
| 87 | <cfset var Validator = 0 /> |
|---|
| 88 | |
|---|
| 89 | <cfset Validator = getObjectFactory().create(arguments.objectAlias, "Validator") /> |
|---|
| 90 | |
|---|
| 91 | <cfreturn Validator /> |
|---|
| 92 | </cffunction> |
|---|
| 93 | |
|---|
| 94 | <cffunction name="getXml" access="public" hint="I return the raw XML for a database object. I combine the configuration and the database metadata." output="false" returntype="any" _returntype="string"> |
|---|
| 95 | <cfargument name="objectAlias" hint="I am the alias of the object the xml describes. I corrispond to the name of a object in the DB." required="yes" type="any" _type="string" /> |
|---|
| 96 | <cfreturn getObjectFactory().getObject(arguments.objectAlias).getXml() /> |
|---|
| 97 | </cffunction> |
|---|
| 98 | |
|---|
| 99 | <cffunction name="createPlugin" access="public" hint="I return a plugin object of the specified type." output="false" returntype="any" _returntype="any"> |
|---|
| 100 | <cfargument name="objectAlias" hint="I am the alias of the metadata to return. I corrispond to the name of a object in the DB." required="yes" type="any" _type="string" /> |
|---|
| 101 | <cfargument name="plugin" hint="I am the name of the plugin to use." required="yes" type="any" _type="string" /> |
|---|
| 102 | <cfset var Object = 0 /> |
|---|
| 103 | |
|---|
| 104 | <cfset Object = getObjectFactory().create(arguments.objectAlias, arguments.plugin, true) /> |
|---|
| 105 | |
|---|
| 106 | <cfreturn Object /> |
|---|
| 107 | </cffunction> |
|---|
| 108 | |
|---|
| 109 | <cffunction name="compile" access="public" hint="I simply call all the create methods for all of the reactor object types so as to compile all objects according to the current configuration options" output="false" returntype="void"> |
|---|
| 110 | <cfset getObjectFactory().compile() /> |
|---|
| 111 | </cffunction> |
|---|
| 112 | |
|---|
| 113 | <!--- ObjectFactory ---> |
|---|
| 114 | <cffunction name="setObjectFactory" access="private" output="false" returntype="void"> |
|---|
| 115 | <cfargument name="ObjectFactory" hint="I am the table factory used to get table metadata" required="yes" type="any" _type="reactor.core.objectFactory" /> |
|---|
| 116 | <cfset variables.ObjectFactory = arguments.ObjectFactory /> |
|---|
| 117 | </cffunction> |
|---|
| 118 | <cffunction name="getObjectFactory" access="private" output="false" returntype="any" _returntype="reactor.core.objectFactory"> |
|---|
| 119 | <cfreturn variables.ObjectFactory /> |
|---|
| 120 | </cffunction> |
|---|
| 121 | |
|---|
| 122 | <!--- BeanFactory ---> |
|---|
| 123 | <cffunction name="setBeanFactory" access="public" output="false" returntype="void" hint="I set a BeanFactory (Spring-interfaced IoC container) to inject into all created objects)." > |
|---|
| 124 | <cfargument name="beanFactory" type="coldspring.beans.beanFactory" _type="coldspring.beans.beanFactory" required="true" /> |
|---|
| 125 | <cfset variables.BeanFactory = arguments.beanFactory /> |
|---|
| 126 | </cffunction> |
|---|
| 127 | <cffunction name="getBeanFactory" access="private" output="false" returntype="any" _returntype="any"> |
|---|
| 128 | <cfreturn variables.BeanFactory /> |
|---|
| 129 | </cffunction> |
|---|
| 130 | |
|---|
| 131 | </cfcomponent> |
|---|