Institutionen För Datavetenskap Department of Computer and Information Science
Total Page:16
File Type:pdf, Size:1020Kb
Institutionen för datavetenskap Department of Computer and Information Science Master’s Thesis Implementation and evaluation of data persistence tools for temporal versioned data models Tor Knutsson Reg Nr: LIU-IDA/LITH-EX-A–09/032–SE Linköping 2009 Department of Computer and Information Science Linköpings universitet SE-581 83 Linköping, Sweden Institutionen för datavetenskap Department of Computer and Information Science Master’s Thesis Implementation and evaluation of data persistence tools for temporal versioned data models Tor Knutsson Reg Nr: LIU-IDA/LITH-EX-A–09/032–SE Linköping 2009 Supervisor: Pascal Muller Wealth CCC S.A Examiner: Lena Strömbäck ida, Linköping University Department of Computer and Information Science Linköpings universitet SE-581 83 Linköping, Sweden Avdelning, Institution Datum Division, Department Date Division for Databases and Information Techniques Department of Computer and Information Science 2009-26-005 Linköpings universitet SE-581 83 Linköping, Sweden Språk Rapporttyp ISBN Language Report category — Svenska/Swedish Licentiatavhandling ISRN Engelska/English Examensarbete LIU-IDA/LITH-EX-A–09/032–SE C-uppsats Serietitel och serienummer ISSN D-uppsats Title of series, numbering — Övrig rapport URL för elektronisk version http://urn.kb.se/resolve?urn=urn:nbn:se:liu:diva-19979 Titel Implementation och utvärdering av persistensverktyg för temporala version- Title shanterade datamodeller Implementation and evaluation of data persistence tools for temporal versioned data models Författare Tor Knutsson Author Sammanfattning Abstract The purpose of this thesis was to investigate different concepts and tools which could support the development of a middleware which persists a temporal and ver- sioned relational data model in an enterprise environment. Further requirements for the target application was that changes to the data model had to be facili- tated, so that a small change to the model would not result in changes in several files and application layers. Other requirements include permissioning and audit tracing. In the thesis the reader is presented with a comparison of a set of tools for enterprise development and object/relational mapping. One of the tools, a code generator, is chosen as a good candidate to match the requirements of the project. An implementation is presented, where the chosen tool is used. An XML- based language which is used to define a data model and to provide input data for the tool is presented. Other concepts concerning the implementation is then described in detail. Finally, the author discusses alternative solutions and future improvements. Nyckelord Keywords object/relational mapping, database structure, code generation, n-tier develop- ment, enterprise applications, software engineering, model driven architecture Abstract The purpose of this thesis was to investigate different concepts and tools which could support the development of a middleware which persists a temporal and versioned relational data model in an enterprise environment. Further require- ments for the target application was that changes to the data model had to be facilitated, so that a small change to the model would not result in changes in several files and application layers. Other requirements include permissioning and audit tracing. In the thesis the reader is presented with a comparison of a set of tools for enterprise development and object/relational mapping. One of the tools, a code generator, is chosen as a good candidate to match the requirements of the project. An implementation is presented, where the chosen tool is used. An XML-based language which is used to define a data model and to provide input data for the tool is presented. Other concepts concerning the implementation is then described in detail. Finally, the author discusses alternative solutions and future improvements. Sammanfattning Syftet med detta exjobb var att undersöka olika koncept och verktyg som kunde underlätta utvecklandet av ett mellanlager för permanent lagring av en temporell och versionshanterad relationell datamodell i enterprise-miljö. Kraven på applika- tionsstödet var bland annat att underlätta förändringar av datamodellen så att en liten förändring av själva modellen inte skulle behöva resultera i småändringar över flera filer och applikationslager. Andra krav på produkten var implementation av en säkerhetsmodell och revisionsverktyg. I exjobbet kan läsaren se en jämförelse av olika verktyg för persistens, object/relational mapping, och enterpriseutveckling. Ett av verktygen, en kodgenerator, väljs som en god kandidat för projektets krav. En implementation presenteras, där verktyget används. Ett XML-baserat språk för att definiera en datamodell och driva kodgeneratorn presenteras. Andra de- lar av implementationen redovisas också i detalj. Slutligen diskuterar författaren alternativa och framtida lösningar. v Acknowledgments Many thanks to Dominique Portal for giving me the opportunity to come to Switzerland and carry out this thesis project. I would also like to thank Pascal Muller for taking the time and showing a great interest in the project and for the many discussions about everything relating to it. Special thanks also goes to to my colleagues Guillaume and Laurent for helping me out with tricky technicalities, and to my friend Marcus Frödin for his support and motivation. Thank you to my examiner Lena Strömbäck for showing patience and providing a lot of feedback when writing this report. Finally, a big thank you to my parents for pushing me and a huge eulogy to Albane for showing patience and motivating me during late nights and weekends. Genève, May 2009 Tor Knutsson vii Contents 1 Introduction 1 1.1 Prerequisites . .1 1.2 Problem statement . .1 1.3 Overview . .2 1.4 Method . .3 1.5 Glossary . .3 2 Literature Study 5 2.1 Overview . .5 2.2 Problem description . .6 2.2.1 Scope . .6 2.3 Software patterns . .7 2.4 Object/Relational Mapping . .8 2.5 Database efforts . 10 2.5.1 Object-relational databases . 10 2.5.2 Object-oriented databases . 11 2.5.3 Reflections . 12 2.6 Temporality . 12 2.6.1 Thoughts on revision control . 14 3 Requirements 15 3.1 Functional requirements . 16 3.1.1 Object/Relational Mapping to Temporal and Versioned en- tities . 16 3.1.2 Permissioning . 16 3.1.3 Audit Tracing . 17 3.1.4 Adjacent database identifiers . 17 3.1.5 Variable Cache . 17 3.1.6 Compile-time error prevention . 18 3.1.7 Environment . 18 3.2 Non-Functional Requirements . 18 ix x Contents 4 The Temporal and Versioned Properties 19 4.1 Temporal entity . 19 4.2 Versioned entity . 20 4.3 Temporal Versioned entity . 20 4.4 Comparing the definitions with literature . 22 5 Available Tools 23 5.1 Model Driven Architecture . 23 5.2 Availability . 25 5.3 Coverage, compliance, artifacts . 26 5.4 Discussion . 26 5.5 Conclusion . 29 5.6 Criticism . 29 6 Architecture Proposals 31 6.1 Layers and Tiers . 31 6.2 Direct Stakeholders . 31 6.3 Database Representation . 32 6.3.1 Linked lists approach . 32 6.3.2 Property separation . 33 6.3.3 Summary . 34 7 Implementation 35 7.1 Creation process . 35 7.1.1 The modeling language . 36 7.2 Overview . 37 7.3 Code generation . 38 7.4 The mockup model . 39 7.4.1 Database Tier . 39 7.4.2 Database Access Layer . 45 7.4.3 Communications and Helper layer . 45 7.4.4 Persistence Layer . 46 7.4.5 Domain Layer . 47 8 Performance Test 51 8.1 Environment . 52 8.2 Test data . 52 8.3 Test results . 53 8.4 Criticism . 54 9 Discussion 55 9.1 Alternative solutions . 55 9.2 Future Work . 56 9.2.1 Dynamic Queries . 56 9.2.2 Extended Properties . 56 9.2.3 Scalability and distribution . 56 Contents xi Bibliography 59 A The Mockup Model 63 B The Model Languange 66 Chapter 1 Introduction WealthCCC implements and maintains a large financial consolidation system called Atrium. Atrium is a strongly data-driven multi-tiered application which uses re- lationally stored data from multiple sources, to generate reports, analysis and projections. This thesis investigates and reflects over persistence tools and their different properties, to find out if or how each tool can be of use when creat- ing a middleware solution that can be used by WealthCCC and other enterprise application developers with similar requirements. 1.1 Prerequisites The reader of this rapport should have a good knowledge of object-oriented pro- gramming, database programming, and the concept of relational databases and the relational model. Furthermore, basic knowledge of XML, XML-related technolo- gies and the programming language Visual Basic.NET may facilitate the reading experience. 1.2 Problem statement The purpose of this thesis is to investigate object/relational mapping concepts, tools, and patterns in order to create the foundation of a generic middleware layer for a relational database that handles persistent data connections. Enterprise ap- plications tend to grow large due to their complexity. To enhance readability and maintainability, the application can be divided into layers. Each layer handles spe- cific tasks. By dividing the tasks this way, the layers become more interchangeable [39]. Secondly, enterprise applications can be divided into tiers. The thought ap- plication is divided in at least three tiers. The data model in the scope of this thesis has specific characteristics, such as high data contention, versioned storage and values which vary over time. The need for an automatized tool that handles data persistence arises from maintainability, something which is increasingly com- plex with each factor mentioned above. A small change to the data model may 1 2 Introduction result in a large number of changes throughout several layers of an application [16]. The problem statement is as follows: “What are the requirements for a generic middleware layer providing support for temporal and versioned relational data, and how can it be implemented in a way that facilitates change?” 1.3 Overview Chapter 1: Introduction In this chapter, the reader is presented with a quick description of the project as well as the problem statement.