Aspect -Oriented Database Systems Springer-Verlag Berlin Heidelberg GmbH Awais Rashid Aspect -Oriented Database Systems With 60 Figures and 17 Tables , Springer Awais Rashid Computing Department, Lancaster University Lancaster LA1 4YR United Kingdom [email protected] Library of Congress Cataloging-in-Publication Data Rashid, Awais. Aspect-oriented database systemslAwais Rashid p.cm. Includes bibliographical references and index. ISBN 978-3-642-05669-7 ISBN 978-3-662-05851-0 (eBook) DOI 10.1007/978-3-662-05851-0 1. Database management. 2. Object-oriented programming (Computer science) 3. Databases. I. Title. QA76.9.D3R322004 005.75'7--dc22 2004061029 ACM Subject Classification (1998): H.2.1, H2.4, D.2.13, D1.5, D.1.m ISBN 978-3-642-05669-7 This work is subject to copyright. All rights are reserved, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilm or in any other way, and storage in data banks. Duplication of this publication or parts thereof is permitted only under the provisions of the German Copyright Law of September 9, 1965, in its current version, and permission for use must always be obtained from Springer-Verlag Berlin Heidelberg GmbH. Violations are liable for prosecution under the German Copyright Law. springeronline.com © Springer-Verlag Berlin Heidelberg 2004 Originally published by Springer-Verlag Berlin Heidelberg New York in 2004 Softcover reprint of the hardcover 1s t edition 2004 The use of designations, trademarks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use. Cover Design: KiinkelLopka, Heidelberg 1)!pesetting: G&U, Flensburg Printed on acid-free paper 45/3142 PS 54 32 10 To my school teacher, Mr. Mehboob Malik Table of Contens Preface.. ............................................... XI P.l Outline of the Book. .. .. .. . .. .. .... . . .. . . . . . . . .. . . XII P.2 Who should Read this Book? .. . . ..... . . . .. . . . . . . .. .. XIII P.3 Relevant Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. XIV PA Acknowledgements. . . . .. .. .. .. . .... . . . . .. . . . . . .. .. XIV 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1 Database Systems .................................. 2 1.1.1 Schema Evolution in Object -Oriented Databases . . . . . . . . 3 1.1.1.1 Class Hierarchy Modification ........................ 3 1.1.1.2 Class Structure Modification . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.1.1.3 Backward and Forward Compatibility. . . . . . . . . . . . . . . . . 6 1.1.1.4 Need for Dynamic Changes. . . . . . . . . . . . . . . . . . . . . . . . .. 10 1.1.2 Versioning and Workgroup Support .................. 10 1.1.3 Transaction Processing ............................. 12 1.2 Aspect-Oriented Database Systems. . . . . . . . . . . . . . . . . . .. 13 1.2.1 Crosscutting Concerns in Database Systems. . . . . . . . . . .. 13 1.2.2 Fundamentals of Aspect-Oriented Database Systems. . . .. 14 1.2.3 Existing Aspect-Oriented Database Systems ............ 17 1.2.3.1 AODBs using AOP in their Implementation and Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 17 1.2.3.2 AODBs Supporting Aspect Persistence ................ 18 1.2.3.3 AODBs or Frameworks Supporting Separation of Persistence Code from Application Logic... . ... . . . . .. 18 1.2.304 Facets of the Database-AOP Relationship Addressed by Current AODBs .. .. .. ... .. .. .... . . ... . . ... . . . ... 19 1.3 Conclusion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 19 2. Aspect-Oriented Programming (AOP) ....................... 21 2.1 Separation of Concerns ............................. 21 2.2 Addressing Crosscutting Concerns with AOP . . . . . . . . . .. 23 2.2.1 Aspect Languages .................................. 26 VIII Table of Contents 2.2.2 Composition Filters ................................ 29 2.2.3 Adaptive Programming ............................. 31 2.2.4 Hyperspaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 33 2.2.5 Reflective Approaches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 34 2.2.6 Hybrid Approach .................................. 35 2.3 Aspect-Oriented Software Development ............... 36 2.4 Conclusion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 37 3. Crosscutting Concerns in Database Systems. . . . . . . . . . . . . . . . . .. 39 3.1 Crosscutting Concerns at DBMS Level ................. 40 3.1.1 Instance Adaptation Approach ....................... 42 3.1.2 Schema Evolution Model . . . . . . . . . . . . . . . . . . . . . . . . . . .. 43 3.1.3 Transaction Model ................................ . 45 3.1.4 Other Crosscutting Concerns at DBMS Level ........... 46 3.2 Crosscutting Concerns at Database Level . . . . . . . . . . . . . .. 46 3.2.1 Links Among Persistent Entities ...................... 47 3.2.2 Versioning Information ............................. 48 3.2.3 Instance Adaptation Routines ........................ 49 3.2.4 Other Crosscutting Concerns at Database Level ......... 51 3.3 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 51 4. Applying AOP in Database Systems. . . . . . . . . . . . . . . . . . . . . . . . .. 53 4.1 A Model for AOP in Database Systems ................. 53 4.2 AOP at DBMS Level ................................ 56 4.2.1 Instance Adaptation Approach ....................... 56 4.2.1.1 Customisable Instance Adaptation in SADES ........... 56 4.2.1.2 Customisable Instance Adaptation in AspOEv .......... 60 4.2.2 Schema Evolution Model . . . . . . . . . . . . . . . . . . . . . . . . . . .. 63 4.2.3 Transaction Model ................................. 64 4.3 AOP at Database Level .............................. 67 4.3.1 Links among Persistent Entities. . . . . . . . . . . . . . . . . . . . . .. 67 4.3.1.3 Overview of SADES Architecture ..................... 67 4.3.1.2 Separation of Links using Composition Filters .......... 70 4.3.1.3 Change Propagation and Referential Integrity. . . . . . . . . .. 76 4.3.2 Versioning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 78 4.3.3 Instance Adaptation Routines ........................ 81 4.3.3.4 Instance Adaptation Routines in SADES ............... 81 4.3.3.2 Instance Adaptation Routines in AspOEv .............. 86 Table of Contents IX 4.4 Change Propagation: DBMS Level to Database Level. . . .. 87 4.5 Cost-effectiveness. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 88 4.6 Conclusion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 88 5. Persistent Aspects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 91 5.1 Need for Aspect Persistence. . . . . . . . . . . . . . . . . . . . . . . . .. 91 5.2 Persistent Aspect Stores ............................. 93 5.2.1 An Aspect Store Based on an Object-Oriented Database.. 94 5.2.1.1 PersAJ: An Aspect Store Based on AspectJ and Jasmine... 97 5.2.2 An Aspect Store Based on a Relational Database. . . . . . . .. 99 5.2.2.2 An Aspect Store for AspectJ using SQL-92 Databases. . .. 100 5.3 Aspect Composition in a Persistent Environment ...... 111 5.3.3 Exploiting Composition Mechanisms of Existing AOP Techniques.................................. 111 5.3.2 Building Composition Mechanisms into the DBMS. . . .. 112 5.3.2.1 Persistent Aspect Structures ........................ 113 5.3.2.2 Weave-on-demand and Weave Histories ............. , 114 5.3.2.3 Weaver for the SADES Object Database Evolution System ................................. 116 5.4 Applications of Aspect Persistence ................... 117 5.5 Conclusion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 117 6. Persistence as an Aspect .................................. 119 6.1 A Bibliography Application. .. . .. .... . . ... . . ... . .... 120 6.2 Aspectising Persistence. . . . . . . . . . . . . . . . . . . . . . . . . . . .. 121 6.2.1 Database Access .................................. 122 6.2.1.1 Connection...................................... 124 6.2.1.2 Storage and Update ............................... 126 6.2.1.3 Retrieval......................................... 127 6.2.1.4 Deletion......................................... 129 6.2.1.5 Transactions ..................................... 130 6.2.1.6 Meta-data Access ................................. 132 6.2.2 SQL Translation .................................. 132 6.2.3 The Emerging Persistence Framework . . . . . . . . . . . . . . .. 136 6.3 Analysis of the Persistence Aspectisation . . . . . . . . . . . . .. 137 6.3.1 Using Other Persistence Mechanisms ................ 137 6.3.2 Reflection and Other AOP Techniques ............... 137 6.3.3 Aspect Interaction ................................ 139 X Table of Contents 6.4 Other Approaches Aspectising Persistence and Related Concerns ........................................ 140 6.5 Conclusion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 142 7. Conclusion and Outlook. . . .. . . . . ... . . . . . . . . . . . . . . . . . . . . .. 145 Abbreviations. .. .. .. .. .. .. . . . . . . . .. . .. .. . . . . . . . . . . . . .. .. 147 References ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 149 Index .................................................. 173 Preface Database systems are central to the operation of most organisations and systems today. Over the years promising new developments in software engineering e.g., object-oriented (00) techniques, have had an impact on the way we develop, maintain and use database systems. This impact has ranged from development of new data management mechanisms (in order to service new programming paradigms e.g., 00) to maintenance tech niques through to APIs, libraries and frameworks for interacting with the database from application programs. A similar promising development is the emerging set of Aspect-Oriented Software Development (AOSD) techniques. These techniques offer system atic means to manage crosscutting concerns such as distribution, security and persistence that cannot be easily modularised using conventional tech niques such as object-orientation. Such crosscutting concerns also exist in the context of database systems or applications served by them. It is, there fore, natural to explore the relationship between database systems and aspect-oriented techniques in order to determine how database systems and their applications can benefit from the advanced separation of con cerns afforded by aspect -orientation. At the same time, it is important to explore how database systems can support aspect-oriented development in the same fashion as databases have previously evolved to support object oriented development. The term Aspect-Oriented Database Systems (AODBs), therefore, implies the use of aspect-oriented techniques and database systems in conjunction with each other. Specifically, in the context of the discussion in this book, it refers to: • database systems employing aspect-orientation within their implemen tation and operation in order to modularise broadly scoped properties, such as evolution and versioning, with a view to improving customis ability, extensibility, evolvability and maintainability;
Description: