Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » Programmatically invoking a match engine
Programmatically invoking a match engine [message #1745347] Fri, 07 October 2016 16:20 Go to next message
Vlad Acretoaie is currently offline Vlad AcretoaieFriend
Messages: 95
Registered: April 2014

I am working on an application that stores EMF models remotely in a Git repository for the purpose of collaborative modeling. My application requires the ability to pull remote model changes, and I would like to use EMF Compare for detecting conflicts.

My first attempt at conflict detection using JGit's ResolveMerger class failed (quite predictably, since JGit is not model-aware).

So I tried replacing my original JGit merger:

ResolveMerger merger = (ResolveMerger) MergeStrategy.RESOLVE.newMerger(repo, true);

with the following EMF Compare merger:

ResolveMerger merger = (ResolveMerger) new StrategyRecursiveModel().newMerger(repo, true);

However, I still get unexpected conflicts. I suspect I may not be instantiating the EMF Compare merger properly, or that it may need some customization for my particular models (i.e. somehow extending the DefaultMatchEngine).

Are there any examples or guides for how to properly invoke the EMF Compare match engine programmatically in a scenario such as the one I described? So far I consulted the EMF Compare developer guide. The code snippets I found there are very useful, but it appears they are somewhat incomplete as a how-to guide.

Thanks in advance!
Re: Programmatically invoking a match engine [message #1745532 is a reply to message #1745347] Wed, 12 October 2016 07:46 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1897
Registered: July 2009
Senior Member

Using the JGit mergers directly involves quite a bit or work and setting up. Make sure you look at the other places where they are used in the JGit and EGit code bases to see how they are initialized and invoked. You need to make sure the comparison engine actually has access to all the data it needs to compare your revisions.

As for your conflicts, I'd suggest you try directly from eclipse instead of using your custom code to invoke EMF Compare through git actions such as Team > Compare With > Revision and see if you get the result you're expecting or not. If not, then yes, you will have to customize the match and diff engines to properly detect the kind of conflicts (or lack of conflicts) you envision. I'd suggest taking a look at what you can do through post-processing of the differences model since that is usually enough. The developer guide explains how to provide your custom post-processor through extension points so that they are "seen" at runtime by EMF Compare when it is invoked for a comparison.

Laurent Goubet
Previous Topic:CompareEditor with custom file format
Next Topic:Using EMFResourceMappingMerger in core
Goto Forum:

Current Time: Sat Jul 02 03:21:56 GMT 2022

Powered by FUDForum. Page generated in 0.02937 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top