Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Global EPackage registry and Resource loading(EMF, global EPackage registry, AnyType)
Global EPackage registry and Resource loading [message #974772] Wed, 07 November 2012 10:07 Go to next message
Arati Rahalkar is currently offline Arati RahalkarFriend
Messages: 12
Registered: November 2012
Junior Member
I am reading an XML file using Resource, ResourceSet APIs of EMF. I have the EPackages registered for some parts of the XML file. Parts of my XML file are open to extensions, hence I do not have those EPackages registered statically in the ResourceSet Package registry, or by calling the eINSTANCE method directly in my code.

However, the plugins that provide these extensions are present in my Eclipse Equinox runtime. These plugins have the extension in the plugin.xml. As per the documentation I see that these EPaackages therefore should get registered in the Global EPackage registry. I am expecting therefore, that even though, I do not have register these EPackages in my ResourceSet's EPackage registry, at the time of de-serializing the XML, the EPackages <--> namespace mapping should be available in the global registry, and should hence get used.

However, I observe that when I deserialize this XML, those snippets of my XML file get mapped to AnyType, and the corresponding EPackage is not found.

So my questions are:
1. When do EPackages get registered in global EPackage Registry?
2. At the time of Resource load, will the global EPackage Registry get consulted?
3. I also looked at osgi console of Equinox, I do see the extension plugins / bundles available in the runtime. Is there any way to explicitly check the contents of the Global EPackage registry?

Thanks,
Arati
Re: Global EPackage registry and Resource loading [message #974791 is a reply to message #974772] Wed, 07 November 2012 10:22 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Arati,

Comments below.

On 07/11/2012 11:07 AM, Arati Rahalkar wrote:
> I am reading an XML file using Resource, ResourceSet APIs of EMF. I
> have the EPackages registered for some parts of the XML file. Parts of
> my XML file are open to extensions, hence I do not have those
> EPackages registered statically in the ResourceSet Package registry,
> or by calling the eINSTANCE method directly in my code.
>
> However, the plugins that provide these extensions are present in my
> Eclipse Equinox runtime. These plugins have the extension in the
> plugin.xml. As per the documentation I see that these EPaackages
> therefore should get registered in the Global EPackage registry. I am
> expecting therefore, that even though, I do not have register these
> EPackages in my ResourceSet's EPackage registry, at the time of
> de-serializing the XML, the EPackages <--> namespace mapping should be
> available in the global registry, and should hence get used.
Yes.
>
> However, I observe that when I deserialize this XML, those snippets of
> my XML file get mapped to AnyType, and the corresponding EPackage is
> not found.
>
> So my questions are:
> 1. When do EPackages get registered in global EPackage Registry?
When the EcorePlugin starts; so it's pretty much impossible for this not
to have happened before you get a chance to see the package registry.
> 2. At the time of Resource load, will the global EPackage Registry get
> consulted?
Normally, yes.
> 3. I also looked at osgi console of Equinox, I do see the extension
> plugins / bundles available in the runtime. Is there any way to
> explicitly check the contents of the Global EPackage registry?
With the debugger. You could try setting a breakpoint in
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(String) or
perhaps better in
org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleMissingPackage(String)
which will only be reached if the package's nsURI/namespace has not been
found in the registry.
>
> Thanks,
> Arati


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Global EPackage registry and Resource loading [message #981002 is a reply to message #974791] Mon, 12 November 2012 04:40 Go to previous message
Arati Rahalkar is currently offline Arati RahalkarFriend
Messages: 12
Registered: November 2012
Junior Member
Hi Ed,

Yes, I debugged, and as expected, the control goes to handleMissingPackage. I found out more in the code, and see that we are using a custom EPackage registry and registry manager, instead of using the default EPackageRegistryImpl. The way the EPackages are registered and made available is different than the default one, and hence the Epackages are not found.

Thanks,
Arati
Previous Topic:[CDO] Problem running clone example
Next Topic:Unexpected meta-model reloading improvement
Goto Forum:
  


Current Time: Fri Apr 26 00:47:15 GMT 2024

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

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

Back to the top