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 |
Arati Rahalkar 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 |
Ed Merks Messages: 33145 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/
|
|
| |
Goto Forum:
Current Time: Mon May 06 03:26:39 GMT 2024
Powered by FUDForum. Page generated in 0.03562 seconds
|