Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 361612

Summary: [Restructuring] New core for new version of the Facet metamodel
Product: z_Archived Reporter: Nicolas Bros <nicolas.bros>
Component: EMF-FacetAssignee: Nicolas Bros <nicolas.bros>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P1 CC: emft.facet-inbox, gdupe
Version: unspecifiedFlags: gdupe: juno+
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 352718    
Attachments:
Description Flags
patch for org.eclipse.emf.facet.efacet.catalog
nicolas.bros: iplog+
patch for org.eclipse.emf.facet.efacet.core
nicolas.bros: iplog+
patch for org.eclipse.emf.facet.efacet2.tests
nicolas.bros: iplog+
patch for org.eclipse.emf.facet.query.java.core
nicolas.bros: iplog+
FacetManager.testConformance(EObject, Facet) patch nicolas.bros: review+

Description Nicolas Bros CLA 2011-10-21 04:00:41 EDT
The new version of the Facet metamodel (eFacet2) leads to modifications in the core Facet plug-ins:
- org.eclipse.emf.facet.efacet.core
- org.eclipse.emf.facet.query.java.core
- org.eclipse.emf.facet.efacet.catalog

This bug is to track these modifications.
Comment 1 Nicolas Bros CLA 2011-10-21 04:46:35 EDT
Created attachment 205697 [details]
patch for org.eclipse.emf.facet.efacet.catalog
Comment 2 Nicolas Bros CLA 2011-10-21 04:46:53 EDT
Created attachment 205698 [details]
patch for org.eclipse.emf.facet.efacet.core
Comment 3 Nicolas Bros CLA 2011-10-21 04:47:12 EDT
Created attachment 205699 [details]
patch for org.eclipse.emf.facet.efacet2.tests
Comment 4 Nicolas Bros CLA 2011-10-21 04:47:28 EDT
Created attachment 205700 [details]
patch for org.eclipse.emf.facet.query.java.core
Comment 5 Nicolas Bros CLA 2011-10-21 04:52:09 EDT
I committed these modifications in revision 996.
Comment 6 Gregoire Dupe CLA 2011-10-25 12:08:19 EDT
There is a warning in a section modified by the fixing of this bug (org.eclipse.emf.facet.efacet.core.FacetUtils, line 43). This must be fixed.
Comment 7 Nicolas Bros CLA 2011-10-26 05:11:19 EDT
(In reply to comment #6)
> There is a warning in a section modified by the fixing of this bug
> (org.eclipse.emf.facet.efacet.core.FacetUtils, line 43). This must be fixed.

This is because this method is a stub. I have commented out the unfinished code in revision 1030.
Comment 8 Nicolas Bros CLA 2011-11-04 11:29:32 EDT
I committed an interface and implementation of the Facet manager (to get and set the values of Facet attributes and references, and evaluate Facet operations) in revision 1059.
Comment 9 Nicolas Bros CLA 2011-11-08 09:50:28 EST
I continued the implementation of the facet manager and I fixed the unit tests in org.eclipse.emf.facet.efacet2.tests by restoring the previous API and redirecting to the new implementation in revision 1069.
Comment 10 Gregoire Dupe CLA 2011-11-09 09:52:59 EST
There is a warning on org.eclipse.emf.facet.efacet.core.internal.FacetManager.createAndCheckOperationParameterValues(EOperation, Class<T>, Object...)
Comment 11 Gregoire Dupe CLA 2011-11-10 05:57:56 EST
To my mind EList should not be used in org.eclipse.emf.facet.efacet.core.IFacetManager because all the lists returned by this API are not real model links.
Comment 12 Nicolas Bros CLA 2011-11-10 09:21:50 EST
In revision 1088 I finished implementing the behaviors that were broken when moving to the new version of the metamodel : conformance tests for Facets using a boolean DerivedTypedElement, error checks
Comment 13 Nicolas Bros CLA 2011-11-10 11:25:57 EST
In revision 1091 I added a check for conformance of the Facet before each get or set, except in the get called from testConformance to avoid an infinite recursion
Comment 14 Nicolas Bros CLA 2011-11-10 11:26:23 EST
In revision 1090 I added a few more unit tests for error cases in the FacetManager
Comment 15 Gregoire Dupe CLA 2011-11-29 15:11:30 EST
Created attachment 207686 [details]
FacetManager.testConformance(EObject, Facet) patch

Hello Nicolas,

I think that in the method org.eclipse.emf.facet.efacet.core.internal.FacetManager.testConformance(EObject, Facet) the case of an EFacet extending the EObject class has not be managed.
The attached patch proposes a fix of this method.

Please, can you review this patch ?

Regards,
Grégoire
Comment 16 Gregoire Dupe CLA 2011-11-29 15:42:40 EST
To implements the EMF Facet customization features, I need to have the capability override a facet attributes. (I have extended this requirement to all the DerivedTypedElements)

That's why I've committed an update of the efacet2 meta-model.

Committed revision 1185.

cf. Bug 361794: https://bugs.eclipse.org/bugs/show_bug.cgi?id=361794#c11
Comment 17 Gregoire Dupe CLA 2011-12-01 09:58:47 EST
With Nicolas Bros, we have refactored the class FacetManager to improve its maintenability.

Committed revision 1195.
Comment 18 Nicolas Bros CLA 2011-12-02 09:50:42 EST
revision 1200:
- simplified the IDerivedTypedElementManager (patch from Gregoire) and refactored the corresponding implementation
- disabled the batch evaluation for now (cf Bug 365429)
- adapted the javadoc to the new interfaces
Comment 19 Nicolas Bros CLA 2011-12-02 09:58:58 EST
I fixed the javadoc of IDerivedTypedElementCollectionImplementation in revision 1201.
Comment 20 Gregoire Dupe CLA 2011-12-04 18:28:23 EST
The class FacetManger is the main important class of EMF Facet, that why I began to clean it by following PMD recommandations.
I expect that this work will improve the maintainability of EMF Facet. I haven’t fixed all the PMD warnings on this class. The main reaming warnings are the "Cyclomatic Complexity" ones.

Committed revision 1206.
Comment 21 Nicolas Bros CLA 2011-12-05 10:20:53 EST
I added tests for the serialization of the DerivedTypedElement*Result in revision 1219.
Comment 22 Gregoire Dupe CLA 2011-12-05 12:53:46 EST
I’ve continued to improve the FacetManger maintainability. I’ve solved the "Cyclomatic Complexity" warnings and moved some static methods the classes EmfUtils, CastUtils, SerializationUtils.
Comment 23 Gregoire Dupe CLA 2011-12-06 04:49:10 EST
The meta-model move may have broken the build:

MESSAGE ERROR   [0033] : No suitable provider for component org.eclipse.emf.facet.efacet2.metamodel:osgi.bundle was found in resourceMap file:/opt/users/hudsonbuild/workspace/emffacet-nightly/sourceTree/releng/org.eclipse.emf.facet.releng.buckminster/emffacet.rmap
Comment 24 Gregoire Dupe CLA 2011-12-06 13:24:39 EST
(In reply to comment #23)
> The meta-model move may have broken the build:
> 
> MESSAGE ERROR   [0033] : No suitable provider for component
> org.eclipse.emf.facet.efacet2.metamodel:osgi.bundle was found in resourceMap
> file:/opt/users/hudsonbuild/workspace/emffacet-nightly/sourceTree/releng/org.eclipse.emf.facet.releng.buckminster/emffacet.rmap

fixed: cf; https://bugs.eclipse.org/bugs/show_bug.cgi?id=361823#c19
Comment 25 Gregoire Dupe CLA 2011-12-06 13:25:43 EST
I’ve finished to clean all PMD warnings in the class "FacetManager"

Committed revisions: 1233-1244
Comment 26 Gregoire Dupe CLA 2011-12-06 13:34:05 EST
The PMD warning cleaning of FacetManager has caused a change of exception type. That why I've modified the following unit test method:

Committed revision 1245.
Comment 27 Nicolas Bros CLA 2011-12-12 04:19:57 EST
(In reply to comment #25)
> Committed revisions: 1233-1244

In these commits, all the methods from SerializationUtils are duplicated in SerializationManager:

createMultiValuedContainmentReferenceInstance
getExtendedEObjectReference
createMultiValuedAttributeInstance
createMultiValuedReferenceInstance
getSingleValuedAttributeInstance
getMultiValuedAttributeInstance
getSingleValuedReferenceInstance
getSingleValuedContainmentReferenceInstance
getMultiValuedReferenceInstance
getMultiValuedContainmentReferenceInstance
Comment 28 Gregoire Dupe CLA 2011-12-14 03:57:23 EST
(In reply to comment #27)

I removed the class SerializationUtils.

Committed revision 1272.
Comment 29 Gregoire Dupe CLA 2012-01-25 03:55:16 EST
The file svn+ssh://dev.eclipse.org/svnroot/modeling/org.eclipse.emft.facet/trunk/tests/org.eclipse.emf.facet.efacet2.tests/src/org/eclipse/emf/facet/efacet2/tests/internal/DerivedTypedElementResultSerializationTests.java doesn't contains any copyright header.
Comment 30 Gregoire Dupe CLA 2012-03-28 04:45:25 EDT
I've committed a patch taking care that the conformance constraints are inherited from the super facet.

Committed revision 1974.
Comment 31 Gregoire Dupe CLA 2012-05-31 08:05:28 EDT
The facet manager work well, so we can close this bug.