[Edapt] Feature not found [message #1651378] |
Thu, 05 March 2015 04:15  |
Eclipse User |
|
|
|
Hello,
I have a simple ecore model and created a history and a release, then I deleted a field (using the delete feature operation) and released again. I added the extension point for the migrator and wrote the migration code like in the library example
However, when I try to migrate an xml file from the old version, I get a PackageNotFoundException. I need to manually add a custom ResourceSetFactory to manually add the URI to the package registry:
protected class ResourceSetFactoryImplCustom extends ResourceSetFactoryImpl {
@Override
public ResourceSet createResourceSet() {
ResourceSet resourceSet = new ResourceSetImpl();
// manually add package with ns-uri of old version
resourceSet.getPackageRegistry().put(<ns-uri>,
BarPackage.eINSTANCE);
return resourceSet;
}
}
....
private void performMigration(final Migrator migrator, final URI resourceURI, final Release release) {
try {
// use the custom xmlResourceSetFactory
migrator.setResourceSetFactory(new ResourceSetFactoryImplCustom());
migrator.migrateAndSave(Collections.singletonList(resourceURI), release, null, new NullProgressMonitor());
} catch (MigrationException e) {
e.printStackTrace();
}
}
When I do this, migrating a file that doesn't contain the deleted feature works, but some XMI-Attributes are added to the root element:
xmi:version="2.0" xmlns:xmi="<link-to-xmi>"
Is there a way to avoid adding this to the file?
Also, when I try to migrate a file that contains the deleted feature, I get a FeatureNotFoundException. So something clearly isn't working, I'm guessing that it's probably something with the way I manually add the old ns-uri to the package registry.
I added the example code that reproduces this.
Thanks in advance
Matthias
Attachment: example.zip
(Size: 61.42KB, Downloaded 137 times)
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02389 seconds