Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » multiple namespaces in one editor supported?
multiple namespaces in one editor supported? [message #411923] Fri, 10 August 2007 09:09 Go to next message
Rene Ladan is currently offline Rene LadanFriend
Messages: 51
Registered: July 2009
Member
Hi,

say I have metamodel A with namespace http://mm.A/ which is a superset
of metamodel B with namespace http://mm.B/ .

If I generate an EMF editor using namespace A, it can by default not
read legacy files which were serialized using namespace B, unless I
manually edit the files to point to namespace A.

Is there a way to support both namespaces in the same editor? An
alternative would be to rename namespace A to B and regenerate the
editor (and merge all the manual code...). The legacy files cannot be
changed since they have to work with another EMF tool.

Regards,
Rene
Re: multiple namespaces in one editor supported? [message #411924 is a reply to message #411923] Fri, 10 August 2007 09:44 Go to previous messageGo to next message
Rene Ladan is currently offline Rene LadanFriend
Messages: 51
Registered: July 2009
Member
This is a multi-part message in MIME format.
--------------000200010305030701090101
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Rene Ladan wrote:
> Hi,
>
> say I have metamodel A with namespace http://mm.A/ which is a superset
> of metamodel B with namespace http://mm.B/ .
>
> If I generate an EMF editor using namespace A, it can by default not
> read legacy files which were serialized using namespace B, unless I
> manually edit the files to point to namespace A.
>
> Is there a way to support both namespaces in the same editor? An
> alternative would be to rename namespace A to B and regenerate the
> editor (and merge all the manual code...). The legacy files cannot be
> changed since they have to work with another EMF tool.
>
Forgot to attach the error log...

> Regards,
> Rene


--------------000200010305030701090101
Content-Type: text/plain;
name="nameloading-exception.txt"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="nameloading-exception.txt"

b3JnLmVjbGlwc2UuY29yZS5ydW50aW1lLkFzc2VydGlvbkZhaWxlZEV4Y2Vw dGlvbjogYXNz
ZXJ0aW9uIGZhaWxlZDogDQoJYXQgb3JnLmVjbGlwc2UuY29yZS5ydW50aW1l LkFzc2VydC5p
c1RydWUoQXNzZXJ0LmphdmE6MTA5KQ0KCWF0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b3JnLmVjbGlwc2UuY29yZS5ydW50aW1lLmludGVybmFsLmFk YXB0b3IuRWNs
aXBzZUFwcExhdW5jaGVyLnJ1bkFwcGxpY2F0aW9uKEVjbGlwc2VBcHBMYXVu Y2hlci5qYXZh
OjEwNikNCglhdCBvcmcuZWNsaXBzZS5jb3JlLnJ1bnRpbWUuaW50ZXJuYWwu YWRhcHRvci5F
Y2xpcHNlQXBwTGF1bmNoZXIuc3RhcnQoRWNsaXBzZUFwcExhdW5jaGVyLmph dmE6NzYpDQoJ
YXQgb3JnLmVjbGlwc2UuY29yZS5ydW50aW1lLmFkYXB0b3IuRWNsaXBzZVN0 YXJ0ZXIucnVu
KEVjbGlwc2VTdGFydGVyLmphdmE6MzYzKQ0KCWF0IG9yZy5lY2xpcHNlLmNv cmUucnVudGlt
ZS5hZGFwdG9yLkVjbGlwc2VTdGFydGVyLnJ1bihFY2xpcHNlU3RhcnRlci5q YXZhOjE3NikN
CglhdCBzdW4ucmVmbGVjdC5OYXRpdmVNZXRob2RBY2Nlc3NvckltcGwuaW52 b2tlMChOYXRp
dmUgTWV0aG9k
--------------000200010305030701090101--
Re: multiple namespaces in one editor supported? [message #411926 is a reply to message #411924] Fri, 10 August 2007 11:11 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Rene,

The error log doesn't show anything useful. Perhaps the problem would
be solved simply by registering A for both namespaces, e.g.,

<extension point="org.eclipse.emf.ecore.generated_package">
<package
uri = "http://www.example.com/OldLibrary"
class = "com.example.library.LibraryPackage"
</extension>

<extension point="org.eclipse.emf.ecore.generated_package">
<package
uri = "http://www.example.com/Library"
class = "com.example.library.LibraryPackage"
genModel = "model/library.genmodel" />
</extension>


Rene Ladan wrote:
> Rene Ladan wrote:
>> Hi,
>>
>> say I have metamodel A with namespace http://mm.A/ which is a
>> superset of metamodel B with namespace http://mm.B/ .
>>
>> If I generate an EMF editor using namespace A, it can by default not
>> read legacy files which were serialized using namespace B, unless I
>> manually edit the files to point to namespace A.
>>
>> Is there a way to support both namespaces in the same editor? An
>> alternative would be to rename namespace A to B and regenerate the
>> editor (and merge all the manual code...). The legacy files cannot
>> be changed since they have to work with another EMF tool.
>>
> Forgot to attach the error log...
>
>> Regards,
>> Rene
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: multiple namespaces in one editor supported? [message #411930 is a reply to message #411926] Fri, 10 August 2007 12:04 Go to previous messageGo to next message
Rene Ladan is currently offline Rene LadanFriend
Messages: 51
Registered: July 2009
Member
Hi Ed,

your suggestion works fine.

Thanks,
Rene

Ed Merks wrote:
> Rene,
>
> The error log doesn't show anything useful. Perhaps the problem would
> be solved simply by registering A for both namespaces, e.g.,
>
> <extension point="org.eclipse.emf.ecore.generated_package">
> <package
> uri = "http://www.example.com/OldLibrary"
> class = "com.example.library.LibraryPackage"
> </extension>
>
> <extension point="org.eclipse.emf.ecore.generated_package">
> <package
> uri = "http://www.example.com/Library"
> class = "com.example.library.LibraryPackage"
> genModel = "model/library.genmodel" />
> </extension>
>
>
> Rene Ladan wrote:
>> Rene Ladan wrote:
>>> Hi,
>>>
>>> say I have metamodel A with namespace http://mm.A/ which is a
>>> superset of metamodel B with namespace http://mm.B/ .
>>>
>>> If I generate an EMF editor using namespace A, it can by default not
>>> read legacy files which were serialized using namespace B, unless I
>>> manually edit the files to point to namespace A.
>>>
>>> Is there a way to support both namespaces in the same editor? An
>>> alternative would be to rename namespace A to B and regenerate the
>>> editor (and merge all the manual code...). The legacy files cannot
>>> be changed since they have to work with another EMF tool.
>>>
>> Forgot to attach the error log...
>>
>>> Regards,
>>> Rene
>>
Re: multiple namespaces in one editor supported? [message #411959 is a reply to message #411926] Mon, 13 August 2007 11:37 Go to previous messageGo to next message
Rene Ladan is currently offline Rene LadanFriend
Messages: 51
Registered: July 2009
Member
Hi all,

I've added Eds suggestion and some further experiences to the new EMF
recipe wiki.

Regards,
Rene

Ed Merks wrote:
> Rene,
>
> [...] Perhaps the problem would
> be solved simply by registering A for both namespaces, e.g.,
>
> <extension point="org.eclipse.emf.ecore.generated_package">
> <package
> uri = "http://www.example.com/OldLibrary"
> class = "com.example.library.LibraryPackage"
> </extension>
>
> <extension point="org.eclipse.emf.ecore.generated_package">
> <package
> uri = "http://www.example.com/Library"
> class = "com.example.library.LibraryPackage"
> genModel = "model/library.genmodel" />
> </extension>
>
>
> Rene Ladan wrote:
>> Rene Ladan wrote:
>>> Hi,
>>>
>>> say I have metamodel A with namespace http://mm.A/ which is a
>>> superset of metamodel B with namespace http://mm.B/ .
>>>
>>> If I generate an EMF editor using namespace A, it can by default not
>>> read legacy files which were serialized using namespace B, unless I
>>> manually edit the files to point to namespace A.
>>>
>>> Is there a way to support both namespaces in the same editor? An
>>> alternative would be to rename namespace A to B and regenerate the
>>> editor (and merge all the manual code...). The legacy files cannot
>>> be changed since they have to work with another EMF tool.
>>>
[...]
>>> Regards,
>>> Rene
>>
Re: multiple namespaces in one editor supported? [message #423530 is a reply to message #411959] Wed, 01 October 2008 19:44 Go to previous messageGo to next message
Vasanth Velusamy is currently offline Vasanth VelusamyFriend
Messages: 31
Registered: July 2009
Member
Ed,

I am trying to register multiple uris to the same package. As you had
described in this thread, and yet another thread, I included an
additional extension contribution (for
org.eclipse.emf.ecore.generated_package) for a new uri, but that didn't
seem to be enough. When I attempted to open a file with the new
namespace, I received a FeatureNotFoundException (full stack trace in
attachement). Without this contribution, I received an exception similar
to what the thread owner received initially (AssertionFailedException).
So I would assume that the new extension contribution is being used.

I did a search for the old namespace in all three projects (model, edit
and editor) and found them used in the following places:

* my schema file
* my ecore file
* XXXFactoryImpl.java
* XXXPackage.java
* plugin.xml in model project
* plugin.xml in edit project (used in contributing to extension point
org.eclipse.emf.edit.itemProviderAdapterFactories. Should there be
additional contributions for the new URI here as well? I tried it but
didn't seem to help.)

I changed XXXPackage.eNS_URI to point to the new URI. Obviously, with
this change, the editor worked for the new URI but not the old URI.

So, I am wondering if I am missing any additional step to get the editor
to work with multiple uris, or if something broke. For example, should I
have another ecore for the new namespace? I am using EMF 2.3.1.

Thanks,
Vasanth


Rene Ladan wrote:
> Hi all,
>
> I've added Eds suggestion and some further experiences to the new EMF
> recipe wiki.
>
> Regards,
> Rene
>
> Ed Merks wrote:
>> Rene,
>>
>> [...] Perhaps the problem would be solved simply by registering A for
>> both namespaces, e.g.,
>>
>> <extension point="org.eclipse.emf.ecore.generated_package">
>> <package
>> uri = "http://www.example.com/OldLibrary"
>> class = "com.example.library.LibraryPackage"
>> </extension>
>>
>> <extension point="org.eclipse.emf.ecore.generated_package">
>> <package
>> uri = "http://www.example.com/Library"
>> class = "com.example.library.LibraryPackage"
>> genModel = "model/library.genmodel" />
>> </extension>
>>
>>
>> Rene Ladan wrote:
>>> Rene Ladan wrote:
>>>> Hi,
>>>>
>>>> say I have metamodel A with namespace http://mm.A/ which is a
>>>> superset of metamodel B with namespace http://mm.B/ .
>>>>
>>>> If I generate an EMF editor using namespace A, it can by default not
>>>> read legacy files which were serialized using namespace B, unless I
>>>> manually edit the files to point to namespace A.
>>>>
>>>> Is there a way to support both namespaces in the same editor? An
>>>> alternative would be to rename namespace A to B and regenerate the
>>>> editor (and merge all the manual code...). The legacy files cannot
>>>> be changed since they have to work with another EMF tool.
>>>>
> [...]
>>>> Regards,
>>>> Rene
>>>
Re: multiple namespaces in one editor supported? [message #423532 is a reply to message #423530] Wed, 01 October 2008 19:47 Go to previous messageGo to next message
Vasanth Velusamy is currently offline Vasanth VelusamyFriend
Messages: 31
Registered: July 2009
Member
This is a multi-part message in MIME format.
--------------030407000700030301020806
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Adding missing attachment.

-Vasanth


Vasanth Velusamy wrote:
> Ed,
>
> I am trying to register multiple uris to the same package. As you had
> described in this thread, and yet another thread, I included an
> additional extension contribution (for
> org.eclipse.emf.ecore.generated_package) for a new uri, but that didn't
> seem to be enough. When I attempted to open a file with the new
> namespace, I received a FeatureNotFoundException (full stack trace in
> attachement). Without this contribution, I received an exception similar
> to what the thread owner received initially (AssertionFailedException).
> So I would assume that the new extension contribution is being used.
>
> I did a search for the old namespace in all three projects (model, edit
> and editor) and found them used in the following places:
>
> * my schema file
> * my ecore file
> * XXXFactoryImpl.java
> * XXXPackage.java
> * plugin.xml in model project
> * plugin.xml in edit project (used in contributing to extension point
> org.eclipse.emf.edit.itemProviderAdapterFactories. Should there be
> additional contributions for the new URI here as well? I tried it but
> didn't seem to help.)
>
> I changed XXXPackage.eNS_URI to point to the new URI. Obviously, with
> this change, the editor worked for the new URI but not the old URI.
>
> So, I am wondering if I am missing any additional step to get the editor
> to work with multiple uris, or if something broke. For example, should I
> have another ecore for the new namespace? I am using EMF 2.3.1.
>
> Thanks,
> Vasanth
>
>
> Rene Ladan wrote:
>> Hi all,
>>
>> I've added Eds suggestion and some further experiences to the new EMF
>> recipe wiki.
>>
>> Regards,
>> Rene
>>
>> Ed Merks wrote:
>>> Rene,
>>>
>>> [...] Perhaps the problem would be solved simply by registering A
>>> for both namespaces, e.g.,
>>>
>>> <extension point="org.eclipse.emf.ecore.generated_package">
>>> <package
>>> uri = "http://www.example.com/OldLibrary"
>>> class = "com.example.library.LibraryPackage"
>>> </extension>
>>>
>>> <extension point="org.eclipse.emf.ecore.generated_package">
>>> <package
>>> uri = "http://www.example.com/Library"
>>> class = "com.example.library.LibraryPackage"
>>> genModel = "model/library.genmodel" />
>>> </extension>
>>>
>>>
>>> Rene Ladan wrote:
>>>> Rene Ladan wrote:
>>>>> Hi,
>>>>>
>>>>> say I have metamodel A with namespace http://mm.A/ which is a
>>>>> superset of metamodel B with namespace http://mm.B/ .
>>>>>
>>>>> If I generate an EMF editor using namespace A, it can by default
>>>>> not read legacy files which were serialized using namespace B,
>>>>> unless I manually edit the files to point to namespace A.
>>>>>
>>>>> Is there a way to support both namespaces in the same editor? An
>>>>> alternative would be to rename namespace A to B and regenerate the
>>>>> editor (and merge all the manual code...). The legacy files cannot
>>>>> be changed since they have to work with another EMF tool.
>>>>>
>> [...]
>>>>> Regards,
>>>>> Rene
>>>>


--------------030407000700030301020806
Content-Type: text/plain;
name="FeatureNotFoundException.txt"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="FeatureNotFoundException.txt"

b3JnLmVjbGlwc2UuZW1mLmVjb3JlLnhtaS5GZWF0dXJlTm90Rm91bmRFeGNl cHRpb246IEZl
YXR1cmUgJ3NhbXBsZScgbm90IGZvdW5kLiAocGxhdGZvcm06L3Jlc291cmNl L3NhbmRib3gx
L015TmV3LnNhbXBsZXYxLCAyLCA3NykNCglhdCBvcmcuZWNsaXBzZS5lbWYu ZWNvcmUueG1p
LmltcGwuWE1MSGFuZGxlci5yZXBvcnRVbmtub3duRmVhdHVyZShYTUxIYW5k bGVyLmphdmE6
MTg1NikNCglhdCBvcmcuZWNsaXBzZS5lbWYuZWNvcmUueG1pLmltcGwuWE1M SGFuZGxlci5o
YW5kbGVVbmtub3duRmVhdHVyZShYTUxIYW5kbGVyLmphdmE6MTgyMCkNCglh dCBvcmcuZWNs
aXBzZS5lbWYuZWNvcmUueG1pLmltcGwuWE1MSGFuZGxlci5oYW5kbGVGZWF0 dXJlKFhNTEhh
bmRsZXIuamF2YToxNzY0KQ0KCWF0IG9yZy5lY2xpcHNlLmVtZi5lY29yZS54 bWkuaW1wbC5Y
TUxIYW5kbGVyLmNyZWF0ZURvY3VtZW50Um9vdChYTUxIYW5kbGVyLmphdmE6 MTMyNikNCglh
dCBvcmcuZWNsaXBzZS5lbWYuZWNvcmUueG1pLmltcGwuWE1MSGFuZGxlci5j cmVhdGVPYmpl
Y3RCeVR5cGUoWE1MSGFuZGxlci5qYXZhOjEyNTkpDQoJYXQgb3JnLmVjbGlw c2UuZW1mLmVj
b3JlLnhtaS5pbXBsLlhNTEhhbmRsZXIuY3JlYXRlVG9wT2JqZWN0KFhNTEhh bmRsZXIuamF2
YToxMzM2KQ0KCWF0IG9yZy5lY2xpcHNlLmVtZi5lY29yZS54bWkuaW1wbC5Y TUxIYW5kbG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YXJ0ZXIu
cnVuKEVjbGlwc2VTdGFydGVyLmphdmE6MTc2KQ0KCWF0IHN1bi5yZWZsZWN0 Lk5hdGl2ZU1l
dGhvZEFjY2Vzc29ySW1wbC5pbnZva2UwKE5hdGl2ZSBNZXRob2QpDQoJYXQg c3VuLnJlZmxl
Y3QuTmF0aXZlTWV0aG9kQWNjZXNzb3JJbXBsLmludm9rZShVbmtub3duIFNv dXJjZSkNCglh
dCBzdW4ucmVmbGVjdC5EZWxlZ2F0aW5nTWV0aG9kQWNjZXNzb3JJbXBsLmlu dm9rZShVbmtu
b3duIFNvdXJjZSkNCglhdCBqYXZhLmxhbmcucmVmbGVjdC5NZXRob2QuaW52 b2tlKFVua25v
d24gU291cmNlKQ0KCWF0IG9yZy5lY2xpcHNlLmVxdWlub3gubGF1bmNoZXIu TWFpbi5pbnZv
a2VGcmFtZXdvcmsoTWFpbi5qYXZhOjUwOCkNCglhdCBvcmcuZWNsaXBzZS5l cXVpbm94Lmxh
dW5jaGVyLk1haW4uYmFzaWNSdW4oTWFpbi5qYXZhOjQ0NykNCglhdCBvcmcu ZWNsaXBzZS5l
cXVpbm94LmxhdW5jaGVyLk1haW4ucnVuKE1haW4uamF2YToxMTczKQ0KCWF0 IG9yZy5lY2xp
cHNlLmVxdWlub3gubGF1bmNoZXIuTWFpbi5tYWluKE1haW4uamF2YToxMTQ4 KQ==
--------------030407000700030301020806--
Re: multiple namespaces in one editor supported? [message #423533 is a reply to message #423530] Wed, 01 October 2008 20:16 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Vasanth,

In a schema based model, it's more complicated because the root
element's qualified name is looked up in the document root of the
EPackage for that namespace. So while the additional registration will
result in ExtendedMetaData.getPackage finding the right package, the
getElement method won't find the right element in the document root. I
think you'd need to create a specialized BasicExtendedMetaData instance
in your resource factory, in place of Boolean.TRUE, and override
getLocalElement to replace with "additional" namespace with the "actual"
namespace before calling super.


Vasanth Velusamy wrote:
> Ed,
>
> I am trying to register multiple uris to the same package. As you had
> described in this thread, and yet another thread, I included an
> additional extension contribution (for
> org.eclipse.emf.ecore.generated_package) for a new uri, but that
> didn't seem to be enough. When I attempted to open a file with the
> new namespace, I received a FeatureNotFoundException (full stack trace
> in attachement). Without this contribution, I received an exception
> similar to what the thread owner received initially
> (AssertionFailedException). So I would assume that the new extension
> contribution is being used.
>
> I did a search for the old namespace in all three projects (model,
> edit and editor) and found them used in the following places:
>
> * my schema file
> * my ecore file
> * XXXFactoryImpl.java
> * XXXPackage.java
> * plugin.xml in model project
> * plugin.xml in edit project (used in contributing to extension point
> org.eclipse.emf.edit.itemProviderAdapterFactories. Should there be
> additional contributions for the new URI here as well? I tried it but
> didn't seem to help.)
>
> I changed XXXPackage.eNS_URI to point to the new URI. Obviously, with
> this change, the editor worked for the new URI but not the old URI.
>
> So, I am wondering if I am missing any additional step to get the
> editor to work with multiple uris, or if something broke. For example,
> should I have another ecore for the new namespace? I am using EMF 2.3.1.
>
> Thanks,
> Vasanth
>
>
> Rene Ladan wrote:
>> Hi all,
>>
>> I've added Eds suggestion and some further experiences to the new EMF
>> recipe wiki.
>>
>> Regards,
>> Rene
>>
>> Ed Merks wrote:
>>> Rene,
>>>
>>> [...] Perhaps the problem would be solved simply by registering A
>>> for both namespaces, e.g.,
>>>
>>> <extension point="org.eclipse.emf.ecore.generated_package">
>>> <package
>>> uri = "http://www.example.com/OldLibrary"
>>> class = "com.example.library.LibraryPackage"
>>> </extension>
>>>
>>> <extension point="org.eclipse.emf.ecore.generated_package">
>>> <package
>>> uri = "http://www.example.com/Library"
>>> class = "com.example.library.LibraryPackage"
>>> genModel = "model/library.genmodel" />
>>> </extension>
>>>
>>>
>>> Rene Ladan wrote:
>>>> Rene Ladan wrote:
>>>>> Hi,
>>>>>
>>>>> say I have metamodel A with namespace http://mm.A/ which is a
>>>>> superset of metamodel B with namespace http://mm.B/ .
>>>>>
>>>>> If I generate an EMF editor using namespace A, it can by default
>>>>> not read legacy files which were serialized using namespace B,
>>>>> unless I manually edit the files to point to namespace A.
>>>>>
>>>>> Is there a way to support both namespaces in the same editor? An
>>>>> alternative would be to rename namespace A to B and regenerate the
>>>>> editor (and merge all the manual code...). The legacy files
>>>>> cannot be changed since they have to work with another EMF tool.
>>>>>
>> [...]
>>>>> Regards,
>>>>> Rene
>>>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: multiple namespaces in one editor supported? [message #423670 is a reply to message #423533] Mon, 06 October 2008 14:18 Go to previous messageGo to next message
Vasanth Velusamy is currently offline Vasanth VelusamyFriend
Messages: 31
Registered: July 2009
Member
Ed,

In XXXResourceFactoryImpl.createResource(...), for default load options,
I set an instance of BasicExtendedMetaData that overrides
getLocalElement(...) to replace older schema namespace with the most
current one. It works. Thanks for the pointer.

However (isn't there always a however?), this essentially converts the
model to have the newer namespace. When I save the model, it writes out
the model to be in the new namespace. This is not what I desire. I
suppose I will just have to work around that. I am planning to remember
the actual namespace when the model was read in, and perform a namespace
conversion before writing it out, if needed.

Thanks,
Vasanth


Ed Merks wrote:
> Vasanth,
>
> In a schema based model, it's more complicated because the root
> element's qualified name is looked up in the document root of the
> EPackage for that namespace. So while the additional registration will
> result in ExtendedMetaData.getPackage finding the right package, the
> getElement method won't find the right element in the document root. I
> think you'd need to create a specialized BasicExtendedMetaData instance
> in your resource factory, in place of Boolean.TRUE, and override
> getLocalElement to replace with "additional" namespace with the "actual"
> namespace before calling super.
>
>
> Vasanth Velusamy wrote:
>> Ed,
>>
>> I am trying to register multiple uris to the same package. As you had
>> described in this thread, and yet another thread, I included an
>> additional extension contribution (for
>> org.eclipse.emf.ecore.generated_package) for a new uri, but that
>> didn't seem to be enough. When I attempted to open a file with the
>> new namespace, I received a FeatureNotFoundException (full stack trace
>> in attachement). Without this contribution, I received an exception
>> similar to what the thread owner received initially
>> (AssertionFailedException). So I would assume that the new extension
>> contribution is being used.
>>
>> I did a search for the old namespace in all three projects (model,
>> edit and editor) and found them used in the following places:
>>
>> * my schema file
>> * my ecore file
>> * XXXFactoryImpl.java
>> * XXXPackage.java
>> * plugin.xml in model project
>> * plugin.xml in edit project (used in contributing to extension point
>> org.eclipse.emf.edit.itemProviderAdapterFactories. Should there be
>> additional contributions for the new URI here as well? I tried it but
>> didn't seem to help.)
>>
>> I changed XXXPackage.eNS_URI to point to the new URI. Obviously, with
>> this change, the editor worked for the new URI but not the old URI.
>>
>> So, I am wondering if I am missing any additional step to get the
>> editor to work with multiple uris, or if something broke. For example,
>> should I have another ecore for the new namespace? I am using EMF 2.3.1.
>>
>> Thanks,
>> Vasanth
>>
>>
>> Rene Ladan wrote:
>>> Hi all,
>>>
>>> I've added Eds suggestion and some further experiences to the new EMF
>>> recipe wiki.
>>>
>>> Regards,
>>> Rene
>>>
>>> Ed Merks wrote:
>>>> Rene,
>>>>
>>>> [...] Perhaps the problem would be solved simply by registering A
>>>> for both namespaces, e.g.,
>>>>
>>>> <extension point="org.eclipse.emf.ecore.generated_package">
>>>> <package
>>>> uri = "http://www.example.com/OldLibrary"
>>>> class = "com.example.library.LibraryPackage"
>>>> </extension>
>>>>
>>>> <extension point="org.eclipse.emf.ecore.generated_package">
>>>> <package
>>>> uri = "http://www.example.com/Library"
>>>> class = "com.example.library.LibraryPackage"
>>>> genModel = "model/library.genmodel" />
>>>> </extension>
>>>>
>>>>
>>>> Rene Ladan wrote:
>>>>> Rene Ladan wrote:
>>>>>> Hi,
>>>>>>
>>>>>> say I have metamodel A with namespace http://mm.A/ which is a
>>>>>> superset of metamodel B with namespace http://mm.B/ .
>>>>>>
>>>>>> If I generate an EMF editor using namespace A, it can by default
>>>>>> not read legacy files which were serialized using namespace B,
>>>>>> unless I manually edit the files to point to namespace A.
>>>>>>
>>>>>> Is there a way to support both namespaces in the same editor? An
>>>>>> alternative would be to rename namespace A to B and regenerate the
>>>>>> editor (and merge all the manual code...). The legacy files
>>>>>> cannot be changed since they have to work with another EMF tool.
>>>>>>
>>> [...]
>>>>>> Regards,
>>>>>> Rene
>>>>>
Re: multiple namespaces in one editor supported? [message #423745 is a reply to message #423670] Mon, 06 October 2008 14:45 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Vasanth,

Comments below.


Vasanth Velusamy wrote:
> Ed,
>
> In XXXResourceFactoryImpl.createResource(...), for default load
> options, I set an instance of BasicExtendedMetaData that overrides
> getLocalElement(...) to replace older schema namespace with the most
> current one. It works. Thanks for the pointer.
>
> However (isn't there always a however?
Unfortunately yes. :-P
> ), this essentially converts the model to have the newer namespace.
> When I save the model, it writes out the model to be in the new namespace.
It generally uses the XyzPackage.getNsURI...
> This is not what I desire. I suppose I will just have to work around that.
When extended meta data is present, it will use methods like
getNamespace() to determine what to use.
> I am planning to remember the actual namespace when the model was read
> in, and perform a namespace conversion before writing it out, if needed.
The DocumentRoot's getXMLNSPrefixDeclarations will record information
about this. You might key your behavior off of that...
>
> Thanks,
> Vasanth
>
>
> Ed Merks wrote:
>> Vasanth,
>>
>> In a schema based model, it's more complicated because the root
>> element's qualified name is looked up in the document root of the
>> EPackage for that namespace. So while the additional registration
>> will result in ExtendedMetaData.getPackage finding the right package,
>> the getElement method won't find the right element in the document
>> root. I think you'd need to create a specialized
>> BasicExtendedMetaData instance in your resource factory, in place of
>> Boolean.TRUE, and override getLocalElement to replace with
>> "additional" namespace with the "actual" namespace before calling super.
>>
>>
>> Vasanth Velusamy wrote:
>>> Ed,
>>>
>>> I am trying to register multiple uris to the same package. As you
>>> had described in this thread, and yet another thread, I included an
>>> additional extension contribution (for
>>> org.eclipse.emf.ecore.generated_package) for a new uri, but that
>>> didn't seem to be enough. When I attempted to open a file with the
>>> new namespace, I received a FeatureNotFoundException (full stack
>>> trace in attachement). Without this contribution, I received an
>>> exception similar to what the thread owner received initially
>>> (AssertionFailedException). So I would assume that the new extension
>>> contribution is being used.
>>>
>>> I did a search for the old namespace in all three projects (model,
>>> edit and editor) and found them used in the following places:
>>>
>>> * my schema file
>>> * my ecore file
>>> * XXXFactoryImpl.java
>>> * XXXPackage.java
>>> * plugin.xml in model project
>>> * plugin.xml in edit project (used in contributing to extension
>>> point org.eclipse.emf.edit.itemProviderAdapterFactories. Should
>>> there be additional contributions for the new URI here as well? I
>>> tried it but didn't seem to help.)
>>>
>>> I changed XXXPackage.eNS_URI to point to the new URI. Obviously,
>>> with this change, the editor worked for the new URI but not the old
>>> URI.
>>>
>>> So, I am wondering if I am missing any additional step to get the
>>> editor to work with multiple uris, or if something broke. For
>>> example, should I have another ecore for the new namespace? I am
>>> using EMF 2.3.1.
>>>
>>> Thanks,
>>> Vasanth
>>>
>>>
>>> Rene Ladan wrote:
>>>> Hi all,
>>>>
>>>> I've added Eds suggestion and some further experiences to the new
>>>> EMF recipe wiki.
>>>>
>>>> Regards,
>>>> Rene
>>>>
>>>> Ed Merks wrote:
>>>>> Rene,
>>>>>
>>>>> [...] Perhaps the problem would be solved simply by registering A
>>>>> for both namespaces, e.g.,
>>>>>
>>>>> <extension point="org.eclipse.emf.ecore.generated_package">
>>>>> <package
>>>>> uri = "http://www.example.com/OldLibrary"
>>>>> class = "com.example.library.LibraryPackage"
>>>>> </extension>
>>>>>
>>>>> <extension point="org.eclipse.emf.ecore.generated_package">
>>>>> <package
>>>>> uri = "http://www.example.com/Library"
>>>>> class = "com.example.library.LibraryPackage"
>>>>> genModel = "model/library.genmodel" />
>>>>> </extension>
>>>>>
>>>>>
>>>>> Rene Ladan wrote:
>>>>>> Rene Ladan wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> say I have metamodel A with namespace http://mm.A/ which is a
>>>>>>> superset of metamodel B with namespace http://mm.B/ .
>>>>>>>
>>>>>>> If I generate an EMF editor using namespace A, it can by default
>>>>>>> not read legacy files which were serialized using namespace B,
>>>>>>> unless I manually edit the files to point to namespace A.
>>>>>>>
>>>>>>> Is there a way to support both namespaces in the same editor?
>>>>>>> An alternative would be to rename namespace A to B and
>>>>>>> regenerate the editor (and merge all the manual code...). The
>>>>>>> legacy files cannot be changed since they have to work with
>>>>>>> another EMF tool.
>>>>>>>
>>>> [...]
>>>>>>> Regards,
>>>>>>> Rene
>>>>>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Instantiating an ecore metamodel
Next Topic:Loosing xsi:schemaLocation after serialization
Goto Forum:
  


Current Time: Fri Apr 19 11:28:48 GMT 2024

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

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

Back to the top