SlideShare una empresa de Scribd logo
1 de 68
Dr. Jan Köhnlein, itemis AG




EMF – Beyond the Basics
Eclipse Modeling
  Framework
Eclipse Modeling
     Framework
• Create Ecore models
Eclipse Modeling
     Framework
• Create Ecore models
 • from Java, XSD, UML, MOF
Eclipse Modeling
     Framework
• Create Ecore models
 • from Java, XSD, UML, MOF
 • or from scratch
Eclipse Modeling
     Framework
• Create Ecore models
 • from Java, XSD, UML, MOF
 • or from scratch
• Generate Java-Code from Ecore
Eclipse Modeling
     Framework
• Create Ecore models
 • from Java, XSD, UML, MOF
 • or from scratch
• Generate Java-Code from Ecore
• Runtime library to process Ecore models
  and instances
Ecore
  EPackage                              EClassifer
                                    * name:String
name: String
                          eClassifiers
nsURI: String


          eSuperTypes
                          *
                         EClass                      EDatatype
                    abstract: boolean
   eReferenceType
                                                          eAttributeType

                           * eStructuralFeatures
                   EStructuralFeature
                 name: String
                 lowerBound: int
                 upperBound: int




        EReference                   EAttribute
   containment: boolean

            *
                eOpposite
Ecore Instances
Ecore Instances
• EObject
Ecore Instances
• EObject
 • Instance of an EClass
Ecore Instances
• EObject
 • Instance of an EClass
 • Values for EAttributes
Ecore Instances
• EObject
 • Instance of an EClass
 • Values for EAttributes
 • References for EReferences
Ecore Instances
• EObject
 • Instance of an EClass
 • Values for EAttributes
 • References for EReferences
• Ecore is self-describing
Ecore Instances
• EObject
 • Instance of an EClass
 • Values for EAttributes
 • References for EReferences
• Ecore is self-describing
 • EClass, EPackage etc. extend EObject
Example Ecore/Instance


                  << EPackage >>                                    <<Node>>
                    TreePackage                          parent                      parent
                                                                    myNode0
              name: quot;Treequot;
              nsURI: quot;http://www.itemis..quot;


                     <<EClass>>
                          Node
              name: quot;Nodequot;
                                                                         children
              abstract: false



     <<EReference>>                << EReference >>
         children                       parent
name: quot;childrenquot;               name: quot;parentquot;
containment: true              containment: false
                                                            << Node >>         << Node >>
upperBound: -1                 upperBound: 1
                                                             myNode2            myNode1
lowerBound: 0                  lowerBound: 0
 eOpposite                                   eOpposite
Example: Java View
               TreePackage::EPackage
              name: quot;Treequot;
                                                         myNode0::Node
              nsURI: quot;http://www.itemis..quot;                               parent



                    Node::EClass
              name: quot;Nodequot;
                                                         children
              abstract: false
                                                               ::EList


  children::EReference            parent::EReference
name: quot;childrenquot;               name: quot;parentquot;
containment: true              containment: false
upperBound: -1                 upperBound: 1
                                                         myNode1::Node
lowerBound: 0                  lowerBound: 0
 eOpposite                                   eOpposite
Example: Java View
               TreePackage::EPackage
              name: quot;Treequot;
                                                         myNode0::Node
              nsURI: quot;http://www.itemis..quot;                               parent



                    Node::EClass
              name: quot;Nodequot;
                                                         children
              abstract: false
                                                               ::EList


  children::EReference            parent::EReference
name: quot;childrenquot;               name: quot;parentquot;
containment: true              containment: false
upperBound: -1                 upperBound: 1
                                                         myNode1::Node
lowerBound: 0                  lowerBound: 0
 eOpposite                                   eOpposite




             Node myNode0 = TreeFactory.eINSTANCE.createNode();
             Node myNode1 = TreeFactory.eINSTANCE.createNode();
             myNode0.getChildren().add(myNode1);
Ecore Reflection
      EStructuralFeature




              *   eStructuralFeatures
            EClass                                       EObject                 eContents
                                   eClass
getEStructuralFeature(String):                eGet(EStructuralFeature): Object
  EStructuralFeature                          eSet(EStructuralFeature, Object)   *
              *   eClassifiers                                   eContainer




           EPackage                                            EFactory
                                            eFactory
getEClassifier(String):EClassifier                       create(EClass):EObject
Dynamic EMF
// load Ecore file
URI resourceURI = URI.createPlatformResourceURI(
   quot;de.itemis.treemodel/model/treemodel.ecorequot;, true);
Resource resource = new XMIResourceImpl(resourceURI);
		
// extract Ecore model
EPackage treePackage = (EPackage) resource.getContents().get(0);
EFactory factory = treePackage.getEFactoryInstance();
EClass nodeClass = (EClass) treePackage.getEClassifier(quot;Nodequot;);
EStructuralFeature childrenReference =
   nodeClass.getEStructuralFeature(quot;childrenquot;);
		
// create instances using reflective API
EObject myNode0 = factory.create(nodeClass);
EObject myNode1 = factory.create(nodeClass);	 	
((EList) myNode0.eGet(childrenReference)).add(myNode1);
References
References
References
                                                  Resource




     Element
                                                                                      Element
                                                                  Element
                        Element               Element



                                                                                      Element
                                                                                          Element Element
                                           Element                                            Element
     Element
                                                                       Element



Element
                                    Element Element
                                                Element                                   Element
        Element
    Element                             Element
                       Element                               Element        Element
                                                                       Element
                                                                  Element

                                                                                  Element
                                                                                                  Element
               Element                                                                Element Element
                   Element Element
                               Element                                                    Element
                       Element
References
                                                    Resource




       Element
                                                                                        Element
                                                                    Element
                          Element               Element

Containment
                                                                                        Element
                                                                                            Element Element
                                             Element                                            Element
       Element
                                                                         Element



  Element
                                      Element Element
                                                  Element                                   Element
          Element
      Element                             Element
                         Element                               Element        Element
                                                                         Element
                                                                    Element

                                                                                    Element
                                                                                                    Element
                 Element                                                                Element Element
                     Element Element
                                 Element                                                    Element
                         Element
References
                                                    Resource




       Element
                                                                                        Element
                                                                    Element
                          Element               Element

Containment
                                                                                        Element
                                                                                            Element Element
                                             Element                                            Element
       Element
                                                                         Element



  Element
                                      Element Element
                                                  Element                                   Element
          Element
      Element                             Element
                         Element                               Element        Element
                                                                         Element
                                                                    Element

                                                                                    Element
                                                                                                    Element
                 Element                                                                Element Element
                     Element Element
                                 Element                                                    Element
                         Element

                                           Cross-References
References
                                                                                         Resource
                                                    Resource

                                                                                        Containment
       Element
                                                                                        Element
                                                                    Element
                          Element               Element

Containment
                                                                                        Element
                                                                                            Element Element
                                             Element                                            Element
       Element
                                                                         Element



  Element
                                      Element Element
                                                  Element                                   Element
          Element
      Element                             Element
                         Element                               Element        Element
                                                                         Element
                                                                    Element

                                                                                    Element
                                                                                                    Element
                 Element                                                                Element Element
                     Element Element
                                 Element                                                    Element
                         Element

                                           Cross-References
Big Models
Lots of elements...


  Big Models
Lots of elements...


  Big Models
 ...and lots of references
Divide
   &
Conquer
Resource

                                                                    Element
           Element

                               Element          Element


                                                                          Element
     Element

                                          Element

                                                                               Element
                                                                    Element Element
Element
                                                                        Element
        Element
    Element          Element
                                     Element
                                             Element
                                         Element          Element


           Element
                           Element
               Element Element
                   Element
                                                Element
                                                                Element
                                                    Element Element
                                                        Element
ResourceSet



      Resource                                                                           Resource
                                     Resource              Resource


           Element                                             Element
                                      Element                                             Element




                                                                                               Element
     Element                                             Element




Element                                             Element                                          Element
                                                                                          Element Element
        Element                                             Element                           Element
    Element                                             Element
                     Element                                             Element




           Element                                             Element
                           Element                                             Element
               Element Element                                     Element Element
                   Element                                             Element
Lazy Loading
Proxy
                                         EObject


• Not yet loaded EObject
                                    eIsProxy(): boolean




• Instantiated on load for           InternalEObject

  external reference
                                   eProxyURI(): String
                                   eSetProxyURI(String)



• eProxyURI attribute set
• Replaced on resolution
                                       EObjectImpl




                                         EcoreUtil
                             resolve(EObject, ResourceSet)
                             resolve(EObject, Resource)
                             resolve(EObject, EObject)
Proxy Resolution
          ResourceSet



            Resource




                          PROXY
            Element




  Element
        Element Element
Proxy Resolution
                        ResourceSet



          Resource




                          PROXY
          Element




Element
      Element Element
Proxy Resolution
                        ResourceSet



          Resource                    Resource




                          PROXY
          Element




Element
      Element Element
Proxy Resolution
                        ResourceSet



          Resource                       Resource



                                           Element
                          PROXY
          Element



                                                Element


Element
      Element Element
                                      Element             Element
                                                Element
Proxy Resolution
                        ResourceSet



          Resource                       Resource



                                           Element
                          PROXY
          Element



                                                Element


Element
      Element Element
                                      Element             Element
                                                Element
How about unloading?
                               ResourceSet




                                               Resource
                    Resource                  Resource
                                              (unloaded)




                                              PROXY
                                              Element
          Element



                                              PROXY
                                              Element


Element
      Element Element
                                    PROXY                  PROXY
                                    Element                Element
                                              PROXY
                                              Element
How about unloading?
                               ResourceSet




                                               Resource
                    Resource                  Resource
                                              (unloaded)




                                              PROXY
                                              Element
          Element



                                              PROXY
                                              Element


Element
      Element Element
                                    PROXY                  PROXY
                                    Element                Element
                                              PROXY
                                              Element
How about unloading?
                               ResourceSet




                                               Resource
                    Resource                  Resource
                                              (unloaded)




                                              PROXY
                                              Element                        PROXY
          Element



                                              PROXY
                                              Element                        PROXY


Element
      Element Element
                                    PROXY                  PROXY
                                    Element                Element   PROXY           PROXY
                                              PROXY
                                              Element                        PROXY
Lazy Loading

• Proxy Resolution / Lazy Loading
 • Transparently when navigating references
• Unload
 • Proxifies elements
 • Keeps elements connected by default
Enabling Proxies
• For cross-references
 • Set
    EResource.isResolveProxies
• For containment references
 • Additionally set
    GenModel.isContainmentProxies
eProxyURI

• Resource URI + Fragment
  [scheme:][//authority][/path][#fragment]

• Examples:
  http://www.itemis.de/files/model.ecore#/

  file:/Users/koehnlein/test.xmi#/children.0

  platform:/resource/myproject/m2.uml#12345126
Resource URIs
• Relative or absolute                 URIConverter
                         normalize(URI): URI
                         createInputStream(URI): InputStream
                         createOutputStream(URI): OutputStream


• URIConverter
                         exists(URI)
                         delete(URI)
                         getURIMap(): Map<URI, URI>



 • Resolves URIs
 • Access to resources
                                ExtensibleURIConverter




 • Abstraction on
                                              *
                                        URIHandler
                         canHandle(URI): boolean
                         createInputStream(URI): InputStream
    I/O Access           createOutputStream(URI): OutputStream
                         exists(URI)
                         delete(URI)
Fragment
Strategies
Fragment Paths
              ::Resource
uri=quot;http://www.itemis.de/model.treequot;



                                        • Example
                   0
               ::Node

                                          •   #/0/children.3

                                        • Compact
                   children


                                        • Fragile with respect
             .1    .2     .3
        ::Node
                                          to reorderig
               ::Node
                       ::Node
Fragment Paths With Keys
                                        • Define EAttribute as key
              ::Resource
uri=quot;http://www.itemis.de/model.treequot;


                                          for EReference
                   0


                                        • Example
              ::Node
         name=quot;rootquot;




                                          •   name key of children
                   children



                                          •
 .Sven           .Peter      .Ed
                                              #/0/children.Ed
  ::Node
name=quot;Svenquot;


                                        • Assert no collisions !
           ::Node
       name=quot;Peterquot;
                         ::Node
                       name=quot;Edquot;
EAttributes as ID
              ::Resource
uri=quot;http://www.itemis.de/model.treequot;


                                        • Set ID flag on EAttribute
                   0

                                        • Example
              ::Node
        index=0



                                          •   index defined as ID

                                          •   #3
             1      2        3
    ::Node


                                        • Initialize without collisions
 index=1
               ::Node
           index=2
                          ::Node
                       index=3
Extrinsic IDs
                           ::Resource
             uri=quot;http://www.itemis.de/model.treequot;
             eObjectToIDMap = {...}




                                                     • Resource manages IDs
                           ::Node
                     index=0


                                                     • Example
    quot;ab3827d8quot;



                                                      •   #276fe78d

                                                     • UUIDs in UML2
                  ::Node

                            ::Node
quot;37fe34c2quot;
                                     ::Node
      quot;87f33bd2quot;
                  quot;276fe78dquot;
Tracking Inverse
  References
ECrossReferenceAdapter

                                           Adapter
                              notifyChanged(Notification)
                              isAdapterForType(Object): boolean



• Works for loaded
  Resources within                    EContentAdapter


  a ResourceSet
                                  ECrossReferenceAdapter
                     getInverseReferences(EObject): List<Setting>
                     getNonNavigableReferences(EObject): List<Setting>
EMF Index

• Indexes all resources in workspace
• Query elements and cross-references
EMF Index

• Indexes all resources in workspace
• Query elements and cross-references

                               Load
                             Resources
EMF Transactions
EMF Transactions
EMF Transactions
 TransactionChangeRecorder
beginRecording()                          ResourceSet
endRecording()




                                       CommandStack
 TransactionalEditingDomain
                                     execute(Command)
runExclusive(Runnable): Object
                                     undo()
                                     redo()



                                   RecordingCommand
                                 execute()
Global Singletons
Global Singletons
Global Singletons
• Configured with Eclipse extensions
Global Singletons
• Configured with Eclipse extensions
• EPackage.Registry:
  Dynamic and static Ecore models
Global Singletons
• Configured with Eclipse extensions
• EPackage.Registry:
  Dynamic and static Ecore models
• Resource.Factory.Registry
  Resource implementations
Global Singletons
• Configured with Eclipse extensions
• EPackage.Registry:
  Dynamic and static Ecore models
• Resource.Factory.Registry
  Resource implementations
• (Extensible)URIConverter
Global Singletons
• Configured with Eclipse extensions
• EPackage.Registry:
  Dynamic and static Ecore models
• Resource.Factory.Registry   Override
  Resource implementations       in

• (Extensible)URIConverter    Resource
                                Set
Questions?

Más contenido relacionado

La actualidad más candente

Javaはどのように動くのか~スライドでわかるJVMの仕組み
Javaはどのように動くのか~スライドでわかるJVMの仕組みJavaはどのように動くのか~スライドでわかるJVMの仕組み
Javaはどのように動くのか~スライドでわかるJVMの仕組みChihiro Ito
 
ドメイン駆動設計 失敗したことと成功したこと
ドメイン駆動設計 失敗したことと成功したことドメイン駆動設計 失敗したことと成功したこと
ドメイン駆動設計 失敗したことと成功したことBIGLOBE Inc.
 
メルカリ・ソウゾウでは どうGoを活用しているのか?
メルカリ・ソウゾウでは どうGoを活用しているのか?メルカリ・ソウゾウでは どうGoを活用しているのか?
メルカリ・ソウゾウでは どうGoを活用しているのか?Takuya Ueda
 
Java ORマッパー選定のポイント #jsug
Java ORマッパー選定のポイント #jsugJava ORマッパー選定のポイント #jsug
Java ORマッパー選定のポイント #jsugMasatoshi Tada
 
Windows Server 2016上でLinuxコンテナが動いた!
Windows Server 2016上でLinuxコンテナが動いた!Windows Server 2016上でLinuxコンテナが動いた!
Windows Server 2016上でLinuxコンテナが動いた!Takashi Kanai
 
[143] Modern C++ 무조건 써야 해?
[143] Modern C++ 무조건 써야 해?[143] Modern C++ 무조건 써야 해?
[143] Modern C++ 무조건 써야 해?NAVER D2
 
XPages 開発 Tips 百連発
XPages 開発 Tips 百連発XPages 開発 Tips 百連発
XPages 開発 Tips 百連発Mitsuru Katoh
 
パフォーマンスの良いGASの書き方 Best Practice
パフォーマンスの良いGASの書き方 Best Practiceパフォーマンスの良いGASの書き方 Best Practice
パフォーマンスの良いGASの書き方 Best Practice啓介 大橋
 
ドメインロジックの実装方法とドメイン駆動設計
ドメインロジックの実装方法とドメイン駆動設計ドメインロジックの実装方法とドメイン駆動設計
ドメインロジックの実装方法とドメイン駆動設計Tadayoshi Sato
 
JavaScript guide 2020 Learn JavaScript
JavaScript guide 2020 Learn JavaScriptJavaScript guide 2020 Learn JavaScript
JavaScript guide 2020 Learn JavaScriptLaurence Svekis ✔
 
덤프 파일을 통한 사후 디버깅 실용 테크닉 NDC2012
덤프 파일을 통한 사후 디버깅 실용 테크닉 NDC2012덤프 파일을 통한 사후 디버깅 실용 테크닉 NDC2012
덤프 파일을 통한 사후 디버깅 실용 테크닉 NDC2012Esun Kim
 
Effective Modern C++ 勉強会#1 Item3,4
Effective Modern C++ 勉強会#1 Item3,4Effective Modern C++ 勉強会#1 Item3,4
Effective Modern C++ 勉強会#1 Item3,4Takashi Hoshino
 
ISUCONで学ぶ Webアプリケーションのパフォーマンス向上のコツ 実践編 完全版
ISUCONで学ぶ Webアプリケーションのパフォーマンス向上のコツ 実践編 完全版ISUCONで学ぶ Webアプリケーションのパフォーマンス向上のコツ 実践編 完全版
ISUCONで学ぶ Webアプリケーションのパフォーマンス向上のコツ 実践編 完全版Masahiro Nagano
 
DDD x CQRS 更新系と参照系で異なるORMを併用して上手くいった話
DDD x CQRS   更新系と参照系で異なるORMを併用して上手くいった話DDD x CQRS   更新系と参照系で異なるORMを併用して上手くいった話
DDD x CQRS 更新系と参照系で異なるORMを併用して上手くいった話Koichiro Matsuoka
 
ドメイン駆動設計に15年取り組んでわかったこと
ドメイン駆動設計に15年取り組んでわかったことドメイン駆動設計に15年取り組んでわかったこと
ドメイン駆動設計に15年取り組んでわかったこと増田 亨
 
今から始める Lens/Prism
今から始める Lens/Prism今から始める Lens/Prism
今から始める Lens/PrismNaoki Aoyama
 

La actualidad más candente (20)

ssh-agentのすすめ
ssh-agentのすすめssh-agentのすすめ
ssh-agentのすすめ
 
Javaはどのように動くのか~スライドでわかるJVMの仕組み
Javaはどのように動くのか~スライドでわかるJVMの仕組みJavaはどのように動くのか~スライドでわかるJVMの仕組み
Javaはどのように動くのか~スライドでわかるJVMの仕組み
 
ドメイン駆動設計 失敗したことと成功したこと
ドメイン駆動設計 失敗したことと成功したことドメイン駆動設計 失敗したことと成功したこと
ドメイン駆動設計 失敗したことと成功したこと
 
メルカリ・ソウゾウでは どうGoを活用しているのか?
メルカリ・ソウゾウでは どうGoを活用しているのか?メルカリ・ソウゾウでは どうGoを活用しているのか?
メルカリ・ソウゾウでは どうGoを活用しているのか?
 
Scala DSLの作り方
Scala DSLの作り方Scala DSLの作り方
Scala DSLの作り方
 
Java ORマッパー選定のポイント #jsug
Java ORマッパー選定のポイント #jsugJava ORマッパー選定のポイント #jsug
Java ORマッパー選定のポイント #jsug
 
Windows Server 2016上でLinuxコンテナが動いた!
Windows Server 2016上でLinuxコンテナが動いた!Windows Server 2016上でLinuxコンテナが動いた!
Windows Server 2016上でLinuxコンテナが動いた!
 
[143] Modern C++ 무조건 써야 해?
[143] Modern C++ 무조건 써야 해?[143] Modern C++ 무조건 써야 해?
[143] Modern C++ 무조건 써야 해?
 
XPages 開発 Tips 百連発
XPages 開発 Tips 百連発XPages 開発 Tips 百連発
XPages 開発 Tips 百連発
 
パフォーマンスの良いGASの書き方 Best Practice
パフォーマンスの良いGASの書き方 Best Practiceパフォーマンスの良いGASの書き方 Best Practice
パフォーマンスの良いGASの書き方 Best Practice
 
ドメインロジックの実装方法とドメイン駆動設計
ドメインロジックの実装方法とドメイン駆動設計ドメインロジックの実装方法とドメイン駆動設計
ドメインロジックの実装方法とドメイン駆動設計
 
JavaScript guide 2020 Learn JavaScript
JavaScript guide 2020 Learn JavaScriptJavaScript guide 2020 Learn JavaScript
JavaScript guide 2020 Learn JavaScript
 
덤프 파일을 통한 사후 디버깅 실용 테크닉 NDC2012
덤프 파일을 통한 사후 디버깅 실용 테크닉 NDC2012덤프 파일을 통한 사후 디버깅 실용 테크닉 NDC2012
덤프 파일을 통한 사후 디버깅 실용 테크닉 NDC2012
 
Effective Modern C++ 勉強会#1 Item3,4
Effective Modern C++ 勉強会#1 Item3,4Effective Modern C++ 勉強会#1 Item3,4
Effective Modern C++ 勉強会#1 Item3,4
 
Javascript validating form
Javascript validating formJavascript validating form
Javascript validating form
 
ISUCONで学ぶ Webアプリケーションのパフォーマンス向上のコツ 実践編 完全版
ISUCONで学ぶ Webアプリケーションのパフォーマンス向上のコツ 実践編 完全版ISUCONで学ぶ Webアプリケーションのパフォーマンス向上のコツ 実践編 完全版
ISUCONで学ぶ Webアプリケーションのパフォーマンス向上のコツ 実践編 完全版
 
Jquery
JqueryJquery
Jquery
 
DDD x CQRS 更新系と参照系で異なるORMを併用して上手くいった話
DDD x CQRS   更新系と参照系で異なるORMを併用して上手くいった話DDD x CQRS   更新系と参照系で異なるORMを併用して上手くいった話
DDD x CQRS 更新系と参照系で異なるORMを併用して上手くいった話
 
ドメイン駆動設計に15年取り組んでわかったこと
ドメイン駆動設計に15年取り組んでわかったことドメイン駆動設計に15年取り組んでわかったこと
ドメイン駆動設計に15年取り組んでわかったこと
 
今から始める Lens/Prism
今から始める Lens/Prism今から始める Lens/Prism
今から始める Lens/Prism
 

Similar a EMF - Beyond The Basics

Building RESTful Java Applications with EMF
Building RESTful Java Applications with EMFBuilding RESTful Java Applications with EMF
Building RESTful Java Applications with EMFKenn Hussey
 
Deep dive into Xtext scoping local and global scopes explained
Deep dive into Xtext scoping local and global scopes explainedDeep dive into Xtext scoping local and global scopes explained
Deep dive into Xtext scoping local and global scopes explainedHolger Schill
 
Memory Leaks In Internet Explorer
Memory Leaks In Internet ExplorerMemory Leaks In Internet Explorer
Memory Leaks In Internet ExplorerChristopher Blum
 
Memory Leaks In Internet Explorer
Memory Leaks In Internet ExplorerMemory Leaks In Internet Explorer
Memory Leaks In Internet ExplorerChristopher Blum
 
Pro bun-fighting - Working with JavaScript projects
Pro bun-fighting - Working with JavaScript projectsPro bun-fighting - Working with JavaScript projects
Pro bun-fighting - Working with JavaScript projectsFrances Berriman
 
Alfresco in few points - Search Tutorial
Alfresco in few points - Search TutorialAlfresco in few points - Search Tutorial
Alfresco in few points - Search TutorialPASCAL Jean Marie
 
Building DSLs with Xtext - Eclipse Modeling Day 2009
Building DSLs with Xtext - Eclipse Modeling Day 2009Building DSLs with Xtext - Eclipse Modeling Day 2009
Building DSLs with Xtext - Eclipse Modeling Day 2009Heiko Behrens
 
Overcoming The Impedance Mismatch Between Source Code And Architecture
Overcoming The Impedance Mismatch Between Source Code And ArchitectureOvercoming The Impedance Mismatch Between Source Code And Architecture
Overcoming The Impedance Mismatch Between Source Code And ArchitecturePeter Friese
 
Akka and the Zen of Reactive System Design
Akka and the Zen of Reactive System DesignAkka and the Zen of Reactive System Design
Akka and the Zen of Reactive System DesignLightbend
 
Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScriptFu Cheng
 
JSF Custom Components
JSF Custom ComponentsJSF Custom Components
JSF Custom ComponentsMichael Fons
 

Similar a EMF - Beyond The Basics (19)

Building RESTful Java Applications with EMF
Building RESTful Java Applications with EMFBuilding RESTful Java Applications with EMF
Building RESTful Java Applications with EMF
 
Deep dive into Xtext scoping local and global scopes explained
Deep dive into Xtext scoping local and global scopes explainedDeep dive into Xtext scoping local and global scopes explained
Deep dive into Xtext scoping local and global scopes explained
 
Memory Leaks In Internet Explorer
Memory Leaks In Internet ExplorerMemory Leaks In Internet Explorer
Memory Leaks In Internet Explorer
 
Spring ME
Spring MESpring ME
Spring ME
 
Memory Leaks In Internet Explorer
Memory Leaks In Internet ExplorerMemory Leaks In Internet Explorer
Memory Leaks In Internet Explorer
 
Pro bun-fighting - Working with JavaScript projects
Pro bun-fighting - Working with JavaScript projectsPro bun-fighting - Working with JavaScript projects
Pro bun-fighting - Working with JavaScript projects
 
Alfresco in few points - Search Tutorial
Alfresco in few points - Search TutorialAlfresco in few points - Search Tutorial
Alfresco in few points - Search Tutorial
 
"this" in JavaScript
"this" in JavaScript"this" in JavaScript
"this" in JavaScript
 
Building DSLs with Xtext - Eclipse Modeling Day 2009
Building DSLs with Xtext - Eclipse Modeling Day 2009Building DSLs with Xtext - Eclipse Modeling Day 2009
Building DSLs with Xtext - Eclipse Modeling Day 2009
 
SPL, not a bridge too far
SPL, not a bridge too farSPL, not a bridge too far
SPL, not a bridge too far
 
Ruby Classes
Ruby ClassesRuby Classes
Ruby Classes
 
Overcoming The Impedance Mismatch Between Source Code And Architecture
Overcoming The Impedance Mismatch Between Source Code And ArchitectureOvercoming The Impedance Mismatch Between Source Code And Architecture
Overcoming The Impedance Mismatch Between Source Code And Architecture
 
Akka and the Zen of Reactive System Design
Akka and the Zen of Reactive System DesignAkka and the Zen of Reactive System Design
Akka and the Zen of Reactive System Design
 
JavaScript Essentials
JavaScript EssentialsJavaScript Essentials
JavaScript Essentials
 
The Xtext Grammar Language
The Xtext Grammar LanguageThe Xtext Grammar Language
The Xtext Grammar Language
 
Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScript
 
JSF Custom Components
JSF Custom ComponentsJSF Custom Components
JSF Custom Components
 
Iphone course 1
Iphone course 1Iphone course 1
Iphone course 1
 
03 managing relationships
03   managing relationships03   managing relationships
03 managing relationships
 

Más de Dr. Jan Köhnlein

The Eclipse Layout Kernel sirius con 2017
The Eclipse Layout Kernel   sirius con 2017The Eclipse Layout Kernel   sirius con 2017
The Eclipse Layout Kernel sirius con 2017Dr. Jan Köhnlein
 
A New Approach Towards Web-based IDEs
A New Approach Towards Web-based IDEsA New Approach Towards Web-based IDEs
A New Approach Towards Web-based IDEsDr. Jan Köhnlein
 
Graphical Views For Xtext With FXDiagram
Graphical Views For Xtext With FXDiagramGraphical Views For Xtext With FXDiagram
Graphical Views For Xtext With FXDiagramDr. Jan Köhnlein
 
Diagram Editors - The FXed Generation
Diagram Editors - The FXed GenerationDiagram Editors - The FXed Generation
Diagram Editors - The FXed GenerationDr. Jan Köhnlein
 
Eclipse Diagram Editors - An Endangered Species
Eclipse Diagram Editors - An Endangered SpeciesEclipse Diagram Editors - An Endangered Species
Eclipse Diagram Editors - An Endangered SpeciesDr. Jan Köhnlein
 
A fresh look at graphical editing
A fresh look at graphical editingA fresh look at graphical editing
A fresh look at graphical editingDr. Jan Köhnlein
 
A fresh look at graphical editing
A fresh look at graphical editingA fresh look at graphical editing
A fresh look at graphical editingDr. Jan Köhnlein
 
A fresh look at graphical editing
A fresh look at graphical editingA fresh look at graphical editing
A fresh look at graphical editingDr. Jan Köhnlein
 
Pragmatic DSL Design with Xtext, Xbase and Xtend 2
Pragmatic DSL Design with Xtext, Xbase and Xtend 2Pragmatic DSL Design with Xtext, Xbase and Xtend 2
Pragmatic DSL Design with Xtext, Xbase and Xtend 2Dr. Jan Köhnlein
 

Más de Dr. Jan Köhnlein (20)

The Eclipse Layout Kernel sirius con 2017
The Eclipse Layout Kernel   sirius con 2017The Eclipse Layout Kernel   sirius con 2017
The Eclipse Layout Kernel sirius con 2017
 
A New Approach Towards Web-based IDEs
A New Approach Towards Web-based IDEsA New Approach Towards Web-based IDEs
A New Approach Towards Web-based IDEs
 
Responsiveness
ResponsivenessResponsiveness
Responsiveness
 
Getting rid of backtracking
Getting rid of backtrackingGetting rid of backtracking
Getting rid of backtracking
 
Graphical Views For Xtext With FXDiagram
Graphical Views For Xtext With FXDiagramGraphical Views For Xtext With FXDiagram
Graphical Views For Xtext With FXDiagram
 
XRobots
XRobotsXRobots
XRobots
 
Diagrams, Xtext and UX
Diagrams, Xtext and UXDiagrams, Xtext and UX
Diagrams, Xtext and UX
 
Scoping
ScopingScoping
Scoping
 
Xtext, diagrams and ux
Xtext, diagrams and uxXtext, diagrams and ux
Xtext, diagrams and ux
 
Diagram Editors - The FXed Generation
Diagram Editors - The FXed GenerationDiagram Editors - The FXed Generation
Diagram Editors - The FXed Generation
 
Code Generation With Xtend
Code Generation With XtendCode Generation With Xtend
Code Generation With Xtend
 
Graphical Views For Xtext
Graphical Views For XtextGraphical Views For Xtext
Graphical Views For Xtext
 
Eclipse Diagram Editors - An Endangered Species
Eclipse Diagram Editors - An Endangered SpeciesEclipse Diagram Editors - An Endangered Species
Eclipse Diagram Editors - An Endangered Species
 
Java DSLs with Xtext
Java DSLs with XtextJava DSLs with Xtext
Java DSLs with Xtext
 
DSLs for Java Developers
DSLs for Java DevelopersDSLs for Java Developers
DSLs for Java Developers
 
A fresh look at graphical editing
A fresh look at graphical editingA fresh look at graphical editing
A fresh look at graphical editing
 
A fresh look at graphical editing
A fresh look at graphical editingA fresh look at graphical editing
A fresh look at graphical editing
 
A fresh look at graphical editing
A fresh look at graphical editingA fresh look at graphical editing
A fresh look at graphical editing
 
Pragmatic DSL Design with Xtext, Xbase and Xtend 2
Pragmatic DSL Design with Xtext, Xbase and Xtend 2Pragmatic DSL Design with Xtext, Xbase and Xtend 2
Pragmatic DSL Design with Xtext, Xbase and Xtend 2
 
What's Cooking in Xtext 2.0
What's Cooking in Xtext 2.0What's Cooking in Xtext 2.0
What's Cooking in Xtext 2.0
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 

Último (20)

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 

EMF - Beyond The Basics

  • 1. Dr. Jan Köhnlein, itemis AG EMF – Beyond the Basics
  • 2.
  • 3. Eclipse Modeling Framework
  • 4. Eclipse Modeling Framework • Create Ecore models
  • 5. Eclipse Modeling Framework • Create Ecore models • from Java, XSD, UML, MOF
  • 6. Eclipse Modeling Framework • Create Ecore models • from Java, XSD, UML, MOF • or from scratch
  • 7. Eclipse Modeling Framework • Create Ecore models • from Java, XSD, UML, MOF • or from scratch • Generate Java-Code from Ecore
  • 8. Eclipse Modeling Framework • Create Ecore models • from Java, XSD, UML, MOF • or from scratch • Generate Java-Code from Ecore • Runtime library to process Ecore models and instances
  • 9. Ecore EPackage EClassifer * name:String name: String eClassifiers nsURI: String eSuperTypes * EClass EDatatype abstract: boolean eReferenceType eAttributeType * eStructuralFeatures EStructuralFeature name: String lowerBound: int upperBound: int EReference EAttribute containment: boolean * eOpposite
  • 12. Ecore Instances • EObject • Instance of an EClass
  • 13. Ecore Instances • EObject • Instance of an EClass • Values for EAttributes
  • 14. Ecore Instances • EObject • Instance of an EClass • Values for EAttributes • References for EReferences
  • 15. Ecore Instances • EObject • Instance of an EClass • Values for EAttributes • References for EReferences • Ecore is self-describing
  • 16. Ecore Instances • EObject • Instance of an EClass • Values for EAttributes • References for EReferences • Ecore is self-describing • EClass, EPackage etc. extend EObject
  • 17. Example Ecore/Instance << EPackage >> <<Node>> TreePackage parent parent myNode0 name: quot;Treequot; nsURI: quot;http://www.itemis..quot; <<EClass>> Node name: quot;Nodequot; children abstract: false <<EReference>> << EReference >> children parent name: quot;childrenquot; name: quot;parentquot; containment: true containment: false << Node >> << Node >> upperBound: -1 upperBound: 1 myNode2 myNode1 lowerBound: 0 lowerBound: 0 eOpposite eOpposite
  • 18. Example: Java View TreePackage::EPackage name: quot;Treequot; myNode0::Node nsURI: quot;http://www.itemis..quot; parent Node::EClass name: quot;Nodequot; children abstract: false ::EList children::EReference parent::EReference name: quot;childrenquot; name: quot;parentquot; containment: true containment: false upperBound: -1 upperBound: 1 myNode1::Node lowerBound: 0 lowerBound: 0 eOpposite eOpposite
  • 19. Example: Java View TreePackage::EPackage name: quot;Treequot; myNode0::Node nsURI: quot;http://www.itemis..quot; parent Node::EClass name: quot;Nodequot; children abstract: false ::EList children::EReference parent::EReference name: quot;childrenquot; name: quot;parentquot; containment: true containment: false upperBound: -1 upperBound: 1 myNode1::Node lowerBound: 0 lowerBound: 0 eOpposite eOpposite Node myNode0 = TreeFactory.eINSTANCE.createNode(); Node myNode1 = TreeFactory.eINSTANCE.createNode(); myNode0.getChildren().add(myNode1);
  • 20. Ecore Reflection EStructuralFeature * eStructuralFeatures EClass EObject eContents eClass getEStructuralFeature(String): eGet(EStructuralFeature): Object EStructuralFeature eSet(EStructuralFeature, Object) * * eClassifiers eContainer EPackage EFactory eFactory getEClassifier(String):EClassifier create(EClass):EObject
  • 21. Dynamic EMF // load Ecore file URI resourceURI = URI.createPlatformResourceURI( quot;de.itemis.treemodel/model/treemodel.ecorequot;, true); Resource resource = new XMIResourceImpl(resourceURI); // extract Ecore model EPackage treePackage = (EPackage) resource.getContents().get(0); EFactory factory = treePackage.getEFactoryInstance(); EClass nodeClass = (EClass) treePackage.getEClassifier(quot;Nodequot;); EStructuralFeature childrenReference = nodeClass.getEStructuralFeature(quot;childrenquot;); // create instances using reflective API EObject myNode0 = factory.create(nodeClass); EObject myNode1 = factory.create(nodeClass); ((EList) myNode0.eGet(childrenReference)).add(myNode1);
  • 24. References Resource Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element
  • 25. References Resource Element Element Element Element Element Containment Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element
  • 26. References Resource Element Element Element Element Element Containment Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Cross-References
  • 27. References Resource Resource Containment Element Element Element Element Element Containment Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Cross-References
  • 29. Lots of elements... Big Models
  • 30. Lots of elements... Big Models ...and lots of references
  • 31. Divide & Conquer
  • 32.
  • 33. Resource Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element
  • 34. ResourceSet Resource Resource Resource Resource Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element Element
  • 36. Proxy EObject • Not yet loaded EObject eIsProxy(): boolean • Instantiated on load for InternalEObject external reference eProxyURI(): String eSetProxyURI(String) • eProxyURI attribute set • Replaced on resolution EObjectImpl EcoreUtil resolve(EObject, ResourceSet) resolve(EObject, Resource) resolve(EObject, EObject)
  • 37. Proxy Resolution ResourceSet Resource PROXY Element Element Element Element
  • 38. Proxy Resolution ResourceSet Resource PROXY Element Element Element Element
  • 39. Proxy Resolution ResourceSet Resource Resource PROXY Element Element Element Element
  • 40. Proxy Resolution ResourceSet Resource Resource Element PROXY Element Element Element Element Element Element Element Element
  • 41. Proxy Resolution ResourceSet Resource Resource Element PROXY Element Element Element Element Element Element Element Element
  • 42. How about unloading? ResourceSet Resource Resource Resource (unloaded) PROXY Element Element PROXY Element Element Element Element PROXY PROXY Element Element PROXY Element
  • 43. How about unloading? ResourceSet Resource Resource Resource (unloaded) PROXY Element Element PROXY Element Element Element Element PROXY PROXY Element Element PROXY Element
  • 44. How about unloading? ResourceSet Resource Resource Resource (unloaded) PROXY Element PROXY Element PROXY Element PROXY Element Element Element PROXY PROXY Element Element PROXY PROXY PROXY Element PROXY
  • 45. Lazy Loading • Proxy Resolution / Lazy Loading • Transparently when navigating references • Unload • Proxifies elements • Keeps elements connected by default
  • 46. Enabling Proxies • For cross-references • Set EResource.isResolveProxies • For containment references • Additionally set GenModel.isContainmentProxies
  • 47. eProxyURI • Resource URI + Fragment [scheme:][//authority][/path][#fragment] • Examples: http://www.itemis.de/files/model.ecore#/ file:/Users/koehnlein/test.xmi#/children.0 platform:/resource/myproject/m2.uml#12345126
  • 48. Resource URIs • Relative or absolute URIConverter normalize(URI): URI createInputStream(URI): InputStream createOutputStream(URI): OutputStream • URIConverter exists(URI) delete(URI) getURIMap(): Map<URI, URI> • Resolves URIs • Access to resources ExtensibleURIConverter • Abstraction on * URIHandler canHandle(URI): boolean createInputStream(URI): InputStream I/O Access createOutputStream(URI): OutputStream exists(URI) delete(URI)
  • 50. Fragment Paths ::Resource uri=quot;http://www.itemis.de/model.treequot; • Example 0 ::Node • #/0/children.3 • Compact children • Fragile with respect .1 .2 .3 ::Node to reorderig ::Node ::Node
  • 51. Fragment Paths With Keys • Define EAttribute as key ::Resource uri=quot;http://www.itemis.de/model.treequot; for EReference 0 • Example ::Node name=quot;rootquot; • name key of children children • .Sven .Peter .Ed #/0/children.Ed ::Node name=quot;Svenquot; • Assert no collisions ! ::Node name=quot;Peterquot; ::Node name=quot;Edquot;
  • 52. EAttributes as ID ::Resource uri=quot;http://www.itemis.de/model.treequot; • Set ID flag on EAttribute 0 • Example ::Node index=0 • index defined as ID • #3 1 2 3 ::Node • Initialize without collisions index=1 ::Node index=2 ::Node index=3
  • 53. Extrinsic IDs ::Resource uri=quot;http://www.itemis.de/model.treequot; eObjectToIDMap = {...} • Resource manages IDs ::Node index=0 • Example quot;ab3827d8quot; • #276fe78d • UUIDs in UML2 ::Node ::Node quot;37fe34c2quot; ::Node quot;87f33bd2quot; quot;276fe78dquot;
  • 54. Tracking Inverse References
  • 55. ECrossReferenceAdapter Adapter notifyChanged(Notification) isAdapterForType(Object): boolean • Works for loaded Resources within EContentAdapter a ResourceSet ECrossReferenceAdapter getInverseReferences(EObject): List<Setting> getNonNavigableReferences(EObject): List<Setting>
  • 56. EMF Index • Indexes all resources in workspace • Query elements and cross-references
  • 57. EMF Index • Indexes all resources in workspace • Query elements and cross-references Load Resources
  • 60. EMF Transactions TransactionChangeRecorder beginRecording() ResourceSet endRecording() CommandStack TransactionalEditingDomain execute(Command) runExclusive(Runnable): Object undo() redo() RecordingCommand execute()
  • 63. Global Singletons • Configured with Eclipse extensions
  • 64. Global Singletons • Configured with Eclipse extensions • EPackage.Registry: Dynamic and static Ecore models
  • 65. Global Singletons • Configured with Eclipse extensions • EPackage.Registry: Dynamic and static Ecore models • Resource.Factory.Registry Resource implementations
  • 66. Global Singletons • Configured with Eclipse extensions • EPackage.Registry: Dynamic and static Ecore models • Resource.Factory.Registry Resource implementations • (Extensible)URIConverter
  • 67. Global Singletons • Configured with Eclipse extensions • EPackage.Registry: Dynamic and static Ecore models • Resource.Factory.Registry Override Resource implementations in • (Extensible)URIConverter Resource Set

Notas del editor