|
Re: [Edapt] Feature not found when migrating [message #1790464 is a reply to message #1790345] |
Mon, 11 June 2018 12:18   |
|
Hi,
Would it be possible to share a running example? Otherwise it is hard to tell what is going wrong.
I suppose you were using a rename operation from the operation browser, updated the NS-URI of the extension ecore, and created an edapt release for the initial history and after the change.
Just from the stacktrace and description I would suggest to check where an attribute called "type" is used in the migrated model file. And then check the ecores/and the history if this feature is actually present in the ecore/and history.
(Maybe this was never present there and not noticed because XMLResource.OPTION_RECORD_UNKNOWN_FEATURE is used)
Besides that I can only suggest to set a breakpoint in org.eclipse.emf.edapt.internal.common.ResourceUtils.loadResourceSet(List<URI>, List<EPackage>, IResourceSetFactory) and check the EPackage which should contain the type feature. Does this EPackage look like you would expect it in comparison to the model you want to load?
Cheers
Johannes
Johannes Faltermeier
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
|
|
|
|
Re: [Edapt] Feature not found when migrating [message #1790678 is a reply to message #1790587] |
Thu, 14 June 2018 10:41   |
|
Hi,
thank you for the example code.
In ContentPart.performMigration(Migrator, URI, Release) you are using the migrateAndLoad method of the migrator.
This returns a ResourceSet which contains the migrated and loaded data. The migration is done in memory only, when you use this method. So in your getData() method you need to reuse the ResourceSet returned by the migrator. When I change the code accordingly, the migration is working.
The other option would be to use migrateAndSave. This would save the model after the migration, so loading it afterwards without Edapt will work as regularly.
Cheers
Johannes
Johannes Faltermeier
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
|
|
|
Re: [Edapt] Feature not found when migrating [message #1790752 is a reply to message #1790678] |
Fri, 15 June 2018 15:03   |
Gernot Krause Messages: 22 Registered: June 2014 |
Junior Member |
|
|
Hi!
Thanks for looking into the code. With the proposed changes I was able to get the example running.
However, on my real case code it still does not work. I went done with the debugger and found that the method call resourceSet.getResource(modelURI, true) fails. This is called in ResourceUtils.loadResourceSet(...):

Both, migrateAndLoad() and migrateAndSave() are ending up at this method and, thus, both fail. So migrateAndXXX() throws an exception that the package with the nsURI from the previous model (version 1.0) was not found.
Usually, in my code I use the createResource() method to return the resource:
final ResourceSet resourceSet = new ResourceSetImpl();
Resource resource = resourceSet.createResource(modelURI);
The modelURI is exactly the same in both cases. When I try createResource() directly in my code the resource is returned without any exception. Interestingly, in ResourceUtils.loadResourceSet(...) the createResource() method was commented out. Any reasons for this?
Honestly, I am not sure what the difference between createResource() and getResource() actually is. The context help for getResource() says that: "...the package registry is used to resolve the namespace URI...". Can this be the root cause because the previous model package is not registered?
Thanks and regards,
Gernot.
|
|
|
Re: [Edapt] Feature not found when migrating [message #1790855 is a reply to message #1790752] |
Tue, 19 June 2018 07:16   |
|
Hi,
Edapt works roughly like this:
1. It parses the text-file for the ns-uris. You can use this to get a migrator and find out the source release. So in your use case the source release should probably be the release at index 0 contained by the history. Is the right source release found on your side?
2. Than it goes to the actual package registry to get the latest version of your ecores. Are both of your emf models registered correctly at the extension point and part of the runtime?
3. Based on the source release it undoes all recorded changes from later releases to get a representation of the ecore which can be used to load the old text file. Here you could check if your history contains all changes, especially ns-uris changes (for earlier release).
4. The loaded file is mapped to a migration model and the miration is done.
I think that since we get an error during resource loading, I think that we have an error during steps 1-3. Could you maybe check that there are two EPackages passed to this loadResourceSet method (base+extension, both should have the original 1.0 ns-uris) and check above comments.
This may help to narrow the problem down.
Cheers
Johannes
Johannes Faltermeier
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
|
|
|
|
Powered by
FUDForum. Page generated in 0.02271 seconds