Here is what we did:
object.CFC - root object everything else inherits from :
id()
returns UUID of object. Normally set in constructor
getData()
makes a deep copy of variables.data and returns the struct. We
override this for more complex objects
setData(struct Data)
recreates an object from the structure produced by getData()
Basic_persistor.cfc - our generic persisting component
init(string DS)
sets the Data source
save(object)
Calls getData() on the object and WDDXs the result. Saves in
CFC_Data table in the data source, keyed off of the UUID
load(string ID)
Loads WDDX from DB based on ID. Creates an object of the
appropriate type (classname is stored in WDDX), and the calls it's
setData() function with the structure form the WDDX packet
This system completely abstracts the serialization and persisting
process from the object itself, making it easy change how you save your
objects.
There is some trickery in dealing with objects in variables.data. We
embed a special key "OBJECT_DATA" to let the loader know that an object
needs to be instantiated. Currently we don't have the ability to ensure
only one object per UUID is created but we are considering setting up a
global object store so we can keep from instantiating objects that are
already loaded.
Thanks,
Mark
-------------
Mark Porter
UNMH Systems Analyst
[EMAIL PROTECTED]
272-5928
>>> [EMAIL PROTECTED] 11/10/03 14:10:54 >>>
I wrote a serialize, deserialize function based on a recommendation by
Barney, mine depends on method naming conventions which sux, but you
can
look at it you like and get an idea for how mine works? Let me know.
Justin
[EMAIL PROTECTED]
-----Original Message-----
From: Jeff Battershall [mailto:[EMAIL PROTECTED]
Sent: Monday, November 10, 2003 2:07 PM
To: [EMAIL PROTECTED]
Subject: [CFCDev] Serialization/De-Serialization of CFCs
In some brief experimentation, I found I could serialize a CFC using
WDDX,
but de-serialization did not work.
Has anyone played around with this? Are there other techniques for
achieving persistence of CFCs across a cluster?
Jeff Battershall
(610) 544-4795 p
[EMAIL PROTECTED]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at
www.mail-archive.com/[EMAIL PROTECTED]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at
www.mail-archive.com/[EMAIL PROTECTED]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]