Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Life of a Resource (XtextCON 2015)

Life of a Resource (XtextCON 2015)

Avatar for Sven Efftinge

Sven Efftinge

May 20, 2015
Tweet

More Decks by Sven Efftinge

Other Decks in Technology

Transcript

  1. At 
 First 
 There Was 
 Text entity This

    { thisProperty : int op thisOperation(That that) { return that.thatOperation(this) } } entity That { thatProperty : String op thatOperation(This _this) { _this.thisProperty + thatProperty } }
  2. ‘This.dmodel’ EObject EObject EObject node node node node node node

    Node Model Concrete Syntax Tree Trace between grammar, 
 text and model
  3. Install Proxies ‘This.dmodel’ EObject EObject EObject proxy proxy • Container

    EObject • EReference • Concrete Text (the node) platform:/resource/my.project/src/This.dmodel#|1
  4. class } class } Install Derived State (pre Index) No

    index lookup allowed! entity This { thisProperty : int op thisOperation(That that) { return that.thatOperation(this) } } entity That { thatProperty : String op thatOperation(This _this) { _this.thisProperty + thatProperty } }
  5. class } class } Install Derived State (pre Index) No

    index lookup allowed! entity This { thisProperty : int op thisOperation(That that) { return that.thatOperation(this) } } entity That { thatProperty : String op thatOperation(This _this) { _this.thisProperty + thatProperty } }
  6. Collecting Global Names (aka indexing) Collect all globally visible symbols.

    ResourceDescriptionManager.getResourceDescription() entity This { thisProperty : int op thisOperation(That that) { return that.thatOperation(this) } } entity That { thatProperty : String op thatOperation(This _this) { _this.thisProperty + thatProperty } } class } class }
  7. entity That { thatProperty : String op thatOperation(This _this) {

    _this.thisProperty + thatProperty } } class private String thatProperty public String getThatProperty() { … } public void setThatProperty(String thatProperty) { … }
 public LAZY_TYPE thatOperation(This _this) { … } } Install Derived State (post! Index) Index lookup allowed!
  8. Full Resolution entity This { thisProperty : int op thisOperation(That

    that) { return that.thatOperation(this) } } Where to find ‘That’? Ask the world (aka index)
  9. entity This { thisProperty : int op thisOperation(That that) {

    return that.thatOperation(this) } } Where to find ‘thatOperation’? Ask ‘That’ (variable type) Full Resolution
  10. Proxy Resolution ‘This.dmodel’ EObject EObject EObject proxy proxy urceSet ‘That.dmodel’

    EObject EObject EObject /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public JvmType getType() { if (type != null && type.eIsProxy()) { InternalEObject oldType = (InternalEObject)type; type = (JvmType)eResolveProxy(oldType); if (type != oldType) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, 
 TypesPackage.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE, 
 oldType, type)); } } return type; }
  11. ‘This.dmodel’ EObject EObject EObject proxy proxy urceSet ‘That.dmodel’ EObject EObject

    EObject BasicEObjectImpl#eResolveProxy(..)
 
 EcoreUtil#resolve(..)
 
 ResourceSet#getResource(URI-part)
 
 Resource#getEObject(fragment) Proxy Resolution
  12. Incremental Build Given 1) Existing Index 2) physically changed URIs

    entity This { thisProperty : int op thisOperation(That that) { return that.thatOperation(this) } } entity That { thatProperty : String op thatOperation(This _this) { _this.thisProperty + thatProperty } } Bazz platform:/resource/my.project/src/This.dmodel Change in
  13. #1 : Create & Load #2 : Pre-Index installDerivedState #3

    : create ResourceDescriptionDelta platform:/resource/my.project/src/This.dmodel Affection Analysis IResourceDescription.Manager#isAffected for (allDescriptions)
  14. #isAffected Is there an outgoing reference? entity This { thisProperty

    : int op thisOperation(That that) { return that.thatOperation(this) } } entity That { thatProperty : String op thatOperation(This _this) { _this.thisProperty + thatProperty } } Bazz This Does the delta contain a name, that has been asked for?
  15. More Specialities • Container Manager • Dirty state • Clustering

    • Integration with Java • Exceptions: Active Annotations