150 likes | 354 Views
Container Based Persistence. Brian Berenbach Siemens Corporate Research brian.berenbach@scr.siemens.com. The Problem. Defining the architecture of “Groupware” systems where : multiple are clients supported by a single server,
E N D
Container Based Persistence Brian Berenbach Siemens Corporate Research brian.berenbach@scr.siemens.com
The Problem Defining the architecture of “Groupware” systems where: • multiple are clients supported by a single server, • there is a requirement to notify client objects whenever something they are viewing or manipulating has changed in the database, • less experienced developers need to extract, manipulate, and store objects with no knowledge of the underlying persistence mechanisms and • there is coherent persistence of complex aggregate objects.
Problem Domains • Real time Command and Control • Payroll and other HR systems • Document Management • Trading • Software Defect Tracking • Other “Groupware” applications with 50 or less simultaneous clients
A Robust Recommended Solution • Let the container manage persistence, • the container collaborates with an event management server, • all events are raised by the container and • all persistence complexities are hidden behind the container API.
Storage Management Persistent Store Store Let the Container Manage Persistence CON T AINER Client Object Transfer
Application Object Application Part Object Client Event Server Event Proxy Container Database Proxy Container-Event Management Collaboration may have notifies uses 1 1..N 1 1..N 1 0..N 1..N 0..N Retrieves & stores Objects from contains notifies 1 1 uses represents raise event 1 1 1 1..N 1 1 Database
anObjectForm theEventServer anObject retrieve( anObjectId ) create populate anObject show editing changes replace ( anObject ) save raise ( anObject Changed ) objectChangedEvent ( objectId ) retrieve( objectId ) repopulate anObject refresh Example of Change Event Notification theObjectContainer
Container Details Base Container add(objItem : Object) : Long checkForCompleteness(varItem : Variant) : Collection copy(objSourceObject : Object, objTargetObject : Object) : Integer delete(varItemToDelete : Variant) : Integer isEmpty() : Boolean exists(varItem : Variant) : Boolean export(strFileName : String) : Integer idToName(lngObjectId : Long) : String nameToId(strName : String) : Long rename(strOldname : String, strNewName : String) : Integer replace(objitem : Object) : Integer retrieve(varItem : Variant) : Object
Persistent Objects can be complex Document Section Name Name 1+ Status : Boolean Contains Status Importance Confidentiality Reference : Boolean Sourcereference : String Version Note that a document contains zero or more sections. How to store a document as a coherent entity? Validatefiles Validatename Status(Documentstatus) {Abstract}
Section Key Data may have Document SectionId [PK1] Key Data Section.DocumentId [PK2] [FK] DocumentId [PK1] The database Id helps manage persistence • The database Id is used to distinguish between new and existing objects: • Newly Created Object • Id is null • Object That Has Been Retrieved From storage • Valid Id • On a Save Operation: If the Id is null perform an INSERT operation Else perform an UPDATE operation End If
Application Developers don’t see this complexity • Documents have • Sections which have • Paragraphs which have…
Container.save() • For each document in Me.Documents • Begin Transaction • document.save • Commit • End Transaction • Next Inside the container Inside a document <Code to save my attributes…> For each section in Me.Sections section.save (Me.Id) Next Inside a section <Code to save my attributes…> For each paragraph in Me.Paragraphs paragraph.save (Me.Id) Next Sample Persistence Process Container boundary
Sample Application:Groupware Test Construction Toolkit Task Developer Assessment Assembler Subject Matter Expert Licensing & Entrance Exams … Test Toolkit Produces
OLE Link Test Toolkit Example