Bug 494766 - Aird reorganisation
Summary: Aird reorganisation
Status: CLOSED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 3.1.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 4.1.0   Edit
Assignee: Laurent Fasani CLA
QA Contact: Julien Dupont CLA
URL:
Whiteboard:
Keywords: triaged
Depends on: 493367
Blocks: 493353 501515
  Show dependency tree
 
Reported: 2016-05-27 10:49 EDT by Maxime Porhel CLA
Modified: 2016-10-18 11:06 EDT (History)
3 users (show)

See Also:


Attachments
Aird - phase 2 (208.33 KB, image/png)
2016-05-27 10:49 EDT, Maxime Porhel CLA
no flags Details
Aird - phase 2 experimental mode (112.32 KB, image/png)
2016-05-27 10:50 EDT, Maxime Porhel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maxime Porhel CLA 2016-05-27 10:49:30 EDT
Created attachment 262082 [details]
Aird - phase 2

This is the phase 2 of Bug 493353 - Representation persistence improvements.

Phase 1 has be done in Bug 493367.

The idea of this second phase is to reorganise the aird content in order to remove the DRepresentation from the DView in favor of the DRepresentationDescriptor introduced in phase 1, ie. the DRepresentation and their graphical data (GMF model, ComputedStyleDescriptionRegistry, ..) will be stored in the DAnalysisCustomData or as additional roots of the aird. 

A DRepresentation will no more have its DAnalysis in its ancestor : several queries, helper and way to retrieve the session, the aird, the Danalysis will have to be modified. 

The serialization order changes will require a specific ExtendedMetaData put on aird resource. We currently set one for migration purpose when required. We will need to look at: 
 . org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.Lookup.listFeatures(EClass)
 . org.eclipse.emf.ecore.util.ExtendedMetaData.getAllElements(EClass) and maybe provide our own specific "aird" ExtendedMetaData (do not forget that we already have one in case of detected migration needs).
Without this, the feature order follows the inheritance tree and the declaration order of the structural features but we might want to mix this: description of DRepresentation is not declared on the DRepresentationEClass but on each concrete representation class but for human readability and parsing speed, it would be great to serialize it before the content of a representation and not at the end of it.

We also would like at the end of this phase an experimental mode to put the representations in their own files.

This will require: 
 . the introduction of a "repPath" attribute on the DRepresentationDescriptor with the corresponding new datatype if required
 . the modification of DRepresentationDescriptor#representation to become derived|transient (volatile|changeable values will be decided later )
 . a migration to move the DRepresentations at the end of the file and to support the repPath and derived representation reference.
 . a "repFile" resource implementation with load instrumentation and migration capabilities (see aird and odesign resources).
 . modification of the migration/repair action
 . impact analysis of the load with first improvements of the ux.
 . a specification of the DRepresentationDescriptor "from aird vs from repfile" synchronization.
Comment 1 Maxime Porhel CLA 2016-05-27 10:50:07 EDT
Created attachment 262083 [details]
Aird - phase 2 experimental mode
Comment 2 Maxime Porhel CLA 2016-05-27 10:53:55 EDT
For the Phase 2 and to allow the experimental implementation of the one resource per representation mode,
the metamodel will need several modifications. The goal is to be able to delay the load of the graphical data, ie.
DRepresentation:
 . representationPath: a new datatype is required to store the URI of the representation (see work done in Bug 456351 in which models links have been replaced by semantic resources datatype on DAnalysis).
 . representation:DRepresentation [0..1] derived|transient|volatile|nonChangeable – reference to the
representation
   . will be computed/set during load/opening of the DRepresentation
   . might trigger the repfile load
   . we might decide to use eIsSet or null value to know that the representation has not been loaded
   . changeable or not || volatile or not: might change after discussion with team on how/where to reference the concrete representation (see next section)
 . The migration will be updated to handle the changes done here.

We have several options to manage the DRepresentationDescriptor in the repfile:
 . we might create an abstract DRepDescriptor class and two concrete subclasses: one for the aird, the second for the repfile with different implementation of the path/representation features.
 . it is not clear yet if the DRepresentationDescriptor of the repfile really needs to be serialized as it can be computed during load but also parsing or directly computed from the DRepresentation when needed for comparison, checks or update of the DRepresentationDescriptor from the .aird file. Depending on this choice, we might need a root container in the new file.
 . Representation might inherit from DRepresentationDescriptor: this does not look safe

This will have to be discussed in phase 2 to choose the final implementation to do in phase 3.
Comment 3 Maxime Porhel CLA 2016-05-27 10:57:24 EDT
Implementation of the links/references between a DRepresentation and its DRepresentationDescriptor(s)

A specific adapter could be used to manage the load/sync. It will be created on each DRepresentationDescriptor loaded from the aird and will also be added to its eAdapters list.
It might be used to store the loaded representation, the DRepresentationDescriptor#representation can then be volatile and non changeable.
It will be used to synchronize the changes done on the representations or on its descriptor(s).

The synchronization mechanism will be detailed later, but it needs to avoid reentrant calls and the amount
of notification must be minimized.

It might also be the support of the synchronization for the permissions on the representation and/or its descriptor (IPermissionAuthority / locks).
Comment 4 Maxime Porhel CLA 2016-05-27 10:59:13 EDT
User Interface Changes - Phase 2
 . transparent changes for use: editor input, saveable, open from markers, eclipse restart with opened editors
 . No UI to activate/deactivate the 'one file per representation experimental mode'
 . Experimental Content provider / file management choice
 . hidden folder/file, name pattern, file extension will have to be specified in this phase.
 . experimental mode: several scenario/choices could be evaluated (might need to sync with Capella, ...)
Comment 5 Maxime Porhel CLA 2016-05-27 11:00:23 EDT
Notes:

During poc implementation (auto-control of the contained representations), I used the following file pattern
 . representations.aird (default name will have to be changed)
 . .representation_aird
      . Neon forbids to save representation.aird folder if a file with the same name exists, I had no issues with Mars
      . we must not forget that the file systems of the targeted system (Windows, Linux, Mac) might have different capabilities.
 . .representation_aird/xxxxxxxxxxx.repfiles where xxxxxxxxxxx is the uriFragment of the representation before control.
Comment 6 Maxime Porhel CLA 2016-05-27 11:01:24 EDT
Tests and Non-regression strategy - Phase 2

 . Existing tests will be adapted for this phase (see UI changes for a list regressions to avoid)
 . Migration test: serialization changes, DRepresentation moves
 . Experimental mode can be tested through local tests after improvements and adaptation of the poc test patch sets.
Comment 7 Eclipse Genie CLA 2016-06-07 11:14:51 EDT
New Gerrit change created: https://git.eclipse.org/r/74795
Comment 8 Eclipse Genie CLA 2016-06-07 11:15:00 EDT
New Gerrit change created: https://git.eclipse.org/r/74797
Comment 9 Eclipse Genie CLA 2016-06-07 11:15:03 EDT
New Gerrit change created: https://git.eclipse.org/r/74796
Comment 10 Eclipse Genie CLA 2016-06-09 11:34:11 EDT
New Gerrit change created: https://git.eclipse.org/r/74994
Comment 11 Eclipse Genie CLA 2016-06-09 11:34:16 EDT
New Gerrit change created: https://git.eclipse.org/r/74993
Comment 12 Eclipse Genie CLA 2016-06-17 06:09:44 EDT
New Gerrit change created: https://git.eclipse.org/r/75447
Comment 13 Eclipse Genie CLA 2016-08-10 10:56:43 EDT
New Gerrit change created: https://git.eclipse.org/r/78767
Comment 14 Eclipse Genie CLA 2016-08-17 09:12:43 EDT
New Gerrit change created: https://git.eclipse.org/r/79193
Comment 15 Eclipse Genie CLA 2016-08-22 05:45:07 EDT
New Gerrit change created: https://git.eclipse.org/r/79422
Comment 16 Eclipse Genie CLA 2016-08-24 10:33:41 EDT
New Gerrit change created: https://git.eclipse.org/r/79634
Comment 30 Laurent Fasani CLA 2016-08-26 05:37:35 EDT
To sum up, the commits related to this ticket are about the second step to save the DRepresentation in its own resource.
@org.eclipse.sirius.viewpoint.DView.getOwnedRepresentations()@ has been removed. The @DRepresentation@ is now created as root element of the representations resource. The main impact is on the core of Sirius but also potentially on client Sirius customization. Each peace of code that makes the supposition that the @DView@ is the container of the @DRepresentation@ must be reworked. The code using methods in the following list may be concerned by the rework:
** @EObject.eContainer()@. If the object is a @DRepresentation@, its container is now null.
** @EcoreUtil.getRootContainer(xxx)@. The root container of a DDiagramElement is the @DRepresentation@ and not the @DAnalysis@ any more.
** @EcoreUtil.isAncestor(xxx)@. the @DView@ is not an ancestor of a @DRepresentation@ (or its content) anymore.

As a developer, the followings utility methods will help you to migrate your code following the second step described above:
** @org.eclipse.sirius.business.api.query.DViewQuery.getLoadedRepresentations()@ replaces the removed @DView.getOwnedRepresentations()@ method. It provides all the loaded representations holds by a @DView@. In this step, all that representations are always loaded as they are into the .aird resource.
** @org.eclipse.sirius.business.api.query.DViewQuery.getAllContentInRepresentations(final Predicate<? super EObject>)@ provides the content of a @DView@ according to a predicate.
** @org.eclipse.sirius.business.api.query.DRepresentationQuery.getRepresentationDescriptor()@ provides the @DRepresentationDescriptor@ which references the @DRepresentation@.
** @org.eclipse.sirius.business.api.query.EObjectQuery.getDAnalysis()@ allows to retrieve a DAnalysis from a @DRepresentationElement@
Comment 31 Eclipse Genie CLA 2016-08-26 05:59:43 EDT
New Gerrit change created: https://git.eclipse.org/r/79815
Comment 33 Julien Dupont CLA 2016-10-04 09:59:45 EDT
Technical issue
Comment 34 Pierre-Charles David CLA 2016-10-18 11:06:33 EDT
Available in Sirius 4.1.0, see https://wiki.eclipse.org/Sirius/4.1.0 for details.