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

Bug 320486

Summary: Java discoverer : retrieve source regions visited
Product: [Modeling] MoDisco Reporter: Fabien Giquel <fabien.giquel>
Component: TechnologiesAssignee: Fabien Giquel <fabien.giquel>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: hugo.bruneliere, modisco.web-inbox, nicolas.guyomar
Version: 0.9.0Flags: fabien.giquel: indigo+
Target Milestone: 0.9.0 M1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Listener mechanism to prepare Java model weaving with kdm one
fabien.giquel: iplog+
Listener mechanism to prepare Java model weaving with kdm one fabien.giquel: iplog+

Description Fabien Giquel CLA 2010-07-21 06:57:33 EDT
In order to prepare the weaving with kdm.source models (files representation), the Java discoverer must be instrumented in order to retrieve the source regions informations (startPosition, startLine, ...) outside of the discoverer.

Such a need will appear for other discoverers, so a generic mechanism may be provided for such informations retrieving.
Comment 1 Nicolas Guyomar CLA 2010-07-22 09:24:40 EDT
Hi Fabien,

Please find attached a generic mechanism of listeners in order to prepare the weaving between kdl.source models and MoDisco Java ones

The Java Reader now raises a flag each time a Compilation Unit is computed. Those events can be captured simply by adding a SourceVisitListener to the used JavaDiscoverer instance

Projects concerned by this patch are : 

org.eclipse.gmt.modisco.infra.discoverymanager
org.eclipse.gmt.modisco.java.discoverer

1. I, Nicolas Guyomar, and others contributors listed in this bug, authored
100% of the content
2. I have the rights to donate the content to Eclipse under the EPL
3. I have already provided the filled Employer Consent Forms to the Foundation

Regards

Nicolas
Comment 2 Nicolas Guyomar CLA 2010-07-22 09:25:32 EDT
Created attachment 174972 [details]
Listener mechanism to prepare Java model weaving with kdm one
Comment 3 Fabien Giquel CLA 2010-07-22 13:42:18 EDT
Hi Nicolas,
thanks for the contribution.

There is something wrong in your implementation of observable/observer pattern :
- the SourceVisitListener should only be an interface in infrastructure.
- the infrastructure must not reference any project from the Java layer.

PS : the Java discoverer has been slightly modified (fix on bug 309606) since you have created the patch. Could you synchronize and create again the patch ?

Fabien.
Comment 4 Nicolas Guyomar CLA 2010-07-23 06:05:45 EDT
Created attachment 175047 [details]
Listener mechanism to prepare Java model weaving with kdm one

This version of the patch does not referenced java layer component
SourceVisitListener is now an interface
Comment 5 Fabien Giquel CLA 2010-07-23 06:44:06 EDT
Now everything looks good. Thanks !

The fix has been commited into SVN.
Comment 6 Hugo Bruneliere CLA 2010-10-05 04:22:14 EDT
The patch has been successfully applied.