EMF - The off beat path

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    EMF - The off beat path - Presentation Transcript

    1. Chetan Kumar K, RBEI jointly with Annamalai C, ANCiT
    2. In-memory dbase content D-Base UI display What is a model ??? That is a model!
    3. What is model ???
      • Placeholder of data
      • Can “get” and “set” data
      Get data Set data Get data Data In memory representation of data
      • Can be derived from a design
    4. … and so on Will you spend time writing each class ?? Map design and code (model) PIM PSM Or be smart and generate them ?? UML Java
    5. Typical code-generation flow PIM Generator Model Code Generation Engine Code generation templates PSM PSM
    6. EMF a code generator.
      • EMF is one such code-generator
      • Let’s you generate concrete classes based on a design (UML)
      • Let’s look at an example…
    7. Code generation flow – EMF way PIM (ecore) Generator Model genmodel EMF Code Generation Engine Code generation Templates (JET) PSM (Java)
    8. First look of EMF as a code-generator… Tap along guys…
    9. The complete Example UML
    10. Properties of (E)Attribute Data type of attribute EType Default value assigned when containing class is instantiated Default value Literal Find out if an attribute was touched Unsettable Value can be changed or not Changeable Attribute isn’t persisted Transient No associated storage (value can be calculated) Volatile Meaning Property
    11. M-V-C architecture thru EMF
    12. … EMF first impressions.
      • EMF generates code – will it steal my job!
      • EMF generates UI stuff – why pay a UI developer ?
      • Oh god! Something new – too much learning curve
      • Should I learn “Modeling” or write code now ?
      Points 3, 4 courtesy Ed Merks It will be great if these points are myths … wat say ?
    13. EMF.Edit Control how model elements are displayed, edited.
    14. EMF.Edit – bird’s eye view. Contains UI Providers for each Model Element. Content Provider Label Provider Property Source Item Provider Generated implementation for different providers
    15. EMF.Edit control flow – Content Providers “ +” clicked Item provider code eGet api calls Generated api getter(s)
    16. EMF.Edit control flow – Label Providers Item provider code eGet api calls Generated api getter(s)
    17. EMF.Edit control flow – Property Source Tree item selected Item provider code Individual feature’s property descriptor built Property descriptors
    18. EMF.Edit providers – one for all, all for one
      • Content, Label, Image, and Property source providers all through one provider instance!!
      • Now that’s called … convenience.
    19. EMF.Edit commands Command based model editing support
    20. EMF.Edit Commands Command based editing of model instances Editing domain UI display “ Set” event as Command Command stack setXXX() undoable Model object
    21. EMF.Edit – How do I create/use Commands ? Model object EMF Editing Domain
      • Contains command stack
      • Factories to create commands
    22. EMF.Edit – commands, a deeper look Command interface Existing Command implementations Do you need to implement this interface ??
    23. EMF.Edit – “Change… is here!” Should I have one command per operation ? Can I “record” changes done to a model ? Oooo yess!! Works on change notofications given on each operation ChangeRecorder recoreds these notifications from individual setters. Hence, bulk undo is possible  Can I perform many operations in one command ?
    24. Should I always generate EMF.xxx code ?
      • Nope … can work with “Dynamic EMF”
      • Ecore – instantiate model (load) – edit – persist … is possible
      Responsible code: EMF Reflective API, EMF Reflective Item Providers
    25. Model xml / xmi load save UI display What after you edit ?? – can ya persist ?
    26. EMF serialization Model object EMF Resource EMF Resource Set xml / xmi
    27. Load and save flows Model object xml / xmi load save EMF Reosource Typical code snippet:
    28. EMF Serialization – behind the scenes
      • EAnnotations stores mapping b/w XML and Ecore
      • Any model element can have EAnnotations
    29. Can I directly persist EMF Objects into dbase ? Yes, u can – using EMF Teneo ( http:// www.eclipse.org/modeling/emf/?project = teneo ) Create HbDataStore Create Hibernate Session, Transaction Begin Transaction Create EMF Model root object, make it persistent Create sub-tree under persistent root Commit Tx
      • Get all students aged > 5
      Model Navigation and search Isn’t there a better way than loops ? Can’t I “Query” an EMF model ?? The cool “Query way”
    30. In the end… what is EMF ?
      • Code generator based on a design (UML)
      • Means of Java XML binding with Inbuilt persistence mechanism
      • Command based model editing support, with generated item providers
      • All in all, a base for applications based on MDA
    31. EMF Transaction Thread-safe editing of a single Model Instance Transaction style editing of model instances
    32. Model editing through multiple threads Thread 1 Change name : “ Jimmy Bend” Thread 2 Change name “ James Bond” name: Harry Potter name: ??? Model object Model object
    33. “ A mind once stretched by a thought never regains its original dimensions”
    34. References
      • EMF newsgroups: http://www.eclipse.org/newsportal/thread.php?group=eclipse.tools.emf
      • EMF book: Eclipse Modeling Framework by Ed Merks et.al
      • EMF Refcard on DZone: http://refcardz.dzone.com/refcardz/essential-emf
      • Articles on Dynamic EMF
      • - IBM developerWorks ( http://www.ibm.com/developerworks/library/os-eclipse-dynamicemf/ )
      • - devX.com ( http://www.devx.com/Java/Article/29093/0/page/1 )
      • Blogs: http://tweakeclipse.blogspot.com/ http://eclipseo.blogspot.com/ and many more!!
    SlideShare Zeitgeist 2009

    + 17thcamel17thcamel Nominate

    custom

    131 views, 0 favs, 0 embeds more stats

    This is a presentation of EMF from the ground up du more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 131
      • 131 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 3
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories