container based persistence 1 container based persistence brian berenbach siemens corporate research...
TRANSCRIPT
Container Based Persistence 1
Container Based PersistenceContainer Based Persistence
Brian BerenbachBrian BerenbachSiemens Corporate ResearchSiemens Corporate Research
[email protected]@scr.siemens.com
Container Based Persistence 2
The ProblemThe ProblemDefining the architecture of “Groupware” Defining the architecture of “Groupware”
systems wheresystems where::
multiple are clients supported by a single server, multiple are clients supported by a single server, there is a requirement to notify client objects there is a requirement to notify client objects
whenever something they are viewing or whenever something they are viewing or manipulating has changed in the database,manipulating has changed in the database,
less experienced developers need to extract, less experienced developers need to extract, manipulate, and store objects with no knowledge manipulate, and store objects with no knowledge of the underlying persistence mechanisms andof the underlying persistence mechanisms and
there is coherent persistence of complex there is coherent persistence of complex aggregate objects.aggregate objects.
Container Based Persistence 3
Problem DomainsProblem Domains
Real time Command and ControlReal time Command and Control Payroll and other HR systemsPayroll and other HR systems Document ManagementDocument Management TradingTrading Software Defect TrackingSoftware Defect Tracking Other “Groupware” applications with 50 or Other “Groupware” applications with 50 or
less simultaneous clientsless simultaneous clients
Container Based Persistence 4
A Robust Recommended SolutionA Robust Recommended Solution
Let the container manage persistence,Let the container manage persistence,
the container collaborates with an event the container collaborates with an event
management server,management server,
all events are raised by the container andall events are raised by the container and
all persistence complexities are hidden all persistence complexities are hidden
behind the container API.behind the container API.
Container Based Persistence 5
Let the Container Manage Persistence
CCOONNTTAAIINNEERR
ClientClient ObjectObjectTransferTransfer
StorePersistentPersistent
StoreStore
StorageStorageManagementManagement
Container Based Persistence 6
Container-Event Management CollaborationContainer-Event Management Collaboration
Container
ApplicationPart Object
ApplicationObjectClient
DatabaseProxy
Event Proxy
Event Server
Database
raiseevent
notifies
uses
notifies
usesmayhave
11 1 1..N 11
represents
1
1..N 1 1..N 1 0..N
Retrieves& stores
Objects from
1
1..N
contains
0..N
1
Container Based Persistence 7
theEventServertheObjectContaineranObjectForm
anObject
raise ( anObject Changed )
replace ( anObject )
editing changes
anObject
retrieve( anObjectId )
create
populate
show
refresh
retrieve( objectId )
repopulate
anObject
save
objectChangedEvent ( objectId )
Example of Change Event NotificationExample of Change Event Notification
Container Based Persistence 8
Container DetailsContainer Details
Base Container
add(objItem : Object) : LongcheckForCompleteness(varItem : Variant) : Collectioncopy(objSourceObject : Object, objTargetObject : Object) : Integerdelete(varItemToDelete : Variant) : IntegerisEmpty() : Booleanexists(varItem : Variant) : Booleanexport(strFileName : String) : IntegeridToName(lngObjectId : Long) : StringnameToId(strName : String) : Longrename(strOldname : String, strNewName : String) : Integerreplace(objitem : Object) : Integerretrieve(varItem : Variant) : Object
Container Based Persistence 9
Persistent Objects can be complexPersistent Objects can be complex
DocumentDocument
NameName
Status : BooleanStatus : Boolean
ImportanceImportance
ConfidentialityConfidentiality
Reference : BooleanReference : Boolean
Sourcereference : StringSourcereference : String
VersionVersion
ValidatefilesValidatefiles
ValidatenameValidatename
Status(Documentstatus)Status(Documentstatus)
{Abstract{Abstract}}
SectionSection
NameName
StatusStatus1+
Contains
Note that a document contains zero or more sections. How to store a document as a coherententity?
Container Based Persistence 10
The database Id helps manage persistenceThe database Id helps manage persistence
The database Id is used to distinguish between new and existing objects:
Newly Created ObjectId is null
Object That Has Been Retrieved From storageValid Id
On a Save Operation:If the Id is null
perform an INSERT operation
Else
perform an UPDATE operation
End If
Section Key Data
SectionId [PK1]Section.DocumentId [PK2] [FK]
Document Key Data DocumentId [PK1]
may have
Container Based Persistence 11
Application Developers don’t see this complexityApplication Developers don’t see this complexity
Documents
save()
Document
documentId
save()0..n1
contains
Sections
save(documentId)
1
1has
Section
sectionId
save(documentId)0..n1
contains
Paragraphs
save(sectionId)
1
1has
Paragraph
paragraphId
save(sectionId)0..n1
contains
1
1
0..n1
0..n1
1
1
0..n1
Documents haveSections which have
Paragraphs which have…
Container Based Persistence 12
Sample Persistence ProcessSample Persistence ProcessContainer.save()
<Code to save my attributes…>For each section in Me.Sections
section.save (Me.Id)Next
Inside a document
For each document in Me.DocumentsBegin Transaction
document.saveCommit
End TransactionNext
Inside the container
<Code to save my attributes…>For each paragraph in Me.Paragraphs
paragraph.save (Me.Id)Next
Inside a section
Container boundary
Container Based Persistence 13
Sample Application:Groupware Test Construction ToolkitSample Application:Groupware Test Construction Toolkit
TaskTaskDeveloperDeveloper
AssessmentAssessmentAssemblerAssembler
Subject MatterSubject MatterExpertExpert
TestToolkitTest
Toolkit
Licensing & Licensing & EntranceEntranceExamsExams
……Produces
Container Based Persistence 14
Test Toolkit ExampleTest Toolkit Example
OLE LinkOLE LinkOLE LinkOLE Link
Container Based Persistence 15
Questions?