|
From: Jeremy F. <jfi...@ma...> - 2002-11-07 22:30:19
|
honda is an object instance created by Modus - a struct. I'm =
suggesting that when Modus creates an object instance, it stores a =
reference to the facade that manages the instances inside the created =
struct. This allows us - for an arbitrary Modus-managed object - to =
perform any operations on the object simply by retrieving the facade =
reference from inside it:
function put(object) {
object._modus.put(object);
}
I gotcha - one more level of abstraction. Rather than calling a separate =
facade, let the udf figure out which facade to call. I was thinking: =
honda.put() and vw.put(), while you're suggesting: put(honda), put(vw).=20
<cfif NOT isDefined('server.modus.facade')>
<!--- Define and retrieve an xml descriptor- -->
<cffile action=3D"READ" =
file=3D"modustest\descriptors\pressrealease.xml" variable=3D"xml">
<cfset pressreleasexml =3D xmlParse(xml)>
Well, I'd have this done through methods that register the type and do =
it explicitly at startup:
=
server.modus.facade.register("modustest/descriptors/pressrelease.xml");
I think I see it now - check my "dumb vs. smart fields" reply for a =
possible implementation. I had the xml parsing being done in a initModus =
file, but that could all be handled internally, as your example shows, =
by passing in the path. So:
<!--- Include and parse contentObject descriptors --->
<cffile action=3D"READ" =
file=3D"#application.hardroot#\descriptors\pressrelease.xml" =
variable=3D"pressrelease">
<cfset pressreleasexml =3D xmlParse(pressrelease)>
=20
<!--- Register contentObjects --->
<cfset server.modus.registry.register(pressreleasexml)>
This becomes:
<cfset =
server.modus.registry.register("modustest\descriptors\pressrealease.xml")=
>
One difference here is that I have a separate registry cfc which =
instantiates a facade for each contentObject, but as I said, let's wait =
till the core is working before worrying about such things.
-Jeremy |