magritte — meta-described web application development

Click here to load reader

Post on 14-Feb-2017

217 views

Category:

Documents

1 download

Embed Size (px)

TRANSCRIPT

  • MagritteMeta-Described Web Application Development

    Masterarbeitder Philosophisch-naturwissenschaftlichen Fakultat

    der Universitat Bern

    vorgelegt von

    Lukas Renggli

    Juni 2006

    Leiter der Arbeit

    Prof. Dr. Stephane DucasseProf. Dr. Oscar Nierstrasz

    Institut fur Informatik und angewandte Mathematik

  • ii

    Further information about this work, the tools used and an online versionof this document can be found at the following places.

    Lukas Rengglirenggli@gmail.comhttp://www.lukas-renggli.ch

    Software Composition GroupUniversity of BernInstitute of Computer Science and Applied MathematicsNeubruckstrasse 10CH-3012 Bernhttp://www.iam.unibe.ch/~scg/

    mailto:renggli@iam.unibe.chhttp://www.lukas-renggli.chhttp://www.iam.unibe.ch/~scg/

  • Abstract

    Developing applications that end users can customize is a challenge, sinceend users are domain experts but still have concrete requirements. In thismaster thesis we present how we used a meta-driven approach to supportthe end user customization of Web applications. We present Magritte, a re-cursive meta-data meta-model integrated into the Smalltalk reflective meta-model. The adaptive model of Magritte enables to not only describe existingclasses but also let end users build their own meta-models on the fly. Furtheron we describe how meta-interpreters automatically build views, reports,validating editors and persistency mechanisms.

    As a complete example of how we applied a meta-model to a Web applicationwe present Pier, the second version of a fully object-oriented implementationof a content management system and Wiki engine. Pier is implemented withobjects from the top to the bottom and is designed to be customizable toaccommodate new needs. The integration of a powerful meta-descriptionlayer makes it a breeze to extend the running system with new functionalitywithout having to patch the core engine.

    We describe the lessons learned from using the Magritte meta-model to buildapplications. Both projects described in this thesis are open source and canbe downloaded from the Web site of the author.

    iii

  • iv ABSTRACT

  • Acknowledgements

    First I wish to thank my supervisor Prof. Dr. Stephane Ducasse for hisguidance and that he motivated me to learn Smalltalk and join the SoftwareComposition Group. It was a great experience to travel with him to differentplaces around Europe and to give presentations about my work.

    I would like to thank Prof. Dr. Stephane Ducasse and Prof. Dr. RoelWuyts for the discussions on the design and implementation of SmallWiki,Pier and Magritte. Thanks for writing with me the two papers, [Duca05]and [Reng07], which were an important point of reference for this masterthesis.

    Also I would like to thank Prof. Dr. Oscar Nierstrasz, head of the SoftwareComposition Group, for giving me the opportunity to work in his group, forthe careful reading of this master thesis and the constructive comments thathelped me to improve it.

    I would like to thank my parents for all their support and encourage-ments during my studies. I also would like to express my thanks to allmy friends.

    Lukas RenggliJune 2006

    v

  • vi ACKNOWLEDGEMENTS

  • Contents

    Abstract iii

    Acknowledgements v

    Contents vii

    1 Introduction 1

    1.1 Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    1.2 Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    2 Magritte 3

    2.1 Context and Constraints . . . . . . . . . . . . . . . . . . . . . 3

    2.2 Describing Domain Objects . . . . . . . . . . . . . . . . . . . 4

    2.3 Interpreting Descriptions . . . . . . . . . . . . . . . . . . . . . 7

    2.3.1 Building Textual Views . . . . . . . . . . . . . . . . . 7

    2.3.2 Object Relational Mapping . . . . . . . . . . . . . . . 8

    2.3.3 Building Validating Editors . . . . . . . . . . . . . . . 8

    2.3.4 Customizing the Meta-Interpretation . . . . . . . . . . 10

    2.4 Meta Magritte . . . . . . . . . . . . . . . . . . . . . . . . . . 11

    2.4.1 Adaptive Model . . . . . . . . . . . . . . . . . . . . . 11

    2.5 Aare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    2.6 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    2.6.1 Descriptions . . . . . . . . . . . . . . . . . . . . . . . . 15

    2.6.2 Accessors . . . . . . . . . . . . . . . . . . . . . . . . . 15

    2.6.3 Conditions . . . . . . . . . . . . . . . . . . . . . . . . 17

    2.6.4 Mementos . . . . . . . . . . . . . . . . . . . . . . . . . 18

    3 Pier 19

    3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

    3.2 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

    3.3 Pier in Action . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

    3.4 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

    3.4.1 Separation of Concerns . . . . . . . . . . . . . . . . . 24

    vii

  • viii CONTENTS

    3.4.2 Pages and Files . . . . . . . . . . . . . . . . . . . . . . 25

    3.4.3 Visitors . . . . . . . . . . . . . . . . . . . . . . . . . . 28

    3.4.4 Context and Commands . . . . . . . . . . . . . . . . . 30

    3.4.5 Environment . . . . . . . . . . . . . . . . . . . . . . . 32

    3.5 Extending Pier . . . . . . . . . . . . . . . . . . . . . . . . . . 33

    3.5.1 Fixing broken links . . . . . . . . . . . . . . . . . . . . 33

    3.5.2 Converting documents . . . . . . . . . . . . . . . . . . 34

    3.5.3 Security . . . . . . . . . . . . . . . . . . . . . . . . . . 35

    3.6 Pier at the Meta-Level . . . . . . . . . . . . . . . . . . . . . . 36

    3.6.1 Searching . . . . . . . . . . . . . . . . . . . . . . . . . 37

    3.6.2 Persistency and Versioning . . . . . . . . . . . . . . . 38

    3.6.3 Adaptive Forms . . . . . . . . . . . . . . . . . . . . . . 39

    3.7 Lessons Learned . . . . . . . . . . . . . . . . . . . . . . . . . 43

    3.8 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

    4 Conclusion 47

    4.1 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

    4.2 Lessons Learned . . . . . . . . . . . . . . . . . . . . . . . . . 51

    4.3 Further Work . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

    Documentation 53

    Magritte-Model-Core . . . . . . . . . . . . . . . . . . . . . . . . . . 53

    MACompatibility . . . . . . . . . . . . . . . . . . . . . . . . . 53

    MADistribution . . . . . . . . . . . . . . . . . . . . . . . . . . 53

    MAObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

    Magritte-Model-Models . . . . . . . . . . . . . . . . . . . . . . . . 55

    MAAdaptiveModel . . . . . . . . . . . . . . . . . . . . . . . . 55

    MAFileModel . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

    MATableModel . . . . . . . . . . . . . . . . . . . . . . . . . . 57

    Magritte-Model-Description . . . . . . . . . . . . . . . . . . . . . . 57

    MABooleanDescription . . . . . . . . . . . . . . . . . . . . . . 57

    MAClassDescription . . . . . . . . . . . . . . . . . . . . . . . 58

    MAColorDescription . . . . . . . . . . . . . . . . . . . . . . . 58

    MAContainer . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

    MADateDescription . . . . . . . . . . . . . . . . . . . . . . . 58

    MADescription . . . . . . . . . . . . . . . . . . . . . . . . . . 58

    MADurationDescription . . . . . . . . . . . . . . . . . . . . . 63

    MAElementDescription . . . . . . . . . . . . . . . . . . . . . 63

    MAFileDescription . . . . . . . . . . . . . . . . . . . . . . . . 64

    MAMagnitudeDescription . . . . . . . . . . . . . . . . . . . . 64

    MAMemoDescription . . . . . . . . . . . . . . . . . . . . . . . 64

    MAMultipleOptionDescription . . . . . . . . . . . . . . . . . 65

    MANumberDescription . . . . . . . . . . . . . . . . . . . . . . 65

    MAOptionDescription . . . . . . . . . . . . . . . . . . . . . . 65

  • CONTENTS ix

    MAPasswordDescription . . . . . . . . . . . . . . . . . . . . . 65MAPriorityContainer . . . . . . . . . . . . . . . . . . . . . . . 66MAReferenceDescription . . . . . . . . . . . . . . . . . . . . . 66MARelationDescription . . . . . . . . . . . . . . . . . . . . . 66MASingleOptionDescription . . . . . . . . . . . . . . . . . . . 67MAStringDescription . . . . . . . . . . . . . . . . . . . . . . . 67MASymbolDescription . . . . . . . . . . . . . . . . . . . . . . 67MATableDescription . . . . . . . . . . . . . . . . . . . . . . . 67MATimeDescription . . . . . . . . . . . . . . . . . . . . . . . 68MATimeStampDescription . . . . . . . . . . . . . . . . . . . . 68MATokenDescription . . . . . . . . . . . . . . . . . . . . . . . 68MAToManyRelationDescription . . . . . . . . . . . . . . . . . 68MAToOneRelationDescription . . . . . . . . . . . . . . . . . . 68

    Magritte-Model-Accessor . . . . . . . . . . . . . . . . . . . . . . . 68MAAccessor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69MAAutoSelectorAccessor . . . . . . . . . . . . . . . . . . . . 69MABlockAccessor . . . . . . . . . . . . . . . . . . . . . . . . 69MAChainAccessor . . . . . . . . . . . . . . . . . . . . . . . . 70MAContainerAccessor . . . . . . . . . . . . . . . . . . . . . . 70MADictionaryAccessor . . . . . . . . . . . . . . . . . . . . . . 70MANullAccessor . . . . . . . . . . . . . . . . . . . . . . . . . 70MASelectorAccessor . . . . . . . . . . . . . . . . . . . . . . . 70MAVariableAccessor . . . . . . . . . . . . . . . . . . . . . . . 71

    Magritte-Model-Condition . . . . . . . . . . . . . . . . . . . . . . . 71MAAllCondition . . . . . . . . . . . . . . . . . . . . . . . . . 71MAAnyCondition . . . . . . . . . .