[Embedlets-dev] Persistence Check in
Status: Alpha
Brought to you by:
tkosan
|
From: Christopher S. <cs...@oo...> - 2003-05-01 23:42:22
|
After taking some time to feed the family I put some work into the persistence model. I have a working PersistentContainer (OutpostContainer subclass) that gets loaded from an XML file, creates the services defined in the XML file and then starts up. I will be following up with some mode documentation and sample components, but wanted to get it archived at a plateau and visible for feedback so I checked it in under the 'Persistence tag'. Please check it out and give me some feedback good or bad. This required a number of new interfaces and classes as you might of expected. I made every effort leave the existing classes intact and only had to change a couple of exposure levels to public in order to subclass the various objects and add a few 'setter' methods. Andrzej please forgive the minor trespasses. The core concept is the persistence.Persistent and persistence.Properties interfaces that allow classes to be saved and restored from a variety of persistent or transient stores. In this case the store is an XML file which is controlled by the XMLProperties class and XMLPersistenceManager. In a remotely controlled model the 'store' is a TCP/IP stream. I am converting an example of this from the OPC components code. Another important class is the PersistentCollection that provides aggregation for other Persistent objects, thus supporting the object tree. References between classes are defined by the href="Identity" attribute The first cut applies a persistence interface to the Context objects that Andrzej created. This is done by sub classing the particular Context class as org.outpost.persistence.PersistentXxxxxContext and implementing the org.embedlet.persistence.Persistent interface to support loading the contexts. I used a small class (org.outpost.persistence.xml.Launcher) to start things off and create the Container and its services from the persistence source at run time. This will allow us to use several launch modes and persistence media with the same container rather than requiring a different container for each. To try things out: 1. Update using the tag Persistent 2. Copy the org/outpost/persistence/xml/kxml-min.jar to the outpost/lib folder. This the parser that I used. 2. Recompile embedlets and outpost using the make.compile 4. Run: java -cp yourClasspath -DConfigFile=YourSrcFolder\org\outpost\persistence\config.xml org.embedlet.persistence.xml.Launcher 5. It should load and run the container and its services. I have created three sample components: a timer, a toggle and a counter. These will be started with the container on the next go around. Chris Christopher Smith OopScope, LLC. www.oopscope.com cs...@oo... 805-276-0598 |