Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » Plugin vs. standalone configuration of EMF Compare
Plugin vs. standalone configuration of EMF Compare [message #1338969] Wed, 07 May 2014 13:03 Go to next message
Anja Hansen is currently offline Anja HansenFriend
Messages: 10
Registered: March 2014
Junior Member
With reference to: http://www.eclipse.org/emf/compare/documentation/latest/developer/developer-guide.html#Putting_it_all_together
I have a number of questions that I hope you can help with regarding the differences between the standalone-configuration and the plugin-configuration

I'm trying to setup a system where we will support comparisons both from command line (standalone) and via eclipse plugins.
Due to this I'm trying to narrow down the number of different "configurations" of EMF that I need to handle in the two scenarios.


standalone:
IMatchEngine.Factory matchEngineFactory = new MatchEngineFactoryImpl(matcher, comparisonFactory);
matchEngineFactory.setRanking(20);
IMatchEngine.Factory.Registry matchEngineRegistry = new MatchEngineFactoryRegistryImpl();
matchEngineRegistry.add(matchEngineFactory);

plugin:
IMatchEngine.Factory.Registry matchEngineRegistry = EMFCompareRCPPlugin.getDefault().getMatchEngineFactoryRegistry();

Question (1):
What are the main differences between the two match engine registries?
Why is only one of them using a ranking?

Question (2):
What is the relevance of the magic number 20 in ranking?
What will happen if I turn it up or down?





standalone - load:
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl());

plugin - load:
no use of the registry.

Question (3):
Is the line omitted because the plugin/Eclipse sets up the dependency automatically?
Will it do any harm to have the line when running in a plugin setup?





In both examples you have these lines of code:
IEObjectMatcher matcher === DefaultMatchEngine.createDefaultEObjectMatcher(UseIdentifiers.NEVER);
IComparisonFactory comparisonFactory === new DefaultComparisonFactory(new DefaultEqualityHelperFactory());
IMatchEngine matchEngine === new DefaultMatchEngine(matcher, comparisonFactory);

Question (4):
The matchEngine (and thereby the matcher and the comparisonFactory) is never used in the plugin-setup.
Can the lines just be deleted?

Kind regards

Anja
Re: Plugin vs. standalone configuration of EMF Compare [message #1351937 is a reply to message #1338969] Tue, 13 May 2014 08:19 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi Anja,

Question 1 : the two registries use rankings, that's how the match engines are ordered within it. You "see" it for the first since it is needed to created the engine and add it to the registry, whereas in the second example the engines are already registered (through extension points).

Question 2 : "20" was the ranking we used for our default engines when we first introduced the extension point, so that users may use a lower ranking to have an even lower-priority engine than the default. As you can see with the link above, we've switched that back to 0 for the default engine : since it can handle any model, an engine of lower priority would never be used... You can change this value however you see fit : the higher, the more priority we give to the match engine (we use "the highest ranking engine that is capable of matching the given models").

Question 3 : When running from Eclipse, this registry will be populated by EMF through its extension points. In standalone, it will be empty (or mostly empty). We need to manually add the registrations we need. For a basic xmi resource, a "new XMIResourceFactoryImpl()" like in this exemple is enough, but other models might need much more than that (see also what's needed for UML as an example). This line shouldn't have any bad effect when running in a plugin setup, but you should be able to "guard" this by using something like "if (!EMFPlugin.IS_ECLIPSE_RUNNING) {/* Standalone code. */}"

Question 4 : yup, seems like an overlook, the engine by default will have been registered through extension point, there is no need to instantiate one.

Laurent Goubet
Obeo
Re: Plugin vs. standalone configuration of EMF Compare [message #1384240 is a reply to message #1351937] Wed, 28 May 2014 13:46 Go to previous message
Anja Hansen is currently offline Anja HansenFriend
Messages: 10
Registered: March 2014
Junior Member
Thanks a lot for the answers.
Now the code makes a lot more sense.
Previous Topic:CompareConfiguration in v3.0 RC1
Next Topic:Post processing matches breaks navigation to differences
Goto Forum:
  


Current Time: Fri Mar 29 15:22:34 GMT 2024

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

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

Back to the top