Changeset 397 for trunk/reactor/core/objectFactory.cfc
- Timestamp:
- 12/1/2006 2:01:11 PM (2 years ago)
- Files:
-
- 1 modified
-
trunk/reactor/core/objectFactory.cfc (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/reactor/core/objectFactory.cfc
r395 r397 4 4 <cfset variables.ReactorFactory = "" /> 5 5 <cfset variables.BeanFactory = "" /> 6 <cfset variables.ObjectDao = "" /> 6 7 <!---<cfset variables.TimedCache = CreateObject("Component", "reactor.util.TimedCache").init(createTimeSpan(0, 0, 0, 10)) />---> 7 8 <cfset variables.Cache = StructNew() /> … … 34 35 <!--- set the avaliable plugins ---> 35 36 <cfset setPluginList(pluginList) /> 37 38 <!--- create the objectDao we'll use to read object data ---> 39 <cfset variables.ObjectDao = CreateObject("Component", "reactor.data.#getConfig().getType()#.ObjectDao").init(getConfig().getDsn(), getConfig().getUsername(), getConfig().getPassword()) /> 36 40 37 41 <cfreturn this /> … … 81 85 <cfset DbObject = getObject(arguments.alias) /> 82 86 <cfset generate = true /> 83 84 <cfelseif compareNocase(getConfig().getMode(), "development") is 0> 87 88 <cfelseif compareNocase(getConfig().getMode(), "development") is 0> 85 89 <!--- we always need the db object to compare to our existing object ---> 86 90 <cfset DbObject = getObject(arguments.alias) /> 91 87 92 <cftry> 88 93 <!--- create an instance of the object and check its signature ---> … … 98 103 </cfif> 99 104 </cfif> 100 105 101 106 <cfelseif compareNocase(getConfig().getMode(), "production") is 0> 102 107 <cftry> … … 125 130 126 131 </cfif> 127 132 128 133 <cfcatch type="Reactor.NoSuchObject"> 129 134 <cfthrow type="Reactor.NoSuchObject" message="Object '#arguments.alias#' does not exist." detail="Reactor was unable to find an object in the database with the name '#arguments.alias#.'" /> … … 143 148 <cfset metadata = create(arguments.alias, "Metadata") /> 144 149 </cfif> 145 150 146 151 <cfset GeneratedObject = CreateObject("Component", getObjectDetails(arguments.type, arguments.alias, arguments.plugin).dbms)._configure(getConfig(), arguments.alias, getReactorFactory(), getConvention(), metadata) /> 147 152 <cfelse> … … 154 159 <cfif StructKeyExists(variables.Cache.metadata, arguments.alias)> 155 160 <cfset metadata = variables.Cache.metadata[arguments.alias] /> 156 <cfelse> 161 <cfelse> 157 162 <cfset metadata = create(arguments.alias, "Metadata") /> 158 163 </cfif> … … 167 172 <cfset GeneratedObject._setBeanFactory(variables.BeanFactory) /> 168 173 </cfif> 174 175 <cfset ObjectTranslator = 0 /> 176 <cfset DbObject = 0 /> 169 177 170 178 <cfreturn GeneratedObject /> … … 224 232 <cfargument name="name" hint="I am the name of the object to translate." required="yes" type="any" _type="string" /> 225 233 <cfset var Object = 0 /> 226 <cfset var ObjectDao = 0/>227 234 228 235 <cfset Object = CreateObject("Component", "reactor.core.object").init(arguments.name, getConfig()) /> 229 <cfset ObjectDao = CreateObject("Component", "reactor.data.#getConfig().getType()#.ObjectDao").init(getConfig().getDsn(), getConfig().getUsername(), getConfig().getPassword()) />230 236 231 237 <!--- read the object ---> 232 <cfset ObjectDao.read(Object) />238 <cfset variables.ObjectDao.read(Object) /> 233 239 234 240 <!--- return the object ---> … … 241 247 <cfargument name="plugin" hint="I indicate if this is creating a plugin" required="yes" type="any" _type="boolean" /> 242 248 <cfset var result = StructNew() /> 243 <cfset var pluginPath = "" /> 244 <cfif arguments.plugin> 245 <cfset pluginPath = ".plugins" /> 246 </cfif> 249 247 250 <!--- get the dbms-specific custom file first ---> 248 <cfset result.dbms = getMapping(arguments.name) & pluginPath& "." & arguments.type & "." & arguments.name & arguments.type & getConfig().getType() />249 <cfset result.custom = getMapping(arguments.name) & pluginPath& "." & arguments.type & "." & arguments.name & arguments.type />250 <cfset result.project = "reactor.project." & getConfig().getProject() & pluginPath &"." & arguments.type & "." & arguments.name & arguments.type />251 <cfset result.dbms = getMapping(arguments.name) & Iif(arguments.plugin, De(".plugins"), De("")) & "." & arguments.type & "." & arguments.name & arguments.type & getConfig().getType() /> 252 <cfset result.custom = getMapping(arguments.name) & Iif(arguments.plugin, De(".plugins"), De("")) & "." & arguments.type & "." & arguments.name & arguments.type /> 253 <cfset result.project = "reactor.project." & getConfig().getProject() & "." & arguments.type & "." & arguments.name & arguments.type /> 251 254 252 255 <!--- insure all three paths exists --->

