|
Re: [Edapt] Can't migrate model after referenced model is migrated? [message #1757919 is a reply to message #1757503] |
Tue, 21 March 2017 20:15 |
|
Hi,
Unfortunately this is a conceptional problem, for which I see only two options:
a) Migrate all files you have at the same time. The Migrator offers you the possibility to hand in multiple URIs for this purpose. If this is not possible, you have to go with
b) Establishing a process for keeping the old models for the migration process in your business code. It is hard to give advice here, but you can use the ReleaseUtils namespace URI methods to find out the version of the source models and then trigger the migration after copying the correct mymodel1 version. I know that this is not nice, but as soon as only a part of your models are migrated and they have links between each other, it is an invalid state.
Regards
Johannes
Johannes Faltermeier
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
|
|
|
Re: [Edapt] Can't migrate model after referenced model is migrated? [message #1758740 is a reply to message #1757919] |
Sat, 01 April 2017 14:34 |
Nicholas Johnson Messages: 12 Registered: March 2017 |
Junior Member |
|
|
Thanks for your reply! Sorry it took me so long to respond. I am now trying to get back to this.
It seems like I'll have to go with option b. We control model1 but there are models that reference model1 that exist outside of our control so we wouldn't be able migrate all models at the same time. Let me see if I understand your suggestion properly:
If I have a folder structure like this:
+ base_models
++ model1 v1
+ derived_models
++ model2 v1 --> base_models\model1 v1
++ model3 v1 --> base_models\model1 v1
Currently, when I migrate model2 from v1 to v2 I end up with:
+ base_models
++ model1 v2
+ derived_models
++ model2 v2 --> base_models\model1 v2
++ model3 v1 --> base_models\model1 v1
Then when I try to migrate model3, it can't find base_models/model1 v1 and migration fails.
If I had something like:
+ old_models
++ model1 v1
+ base_models
++ model1 v1
+ derived_models
++ model2 v1 --> base_models\model1 v1
++ model3 v1 --> base_models\model1 v1
When I migrate model2 from v1 to v2 I end up with:
+ old_models
++ model1 v1
+ base_models
++ model1 v2
+ derived_models
++ model2 v2 --> base_models\model1 v2
++ model3 v1 --> base_models\model1 v1
Then when I try to migrate model3, I can see that model3 depends on model1 v1 and copy model1 v1 from old_models into base_models before performing the migration of model3?
Is that right?
Not as clean as I'd like but only because I'd constantly be migrating model1. However, I can see where model1 and model2 would need to migrate at the same time since there may be changes to model1 that occur during migration that affects model2.
Keeping the old models around doesn't sound like too big of a deal. If size becomes an issue, I think all I need to do is really keep version 1 around since the migrator can migrate from v1 to any other version at the cost of migration time. I think I've shown that all I need is a version of model1 that is equal to or less than the version model2 depends on to have migration work.
I think this is probably my best bet.
I think I'm also going to try to prompt the user to migrate all models they have at the same time to reduce the number of "do you want to migrate" prompts and reduce the number of times I need to copy over the old model(s).
[Updated on: Sat, 01 April 2017 14:35] Report message to a moderator
|
|
|
Re: [Edapt] Can't migrate model after referenced model is migrated? [message #1758747 is a reply to message #1758740] |
Sat, 01 April 2017 16:12 |
Nicholas Johnson Messages: 12 Registered: March 2017 |
Junior Member |
|
|
How can a list of all the referenced models before I perform the migration?
I tried loading the resource and then using EcoreUtil.resolveAll but that failed; which makes sense because the metamodel has changed so the existing model can't be opened.
I need to know what models are being referenced so I can copy over the correct older versions. Also, I would like to show the user a list of the referenced models that will also be migrated if they continue.
[Updated on: Sat, 01 April 2017 16:20] Report message to a moderator
|
|
|
Re: [Edapt] Can't migrate model after referenced model is migrated? [message #1758928 is a reply to message #1758747] |
Tue, 04 April 2017 16:49 |
|
Hi,
the idea is to use the migrator.migrateAndLoad method. This will give you a resource set. If the file passed to the migrator references other files, they will be migrated and there will be dedicated resources for the referenced files in the resource set. Also the URIs of these resources point to original files.
So after migrating you may loop over all resources in the set, look at the URI, and save them at a new location as required. You don't need to find out before the migration.
Cheers
Johannes
Johannes Faltermeier
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02023 seconds