Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 340009 - org.eclipse.sphinx.emf.validation.bridge shall not start contributing plugin
Summary: org.eclipse.sphinx.emf.validation.bridge shall not start contributing plugin
Status: CLOSED FIXED
Alias: None
Product: Sphinx
Classification: Automotive
Component: Core (show other bugs)
Version: 0.7.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 0.7.0   Edit
Assignee: Stephan Eberle CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-15 08:32 EDT by Robert Kiss CLA
Modified: 2021-07-14 02:16 EDT (History)
1 user (show)

See Also:


Attachments
Patch (4.25 KB, patch)
2011-03-22 11:05 EDT, Robert Kiss CLA
idydieng: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Kiss CLA 2011-03-15 08:32:04 EDT
Build Identifier: 

Starting the org.eclipse.sphinx.emf.validation.bridge plugin currently trigger a start to all model plugins that the contributors to the org.eclipse.sphinx.emf.validation.registration extension point are referring. This is triggered in two different places:

1: Inside RulesExtReader#readElement(...) method the NsURI of the EMF package refered by the contribution is retrieved from registry which trigger a start of the plugin implementing the model. I suggest to do 
ePackageWrapper = EPackage.Registry.INSTANCE.get(tgt.getNsURI().toString());
instead of
ePackage = EPackage.Registry.INSTANCE.getEPackage(tgt.getNsURI().toString())
The first version will return either the EPackage or the EPackage.Descriptor, it should be enough to check the presence of the package.

2: Inside RulesExtCache#addExtension(IExtension)
There is an explicit call to load the bundle that contributed to the org.eclipse.sphinx.emf.validation.registration extension. I don't know why this is needed, if it really is, but temporary disabling it showed no impact on the application. 

Additionally, if starting with an empty workspace, with the above mentioned changes applied going to "Preferences\Model Validation\Constraints" trigger a load of contributed models even if all the information present lays only inside plugin.xml files. So there shouldn't be a reason to start the plugins. But I'm not sure if this is because of the Sphinx plugin or of the EMF Validation plugin.

Reproducible: Always
Comment 1 Stephan Eberle CLA 2011-03-17 10:48:38 EDT
(In reply to comment #0)
> Starting the org.eclipse.sphinx.emf.validation.bridge plugin currently trigger a
> start to all model plugins that the contributors to the
> org.eclipse.sphinx.emf.validation.registration extension point are referring.

I'm fully aware of that and agree that this is a very ugly kind of approach. It btw. is the reason why the progress bar which is displayed when starting a runtime workbench on a Sphinx workspace stops approx. in the middle and continues after a little while only.

> This is triggered in two different places:
> 
> 1: Inside RulesExtReader#readElement(...) method the NsURI of the EMF package
> refered by the contribution is retrieved from registry which trigger a start of
> the plugin implementing the model. I suggest to do
> ePackageWrapper = EPackage.Registry.INSTANCE.get(tgt.getNsURI().toString());
> instead of
> ePackage = EPackage.Registry.INSTANCE.getEPackage(tgt.getNsURI().toString())
> The first version will return either the EPackage or the EPackage.Descriptor, it
> should be enough to check the presence of the package.

Agreed.

> 2: Inside RulesExtCache#addExtension(IExtension)
> There is an explicit call to load the bundle that contributed to the
> org.eclipse.sphinx.emf.validation.registration extension. I don't know why this
> is needed, if it really is, but temporary disabling it showed no impact on the
> application.

I have to admit that I also don't know the reason for the explicit contributor bundle loading approach. I agree with removing it. It clearly violates the good old Eclipse lazy loading house rule. If ever we should encounter side effects because of that later on then we can reopen this bug and think of a better solution than the current implementation for getting around this side effect.
Comment 2 Robert Kiss CLA 2011-03-22 11:05:16 EDT
Created attachment 191688 [details]
Patch

Patch attached
Comment 3 Stephan Eberle CLA 2011-03-25 12:38:57 EDT
Fixed by applying proposed patch.
Comment 4 Balazs Grill CLA 2021-07-14 02:16:37 EDT
Mass-closing Resolved tickets