aspect -oriented database systems - home - springer978-3-662-058… ·  · 2017-08-25aspect...

14
Aspect -Oriented Database Systems

Upload: duongminh

Post on 19-May-2018

220 views

Category:

Documents


2 download

TRANSCRIPT

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 1 st 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 3.1.4 3.2 3.2.1 3.2.2 3.2.3 3.2.4 3.3

Transaction Model ................................ . 45 Other Crosscutting Concerns at DBMS Level ........... 46 Crosscutting Concerns at Database Level . . . . . . . . . . . . . .. 46 Links Among Persistent Entities ...................... 47 Versioning Information ............................. 48 Instance Adaptation Routines ........................ 49 Other Crosscutting Concerns at Database Level ......... 51 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;

XII Preface

• database systems supporting aspect-oriented development techniques by providing means for storage, retrieval and manipulation of aspects;

• use of aspect-oriented techniques to separate database access and inter­action from application code.

The following sections provide an overview of the book, indicate its tar­get audience, outline some relevant resources and acknowledge the various people and organisations that have influenced or contributed to my work over the years.

P.1 Outline of the Book

Chapter 1 provides a basic introduction to database systems focussing on the concepts most relevant to the discussion in the following chapters. It also elaborates on the notion of Aspect-Oriented Database Systems and intro­duces several systems, which form the basis of the discussion in the book.

Chapter 2 provides an introduction to aspect -oriented programming (AOP) for readers not familiar with the concepts. A number of AOP tech­niques are discussed and approaches supporting separation of crosscutting concerns at earlier software development stages are also summarised. Besides offering an introduction to AOP, the chapter also provides readers the opportunity to contrast the programming models offered by various AOP techniques.

Chapter 3 discusses the problem of crosscutting concerns in database systems and how their lack of modularisation inhibits customisability, extensibility, evolvability and maintainability. Several concrete examples of concerns cutting across elements in the database management system and the database are discussed. The chapter motivates the need to aspectise crosscutting concerns in database systems.

Chapter 4 provides a general model for AOP in database systems before moving on to discussing how the concrete examples of crosscutting con­cerns, discussed in chapter 3, can be effectively modularised using aspects. The discussion draws upon three concrete database systems, SADES, GOODS and AspOEv, which employ AOP in their implementation and operation to improve modularity and localise the impact of changes. This, in turn, provides improved support for customisability, extensibility, evolvability and maintainability. A quantitative evaluation of the localisa­tion of change impact upon evolution in SADES is also provided.

P.2 Who should Read this Book? XIII

Chapter 5 highlights various aspects that might need to outlive program execution and hence require persistent storage. Models for persistent aspect stores based on object-oriented and relational database systems are dis­cussed. Concrete implementations of the models based on the Jasmine object-oriented database system and SQL-92 compliant relational data­bases are also detailed. The chapter also discusses models for composing aspects in a persistent environment and the potential of mechanisms such as weave-on-demand, weaving histories and selective weaving to improve the composition efficiency in this context.

Chapter 6 provides the reader with a large-scale example of the use of AOP in relation to database systems. It uses a classical database application, a bibliography system, as a basis to discuss how AspectJ (an aspect language for Java) can be used to modularise code relating to accessing and interact­ing with SQL-92 compliant relational databases. The interesting features of the chapter include: a real-world example of the use of AOP, provision of rationale behind the design of the various aspects and classes employed, and a discussion of how the resulting design may be employed when modularising persistence code relating to object-oriented and object-rela­tional database systems.

Chapter 7 concludes the book by summarising the concepts discussed and providing an outlook on the potential impact of AOP and database sys­tems on each other.

P.2 Who should Read this Book?

This book is aimed at professionals who are experienced in database systems, AOP or both. For database professionals, it offers insight into how AOP can serve as a means to build more modular database systems that are customis­able, extensible and maintainable in the face of changing requirements. For AOP professionals, it provides concrete examples of the use of AOP in an application domain fundamental to most businesses. It also describes how database systems can support AOP by providing support for aspect mining and reuse. Professionals experienced in both AOP and database systems can gain an understanding of how the two technologies can benefit each other. The book may also be useful to students studying advanced courses on data­base systems, software engineering or software modularity.

XIV Preface

P.3 Relevant Resources

Chapter 1 provides a brief introduction to database systems and the con­cepts most relevant to the discussion in Chaps. 3-6. Readers less familiar with database systems in general, and object-oriented databases in particu­lar, may find the following books useful:

• R. Elmasri and S. B. Navathe, Fundamentals of Database Systems (3rd ed.): Addison-Wesley, 2000.

• M. Stonebraker, P. Brown, and D. Moore, Object-Relational DBMSs: Tracking the Next Great Wave (2nd ed.): Morgan Kaufmann, 1999.

• A. B. Chaudhri and R. Zicari (eds.), Succeeding with Object Databases: John Wiley, 2001.

Chapter 2 provides an introduction to AOP for readers who are not familiar with the concepts. Additional resources for AOP are:

• Aspect-Oriented Software Development Web Site: http://aosd.net. • T. Elrad, R. Filman, and A. Bader (eds.), "Theme Section on Aspect­

Oriented Programming", Communications of ACM, Vol. 44, No. 10, 2001.

• A. Rashid (ed.), "Aspect-Oriented and Component-based Software Engi­neering", lEE Proceedings - Software (SpecialJssue), Vol. 148, No.3, 2001.

• G. Kiczales (ed.), "Proceedings of 1st International Conference on Aspect-Oriented Software Development", ACM, 2002.

• M. Aksit (ed.), "Proceedings of 2nd International Conference on Aspect­Oriented Software Development", ACM, 2003.

• A. Rashid and L. Blair (eds.), "Aspect-Oriented Programming and Sepa­ration of Crosscutting Concerns", The Computer Journal (Special Sec­tion), Vol. 46, No.5, 2003.

• R. Laddad, "AspectJ in Action - Practical Aspect-Oriented Program­ming", Manning, 2003.

P.4 Acknowledgements

The work on the SADES object database evolution system (discussed in Chaps. 4 and 5) was funded by Computing Department, Lancaster Univer­sity while the work on the AspOEv evolution framework (discussed in Chap.

PA Acknowledgements XV

4) is funded by a current UK Engineering and Physical Sciences Research Council (EPSRC) grant GRJR08612.

The work discussed in this book has mainly been derived from various conference and journal publications that I have authored or co-authored over the years. A number of these appeared in Lecture Notes in Computer Science volumes by Springer. I would like to explicitly acknowledge parts of the book that have been derived from papers that appeared in publications from other publishers. Parts of Chaps. 3 and 4 have been derived from (Rashid and Sawyer 2000a), (Rashid and Sawyer 2001) and (Rashid 2003). Parts of Chap. 5 have been derived from (Rashid 2002b) while the material in Chap. 6 is almost entirely reproduced from (Rashid and Chitchyan 2003).

I wish to thank everyone with whom I have worked over the years on database systems, software engineering, object-oriented techniques and aspect-oriented software development. This book has been influenced by these collaborations and discussions in one way or another. In particular, I wish to thank Peter Sawyer, Ian Sommerville, Gerald Kotonya, Gordon Blair and Lynne Blair at Lancaster University, Ian MacCallum at University of Essex, Akmal B. Chaudhri at IBM, and Ana Moreira and Joao Araujo at New University of Lisbon. I also wish to thank my friends in the Computing Department, especially the "lunch gang", as their company makes my work place that extra special.

I owe special thanks to Andreas Speck at Intershop Research and Elke Pulvermueller at University of Karlsruhe together with whom I first got involved in work on AOP. I am also very thankful to several graduate stu­dents at Computing Department, Lancaster University for contributing to some of the work on Aspect -Oriented Database Systems included in this book. These include Neil Loughran (for his work on the relational aspect store, discussed in Chap. 5), Robin Green (for the current AspOEv imple­mentation, discussed in Chap. 4) and Ruzanna Chitchyan (for her contribu­tion to the aspectisation of persistence using AspectJ, discussed in Chap. 6).

I would also like to thank the team at Springer Verlag, in particular Ralf Gerstner for encouraging me to write this book in the first place. I am very thankful to Rainer Unland from University of Essen, Ralf Gerstner from Springer and the anonymous reviewer for their helpful comments on the book. Last, but not least, I wish to thank my family, especially my wife for her patience and support throughout the writing of this book.